show 'NEW' icon badge for major upgrades

This commit is contained in:
groovecoder 2017-05-11 11:45:39 -05:00
parent 8f80b527f5
commit 4a48a7debb
5 changed files with 18 additions and 2 deletions

View file

@ -8,6 +8,8 @@ const DEFAULT_TAB = "about:newtab";
const SHOW_MENU_TIMEOUT = 100;
const HIDE_MENU_TIMEOUT = 300;
const MAJOR_VERSIONS = ["2.2.1"];
const INCOMPATIBLE_ADDON_IDS = [
"pulse@mozilla.com",
"snoozetabs@mozilla.com",
@ -256,6 +258,9 @@ const ContainerService = {
webExtension.startup().then(api => {
api.browser.runtime.onMessage.addListener((message, sender, sendReply) => {
if (message.method === "checkForMajorUpgrade") {
sendReply(reason === "upgrade" && MAJOR_VERSIONS.indexOf(self.version) > -1);
}
if ("method" in message && methods.indexOf(message.method) !== -1) {
sendReply(this[message.method](message));
}

View file

@ -467,6 +467,13 @@ browser.runtime.sendMessage({
}
}).catch(() => {});
browser.runtime.sendMessage({method: "checkForMajorUpgrade"}).then(upgrading=> {
if (upgrading) {
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
browser.browserAction.setBadgeText({text: "NEW"});
}
}).catch((e) => { throw e;});
function disableAddon(tabId) {
browser.browserAction.disable(tabId);
browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -64,6 +64,10 @@ const Logic = {
_panels: {},
init() {
// Remove browserAction "upgraded" badge when opening panel
browser.browserAction.setBadgeBackgroundColor({color: ""});
browser.browserAction.setBadgeText({text: ""});
// Retrieve the list of identities.
this.refreshIdentities()

View file

@ -32,8 +32,8 @@
<div class="panel onboarding onboarding-panel-4 hide" id="onboarding-panel-4">
<img class="onboarding-img" alt="How to assign sites to containers" src="/img/onboarding-4.png" />
<h3 class="onboarding-title">Assign your favorite sites to containers..</h3>
<p>Assign your favorite sites to automatically open in containers.</p>
<h3 class="onboarding-title">Always open sites in the containers you want.</h3>
<p>Right-click inside a container tab to assign the site to always open in the container.</p>
<a href="#" id="onboarding-done-button" class="onboarding-button">Done</a>
</div>