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,8 +583,10 @@ 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) {
if (!hasShownUpdateNotification) {
notifier.notify({ notifier.notify({
icon: trayIcon, icon: trayIcon,
title: 'An update is available!', title: 'An update is available!',
@ -592,6 +594,8 @@ app.on('ready', function() {
wait: true, wait: true,
url: url 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);