mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 17:55:24 +03:00
only trigger notification on major v change
This commit is contained in:
parent
05f06075b2
commit
4fc1d3ef53
1 changed files with 22 additions and 16 deletions
|
@ -37,23 +37,29 @@ chrome.app.runtime.onLaunched.addListener(function() {
|
||||||
|
|
||||||
chrome.runtime.onInstalled.addListener(function(details) {
|
chrome.runtime.onInstalled.addListener(function(details) {
|
||||||
if (details.reason == 'update') {
|
if (details.reason == 'update') {
|
||||||
chrome.storage.local.get('update_notify', function(result) {
|
var previousVersionArr = details.previousVersion.split('.');
|
||||||
if (typeof result.update_notify === 'undefined' || result.update_notify) {
|
var currentVersionArr = chrome.runtime.getManifest().version.split('.');
|
||||||
var manifest = chrome.runtime.getManifest();
|
|
||||||
var options = {
|
|
||||||
priority: 0,
|
|
||||||
type: 'basic',
|
|
||||||
title: manifest.name,
|
|
||||||
message: chrome.i18n.getMessage('notifications_app_just_updated_to_version', [manifest.version]),
|
|
||||||
iconUrl: '/images/icon_128.png',
|
|
||||||
buttons: [{'title': chrome.i18n.getMessage('notifications_click_here_to_start_app')}]
|
|
||||||
};
|
|
||||||
|
|
||||||
chrome.notifications.create('baseflight_update', options, function(notificationId) {
|
// only fire up notification sequence when one of the major version numbers changed
|
||||||
// empty
|
if (currentVersionArr[0] != previousVersionArr[0] || currentVersionArr[1] != previousVersionArr[1]) {
|
||||||
});
|
chrome.storage.local.get('update_notify', function(result) {
|
||||||
}
|
if (typeof result.update_notify === 'undefined' || result.update_notify) {
|
||||||
});
|
var manifest = chrome.runtime.getManifest();
|
||||||
|
var options = {
|
||||||
|
priority: 0,
|
||||||
|
type: 'basic',
|
||||||
|
title: manifest.name,
|
||||||
|
message: chrome.i18n.getMessage('notifications_app_just_updated_to_version', [manifest.version]),
|
||||||
|
iconUrl: '/images/icon_128.png',
|
||||||
|
buttons: [{'title': chrome.i18n.getMessage('notifications_click_here_to_start_app')}]
|
||||||
|
};
|
||||||
|
|
||||||
|
chrome.notifications.create('baseflight_update', options, function(notificationId) {
|
||||||
|
// empty
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue