Skip to content

Commit

Permalink
Bug 1664545 - use correct RS bucket for badging Pioneer icon on new s…
Browse files Browse the repository at this point in the history
…tudies r=mstriemer

Differential Revision: https://phabricator.services.mozilla.com/D89956
  • Loading branch information
rhelmer committed Sep 11, 2020
1 parent 82521cb commit 658096a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion browser/components/BrowserGlue.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ BrowserGlue.prototype = {
},

_monitorPioneerStudies() {
const STUDY_ADDON_COLLECTION_KEY = "pioneer-study-addons";
const STUDY_ADDON_COLLECTION_KEY = "pioneer-study-addons-v1";
const PREF_PIONEER_NEW_STUDIES_AVAILABLE =
"toolkit.telemetry.pioneer-new-studies-available";

Expand Down Expand Up @@ -2256,12 +2256,19 @@ BrowserGlue.prototype = {
onCloseWindow() {},
};

// Update all open windows if the pref changes.
Services.prefs.addObserver(PREF_PIONEER_NEW_STUDIES_AVAILABLE, _badgeIcon);

// Badge any currently-open windows.
if (Services.prefs.getBoolPref(PREF_PIONEER_NEW_STUDIES_AVAILABLE, false)) {
_badgeIcon();
}

RemoteSettings(STUDY_ADDON_COLLECTION_KEY).on("sync", async event => {
Services.prefs.setBoolPref(PREF_PIONEER_NEW_STUDIES_AVAILABLE, true);
});

// When a new window opens, check if we need to badge the icon.
Services.wm.addListener(windowListener);
},

Expand Down
2 changes: 1 addition & 1 deletion browser/components/pioneer/content/pioneer.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ document.addEventListener("DOMContentLoaded", async domEvent => {
await showAvailableStudies(cachedAddons);
} catch (ex) {
// No need to throw here, we'll try again before letting users enroll in any studies.
console.error(`Could not install default add-on.`);
console.error(`Could not show available studies`, ex);
}
});

Expand Down

0 comments on commit 658096a

Please sign in to comment.