Skip to content

Commit

Permalink
Option to disable firstrun/update popups
Browse files Browse the repository at this point in the history
Repurpose "NO_NAG" option. When activated it will disable the popups during first run and extension updates.
  • Loading branch information
aciidic authored Feb 28, 2021
1 parent e66afcb commit 0726b82
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/js/gsSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -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 });
}
}
}

Expand Down

0 comments on commit 0726b82

Please sign in to comment.