Update update notification to only show once

This commit is contained in:
Ryan Huffman 2016-01-19 14:40:14 -08:00
parent a62da96785
commit dc1d1dfebd

View file

@ -583,15 +583,19 @@ app.on('ready', function() {
if (currentVersion !== null) { if (currentVersion !== null) {
const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30; const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30;
var hasShownUpdateNotification = false;
const updateChecker = new updater.UpdateChecker(currentVersion, CHECK_FOR_UPDATES_INTERVAL_SECONDS); const updateChecker = new updater.UpdateChecker(currentVersion, CHECK_FOR_UPDATES_INTERVAL_SECONDS);
updateChecker.on('update-available', function(latestVersion, url) { updateChecker.on('update-available', function(latestVersion, url) {
notifier.notify({ if (!hasShownUpdateNotification) {
icon: trayIcon, notifier.notify({
title: 'An update is available!', icon: trayIcon,
message: 'High Fidelity version ' + latestVersion + ' is available', title: 'An update is available!',
wait: true, message: 'High Fidelity version ' + latestVersion + ' is available',
url: url wait: true,
}); url: url
});
hasShownUpdateNotification = true;
}
}); });
notifier.on('click', function(notifierObject, options) { notifier.on('click', function(notifierObject, options) {
console.log("Got click", options.url); console.log("Got click", options.url);