Option to mark all chat reactions as read

This commit is contained in:
Sebastian Wolf 2022-05-24 21:19:15 +02:00
parent 033f96b366
commit 0cc6f959fc
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
4 changed files with 13 additions and 0 deletions

View file

@ -51,6 +51,8 @@ PhotoTextsListItem {
visible: unread_count > 0 visible: unread_count > 0
onClicked: { onClicked: {
tdLibWrapper.viewMessage(chat_id, display.last_message.id, true); tdLibWrapper.viewMessage(chat_id, display.last_message.id, true);
tdLibWrapper.readAllChatMentions(chat_id);
tdLibWrapper.readAllChatReactions(chat_id);
tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, false); tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, false);
} }
text: qsTr("Mark all messages as read") text: qsTr("Mark all messages as read")

View file

@ -716,6 +716,7 @@ Page {
} }
if (chatInformation.unread_count === 0) { if (chatInformation.unread_count === 0) {
tdLibWrapper.readAllChatMentions(chatInformation.id); tdLibWrapper.readAllChatMentions(chatInformation.id);
tdLibWrapper.readAllChatReactions(chatInformation.id);
} }
} }
} }

View file

@ -1113,6 +1113,15 @@ void TDLibWrapper::readAllChatMentions(qlonglong chatId)
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::readAllChatReactions(qlonglong chatId)
{
LOG("Read all chat reactions" << chatId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "readAllChatReactions");
requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject);
}
void TDLibWrapper::toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsUnread) void TDLibWrapper::toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsUnread)
{ {
LOG("Toggle chat is marked as unread" << chatId << isMarkedAsUnread); LOG("Toggle chat is marked as unread" << chatId << isMarkedAsUnread);

View file

@ -217,6 +217,7 @@ public:
Q_INVOKABLE void searchChatMessages(qlonglong chatId, const QString &query, qlonglong fromMessageId = 0); Q_INVOKABLE void searchChatMessages(qlonglong chatId, const QString &query, qlonglong fromMessageId = 0);
Q_INVOKABLE void searchPublicChats(const QString &query); Q_INVOKABLE void searchPublicChats(const QString &query);
Q_INVOKABLE void readAllChatMentions(qlonglong chatId); Q_INVOKABLE void readAllChatMentions(qlonglong chatId);
Q_INVOKABLE void readAllChatReactions(qlonglong chatId);
Q_INVOKABLE void toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsUnread); Q_INVOKABLE void toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsUnread);
Q_INVOKABLE void toggleChatIsPinned(qlonglong chatId, bool isPinned); Q_INVOKABLE void toggleChatIsPinned(qlonglong chatId, bool isPinned);
Q_INVOKABLE void setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlonglong replyToMessageId, const QString &draft); Q_INVOKABLE void setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlonglong replyToMessageId, const QString &draft);