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;
|
||||
}
|
||||
|
||||
burntIcon: IconEmoji{
|
||||
icon: icon{{ "ayu/burnt", windowFg }};
|
||||
padding: margins(0px, 0px, 0px, 0px);
|
||||
useIconColor: false;
|
||||
}
|
||||
|
||||
dialogsExteraOfficialIcon: ThreeStateIcon {
|
||||
icon: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBg }};
|
||||
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) {
|
||||
if (item->isLocal() || item->isService() || item->out() || item->isDeleted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->history()->peer->isSelf()) {
|
||||
if (item->isLocal() || item->out() || item->isDeleted() || item->history()->peer->isSelf()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -754,11 +750,10 @@ void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
|
||||
menu->addAction(
|
||||
tr::ayu_ReadUntilMenuText(tr::now),
|
||||
[=]()
|
||||
[=]
|
||||
{
|
||||
readHistory(item);
|
||||
if (item->media() && item->media()->ttlSeconds() <= 0 && item->unsupportedTTL() <= 0 && !item->out() && item
|
||||
->isUnreadMedia()) {
|
||||
if (item->media() && item->media()->ttlSeconds() <= 0 && item->unsupportedTTL() <= 0 && !item->out()) {
|
||||
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
||||
if (const auto channel = item->history()->peer->asChannel()) {
|
||||
item->history()->session().api().request(MTPchannels_ReadMessageContents(
|
||||
@@ -789,38 +784,19 @@ void AddBurnAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
|
||||
menu->addAction(
|
||||
tr::ayu_ExpireMediaContextMenuText(tr::now),
|
||||
[=]()
|
||||
[=]
|
||||
{
|
||||
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(MTPchannels_ReadMessageContents(
|
||||
channel->inputChannel(),
|
||||
ids
|
||||
)).done([=]()
|
||||
{
|
||||
callback();
|
||||
}).send();
|
||||
} else {
|
||||
item->history()->session().api().request(MTPmessages_ReadMessageContents(
|
||||
item->history()->session().api().request(MTPmessages_ReadMessageContents(
|
||||
ids
|
||||
)).done([=](const MTPmessages_AffectedMessages &result)
|
||||
{
|
||||
item->history()->session().api().applyAffectedMessages(
|
||||
item->history()->peer,
|
||||
result);
|
||||
callback();
|
||||
item->markContentsRead();
|
||||
}).send();
|
||||
}
|
||||
item->markContentsRead();
|
||||
},
|
||||
&st::menuIconTTLAny);
|
||||
}
|
||||
|
||||
@@ -1677,6 +1677,10 @@ void HistoryItem::markMediaAndMentionRead() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isBurnt()) {
|
||||
_history->owner().notifyItemDataChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryItem::markReactionsRead() {
|
||||
@@ -3533,6 +3537,10 @@ bool HistoryItem::isDeleted() const {
|
||||
return _deleted;
|
||||
}
|
||||
|
||||
bool HistoryItem::isBurnt() const {
|
||||
return ((media() && media()->ttlSeconds()) || unsupportedTTL()) && !isUnreadMedia();
|
||||
}
|
||||
|
||||
bool HistoryItem::wasDeletedAnimated() const {
|
||||
return _deletedAnimated;
|
||||
}
|
||||
|
||||
@@ -436,7 +436,8 @@ public:
|
||||
bool isForumPost);
|
||||
void setPostAuthor(const QString &author);
|
||||
void setDeleted();
|
||||
bool isDeleted() const;
|
||||
[[nodiscard]] bool isDeleted() const;
|
||||
[[nodiscard]] bool isBurnt() const;
|
||||
[[nodiscard]] bool wasDeletedAnimated() const;
|
||||
void markDeletedAnimated();
|
||||
void applyTTL(TimeId destroyAt);
|
||||
|
||||
@@ -509,6 +509,10 @@ void BottomInfo::layoutDateText() {
|
||||
.textColor = false,
|
||||
})).append(" ");
|
||||
}
|
||||
if (_data.flags & Data::Flag::AyuBurnt) {
|
||||
marked.append(Ui::Text::IconEmoji(&st::burntIcon));
|
||||
marked.append(' ');
|
||||
}
|
||||
marked.append(full);
|
||||
_authorEditedDate.setMarkedText(
|
||||
st::msgDateTextStyle,
|
||||
@@ -516,6 +520,15 @@ void BottomInfo::layoutDateText() {
|
||||
Ui::NameTextOptions(),
|
||||
helper.context());
|
||||
} 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;
|
||||
if (_data.flags & Data::Flag::AyuDeleted) {
|
||||
deleted = Ui::Text::IconEmoji(&st::deletedIcon);
|
||||
@@ -559,11 +572,11 @@ void BottomInfo::layoutDateText() {
|
||||
if (_data.flags & Data::Flag::Sponsored) {
|
||||
// ...
|
||||
} 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()) {
|
||||
full.append(deleted).append(date);
|
||||
full.append(burnt).append(deleted).append(date);
|
||||
} else {
|
||||
full.append(deleted).append(name).append(afterAuthor);
|
||||
full.append(burnt).append(deleted).append(name).append(afterAuthor);
|
||||
}
|
||||
|
||||
auto helper = Ui::Text::CustomEmojiHelper(
|
||||
@@ -775,6 +788,9 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
|
||||
if (item->isDeleted()) {
|
||||
result.flags |= Flag::AyuDeleted;
|
||||
}
|
||||
if (item->isBurnt()) {
|
||||
result.flags |= Flag::AyuBurnt;
|
||||
}
|
||||
if (!forwarded) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
EstimateDate = 0x100,
|
||||
ForwardedDate = 0x200,
|
||||
AyuDeleted = 0x400,
|
||||
AyuBurnt = 0x800,
|
||||
//Unread, // We don't want to pass and update it in Date for now.
|
||||
};
|
||||
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
||||
|
||||
@@ -426,7 +426,7 @@ QSize Document::countOptimalSize() {
|
||||
const auto history = _realParent->history();
|
||||
const auto session = &history->session();
|
||||
const auto transcribes = &session->api().transcribes();
|
||||
if (_parent->data()->media()->ttlSeconds()
|
||||
if ((_parent->data()->media() && _parent->data()->media()->ttlSeconds())
|
||||
|| _realParent->isScheduled()
|
||||
|| _realParent->isAdminLogEntry()
|
||||
|| (!session->premium()
|
||||
|
||||
Reference in New Issue
Block a user