Merge pull request #2816 from mozilla/achievements

Mark all the unknown achievements as done and remove the survey one during the installation
This commit is contained in:
Lesley Norton
2025-10-28 09:24:22 -05:00
committed by GitHub
4 changed files with 33 additions and 11 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "testpilot-containers", "name": "testpilot-containers",
"title": "Multi-Account Containers", "title": "Multi-Account Containers",
"description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.", "description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
"version": "8.3.2", "version": "8.3.4",
"author": "Andrea Marchesini, Luke Crouch, Lesley Norton, Kendall Werts, Maxx Crawford, Jonathan Kingston", "author": "Andrea Marchesini, Luke Crouch, Lesley Norton, Kendall Werts, Maxx Crawford, Jonathan Kingston",
"bugs": { "bugs": {
"url": "https://github.com/mozilla/multi-account-containers/issues" "url": "https://github.com/mozilla/multi-account-containers/issues"
+15
View File
@@ -38,6 +38,7 @@ const backgroundLogic = {
browser.runtime.onInstalled.addListener((details) => { browser.runtime.onInstalled.addListener((details) => {
this.updateTranslationInManifest(); this.updateTranslationInManifest();
this._undoDefault820SortTabsKeyboardShortcut(details); this._undoDefault820SortTabsKeyboardShortcut(details);
this._removeSurveyAchievement();
}); });
browser.runtime.onStartup.addListener(this.updateTranslationInManifest); 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() { updateTranslationInManifest() {
for (let index = 0; index < 10; index++) { for (let index = 0; index < 10; index++) {
const ajustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI. const ajustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI.
+16 -9
View File
@@ -137,19 +137,26 @@ const Logic = {
}, },
async showAchievementOrContainersListPanel() { async showAchievementOrContainersListPanel() {
// Do we need to show an achievement panel?
let showAchievements = false;
const achievementsStorage = await browser.storage.local.get({ achievements: [] }); const achievementsStorage = await browser.storage.local.get({ achievements: [] });
for (const achievement of achievementsStorage.achievements) { const achievements = achievementsStorage.achievements;
if (!achievement.done) {
showAchievements = true; let saveAchievements = 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;
saveAchievements = true;
} }
if (showAchievements) {
this.showPanel(P_CONTAINERS_ACHIEVEMENT); if (saveAchievements) {
} else { browser.storage.local.set({ achievements });
this.showPanel(P_CONTAINERS_LIST);
} }
this.showPanel(P_CONTAINERS_LIST);
}, },
// In case the user wants to click multiple actions, // In case the user wants to click multiple actions,
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Firefox Multi-Account Containers", "name": "Firefox Multi-Account Containers",
"version": "8.3.2", "version": "8.3.4",
"incognito": "not_allowed", "incognito": "not_allowed",
"description": "__MSG_extensionDescription__", "description": "__MSG_extensionDescription__",
"icons": { "icons": {