From 542bd54c6baa4c7598811d70df344d33a8c914d1 Mon Sep 17 00:00:00 2001
From: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
Date: Mon, 28 Oct 2024 12:42:16 -0400
Subject: [PATCH] read_receipt: add logic when alone in a conversation

No logic was implemented when you were alone in a conversation
(either conv with yourself or swarm with 1 member). This adds
the logic. Currently the receipts will change in swarms
if you add a member.

GitLab: #1867
GitLab: #1017
Change-Id: Iff2ea5978ac988d30edef32d803c0b5b70b11d90
---
 src/app/commoncomponents/SBSMessageBase.qml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/app/commoncomponents/SBSMessageBase.qml b/src/app/commoncomponents/SBSMessageBase.qml
index 6e49daea2..77416d47f 100644
--- a/src/app/commoncomponents/SBSMessageBase.qml
+++ b/src/app/commoncomponents/SBSMessageBase.qml
@@ -646,6 +646,7 @@ Control {
                 id: status
                 Layout.alignment: Qt.AlignBottom
                 width: JamiTheme.avatarReadReceiptSize
+                property bool isAlone: CurrentConversation.members.count === 1
 
                 Rectangle {
                     id: sending
@@ -656,7 +657,7 @@ Control {
                     border.color: JamiTheme.sending
                     border.width: 1
                     color: JamiTheme.transparentColor
-                    visible: isOutgoing && Status === Interaction.Status.SENDING
+                    visible: isOutgoing && Status === Interaction.Status.SENDING && !status.isAlone
 
                     anchors.bottom: parent.bottom
                 }
@@ -687,6 +688,22 @@ Control {
                     anchors.bottom: parent.bottom
                     readers: root.readers
                 }
+
+               Component {
+                    id: selfReadIconComp
+                    Avatar {
+                        width: JamiTheme.avatarReadReceiptSize
+                        height: JamiTheme.avatarReadReceiptSize
+                        mode: Avatar.Mode.Account
+                        imageId: CurrentAccount.id
+                        showPresenceIndicator: false
+                    }
+                }
+                Loader {
+                    active: status.isAlone && CurrentConversation.lastSelfMessageId === Id
+                    sourceComponent: selfReadIconComp
+                    anchors.bottom: parent.bottom
+                }
             }
         }
 
-- 
GitLab