diff --git a/scripts/system/html/ShareSnapshot.html b/scripts/system/html/ShareSnapshot.html index d838a01e99..d41da0fb7a 100644 --- a/scripts/system/html/ShareSnapshot.html +++ b/scripts/system/html/ShareSnapshot.html @@ -28,10 +28,16 @@ paths.push(data); } - function handleShareButtons(canShare) { - if (!canShare) { - // hide the share/do not share buttons - document.getElementById("sharing").innerHTML = "

You can share if you are logged in and in a public place"; + function handleShareButtons(shareMsg) { + if (!shareMsg.canShare) { + // this means you may or may not be logged in, but can't share + // because you are not in a public place. + document.getElementById("sharing").innerHTML = "

You can share if you are in a public place"; + } else if (!shareMsg.isLoggedIn) { + // this means you are in a public place, but can't share because + // you need to login. Soon we will just bring up the share dialog + // in this case (and maybe set a boolean here to inform the html) + document.getElementById("sharing").innerHTML = "

You can share if you are logged in"; } } window.onload = function () { @@ -41,9 +47,8 @@ // Set up a handler for receiving the data, and tell the .js we are ready to receive it. EventBridge.scriptEventReceived.connect(function (message) { // last element of list contains a bool for whether or not we can share stuff - var canShare = message.pop().canShare; - print("canShare:"+canShare+", message:" + message.toString()) - handleShareButtons(canShare); + var shareMsg = message.pop(); + handleShareButtons(shareMsg); // rest are image paths which we add message.forEach(addImage); @@ -74,10 +79,10 @@

-
- -
+
+ +
diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 0acb5d5acf..4c0ba37ab3 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -77,10 +77,6 @@ function onClicked() { }, SNAPSHOT_DELAY); } -function canShare() { - return Account.isLoggedIn() && Boolean(Window.location.placename); -} - function resetButtons(path, notify) { // show overlays if they were on if (resetOverlays) { @@ -96,7 +92,10 @@ function resetButtons(path, notify) { Window.snapshotTaken.disconnect(resetButtons); // last element in data array tells dialog whether we can share or not - confirmShare([ { localPath: path }, { canShare: canShare() } ]); + confirmShare([ + { localPath: path }, + { canShare: Boolean(Window.location.placename), isLoggedIn: Account.isLoggedIn() } + ]); } button.clicked.connect(onClicked);