From c8c8208378db172b970c47684dabc973896e0b16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Fri, 3 Feb 2023 11:41:17 -0500
Subject: [PATCH] chatview: do not show "A call is in progress" in a call

Change-Id: I6e04c8e01e87f66a9e6da4fb32524f085066a5d0
GitLab: #940
---
 src/app/mainview/MainView.qml            |  3 +++
 src/app/mainview/components/ChatView.qml | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/app/mainview/MainView.qml b/src/app/mainview/MainView.qml
index 4a19aea65..8f81740d0 100644
--- a/src/app/mainview/MainView.qml
+++ b/src/app/mainview/MainView.qml
@@ -91,6 +91,7 @@ Rectangle {
     }
 
     function pushCallStackView() {
+        chatView.inCallView = true
         if (sidePanelOnly) {
             sidePanelViewStack.pop(StackView.Immediate)
             sidePanelViewStack.push(callStackView, StackView.Immediate)
@@ -102,6 +103,7 @@ Rectangle {
     }
 
     function pushCommunicationMessageWebView() {
+        chatView.inCallView = false
         if (sidePanelOnly) {
             sidePanelViewStack.pop(StackView.Immediate)
             sidePanelViewStack.push(chatView, StackView.Immediate)
@@ -412,6 +414,7 @@ Rectangle {
 
         objectName: "chatView"
         visible: false
+        inCallView: false
         Component.onCompleted: {
             MessagesAdapter.setQmlObject(this)
             PositionManager.setQmlObject(this)
diff --git a/src/app/mainview/components/ChatView.qml b/src/app/mainview/components/ChatView.qml
index eb16cd6ba..2f5c44753 100644
--- a/src/app/mainview/components/ChatView.qml
+++ b/src/app/mainview/components/ChatView.qml
@@ -35,6 +35,7 @@ Rectangle {
 
     property bool allMessagesLoaded
     property var mapPositions: PositionManager.mapStatus
+    property var inCallView: false
 
     property int lastContentsSplitSize: JamiTheme.detailsPageMinWidth
     property int lastDetailsSplitSize: JamiTheme.detailsPageMinWidth
@@ -44,7 +45,11 @@ Rectangle {
     signal messagesCleared
     signal messagesLoaded
 
-     onVisibleChanged: {
+    onInCallViewChanged: {
+        notificationArea.visible = CurrentConversation.activeCalls.length > 0 && !root.inCallView
+    }
+
+    onVisibleChanged: {
         if (visible)
             return
         UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id)
@@ -185,7 +190,7 @@ Rectangle {
                     notificationArea.uri = CurrentConversation.activeCalls[0]["uri"]
                     notificationArea.device = CurrentConversation.activeCalls[0]["device"]
                 }
-                notificationArea.visible = CurrentConversation.activeCalls.length > 0
+                notificationArea.visible = CurrentConversation.activeCalls.length > 0 && !root.inCallView
             }
 
             function onErrorsChanged() {
@@ -227,7 +232,7 @@ Rectangle {
             id: notificationArea
             Layout.fillWidth: true
             Layout.preferredHeight: JamiTheme.chatViewHeaderPreferredHeight
-            visible: false
+            visible: CurrentConversation.activeCalls.length > 0 && !root.inCallView
         }
 
         SplitView {
-- 
GitLab