Commit 87f2b2e1 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/Chat/IncomingMessage): display avatar if it exits one...

feat(ui/modules/Linphone/Chat/IncomingMessage): display avatar if it exits one hour between two messages
parent 52eb9f2c
...@@ -27,11 +27,17 @@ RowLayout { ...@@ -27,11 +27,17 @@ RowLayout {
// The avatar is only visible for the first message of a incoming messages sequence. // The avatar is only visible for the first message of a incoming messages sequence.
visible: { visible: {
if (index <= 0) { if (index <= 0) {
return true return true // 1. First message, so visible.
} }
var entry = proxyModel.data(proxyModel.index(index - 1, 0)) var previousEntry = proxyModel.data(proxyModel.index(index - 1, 0))
return entry.type !== ChatModel.MessageEntry || entry.isOutgoing
// 2. Previous entry is a call event. => Visible.
// 3. I have sent a message before me contact. => Visible.
// 4. One hour between two incoming message. => Visible.
return previousEntry.type !== ChatModel.MessageEntry ||
previousEntry.isOutgoing ||
$chatEntry.timestamp.getTime() - previousEntry.timestamp.getTime() > 3600
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment