mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
feat: show burn status
This commit is contained in:
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 360 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 559 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 791 B |
@@ -47,6 +47,12 @@ deletedIcon: IconEmoji{
|
|||||||
useIconColor: false;
|
useIconColor: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
burntIcon: IconEmoji{
|
||||||
|
icon: icon{{ "ayu/burnt", windowFg }};
|
||||||
|
padding: margins(0px, 0px, 0px, 0px);
|
||||||
|
useIconColor: false;
|
||||||
|
}
|
||||||
|
|
||||||
dialogsExteraOfficialIcon: ThreeStateIcon {
|
dialogsExteraOfficialIcon: ThreeStateIcon {
|
||||||
icon: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBg }};
|
icon: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBg }};
|
||||||
over: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBgOver }};
|
over: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBgOver }};
|
||||||
|
|||||||
@@ -739,11 +739,7 @@ void AddRepeatMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
if (item->isLocal() || item->isService() || item->out() || item->isDeleted()) {
|
if (item->isLocal() || item->out() || item->isDeleted() || item->history()->peer->isSelf()) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->history()->peer->isSelf()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,11 +750,10 @@ void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||||||
|
|
||||||
menu->addAction(
|
menu->addAction(
|
||||||
tr::ayu_ReadUntilMenuText(tr::now),
|
tr::ayu_ReadUntilMenuText(tr::now),
|
||||||
[=]()
|
[=]
|
||||||
{
|
{
|
||||||
readHistory(item);
|
readHistory(item);
|
||||||
if (item->media() && item->media()->ttlSeconds() <= 0 && item->unsupportedTTL() <= 0 && !item->out() && item
|
if (item->media() && item->media()->ttlSeconds() <= 0 && item->unsupportedTTL() <= 0 && !item->out()) {
|
||||||
->isUnreadMedia()) {
|
|
||||||
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
||||||
if (const auto channel = item->history()->peer->asChannel()) {
|
if (const auto channel = item->history()->peer->asChannel()) {
|
||||||
item->history()->session().api().request(MTPchannels_ReadMessageContents(
|
item->history()->session().api().request(MTPchannels_ReadMessageContents(
|
||||||
@@ -789,38 +784,19 @@ void AddBurnAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||||||
|
|
||||||
menu->addAction(
|
menu->addAction(
|
||||||
tr::ayu_ExpireMediaContextMenuText(tr::now),
|
tr::ayu_ExpireMediaContextMenuText(tr::now),
|
||||||
[=]()
|
[=]
|
||||||
{
|
{
|
||||||
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
||||||
const auto callback = [=]()
|
|
||||||
{
|
|
||||||
if (const auto window = Core::App().activeWindow()) {
|
|
||||||
if (const auto controller = window->sessionController()) {
|
|
||||||
controller->showToast(tr::lng_box_ok(tr::now));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (const auto channel = item->history()->peer->asChannel()) {
|
item->history()->session().api().request(MTPmessages_ReadMessageContents(
|
||||||
item->history()->session().api().request(MTPchannels_ReadMessageContents(
|
|
||||||
channel->inputChannel(),
|
|
||||||
ids
|
|
||||||
)).done([=]()
|
|
||||||
{
|
|
||||||
callback();
|
|
||||||
}).send();
|
|
||||||
} else {
|
|
||||||
item->history()->session().api().request(MTPmessages_ReadMessageContents(
|
|
||||||
ids
|
ids
|
||||||
)).done([=](const MTPmessages_AffectedMessages &result)
|
)).done([=](const MTPmessages_AffectedMessages &result)
|
||||||
{
|
{
|
||||||
item->history()->session().api().applyAffectedMessages(
|
item->history()->session().api().applyAffectedMessages(
|
||||||
item->history()->peer,
|
item->history()->peer,
|
||||||
result);
|
result);
|
||||||
callback();
|
item->markContentsRead();
|
||||||
}).send();
|
}).send();
|
||||||
}
|
|
||||||
item->markContentsRead();
|
|
||||||
},
|
},
|
||||||
&st::menuIconTTLAny);
|
&st::menuIconTTLAny);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1677,6 +1677,10 @@ void HistoryItem::markMediaAndMentionRead() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isBurnt()) {
|
||||||
|
_history->owner().notifyItemDataChange(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryItem::markReactionsRead() {
|
void HistoryItem::markReactionsRead() {
|
||||||
@@ -3533,6 +3537,10 @@ bool HistoryItem::isDeleted() const {
|
|||||||
return _deleted;
|
return _deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HistoryItem::isBurnt() const {
|
||||||
|
return ((media() && media()->ttlSeconds()) || unsupportedTTL()) && !isUnreadMedia();
|
||||||
|
}
|
||||||
|
|
||||||
bool HistoryItem::wasDeletedAnimated() const {
|
bool HistoryItem::wasDeletedAnimated() const {
|
||||||
return _deletedAnimated;
|
return _deletedAnimated;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,7 +436,8 @@ public:
|
|||||||
bool isForumPost);
|
bool isForumPost);
|
||||||
void setPostAuthor(const QString &author);
|
void setPostAuthor(const QString &author);
|
||||||
void setDeleted();
|
void setDeleted();
|
||||||
bool isDeleted() const;
|
[[nodiscard]] bool isDeleted() const;
|
||||||
|
[[nodiscard]] bool isBurnt() const;
|
||||||
[[nodiscard]] bool wasDeletedAnimated() const;
|
[[nodiscard]] bool wasDeletedAnimated() const;
|
||||||
void markDeletedAnimated();
|
void markDeletedAnimated();
|
||||||
void applyTTL(TimeId destroyAt);
|
void applyTTL(TimeId destroyAt);
|
||||||
|
|||||||
@@ -509,6 +509,10 @@ void BottomInfo::layoutDateText() {
|
|||||||
.textColor = false,
|
.textColor = false,
|
||||||
})).append(" ");
|
})).append(" ");
|
||||||
}
|
}
|
||||||
|
if (_data.flags & Data::Flag::AyuBurnt) {
|
||||||
|
marked.append(Ui::Text::IconEmoji(&st::burntIcon));
|
||||||
|
marked.append(' ');
|
||||||
|
}
|
||||||
marked.append(full);
|
marked.append(full);
|
||||||
_authorEditedDate.setMarkedText(
|
_authorEditedDate.setMarkedText(
|
||||||
st::msgDateTextStyle,
|
st::msgDateTextStyle,
|
||||||
@@ -516,6 +520,15 @@ void BottomInfo::layoutDateText() {
|
|||||||
Ui::NameTextOptions(),
|
Ui::NameTextOptions(),
|
||||||
helper.context());
|
helper.context());
|
||||||
} else {
|
} else {
|
||||||
|
TextWithEntities burnt;
|
||||||
|
if (_data.flags & Data::Flag::AyuBurnt) {
|
||||||
|
burnt = Ui::Text::IconEmoji(&st::burntIcon);
|
||||||
|
if (!(_data.flags & Data::Flag::AyuDeleted)
|
||||||
|
&& !(_data.flags & Data::Flag::Edited)) {
|
||||||
|
burnt.append(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities deleted;
|
TextWithEntities deleted;
|
||||||
if (_data.flags & Data::Flag::AyuDeleted) {
|
if (_data.flags & Data::Flag::AyuDeleted) {
|
||||||
deleted = Ui::Text::IconEmoji(&st::deletedIcon);
|
deleted = Ui::Text::IconEmoji(&st::deletedIcon);
|
||||||
@@ -559,11 +572,11 @@ void BottomInfo::layoutDateText() {
|
|||||||
if (_data.flags & Data::Flag::Sponsored) {
|
if (_data.flags & Data::Flag::Sponsored) {
|
||||||
// ...
|
// ...
|
||||||
} else if (_data.flags & Data::Flag::Imported) {
|
} else if (_data.flags & Data::Flag::Imported) {
|
||||||
full.append(deleted).append(date).append(' ').append(tr::lng_imported(tr::now));
|
full.append(burnt).append(deleted).append(date).append(' ').append(tr::lng_imported(tr::now));
|
||||||
} else if (name.isEmpty()) {
|
} else if (name.isEmpty()) {
|
||||||
full.append(deleted).append(date);
|
full.append(burnt).append(deleted).append(date);
|
||||||
} else {
|
} else {
|
||||||
full.append(deleted).append(name).append(afterAuthor);
|
full.append(burnt).append(deleted).append(name).append(afterAuthor);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto helper = Ui::Text::CustomEmojiHelper(
|
auto helper = Ui::Text::CustomEmojiHelper(
|
||||||
@@ -775,6 +788,9 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
|
|||||||
if (item->isDeleted()) {
|
if (item->isDeleted()) {
|
||||||
result.flags |= Flag::AyuDeleted;
|
result.flags |= Flag::AyuDeleted;
|
||||||
}
|
}
|
||||||
|
if (item->isBurnt()) {
|
||||||
|
result.flags |= Flag::AyuBurnt;
|
||||||
|
}
|
||||||
if (!forwarded) {
|
if (!forwarded) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
EstimateDate = 0x100,
|
EstimateDate = 0x100,
|
||||||
ForwardedDate = 0x200,
|
ForwardedDate = 0x200,
|
||||||
AyuDeleted = 0x400,
|
AyuDeleted = 0x400,
|
||||||
|
AyuBurnt = 0x800,
|
||||||
//Unread, // We don't want to pass and update it in Date for now.
|
//Unread, // We don't want to pass and update it in Date for now.
|
||||||
};
|
};
|
||||||
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ QSize Document::countOptimalSize() {
|
|||||||
const auto history = _realParent->history();
|
const auto history = _realParent->history();
|
||||||
const auto session = &history->session();
|
const auto session = &history->session();
|
||||||
const auto transcribes = &session->api().transcribes();
|
const auto transcribes = &session->api().transcribes();
|
||||||
if (_parent->data()->media()->ttlSeconds()
|
if ((_parent->data()->media() && _parent->data()->media()->ttlSeconds())
|
||||||
|| _realParent->isScheduled()
|
|| _realParent->isScheduled()
|
||||||
|| _realParent->isAdminLogEntry()
|
|| _realParent->isAdminLogEntry()
|
||||||
|| (!session->premium()
|
|| (!session->premium()
|
||||||
|
|||||||
Reference in New Issue
Block a user