From 0a76ede35adf657c4c6646b8c8488b57c7a31f86 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 6 Jun 2022 23:06:57 +0200 Subject: [PATCH] Only display reactions on chat list for now --- qml/components/MessageListViewItem.qml | 2 -- qml/components/PhotoTextsListItem.qml | 33 ++++---------------------- src/chatmodel.cpp | 8 +++---- 3 files changed, 8 insertions(+), 35 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index d2e9c06..c49db28 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -286,8 +286,6 @@ ListItem { tdLibWrapper.getMessage(myMessage.reply_in_chat_id ? myMessage.reply_in_chat_id : page.chatInformation.id, myMessage.reply_to_message_id) } - - console.log("HUGGA: " + messageViewCount + " | " + JSON.stringify(reactions)); } onMyMessageChanged: { diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 40cf989..62f431a 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -117,38 +117,15 @@ ListItem { visible: chatListViewItem.unreadReactionCount > 0 } - Text { - id: chatUnreadReactionCount - font.pixelSize: Theme.fontSizeSmall - font.bold: true - color: Theme.primaryColor + Icon { + source: "image://theme/icon-s-favorite" + height: Theme.iconSizeExtraSmall + width: Theme.iconSizeExtraSmall + highlighted: chatListViewItem.highlighted anchors.centerIn: chatUnreadReactionCountBackground visible: chatListViewItem.unreadReactionCount > 0 - opacity: isMuted ? Theme.opacityHigh : 1.0 - text: "❤️" } - Rectangle { - id: chatUnreadMentionCountBackground - color: isMuted ? ((Theme.colorScheme === Theme.DarkOnLight) ? "lightgray" : "dimgray") : Theme.highlightBackgroundColor - width: Theme.fontSizeLarge - height: Theme.fontSizeLarge - anchors.right: parent.right - anchors.top: parent.top - radius: parent.width / 2 - visible: chatListViewItem.unreadMentionCount > 0 - } - - Text { - id: chatUnreadMentionCount - font.pixelSize: Theme.fontSizeSmall - font.bold: true - color: Theme.primaryColor - anchors.centerIn: chatUnreadMentionCountBackground - visible: chatListViewItem.unreadMentionCount > 0 - opacity: isMuted ? Theme.opacityHigh : 1.0 - text: "@" - } } } Column { diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 2d182f1..b4bf632 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -225,15 +225,13 @@ uint ChatModel::MessageData::updateViewCount(const QVariantMap &interactionInfo) uint ChatModel::MessageData::updateInteractionInfo(const QVariantMap &interactionInfo) { - if (interactionInfo.value(_TYPE) == TYPE_MESSAGE_INTERACTION_INFO) { - messageData.insert(INTERACTION_INFO, interactionInfo); - return RoleFlagDisplay | updateViewCount(interactionInfo) | updateReactions(interactionInfo); - } - return 0; + messageData.insert(INTERACTION_INFO, interactionInfo); + return RoleFlagDisplay | updateViewCount(interactionInfo) | updateReactions(interactionInfo); } uint ChatModel::MessageData::updateReactions(const QVariantMap &interactionInfo) { + LOG("Updating reactions..."); const QVariantList oldReactions = reactions; reactions = interactionInfo.value(REACTIONS).toList(); return (reactions == oldReactions) ? 0 : RoleFlagMessageReactions;