Added "unread mention" indicator to the chat list (#530)
It's displayed in place of the "unread reaction" indicator. In case if there are both unread mentions and reactions, "unread mention" takes precedence.
This commit is contained in:
parent
4b9732b64f
commit
256514e55d
2 changed files with 25 additions and 11 deletions
|
@ -108,27 +108,38 @@ ListItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: chatUnreadReactionCountBackground
|
|
||||||
color: isMuted ? ((Theme.colorScheme === Theme.DarkOnLight) ? "lightgray" : "dimgray") : Theme.highlightBackgroundColor
|
color: isMuted ? ((Theme.colorScheme === Theme.DarkOnLight) ? "lightgray" : "dimgray") : Theme.highlightBackgroundColor
|
||||||
width: Theme.fontSizeLarge
|
width: Theme.fontSizeLarge
|
||||||
height: Theme.fontSizeLarge
|
height: Theme.fontSizeLarge
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
radius: parent.width / 2
|
radius: parent.width / 2
|
||||||
visible: chatListViewItem.unreadReactionCount > 0
|
visible: chatListViewItem.unreadReactionCount > 0 || chatListViewItem.unreadMentionCount > 0
|
||||||
}
|
|
||||||
|
|
||||||
Icon {
|
Icon {
|
||||||
source: "image://theme/icon-s-favorite"
|
source: "image://theme/icon-s-favorite"
|
||||||
height: Theme.iconSizeExtraSmall
|
height: Theme.iconSizeExtraSmall
|
||||||
width: Theme.iconSizeExtraSmall
|
width: Theme.iconSizeExtraSmall
|
||||||
highlighted: chatListViewItem.highlighted
|
highlighted: chatListViewItem.highlighted
|
||||||
anchors.centerIn: chatUnreadReactionCountBackground
|
anchors.centerIn: parent
|
||||||
visible: chatListViewItem.unreadReactionCount > 0
|
visible: chatListViewItem.unreadReactionCount > 0 && !chatListViewItem.unreadMentionCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
font {
|
||||||
|
pixelSize: Theme.iconSizeExtraSmall
|
||||||
|
bold: true
|
||||||
|
}
|
||||||
|
color: Theme.primaryColor
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: chatListViewItem.unreadMentionCount > 0
|
||||||
|
opacity: isMuted ? Theme.opacityHigh : 1.0
|
||||||
|
text: "@"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: contentColumn
|
id: contentColumn
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
@ -175,6 +175,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
|
||||||
handlers.insert("updateMessageInteractionInfo", &TDLibReceiver::processUpdateMessageInteractionInfo);
|
handlers.insert("updateMessageInteractionInfo", &TDLibReceiver::processUpdateMessageInteractionInfo);
|
||||||
handlers.insert("sessions", &TDLibReceiver::processSessions);
|
handlers.insert("sessions", &TDLibReceiver::processSessions);
|
||||||
handlers.insert("availableReactions", &TDLibReceiver::processAvailableReactions);
|
handlers.insert("availableReactions", &TDLibReceiver::processAvailableReactions);
|
||||||
|
handlers.insert("updateMessageMentionRead", &TDLibReceiver::processUpdateChatUnreadMentionCount);
|
||||||
handlers.insert("updateChatUnreadMentionCount", &TDLibReceiver::processUpdateChatUnreadMentionCount);
|
handlers.insert("updateChatUnreadMentionCount", &TDLibReceiver::processUpdateChatUnreadMentionCount);
|
||||||
handlers.insert("updateChatUnreadReactionCount", &TDLibReceiver::processUpdateChatUnreadReactionCount);
|
handlers.insert("updateChatUnreadReactionCount", &TDLibReceiver::processUpdateChatUnreadReactionCount);
|
||||||
handlers.insert("updateActiveEmojiReactions", &TDLibReceiver::processUpdateActiveEmojiReactions);
|
handlers.insert("updateActiveEmojiReactions", &TDLibReceiver::processUpdateActiveEmojiReactions);
|
||||||
|
@ -736,6 +737,8 @@ void TDLibReceiver::processAvailableReactions(const QVariantMap &receivedInforma
|
||||||
|
|
||||||
void TDLibReceiver::processUpdateChatUnreadMentionCount(const QVariantMap &receivedInformation)
|
void TDLibReceiver::processUpdateChatUnreadMentionCount(const QVariantMap &receivedInformation)
|
||||||
{
|
{
|
||||||
|
// Handles both updateMessageMentionRead and updateChatUnreadMentionCount
|
||||||
|
// They both have chat_id and unread_mention_count which is all we need
|
||||||
const qlonglong chatId = receivedInformation.value(CHAT_ID).toLongLong();
|
const qlonglong chatId = receivedInformation.value(CHAT_ID).toLongLong();
|
||||||
const int unreadMentionCount = receivedInformation.value(UNREAD_MENTION_COUNT).toInt();
|
const int unreadMentionCount = receivedInformation.value(UNREAD_MENTION_COUNT).toInt();
|
||||||
LOG("Chat unread mention count updated" << chatId << unreadMentionCount);
|
LOG("Chat unread mention count updated" << chatId << unreadMentionCount);
|
||||||
|
|
Loading…
Reference in a new issue