From 6e5eff9407b9a26226de7729ca1474d0cf2f955d Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 29 Jun 2017 10:01:48 -0700 Subject: [PATCH] Fix snapshot connection errors --- scripts/system/snapshot.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index c60e3a67f7..7825490b2c 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -384,7 +384,6 @@ function onButtonClicked() { } else { fillImageDataFromPrevious(); tablet.gotoWebScreen(SNAPSHOT_REVIEW_URL); - tablet.webEventReceived.connect(onMessage); HMD.openTablet(); } } @@ -659,10 +658,15 @@ function maybeDeleteSnapshotStories() { storyIDsToMaybeDelete = []; } function onTabletScreenChanged(type, url) { + var wasInSnapshotReview = isInSnapshotReview; isInSnapshotReview = (type === "Web" && url === SNAPSHOT_REVIEW_URL); button.editProperties({ isActive: isInSnapshotReview }); - if (!isInSnapshotReview) { - tablet.webEventReceived.disconnect(onMessage); + if (isInSnapshotReview !== wasInSnapshotReview) { + if (isInSnapshotReview) { + tablet.webEventReceived.connect(onMessage); + } else { + tablet.webEventReceived.disconnect(onMessage); + } } } function onUsernameChanged() {