Only display reactions on chat list for now

This commit is contained in:
Sebastian Wolf 2022-06-06 23:06:57 +02:00
parent 99910a3f3a
commit 0a76ede35a
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 8 additions and 35 deletions

View file

@ -286,8 +286,6 @@ ListItem {
tdLibWrapper.getMessage(myMessage.reply_in_chat_id ? myMessage.reply_in_chat_id : page.chatInformation.id, tdLibWrapper.getMessage(myMessage.reply_in_chat_id ? myMessage.reply_in_chat_id : page.chatInformation.id,
myMessage.reply_to_message_id) myMessage.reply_to_message_id)
} }
console.log("HUGGA: " + messageViewCount + " | " + JSON.stringify(reactions));
} }
onMyMessageChanged: { onMyMessageChanged: {

View file

@ -117,38 +117,15 @@ ListItem {
visible: chatListViewItem.unreadReactionCount > 0 visible: chatListViewItem.unreadReactionCount > 0
} }
Text { Icon {
id: chatUnreadReactionCount source: "image://theme/icon-s-favorite"
font.pixelSize: Theme.fontSizeSmall height: Theme.iconSizeExtraSmall
font.bold: true width: Theme.iconSizeExtraSmall
color: Theme.primaryColor highlighted: chatListViewItem.highlighted
anchors.centerIn: chatUnreadReactionCountBackground anchors.centerIn: chatUnreadReactionCountBackground
visible: chatListViewItem.unreadReactionCount > 0 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 { Column {

View file

@ -225,15 +225,13 @@ uint ChatModel::MessageData::updateViewCount(const QVariantMap &interactionInfo)
uint ChatModel::MessageData::updateInteractionInfo(const QVariantMap &interactionInfo) uint ChatModel::MessageData::updateInteractionInfo(const QVariantMap &interactionInfo)
{ {
if (interactionInfo.value(_TYPE) == TYPE_MESSAGE_INTERACTION_INFO) {
messageData.insert(INTERACTION_INFO, interactionInfo); messageData.insert(INTERACTION_INFO, interactionInfo);
return RoleFlagDisplay | updateViewCount(interactionInfo) | updateReactions(interactionInfo); return RoleFlagDisplay | updateViewCount(interactionInfo) | updateReactions(interactionInfo);
}
return 0;
} }
uint ChatModel::MessageData::updateReactions(const QVariantMap &interactionInfo) uint ChatModel::MessageData::updateReactions(const QVariantMap &interactionInfo)
{ {
LOG("Updating reactions...");
const QVariantList oldReactions = reactions; const QVariantList oldReactions = reactions;
reactions = interactionInfo.value(REACTIONS).toList(); reactions = interactionInfo.value(REACTIONS).toList();
return (reactions == oldReactions) ? 0 : RoleFlagMessageReactions; return (reactions == oldReactions) ? 0 : RoleFlagMessageReactions;