Mark all the unknown achievements as done and remove the survey one during the installation
This commit is contained in:
@@ -38,6 +38,7 @@ const backgroundLogic = {
|
||||
browser.runtime.onInstalled.addListener((details) => {
|
||||
this.updateTranslationInManifest();
|
||||
this._undoDefault820SortTabsKeyboardShortcut(details);
|
||||
this._removeSurveyAchievement();
|
||||
});
|
||||
browser.runtime.onStartup.addListener(this.updateTranslationInManifest);
|
||||
},
|
||||
@@ -68,6 +69,20 @@ const backgroundLogic = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* We left an achievement entry in storage during a user research study in
|
||||
* version 8.3.1. This method removes that entry to prevent broken logic in
|
||||
* the achievement views.
|
||||
*/
|
||||
async _removeSurveyAchievement() {
|
||||
const achievementsStorage = await browser.storage.local.get({ achievements: [] });
|
||||
const achievements = achievementsStorage.achievements;
|
||||
const filtered = achievements.filter(a => a.name !== "survey");
|
||||
if (filtered.length !== achievements.length) {
|
||||
await browser.storage.local.set({achievements: filtered});
|
||||
}
|
||||
},
|
||||
|
||||
updateTranslationInManifest() {
|
||||
for (let index = 0; index < 10; index++) {
|
||||
const ajustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI.
|
||||
|
||||
+16
-9
@@ -137,19 +137,26 @@ const Logic = {
|
||||
},
|
||||
|
||||
async showAchievementOrContainersListPanel() {
|
||||
// Do we need to show an achievement panel?
|
||||
let showAchievements = false;
|
||||
const achievementsStorage = await browser.storage.local.get({ achievements: [] });
|
||||
for (const achievement of achievementsStorage.achievements) {
|
||||
if (!achievement.done) {
|
||||
showAchievements = true;
|
||||
const achievements = achievementsStorage.achievements;
|
||||
|
||||
let saveAchivements = false;
|
||||
for (const achievement of achievements.filter(a => !a.done)) {
|
||||
if (achievement.name === "manyContainersOpened") {
|
||||
this.showPanel(P_CONTAINERS_ACHIEVEMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
// We have found an unknown achievement. Let's mark it as done.
|
||||
achievement.done = true;
|
||||
saveAchivements = true;
|
||||
}
|
||||
if (showAchievements) {
|
||||
this.showPanel(P_CONTAINERS_ACHIEVEMENT);
|
||||
} else {
|
||||
this.showPanel(P_CONTAINERS_LIST);
|
||||
|
||||
if (saveAchivements) {
|
||||
browser.storage.local.set({ achievements });
|
||||
}
|
||||
|
||||
this.showPanel(P_CONTAINERS_LIST);
|
||||
},
|
||||
|
||||
// In case the user wants to click multiple actions,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Firefox Multi-Account Containers",
|
||||
"version": "8.3.2",
|
||||
"version": "8.3.4",
|
||||
"incognito": "not_allowed",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"icons": {
|
||||
|
||||
Reference in New Issue
Block a user