PR feedback

This commit is contained in:
David Kelly 2016-08-11 11:47:55 -07:00
parent 47dea0ea2b
commit c1edd008a4
2 changed files with 19 additions and 15 deletions

View file

@ -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>

View file

@ -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);