mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 05:52:31 +02:00
persist "open feed after" checkbox setting
This commit is contained in:
parent
0f415abd6b
commit
5e8722ccf5
2 changed files with 24 additions and 10 deletions
|
@ -84,6 +84,9 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
function handleShareButtons(shareMsg) {
|
function handleShareButtons(shareMsg) {
|
||||||
|
var openFeed = document.getElementById('openFeed');
|
||||||
|
openFeed.checked = shareMsg.openFeedAfterShare;
|
||||||
|
openFeed.onchange = function () { EventBridge.emitWebEvent(openFeed.checked ? 'setOpenFeedTrue' : 'setOpenFeedFalse'); };
|
||||||
if (!shareMsg.canShare) {
|
if (!shareMsg.canShare) {
|
||||||
// this means you may or may not be logged in, but can't share
|
// this means you may or may not be logged in, but can't share
|
||||||
// because you are not in a public place.
|
// because you are not in a public place.
|
||||||
|
@ -116,10 +119,10 @@
|
||||||
};
|
};
|
||||||
// beware of bug: Cannot send objects at top level. (Nested in arrays is fine.)
|
// beware of bug: Cannot send objects at top level. (Nested in arrays is fine.)
|
||||||
shareSelected = function () {
|
shareSelected = function () {
|
||||||
EventBridge.emitWebEvent(paths.concat({openFeed: document.getElementById("openFeed").checked}));
|
EventBridge.emitWebEvent(paths);
|
||||||
};
|
};
|
||||||
doNotShare = function () {
|
doNotShare = function () {
|
||||||
EventBridge.emitWebEvent([{openFeed: document.getElementById("openFeed").checked}]);
|
EventBridge.emitWebEvent([]);
|
||||||
};
|
};
|
||||||
snapshotSettings = function () {
|
snapshotSettings = function () {
|
||||||
EventBridge.emitWebEvent("openSettings");
|
EventBridge.emitWebEvent("openSettings");
|
||||||
|
|
|
@ -20,23 +20,32 @@ var button = toolBar.addButton({
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function shouldOpenFeedAfterShare() {
|
||||||
|
var persisted = Settings.getValue('openFeedAfterShare', true); // might answer true, false, "true", or "false"
|
||||||
|
return persisted && (persisted !== 'false');
|
||||||
|
}
|
||||||
function showFeedWindow() {
|
function showFeedWindow() {
|
||||||
DialogsManager.showFeed();
|
DialogsManager.showFeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
var openFeed, outstanding;
|
var outstanding;
|
||||||
function confirmShare(data) {
|
function confirmShare(data) {
|
||||||
var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/ShareSnapshot.html"), 800, 470);
|
var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/ShareSnapshot.html"), 800, 470);
|
||||||
function onMessage(message) {
|
function onMessage(message) {
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case 'ready':
|
case 'ready':
|
||||||
dialog.emitScriptEvent(data); // Send it.
|
dialog.emitScriptEvent(data); // Send it.
|
||||||
openFeed = false;
|
|
||||||
outstanding = 0;
|
outstanding = 0;
|
||||||
break;
|
break;
|
||||||
case 'openSettings':
|
case 'openSettings':
|
||||||
Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog");
|
Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog");
|
||||||
break;
|
break;
|
||||||
|
case 'setOpenFeedFalse':
|
||||||
|
Settings.setValue('openFeedAfterShare', false)
|
||||||
|
break;
|
||||||
|
case 'setOpenFeedTrue':
|
||||||
|
Settings.setValue('openFeedAfterShare', true)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close?
|
dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close?
|
||||||
dialog.close();
|
dialog.close();
|
||||||
|
@ -46,11 +55,9 @@ function confirmShare(data) {
|
||||||
print('sharing', submessage.localPath);
|
print('sharing', submessage.localPath);
|
||||||
outstanding++;
|
outstanding++;
|
||||||
Window.shareSnapshot(submessage.localPath);
|
Window.shareSnapshot(submessage.localPath);
|
||||||
} else if (submessage.openFeed) {
|
|
||||||
openFeed = true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (openFeed && !outstanding) {
|
if (!outstanding && shouldOpenFeedAfterShare()) {
|
||||||
showFeedWindow();
|
showFeedWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +74,7 @@ function snapshotShared(success) {
|
||||||
// for now just print an error.
|
// for now just print an error.
|
||||||
print('snapshot upload/share failed');
|
print('snapshot upload/share failed');
|
||||||
}
|
}
|
||||||
if ((--outstanding <= 0) && openFeed) {
|
if ((--outstanding <= 0) && shouldOpenFeedAfterShare()) {
|
||||||
showFeedWindow();
|
showFeedWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,8 +121,12 @@ function resetButtons(path, notify) {
|
||||||
|
|
||||||
// last element in data array tells dialog whether we can share or not
|
// last element in data array tells dialog whether we can share or not
|
||||||
confirmShare([
|
confirmShare([
|
||||||
{ localPath: path },
|
{ localPath: path },
|
||||||
{ canShare: Boolean(Window.location.placename), isLoggedIn: Account.isLoggedIn() }
|
{
|
||||||
|
canShare: Boolean(Window.location.placename),
|
||||||
|
isLoggedIn: Account.isLoggedIn(),
|
||||||
|
openFeedAfterShare: shouldOpenFeedAfterShare()
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue