Force read all mentions in a chat when nothing is unread

This commit is contained in:
Sebastian Wolf 2020-12-28 21:57:34 +01:00
parent ef1f824cd8
commit e6fd5885aa
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 15 additions and 0 deletions

View file

@ -562,6 +562,9 @@ Page {
} }
lastQueuedIndex = -1 lastQueuedIndex = -1
} }
if (chatInformation.unread_count === 0) {
tdLibWrapper.readAllChatMentions(chatInformation.id);
}
} }
} }
@ -825,6 +828,8 @@ Page {
if (bottomIndex > -1) { if (bottomIndex > -1) {
viewMessageTimer.queueViewMessage(bottomIndex) viewMessageTimer.queueViewMessage(bottomIndex)
} }
} else {
tdLibWrapper.readAllChatMentions(chatInformation.id);
} }
manuallyScrolledToBottom = chatView.atYEnd manuallyScrolledToBottom = chatView.atYEnd
} }

View file

@ -937,6 +937,15 @@ void TDLibWrapper::importContacts(const QVariantList &contacts)
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::readAllChatMentions(qlonglong chatId)
{
LOG("Read all chat mentions" << chatId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "readAllChatMentions");
requestObject.insert("chat_id", chatId);
this->sendRequest(requestObject);
}
void TDLibWrapper::searchEmoji(const QString &queryString) void TDLibWrapper::searchEmoji(const QString &queryString)
{ {
LOG("Searching emoji" << queryString); LOG("Searching emoji" << queryString);

View file

@ -179,6 +179,7 @@ public:
Q_INVOKABLE void getSecretChat(qlonglong secretChatId); Q_INVOKABLE void getSecretChat(qlonglong secretChatId);
Q_INVOKABLE void closeSecretChat(qlonglong secretChatId); Q_INVOKABLE void closeSecretChat(qlonglong secretChatId);
Q_INVOKABLE void importContacts(const QVariantList &contacts); Q_INVOKABLE void importContacts(const QVariantList &contacts);
Q_INVOKABLE void readAllChatMentions(qlonglong chatId);
// Others (candidates for extraction ;)) // Others (candidates for extraction ;))
Q_INVOKABLE void searchEmoji(const QString &queryString); Q_INVOKABLE void searchEmoji(const QString &queryString);