diff --git a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml index 59bfbfd047..46421caf7a 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml @@ -31,6 +31,9 @@ Item { property string authorCurrentMsg: "authorCurrentMsg" property string authorPrevMsg: "authorPrevMsg" + property string prevMsgTimestamp: chatsModel.messageList.getMessageData(prevMessageIndex, "timestamp") + property bool shouldRepeatHeader: ((parseInt(timestamp, 10) - parseInt(prevMsgTimestamp, 10)) / 60 / 1000) > Constants.repeatHeaderInterval + property bool isEmoji: contentType === Constants.emojiType property bool isImage: contentType === Constants.imageType property bool isAudio: contentType === Constants.audioType diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml index 423bcf1c0e..935366054e 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml @@ -71,6 +71,7 @@ Item { UserImage { id: chatImage + visible: authorCurrentMsg != authorPrevMsg anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.top: parent.top diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/NormalMessage.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/NormalMessage.qml index 6c8a34a711..676e945d3a 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/NormalMessage.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/NormalMessage.qml @@ -8,6 +8,7 @@ Item { property bool isCurrentUser: false property int contentType: 2 property var container + property bool headerRepeatCondition: (authorCurrentMsg != authorPrevMsg || shouldRepeatHeader || dateGroupLbl.visible) id: root anchors.top: parent.top @@ -21,7 +22,7 @@ Item { UserImage { id: chatImage - visible: chatsModel.activeChannel.chatType !== Constants.chatTypeOneToOne && isMessage && authorCurrentMsg != authorPrevMsg && !root.isCurrentUser + visible: chatsModel.activeChannel.chatType !== Constants.chatTypeOneToOne && isMessage && headerRepeatCondition && !root.isCurrentUser anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top @@ -30,7 +31,7 @@ Item { UsernameLabel { id: chatName - visible: chatsModel.activeChannel.chatType !== Constants.chatTypeOneToOne && isMessage && authorCurrentMsg != authorPrevMsg && !root.isCurrentUser + visible: chatsModel.activeChannel.chatType !== Constants.chatTypeOneToOne && isMessage && headerRepeatCondition && !root.isCurrentUser anchors.leftMargin: 20 anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top anchors.topMargin: 0 @@ -111,7 +112,7 @@ Item { anchors.leftMargin: !root.isCurrentUser ? 8 : 0 anchors.right: !root.isCurrentUser ? undefined : parent.right anchors.rightMargin: !root.isCurrentUser ? 0 : Style.current.padding - anchors.top: authorCurrentMsg != authorPrevMsg && !root.isCurrentUser ? chatImage.top : (dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top) + anchors.top: headerRepeatCondition && !root.isCurrentUser ? chatImage.top : (dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top) anchors.topMargin: 0 visible: isMessage && contentType !== Constants.transactionType diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/UserImage.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/UserImage.qml index 09fb2cb2b4..ae0a8e1beb 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/UserImage.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/UserImage.qml @@ -3,7 +3,7 @@ import "../../../../../shared" import "../../../../../imports" Loader { - active: isMessage && authorCurrentMsg !== authorPrevMsg + active: isMessage height: active ? item.height : 0 sourceComponent: Component { diff --git a/ui/imports/Constants.qml b/ui/imports/Constants.qml index f573126417..d73090fb43 100644 --- a/ui/imports/Constants.qml +++ b/ui/imports/Constants.qml @@ -116,4 +116,6 @@ QtObject { readonly property int browserEthereumExplorerEtherscan: 1 readonly property int browserEthereumExplorerEthplorer: 2 readonly property int browserEthereumExplorerBlockchair: 3 + + readonly property int repeatHeaderInterval: 2 }