Skip to content
This repository was archived by the owner on May 27, 2019. It is now read-only.

Commit 1594a12

Browse files
committed
Make sure all important notifications are shown during update
During an update from version X to version Y, show all important notifications for all versions between [X+1..Y]
1 parent 57808e2 commit 1594a12

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

chrome/background.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,23 @@ function onExtensionInstalled(details) {
173173
}
174174

175175
var changelog = {
176-
"2.0.13": "Breaking change: please update the host app to at least v2.0.12"
176+
2012: "Breaking change: please update the host app to at least v2.0.12"
177177
};
178178

179-
var version = chrome.runtime.getManifest().version;
180-
if (!(version in changelog)) {
181-
return;
182-
}
183-
184-
chrome.notifications.create(version, {
185-
title: "browserpass: Important changes",
186-
message: changelog[version],
187-
iconUrl: "icon-lock.png",
188-
type: "basic"
189-
});
179+
var parseVersion = version => parseInt(version.replace(/\./g, ""));
180+
var newVersion = parseVersion(chrome.runtime.getManifest().version);
181+
var prevVersion = parseVersion(details.previousVersion);
182+
183+
Object.keys(changelog)
184+
.sort()
185+
.forEach(function(version) {
186+
if (version > prevVersion && version <= newVersion) {
187+
chrome.notifications.create(version, {
188+
title: "browserpass: Important changes",
189+
message: changelog[version],
190+
iconUrl: "icon-lock.png",
191+
type: "basic"
192+
});
193+
}
194+
});
190195
}

0 commit comments

Comments
 (0)