Fixes #379
This commit is contained in:
parent
abedf179d5
commit
188dc068d8
2 changed files with 26 additions and 6 deletions
|
@ -117,5 +117,7 @@
|
|||
"notificationNoUpdateTitle": { "message": "No updates available" },
|
||||
"notificationNoUpdateDetail": { "message": "There aren't any updates for Caret at this time." },
|
||||
"notificationUpdateOK": { "message": "Yes, update and restart" },
|
||||
"notificationUpdateWait": { "message": "No thanks" }
|
||||
"notificationUpdateWait": { "message": "No thanks" },
|
||||
"notificationUpdated": { "message": "Caret has been updated" },
|
||||
"notificationUpdatedDetail": { "message": "Now at version $1. Click to see the changelog in the Chrome store." }
|
||||
}
|
||||
|
|
28
installer.js
28
installer.js
|
@ -1,21 +1,39 @@
|
|||
var notification = "upgraded";
|
||||
|
||||
chrome.runtime.onInstalled.addListener(function(e) {
|
||||
//this is where we'll track upgrades
|
||||
if (!e.previousVersion) return;
|
||||
|
||||
var manifest = chrome.runtime.getManifest();
|
||||
|
||||
var semver = e.previousVersion.split(".");
|
||||
var major = semver[0];
|
||||
var minor = semver[1];
|
||||
var build = semver[2];
|
||||
|
||||
console.log("Upgrading Caret from version " + e.previousVersion);
|
||||
if (e.previousVersion != manifest.version) {
|
||||
//let the user know
|
||||
chrome.notifications.create(notification, {
|
||||
type: "basic",
|
||||
iconUrl: "icon-128.png",
|
||||
title: chrome.i18n.getMessage("notificationUpdated"),
|
||||
message: chrome.i18n.getMessage("notificationUpdatedDetail", [manifest.version]),
|
||||
isClickable: true
|
||||
}, function(id) { notification = id });
|
||||
}
|
||||
|
||||
// console.log("Upgrading Caret from version " + e.previousVersion);
|
||||
|
||||
/*
|
||||
|
||||
As with Android database upgrades, we'll perform these as a series of if statements, ordered by increasing
|
||||
version number. We should also provide a notification that the system is upgrading, and prevent opening new
|
||||
windows until the process finishes. In theory, this script shares a document with background.js, so they can
|
||||
just use a common flag to halt the openWindow process during upgrades.
|
||||
As with Android database upgrades, we'll perform these as a series of if statements, ordered by increasing version number. We should also provide a notification that the system is upgrading, and prevent opening new windows until the process finishes. In theory, this script shares a document with background.js, so they can just use a common flag to halt the openWindow process during upgrades.
|
||||
|
||||
*/
|
||||
|
||||
});
|
||||
|
||||
|
||||
chrome.notifications.onClicked.addListener(function(id) {
|
||||
if (id != notification) return;
|
||||
window.open("https://chrome.google.com/webstore/detail/caret/fljalecfjciodhpcledpamjachpmelml", "target=_blank");
|
||||
});
|
Loading…
Reference in a new issue