mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
chore: adjust ttl stuff
This commit is contained in:
@@ -1239,7 +1239,7 @@ void Updates::applyUpdateNoPtsCheck(const MTPUpdate &update) {
|
||||
auto unknownReadIds = base::flat_set<MsgId>();
|
||||
for (const auto &msgId : d.vmessages().v) {
|
||||
if (const auto item = _session->data().nonChannelMessage(msgId.v)) {
|
||||
if (item->isUnreadMedia() || item->isUnreadMention()) {
|
||||
if (item->isUnreadMedia() || item->isUnreadMention() || (item->unsupportedTTL() && item->hasUnreadMediaFlag())) {
|
||||
item->markMediaAndMentionRead();
|
||||
_session->data().requestItemRepaint(item);
|
||||
|
||||
@@ -1625,7 +1625,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
auto unknownReadIds = base::flat_set<MsgId>();
|
||||
for (const auto &msgId : d.vmessages().v) {
|
||||
if (auto item = session().data().message(channel->id, msgId.v)) {
|
||||
if (item->isUnreadMedia() || item->isUnreadMention()) {
|
||||
if (item->isUnreadMedia() || item->isUnreadMention() || (item->unsupportedTTL() && item->hasUnreadMediaFlag())) {
|
||||
item->markMediaAndMentionRead();
|
||||
session().data().requestItemRepaint(item);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
|
||||
void AddBurnAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
if (!item->media() || (item->media()->ttlSeconds() <= 0 && item->unsupportedTTL() <= 0) || item->out() ||
|
||||
!item->isUnreadMedia()) {
|
||||
!item->hasUnreadMediaFlag()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ int mapItemFlagsToMTPFlags(not_null<HistoryItem*> item) {
|
||||
flags |= kMessageFlagMention;
|
||||
}
|
||||
|
||||
if (item->isUnreadMedia()) {
|
||||
if (item->hasUnreadMediaFlag()) {
|
||||
flags |= kMessageFlagContentUnread;
|
||||
}
|
||||
|
||||
|
||||
@@ -358,12 +358,12 @@ void readHistory(not_null<HistoryItem*> message) {
|
||||
}
|
||||
}
|
||||
|
||||
QString formatTTL(int time) {
|
||||
QString formatTTL(int time, bool isDoc) {
|
||||
if (time == 0x7FFFFFFF) {
|
||||
return QString("👀 %1").arg(tr::ayu_OneViewTTL(tr::now));
|
||||
return isDoc ? tr::ayu_OnePlayTTL(tr::now) : tr::ayu_OneViewTTL(tr::now);
|
||||
}
|
||||
|
||||
return QString("🕓 %1s").arg(time);
|
||||
return QString("%1s").arg(time);
|
||||
}
|
||||
|
||||
QString getDCName(int dc) {
|
||||
|
||||
@@ -75,7 +75,7 @@ void MarkAsReadThread(not_null<Data::Thread*> thread);
|
||||
|
||||
void readHistory(not_null<HistoryItem*> message);
|
||||
|
||||
QString formatTTL(int time);
|
||||
QString formatTTL(int time, bool isDoc);
|
||||
QString formatDateTime(const QDateTime &date);
|
||||
QString formatMessageTime(const QTime &time);
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ HistoryItem::HistoryItem(
|
||||
}
|
||||
|
||||
const auto time = media.vttl_seconds()->v;
|
||||
setAyuHint(formatTTL(time));
|
||||
setAyuHint(formatTTL(time, false));
|
||||
_unsupportedTTL = time;
|
||||
},
|
||||
[&](const MTPDmessageMediaDocument &media)
|
||||
@@ -483,30 +483,10 @@ HistoryItem::HistoryItem(
|
||||
}
|
||||
|
||||
const auto time = media.vttl_seconds()->v;
|
||||
setAyuHint(formatTTL(time));
|
||||
setAyuHint(formatTTL(time, true));
|
||||
_unsupportedTTL = time;
|
||||
},
|
||||
[&](const MTPDmessageMediaWebPage &media)
|
||||
{
|
||||
},
|
||||
[&](const MTPDmessageMediaGame &media)
|
||||
{
|
||||
},
|
||||
[&](const MTPDmessageMediaInvoice &media)
|
||||
{
|
||||
},
|
||||
[&](const MTPDmessageMediaPoll &media)
|
||||
{
|
||||
},
|
||||
[&](const MTPDmessageMediaDice &media)
|
||||
{
|
||||
},
|
||||
[&](const MTPDmessageMediaStory &media)
|
||||
{
|
||||
},
|
||||
[&](const auto &)
|
||||
{
|
||||
});
|
||||
[](const auto &) {});
|
||||
}
|
||||
}
|
||||
auto textWithEntities = TextWithEntities{
|
||||
@@ -1714,7 +1694,7 @@ bool HistoryItem::markContentsRead(bool fromThisClient) {
|
||||
}
|
||||
markReactionsRead();
|
||||
return true;
|
||||
} else if (isUnreadMention() || isIncomingUnreadMedia()) {
|
||||
} else if (isUnreadMention() || isIncomingUnreadMedia() || (unsupportedTTL() && hasUnreadMediaFlag())) {
|
||||
markMediaAndMentionRead();
|
||||
return true;
|
||||
}
|
||||
@@ -3567,7 +3547,7 @@ bool HistoryItem::isDeleted() const {
|
||||
}
|
||||
|
||||
bool HistoryItem::isBurnt() const {
|
||||
return ((media() && media()->ttlSeconds()) || unsupportedTTL()) && !isUnreadMedia();
|
||||
return ((media() && media()->ttlSeconds()) || unsupportedTTL()) && !hasUnreadMediaFlag();
|
||||
}
|
||||
|
||||
bool HistoryItem::wasDeletedAnimated() const {
|
||||
|
||||
Reference in New Issue
Block a user