Skip to content
Snippets Groups Projects
Commit f69df341 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

messages: add read receipt support

Change-Id: Ide4b1336a13972a9291cb1e9e2bf881b32b97198
GitLab: #468
parent 4a2bf0d6
No related branches found
No related tags found
No related merge requests found
......@@ -167,6 +167,7 @@
<file>src/constant/MsgSeq.qml</file>
<file>src/commoncomponents/SBSContextMenu.qml</file>
<file>src/commoncomponents/SBSMessageBase.qml</file>
<file>src/commoncomponents/ReadStatus.qml</file>
<file>src/commoncomponents/GeneratedMessageDelegate.qml</file>
<file>src/commoncomponents/DataTransferMessageDelegate.qml</file>
<file>src/mainview/components/ScrollToBottomButton.qml</file>
......
......@@ -36,6 +36,7 @@ const QString defaultDownloadPath = QStandardPaths::writableLocation(
X(DownloadPath, defaultDownloadPath) \
X(EnableNotifications, true) \
X(EnableTypingIndicator, true) \
X(EnableReadReceipt, true) \
X(AllowFromUntrusted, false) \
X(AcceptTransferBelow, 20) \
X(AutoAcceptFiles, true) \
......
......@@ -70,6 +70,7 @@ Loader {
location: Body
transferName: TransferName
transferId: Id
readers: Readers
formattedTime: MessagesAdapter.getFormattedTime(Timestamp)
extraHeight: progressBar.visible ? 18 : 0
innerContent.children: [
......@@ -239,6 +240,7 @@ Loader {
location: Body
transferName: TransferName
transferId: Id
readers: Readers
formattedTime: MessagesAdapter.getFormattedTime(Timestamp)
bubble.visible: false
innerContent.children: [
......
/*
* Copyright (C) 2021 by Savoir-faire Linux
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
ListView {
id: root
property var readers: []
model: readers
orientation: ListView.Horizontal
Layout.alignment: Qt.AlignRight
spacing: -(JamiTheme.avatarReadReceiptSize/3)
delegate: Avatar {
width: JamiTheme.avatarReadReceiptSize
height: JamiTheme.avatarReadReceiptSize
z: -index
imageId: modelData
showPresenceIndicator: false
mode: Avatar.Mode.Contact
}
}
\ No newline at end of file
......@@ -43,6 +43,7 @@ Control {
property string formattedTime
property string location
property string hoveredLink
property var readers: []
readonly property real senderMargin: 64
readonly property real avatarSize: 32
......@@ -106,11 +107,18 @@ Control {
}
}
}
Item {
ListView {
id: infoCell
Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
orientation: ListView.Horizontal
Layout.preferredHeight: {
if (showTime || seq === MsgSeq.last)
return childrenRect.height
else if (reads.visible)
return JamiTheme.avatarReadReceiptSize
return 0
}
Label {
text: formattedTime
......@@ -119,11 +127,24 @@ Control {
height: visible * implicitHeight
font.pointSize: 9
anchors.right: !isOutgoing ? undefined : parent.right
anchors.right: !isOutgoing ? undefined : reads.left
anchors.rightMargin: 8
anchors.left: isOutgoing ? undefined : parent.left
anchors.leftMargin: avatarBlockWidth + 6
}
ReadStatus {
id: reads
visible: root.readers.length !== 0 && CurrentAccount.sendReadReceipt
width: {
if (root.readers.length === 0)
return 0
var nbAvatars = root.readers.length
var margin = JamiTheme.avatarReadReceiptSize / 3
return nbAvatars * JamiTheme.avatarReadReceiptSize - (nbAvatars - 1) * margin
}
anchors.right: parent.right
readers: root.readers
}
}
}
......
......@@ -35,6 +35,7 @@ SBSMessageBase {
isOutgoing: Author === ""
author: Author
readers: Readers
formattedTime: MessagesAdapter.getFormattedTime(Timestamp)
extraHeight: extraContent.active && !isRemoteImage ? msgRadius : -isRemoteImage
innerContent.children: [
......
......@@ -242,6 +242,7 @@ Item {
property int mosaicButtonPreferredWidth: 70
property int mosaicButtonMaxWidth: 100
property real avatarPresenceRatio: 0.26
property int avatarReadReceiptSize: 18
property int menuItemsPreferredWidth: 220
property int menuItemsPreferredHeight: 48
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment