diff options
author | Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> | 2023-03-29 20:32:40 -0600 |
---|---|---|
committer | Darius Jahandarie <djahandarie@gmail.com> | 2023-04-02 22:12:01 +0900 |
commit | 5fcd37872a5adb45c42e17a78b87d1e174e72908 (patch) | |
tree | 83763c99e3c062f623de333a80830ab604a9208f | |
parent | ddf7769561b1bb06154f6b0c002131341bd7ed90 (diff) |
fix: welcome page no longer loads multiple times
-rw-r--r-- | ext/js/background/backend.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 5f42b4c9..a22371ed 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,21 @@ class Backend { return textReplacements; } + async _openWelcomeGuidePageOnce() { + if (isObject(chrome.storage) && isObject(chrome.storage.session)) { + chrome.storage.session.get(["openedWelcomePage"]).then((result) => { + console.log(new Date(), "openedWelcomePage:", result["openedWelcomePage"]); + if (!result["openedWelcomePage"]) { + this._openWelcomeGuidePage(); + chrome.storage.session.set({"openedWelcomePage": true}); + } + }); + } else { + // likely not mv3 + this._openWelcomeGuidePage(); + } + } + async _openWelcomeGuidePage() { await this._createTab(chrome.runtime.getURL('/welcome.html')); } |