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

Commit d76a85e

Browse files
authoredMar 19, 2018
Show notification on update with major changes (#221)
1 parent 49bbfd5 commit d76a85e

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed
 

‎chrome/background.js

+31-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var tabInfos = {};
66

77
chrome.runtime.onMessage.addListener(onMessage);
88
chrome.tabs.onUpdated.addListener(onTabUpdated);
9+
chrome.runtime.onInstalled.addListener(onExtensionInstalled);
910

1011
// fill login form & submit
1112
function fillLoginForm(login, tab) {
@@ -90,8 +91,9 @@ function onMessage(request, sender, sendResponse) {
9091
// object that has current settings. Update this as new settings
9192
// are added (or old ones removed)
9293
if (request.action == "getSettings") {
93-
const use_fuzzy_search = localStorage.getItem("use_fuzzy_search") != "false";
94-
sendResponse({ use_fuzzy_search: use_fuzzy_search})
94+
const use_fuzzy_search =
95+
localStorage.getItem("use_fuzzy_search") != "false";
96+
sendResponse({ use_fuzzy_search: use_fuzzy_search });
9597
}
9698
}
9799

@@ -113,3 +115,30 @@ function getHostname(url) {
113115
a.href = url;
114116
return a.hostname;
115117
}
118+
119+
function onExtensionInstalled(details) {
120+
// No permissions
121+
if (!chrome.notifications) {
122+
return;
123+
}
124+
125+
if (details.reason != "update") {
126+
return;
127+
}
128+
129+
var changelog = {
130+
"2.0.13": "Breaking change: please update the host app to at least v2.0.12"
131+
};
132+
133+
var version = chrome.runtime.getManifest().version;
134+
if (!(version in changelog)) {
135+
return;
136+
}
137+
138+
chrome.notifications.create(version, {
139+
title: "browserpass: Important changes",
140+
message: changelog[version],
141+
iconUrl: "icon-lock.png",
142+
type: "basic"
143+
});
144+
}

‎chrome/manifest.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"manifest_version": 2,
44
"name": "browserpass-ce",
55
"description": "Chrome extension for zx2c4's pass (password manager) - Community Edition.",
6-
"version": "2.0.12",
6+
"version": "2.0.13",
77
"author": "Danny van Kooten",
88
"homepage_url": "https://github.com/dannyvankooten/browserpass",
99
"background": {
@@ -26,6 +26,7 @@
2626
"tabs",
2727
"activeTab",
2828
"nativeMessaging",
29+
"notifications",
2930
"storage",
3031
"http://*/*",
3132
"https://*/*"

‎firefox/manifest.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "browserpass-ce",
44
"description": "Firefox extension for zx2c4's pass (password manager) - Community Edition.",
5-
"version": "2.0.12",
5+
"version": "2.0.13",
66
"author": "Danny van Kooten",
77
"homepage_url": "https://github.com/dannyvankooten/browserpass",
88
"options_ui": {
@@ -24,6 +24,7 @@
2424
"tabs",
2525
"activeTab",
2626
"nativeMessaging",
27+
"notifications",
2728
"storage",
2829
"http://*/*",
2930
"https://*/*"

0 commit comments

Comments
 (0)
This repository has been archived.