Mark display messages as read
This commit is contained in:
parent
ca7abb2a2f
commit
59a7c8381d
3 changed files with 30 additions and 0 deletions
|
@ -239,6 +239,20 @@ Page {
|
||||||
clip: true
|
clip: true
|
||||||
visible: count > 0
|
visible: count > 0
|
||||||
|
|
||||||
|
onMovementEnded: {
|
||||||
|
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
onQuickScrollAnimatingChanged: {
|
||||||
|
if (!quickScrollAnimating) {
|
||||||
|
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
tdLibWrapper.viewMessage(chatInformation.id, currentItem.myMessage.id);
|
||||||
|
}
|
||||||
|
|
||||||
model: chatModel
|
model: chatModel
|
||||||
delegate: ListItem {
|
delegate: ListItem {
|
||||||
|
|
||||||
|
@ -246,6 +260,8 @@ Page {
|
||||||
contentHeight: messageTextItem.height + Theme.paddingMedium
|
contentHeight: messageTextItem.height + Theme.paddingMedium
|
||||||
contentWidth: parent.width
|
contentWidth: parent.width
|
||||||
|
|
||||||
|
property variant myMessage: display
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: messageTextItem
|
id: messageTextItem
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,19 @@ void TDLibWrapper::getChatHistory(const QString &chatId, const qlonglong &fromMe
|
||||||
this->sendRequest(requestObject);
|
this->sendRequest(requestObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId)
|
||||||
|
{
|
||||||
|
qDebug() << "[TDLibWrapper] Mark message as viewed " << chatId << messageId;
|
||||||
|
QVariantMap requestObject;
|
||||||
|
requestObject.insert("@type", "viewMessages");
|
||||||
|
requestObject.insert("chat_id", chatId);
|
||||||
|
requestObject.insert("force_read", false);
|
||||||
|
QVariantList messageIds;
|
||||||
|
messageIds.append(messageId);
|
||||||
|
requestObject.insert("message_ids", messageIds);
|
||||||
|
this->sendRequest(requestObject);
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap TDLibWrapper::getUserInformation()
|
QVariantMap TDLibWrapper::getUserInformation()
|
||||||
{
|
{
|
||||||
return this->userInformation;
|
return this->userInformation;
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
Q_INVOKABLE void openChat(const QString &chatId);
|
Q_INVOKABLE void openChat(const QString &chatId);
|
||||||
Q_INVOKABLE void closeChat(const QString &chatId);
|
Q_INVOKABLE void closeChat(const QString &chatId);
|
||||||
Q_INVOKABLE void getChatHistory(const QString &chatId, const qlonglong &fromMessageId = 0, const int &offset = 0, const int &limit = 50, const bool &onlyLocal = false);
|
Q_INVOKABLE void getChatHistory(const QString &chatId, const qlonglong &fromMessageId = 0, const int &offset = 0, const int &limit = 50, const bool &onlyLocal = false);
|
||||||
|
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void versionDetected(const QString &version);
|
void versionDetected(const QString &version);
|
||||||
|
|
Loading…
Reference in a new issue