feat(ui/modules/Linphone/Chat/IncomingMessage): display avatar only for the first incoming message of a sequence

This commit is contained in:
Ronan Abhamon 2017-01-06 16:44:23 +01:00
parent 30d8de5149
commit 34fbdac7e2

View file

@ -21,8 +21,18 @@ RowLayout {
anchors.centerIn: parent
height: ChatStyle.entry.message.incoming.avatarSize
image: _contactObserver.contact ? _contactObserver.contact.avatar : ''
username: LinphoneUtils.getContactUsername(_contactObserver.contact || _contactObserver.sipAddress)
username: LinphoneUtils.getContactUsername(_contactObserver.contact || proxyModel.sipAddress)
width: ChatStyle.entry.message.incoming.avatarSize
// The avatar is only visible for the first message of a incoming messages sequence.
visible: {
if (index === 0) {
return true
}
var entry = proxyModel.data(proxyModel.index(index - 1, 0))
return entry.type !== ChatModel.MessageEntry || entry.isOutgoing
}
}
}
@ -33,7 +43,7 @@ RowLayout {
// Not a style. Workaround to avoid a 0 width.
// Arbitrary value.
Layout.minimumWidth: 20
Layout.minimumWidth: 1
backgroundColor: ChatStyle.entry.message.incoming.backgroundColor
color: ChatStyle.entry.message.incoming.text.color