mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add getMenu method
This commit is contained in:
@@ -3,31 +3,30 @@ dialog = require 'dialog'
|
||||
|
||||
module.exports =
|
||||
class AutoUpdateManager
|
||||
constructor: (@applicationMenu) ->
|
||||
|
||||
constructor: ->
|
||||
# Only released versions should check for updates.
|
||||
return if /\w{7}/.test(@getVersion())
|
||||
|
||||
autoUpdater.setFeedUrl "https://atom.io/api/updates?version=#{@getVersion()}"
|
||||
|
||||
autoUpdater.on 'checking-for-update', =>
|
||||
@applicationMenu.showDownloadingUpdateItem(false)
|
||||
@applicationMenu.showInstallUpdateItem(false)
|
||||
@applicationMenu.showCheckForUpdateItem(false)
|
||||
@getMenu().showDownloadingUpdateItem(false)
|
||||
@getMenu().showInstallUpdateItem(false)
|
||||
@getMenu().showCheckForUpdateItem(false)
|
||||
|
||||
autoUpdater.on 'update-not-available', =>
|
||||
@applicationMenu.showCheckForUpdateItem(true)
|
||||
@getMenu().showCheckForUpdateItem(true)
|
||||
|
||||
autoUpdater.on 'update-available', =>
|
||||
@applicationMenu.showDownloadingUpdateItem(true)
|
||||
@getMenu().showDownloadingUpdateItem(true)
|
||||
|
||||
autoUpdater.on 'update-downloaded', (event, releaseNotes, releaseVersion, releaseDate, releaseURL) =>
|
||||
for atomWindow in @getWindows()
|
||||
atomWindow.sendCommand('window:update-available', [releaseVersion, releaseNotes])
|
||||
@applicationMenu.showInstallUpdateItem(true)
|
||||
@getMenu().showInstallUpdateItem(true)
|
||||
|
||||
autoUpdater.on 'error', (event, message) =>
|
||||
@applicationMenu.showCheckForUpdateItem(true)
|
||||
@getMenu().showCheckForUpdateItem(true)
|
||||
|
||||
# Check for update after Atom has fully started and the menus are created
|
||||
setTimeout((-> autoUpdater.checkForUpdates()), 5000)
|
||||
@@ -48,6 +47,9 @@ class AutoUpdateManager
|
||||
autoUpdater.removeListener 'update-not-available', @onUpdateNotAvailable
|
||||
dialog.showMessageBox type: 'warning', buttons: ['OK'], message: 'There was an error checking for updates.', detail: message
|
||||
|
||||
getMenu: ->
|
||||
global.atomApplication.applicationMenu
|
||||
|
||||
getVersion: ->
|
||||
global.atomApplication.version
|
||||
|
||||
|
||||
Reference in New Issue
Block a user