From 8823f486666c799be58e11dbbcaea39f9a262422 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 17 Aug 2016 10:00:20 -0700 Subject: [PATCH] new snapshot review behavior --- scripts/system/html/ShareSnapshot.html | 47 ++++++++++++++++++------- scripts/system/snapshot.js | 48 ++++++++++++++++++-------- 2 files changed, 67 insertions(+), 28 deletions(-) diff --git a/scripts/system/html/ShareSnapshot.html b/scripts/system/html/ShareSnapshot.html index 7754371547..9098b30121 100644 --- a/scripts/system/html/ShareSnapshot.html +++ b/scripts/system/html/ShareSnapshot.html @@ -21,6 +21,15 @@ max-width: 100%; height:auto; } + .prompt { + font-family: Raleway-SemiBold; + text-transform: none; + } + + .sub-section-header > div > input { + margin-top:20px; + } + span.inline-checkbox { display:inline; } @media (max-width: 768px){ .snapshot-column-left{ @@ -37,6 +46,8 @@ .snapsection{ width:95% !important; padding-right:0px; + margin-left: auto; + margin-right: auto; } div#sharing { margin-top:50px; @@ -104,11 +115,14 @@ }; // beware of bug: Cannot send objects at top level. (Nested in arrays is fine.) - shareSelected = function() { - EventBridge.emitWebEvent(paths); + shareSelected = function () { + EventBridge.emitWebEvent(paths.concat({openFeed: document.getElementById("openFeed").checked})); }; - doNotShare = function() { - EventBridge.emitWebEvent([]); + doNotShare = function () { + EventBridge.emitWebEvent([{openFeed: document.getElementById("openFeed").checked}]); + }; + snapshotSettings = function () { + EventBridge.emitWebEvent("openSettings"); }; @@ -120,16 +134,23 @@
-
-
- -
-
- -
-
- +
+
+
Would you like to share your pic in the Snapshots feed?
+
+
+
+
+ +
+
+
+ + + + +
diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 795e469c83..6c9132194e 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -20,24 +20,39 @@ var button = toolBar.addButton({ alpha: 0.9, }); +function showFeedWindow() { + DialogsManager.showFeed(); +} + +var openFeed, outstanding; function confirmShare(data) { - var dialog = new OverlayWebWindow('Snapshot', Script.resolvePath("html/ShareSnapshot.html"), 800, 470); + var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/ShareSnapshot.html"), 800, 470); function onMessage(message) { - if (message == 'ready') { // The window can now receive data from us. + switch (message) { + case 'ready': dialog.emitScriptEvent(data); // Send it. - return; - } // Rest is confirmation processing - 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.deleteLater(); - message = message.filter(function (picture) { return picture.share; }); - if (message.length) { - print('sharing', message.map(function (picture) { return picture.localPath; }).join(', ')); - message.forEach(function (data) { - Window.shareSnapshot(data.localPath); + openFeed = false; + outstanding = 0; + break; + case 'openSettings': + Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog"); + break; + default: + 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.deleteLater(); + message.forEach(function (submessage) { + if (submessage.share) { + print('sharing', submessage.localPath); + outstanding++; + Window.shareSnapshot(submessage.localPath); + } else if (submessage.openFeed) { + openFeed = true; + } }); - } else { - print('declined to share', JSON.stringify(data)); + if (openFeed && !outstanding) { + showFeedWindow(); + } } } dialog.webEventReceived.connect(onMessage); @@ -51,7 +66,10 @@ function snapshotShared(success) { } else { // for now just print an error. print('snapshot upload/share failed'); - } + } + if ((--outstanding <= 0) && openFeed) { + showFeedWindow(); + } } function onClicked() {