Skip to content

Commit

Permalink
Work around welcome page disappearing post install
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Sep 3, 2021
1 parent 9d9565f commit 0a0ca5d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ function Badger() {
// set up periodic fetching of hashes from eff.org
setInterval(self.updateDntPolicyHashes.bind(self), utils.oneDay() * 4);

let privateStore = self.getPrivateSettings();
if (self.isFirstRun) {
// work around the welcome page getting closed by an extension restart
// such as in response to being granted Private Browsing permission
// from the post-install doorhanger on Firefox
setTimeout(function () {
privateStore.setItem("firstRunTimerFinished", true);
}, utils.oneMinute());

self.showFirstRunPage();

} else if (!privateStore.getItem("firstRunTimerFinished")) {
privateStore.setItem("firstRunTimerFinished", true);
self.showFirstRunPage();
}
});
Expand Down Expand Up @@ -880,8 +892,14 @@ Badger.prototype = {
}

// initialize any other private store (not-for-export) settings
if (!privateStore.hasItem("showLearningPrompt")) {
privateStore.setItem("showLearningPrompt", false);
let privateDefaultSettings = {
"firstRunTimerFinished": false,
"showLearningPrompt": false,
};
for (let key of Object.keys(privateDefaultSettings)) {
if (!privateStore.hasItem(key)) {
privateStore.setItem(key, privateDefaultSettings[key]);
}
}
badger.initDeprecations();

Expand Down

0 comments on commit 0a0ca5d

Please sign in to comment.