Disable update notifications in Snap-packaged version

This commit is contained in:
Ben Gotow 2017-10-05 14:37:25 -07:00
parent b607b4c3fe
commit aaffeb7e44
2 changed files with 16 additions and 4 deletions

View file

@ -4,6 +4,15 @@ import { shell } from 'electron';
import url from 'url';
export default class AutoupdateImplBase extends EventEmitter {
supportsUpdates() {
// If we're packaged into a Snapcraft distribution, we don't need
// autoupdates within the app because they're handled transparently.
if (process.env.SNAP) {
return false;
}
return true;
}
/* Public: Set the feed URL where we retrieve update information. */
setFeedURL(feedURL) {
this.feedURL = feedURL;

View file

@ -89,8 +89,15 @@ export default class AutoUpdateManager extends EventEmitter {
this.emitUpdateAvailableEvent();
});
if (autoUpdater.supportsUpdates && !autoUpdater.supportsUpdates()) {
this.setState(UnsupportedState);
return;
}
//check immediately at startup
this.check({ hidePopups: true });
//check every 30 minutes
setInterval(() => {
if ([UpdateAvailableState, UnsupportedState].includes(this.state)) {
console.log('Skipping update check... update ready to install, or updater unavailable.');
@ -98,10 +105,6 @@ export default class AutoUpdateManager extends EventEmitter {
}
this.check({ hidePopups: true });
}, 1000 * 60 * 30);
if (autoUpdater.supportsUpdates && !autoUpdater.supportsUpdates()) {
this.setState(UnsupportedState);
}
}
emitUpdateAvailableEvent() {