Open snapshot dialog in tablet or window appropriately

This commit is contained in:
David Rowe 2017-03-27 15:04:33 +13:00
parent 8a678dfb04
commit aa8a1e1dda
2 changed files with 6 additions and 7 deletions

View file

@ -3,7 +3,6 @@
<title>Share</title>
<link rel="stylesheet" type="text/css" href="css/edit-style.css">
<link rel="stylesheet" type="text/css" href="css/SnapshotReview.css">
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
<script type="text/javascript" src="js/SnapshotReview.js"></script>
</head>

View file

@ -40,7 +40,7 @@ var SNAPSHOT_REVIEW_URL = Script.resolvePath("html/SnapshotReview.html");
var outstanding;
function confirmShare(data) {
var dialog = new OverlayWebWindow('Snapshot Review', SNAPSHOT_REVIEW_URL, 800, 520);
tablet.gotoWebScreen(SNAPSHOT_REVIEW_URL);
function onMessage(message) {
// Receives message from the html dialog via the qwebchannel EventBridge. This is complicated by the following:
// 1. Although we can send POJOs, we cannot receive a toplevel object. (Arrays of POJOs are fine, though.)
@ -51,7 +51,7 @@ function confirmShare(data) {
var needsLogin = false;
switch (message) {
case 'ready':
dialog.emitScriptEvent(data); // Send it.
tablet.emitScriptEvent(data); // Send it.
outstanding = 0;
break;
case 'openSettings':
@ -64,8 +64,8 @@ function confirmShare(data) {
Settings.setValue('openFeedAfterShare', true);
break;
default:
dialog.webEventReceived.disconnect(onMessage);
dialog.close();
tablet.webEventReceived.disconnect(onMessage);
HMD.closeTablet();
isLoggedIn = Account.isLoggedIn();
message.forEach(function (submessage) {
if (submessage.share && !isLoggedIn) {
@ -88,8 +88,8 @@ function confirmShare(data) {
}
}
}
dialog.webEventReceived.connect(onMessage);
dialog.raise();
tablet.webEventReceived.connect(onMessage);
HMD.openTablet();
}
function snapshotShared(errorMessage) {