summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-04-02 22:17:15 +0900
committerGitHub <noreply@github.com>2023-04-02 22:17:15 +0900
commitda4e4dc6591838667998959aa7d5558a61278665 (patch)
treeb5c4650d8b3bf0dd67a53d9f9d4349d92a73e09f /ext
parentddf7769561b1bb06154f6b0c002131341bd7ed90 (diff)
parent033d38d3a0dfabc2565769ff12e30145f5450eb5 (diff)
Merge pull request #113 from Aquafina-water-bottle/fix_welcome_page
fix: welcome page no longer loads multiple times
Diffstat (limited to 'ext')
-rw-r--r--ext/js/background/backend.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index 5f42b4c9..db6cfada 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -239,7 +239,7 @@ class Backend {
const options = this._getProfileOptions({current: true});
if (options.general.showGuide) {
- this._openWelcomeGuidePage();
+ this._openWelcomeGuidePageOnce();
}
this._clipboardMonitor.on('change', this._onClipboardTextChange.bind(this));
@@ -2152,6 +2152,23 @@ class Backend {
return textReplacements;
}
+ async _openWelcomeGuidePageOnce() {
+ if (isObject(chrome.storage) && isObject(chrome.storage.session)) {
+ // Chrome
+ chrome.storage.session.get(['openedWelcomePage']).then((result) => {
+ if (!result.openedWelcomePage) {
+ this._openWelcomeGuidePage();
+ chrome.storage.session.set({'openedWelcomePage': true});
+ }
+ });
+ } else {
+ // Firefox (storage.session is not supported yet)
+ // NOTE: This means that the welcome page will repeatedly open in Firefox
+ // until they support storage.session.
+ this._openWelcomeGuidePage();
+ }
+ }
+
async _openWelcomeGuidePage() {
await this._createTab(chrome.runtime.getURL('/welcome.html'));
}