mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
PR feedback
This commit is contained in:
parent
47dea0ea2b
commit
c1edd008a4
2 changed files with 19 additions and 15 deletions
|
@ -28,10 +28,16 @@
|
|||
paths.push(data);
|
||||
|
||||
}
|
||||
function handleShareButtons(canShare) {
|
||||
if (!canShare) {
|
||||
// hide the share/do not share buttons
|
||||
document.getElementById("sharing").innerHTML = "<p>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 = "<p>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 = "<p>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 @@
|
|||
<div class="section-header">
|
||||
<label>Snapshots sucessfully saved!</label>
|
||||
</div>
|
||||
<div class="sub-section-header">
|
||||
<label>Would you like to share?</label>
|
||||
</div>
|
||||
<div id="sharing">
|
||||
<div class="sub-section-header">
|
||||
<label>Would you like to share?</label>
|
||||
</div>
|
||||
<div class="sub-section-header">
|
||||
<input type="button" id="share" value="SHARE IN FEED" onclick="shareSelected()"/>
|
||||
</div>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue