From 0c669d6b8301669a1f427e872898cc34b1556b17 Mon Sep 17 00:00:00 2001 From: Anton Bershanskiy Date: Thu, 8 Aug 2019 13:29:09 -0500 Subject: [PATCH] Fix: add migration path away from shownInstallPage --- background.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/background.js b/background.js index b7069994..d60dfb84 100644 --- a/background.js +++ b/background.js @@ -54,12 +54,28 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) { //add help page on install chrome.runtime.onInstalled.addListener(function (object) { - chrome.storage.sync.get(["userID"], function(result) { + // TODO (shownInstallPage): remove shownInstallPage logic after sufficient amount of time, + // so that people have time to upgrade and move to shownInstallPage-free code. + chrome.storage.sync.get(["userID", "shownInstallPage"], function(result) { const userID = result.userID; + // TODO (shownInstallPage): delete row below + const shownInstallPage = result.shownInstallPage; + // If there is no userID, then it is the first install. if (!userID){ - //open up the install page - chrome.tabs.create({url: chrome.extension.getURL("/help/index.html")}); + // Show install page, if there is no user id + // and there is no shownInstallPage. + // TODO (shownInstallPage): remove this if statement, but leave contents + if (!shownInstallPage){ + //open up the install page + chrome.tabs.create({url: chrome.extension.getURL("/help/index.html")}); + } + + // TODO (shownInstallPage): delete if statement and contents + // If shownInstallPage is set, remove it. + if (!!shownInstallPage){ + chrome.storage.sync.remove("shownInstallPage"); + } //generate a userID const newUserID = generateUUID();