Mark all the unknown achievements as done and remove the survey one during the installation

This commit is contained in:
Andrea Marchesini
2025-10-28 14:56:52 +01:00
parent f6a59ab54e
commit f377174bf2
3 changed files with 32 additions and 10 deletions
+15
View File
@@ -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.
+17 -10
View File
@@ -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;
}
}
if (showAchievements) {
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);
} else {
this.showPanel(P_CONTAINERS_LIST);
return;
}
// We have found an unknown achievement. Let's mark it as done.
achievement.done = true;
saveAchivements = true;
}
if (saveAchivements) {
browser.storage.local.set({ achievements });
}
this.showPanel(P_CONTAINERS_LIST);
},
// In case the user wants to click multiple actions,
+1 -1
View File
@@ -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": {