Allow disabling the onboarding panel from enterprise policies

This commit is contained in:
Danny Colin 2024-03-30 14:48:06 -04:00
parent 0acc48af48
commit 299057edb5
2 changed files with 22 additions and 2 deletions

@ -1 +1 @@
Subproject commit d3301069f51262e8cf493a86aa2785cf3261141e
Subproject commit 985531f5c9a4187c0fd172032933c0cc813ab49d

View file

@ -81,7 +81,10 @@ const Logic = {
}
// Routing to the correct panel.
// If localStorage is disabled, we don't show the onboarding.
//
// We do not show the onboarding panel when:
// 1. localStorage is disabled
// 2. `disableOnboarding` is set to `true` in the enterprise policies
const onboardingData = await browser.storage.local.get([ONBOARDING_STORAGE_KEY]);
let onboarded = onboardingData[ONBOARDING_STORAGE_KEY];
if (!onboarded) {
@ -89,6 +92,23 @@ const Logic = {
this.setOnboardingStage(onboarded);
}
// If a polices file or a key in it do not exists, an error is raised.
// As a workaround, we catch and ignore the error if there is one. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=1868153
let disableOnboarding = false;
try {
const managedStorage =
await browser.storage.managed.get("disableOnboarding");
disableOnboarding = managedStorage.disableOnboarding;
} catch(e) {
// ignore error
}
if (disableOnboarding) {
onboarded = 8;
this.setOnboardingStage(onboarded);
}
switch (onboarded) {
case 8:
this.showAchievementOrContainersListPanel();