Show chat image and username again after a couple of minutes in chat

Fixes #1764
This commit is contained in:
Richard Ramos 2021-02-09 10:53:54 -04:00 committed by Iuri Matias
parent f84c96752b
commit b2262c8105
5 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -71,6 +71,7 @@ Item {
UserImage {
id: chatImage
visible: authorCurrentMsg != authorPrevMsg
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.top: parent.top

View File

@ -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

View File

@ -3,7 +3,7 @@ import "../../../../../shared"
import "../../../../../imports"
Loader {
active: isMessage && authorCurrentMsg !== authorPrevMsg
active: isMessage
height: active ? item.height : 0
sourceComponent: Component {

View File

@ -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
}