From 6498dadd68689d75baae3126e6b164791da5ee75 Mon Sep 17 00:00:00 2001
From: Nicolas Vengeon <nicolas.vengeon@savoirfairelinux.com>
Date: Thu, 2 Feb 2023 16:53:22 -0500
Subject: [PATCH] locationsharing: share button visibilty bug

binding of isSharingToCurrentConversation is now also done
when the webview is loaded (it was only done on conversationChange)

GitLab: #972

Change-Id: I5b767ed3f85334f97064112d125187b7093a1e26
---
 src/app/webengine/map/MapPosition.qml               | 2 +-
 src/app/webengine/map/MapPositionSharingControl.qml | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/app/webengine/map/MapPosition.qml b/src/app/webengine/map/MapPosition.qml
index 636d92ab8..86677992c 100644
--- a/src/app/webengine/map/MapPosition.qml
+++ b/src/app/webengine/map/MapPosition.qml
@@ -219,6 +219,7 @@ Item {
                         PositionManager.startPositioning()
                         //load locations that were received before this conversation was opened
                         PositionManager.loadPreviousLocations(attachedAccountId);
+                        isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId)
                     }
                 }
             }
@@ -230,7 +231,6 @@ Item {
             StopSharingPositionPopup {
                 id: stopSharingPositionPopup
 
-                property alias attachedAccountId: root.attachedAccountId
             }
         }
     }
diff --git a/src/app/webengine/map/MapPositionSharingControl.qml b/src/app/webengine/map/MapPositionSharingControl.qml
index 92a16240e..5e578cdfc 100644
--- a/src/app/webengine/map/MapPositionSharingControl.qml
+++ b/src/app/webengine/map/MapPositionSharingControl.qml
@@ -98,7 +98,8 @@ ColumnLayout {
             textLeftPadding: JamiTheme.buttontextPadding
             textRightPadding: JamiTheme.buttontextPadding
             primary: true
-            visible: !isSharingToCurrentConversation && !isUnpin
+            visible: !isSharingToCurrentConversation && !isUnpin && webView.isLoaded
+
             text: JamiStrings.shareLocation
             color: isError
                    ? JamiTheme.buttonTintedGreyInactive
-- 
GitLab