From 0726b82644b4b29dfa8ff1bd6a2a81b8c87f950e Mon Sep 17 00:00:00 2001 From: aciidic Date: Sun, 28 Feb 2021 13:55:08 +0000 Subject: [PATCH] Option to disable firstrun/update popups Repurpose "NO_NAG" option. When activated it will disable the popups during first run and extension updates. --- src/js/gsSession.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/js/gsSession.js b/src/js/gsSession.js index 912295ae..b1e5ae6a 100644 --- a/src/js/gsSession.js +++ b/src/js/gsSession.js @@ -263,7 +263,10 @@ var gsSession = (function() { ) { //show welcome message const optionsUrl = chrome.extension.getURL('options.html?firstTime'); - await gsChrome.tabsCreate(optionsUrl); + const noNag = gsStorage.getOption(gsStorage.NO_NAG); + if (!noNag) { + await gsChrome.tabsCreate(optionsUrl); + } } } @@ -303,9 +306,12 @@ var gsSession = (function() { await gsIndexedDb.performMigration(lastVersion); gsStorage.setNoticeVersion('0'); + const noNag = gsStorage.getOption(gsStorage.NO_NAG); const shouldRecoverTabs = await checkForCrashRecovery(currentSessionTabs); if (shouldRecoverTabs) { - await gsUtils.createTabAndWaitForFinishLoading(updatedUrl, 10000); + if (!noNag) { + await gsUtils.createTabAndWaitForFinishLoading(updatedUrl, 10000); + } await recoverLostTabs(); updated = true; @@ -318,11 +324,15 @@ var gsSession = (function() { } } else { await gsUtils.removeTabsByUrlAsPromised(updatedUrl); - await gsChrome.tabsCreate({ url: updatedUrl }); + if (!noNag) { + await gsChrome.tabsCreate({ url: updatedUrl }); + } } } else { updated = true; - await gsChrome.tabsCreate({ url: updatedUrl }); + if (!noNag) { + await gsChrome.tabsCreate({ url: updatedUrl }); + } } }