Highlight unread messages in chat
This commit is contained in:
parent
db831f5a0a
commit
fbb1fbcf90
1 changed files with 12 additions and 4 deletions
|
@ -193,8 +193,8 @@ Page {
|
||||||
onUnreadCountUpdated: {
|
onUnreadCountUpdated: {
|
||||||
console.log("[ChatPage] Unread count updated, new count: " + unreadCount);
|
console.log("[ChatPage] Unread count updated, new count: " + unreadCount);
|
||||||
chatInformation.unread_count = unreadCount;
|
chatInformation.unread_count = unreadCount;
|
||||||
chatUnreadMessagesCountBackground.visible = ( !chatPage.loading && unreadCount > 0 )
|
chatUnreadMessagesCountBackground.visible = ( !chatPage.loading && unreadCount > 0 );
|
||||||
chatUnreadMessagesCount.text = unreadCount > 99 ? "99+" : unreadCount
|
chatUnreadMessagesCount.text = unreadCount > 99 ? "99+" : unreadCount;
|
||||||
}
|
}
|
||||||
onLastReadSentMessageUpdated: {
|
onLastReadSentMessageUpdated: {
|
||||||
console.log("[ChatPage] Updating last read sent index, new index: " + lastReadSentIndex);
|
console.log("[ChatPage] Updating last read sent index, new index: " + lastReadSentIndex);
|
||||||
|
@ -354,6 +354,14 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: chatModel
|
||||||
|
onUnreadCountUpdated: {
|
||||||
|
messageBackground.color = index > ( chatView.count - unreadCount - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor;
|
||||||
|
messageBackground.opacity = index > ( chatView.count - unreadCount - 1 ) ? 0.5 : 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: messageTextRow
|
id: messageTextRow
|
||||||
spacing: Theme.paddingSmall
|
spacing: Theme.paddingSmall
|
||||||
|
@ -389,9 +397,9 @@ Page {
|
||||||
}
|
}
|
||||||
height: messageTextColumn.height + ( 2 * Theme.paddingMedium )
|
height: messageTextColumn.height + ( 2 * Theme.paddingMedium )
|
||||||
|
|
||||||
color: Theme.secondaryColor
|
color: index > ( chatView.count - chatInformation.unread_count - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||||
radius: parent.width / 50
|
radius: parent.width / 50
|
||||||
opacity: 0.2
|
opacity: index > ( chatView.count - chatInformation.unread_count - 1 ) ? 0.5 : 0.2
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
|
Loading…
Reference in a new issue