Add unsupported state to update manager

This commit is contained in:
Kevin Sawicki
2014-11-19 14:05:12 -08:00
parent 9293ef766b
commit 1c0c8db042
2 changed files with 10 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ CheckingState = 'checking'
DownladingState = 'downloading'
UpdateAvailableState = 'update-available'
NoUpdateAvailableState = 'no-update-available'
UnsupportedState = 'unsupported'
ErrorState = 'error'
module.exports =
@@ -53,6 +54,12 @@ class AutoUpdateManager
unless /\w{7}/.test(@version)
@check(hidePopups: true)
switch process.platform
when 'win32'
@setState(UnsupportedState) unless autoUpdater.supportsUpdates()
when 'linux'
@setState(UnsupportedState)
emitUpdateAvailableEvent: (windows...) ->
return unless @releaseVersion? and @releaseNotes
for atomWindow in windows

View File

@@ -36,6 +36,9 @@ class AutoUpdater
installUpdate: (callback) ->
SquirrelUpdate.spawn(['--update', @updateUrl], callback)
supportsUpdates: ->
SquirrelUpdate.existsSync()
checkForUpdates: ->
throw new Error('Update URL is not set') unless @updateUrl