mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 08:08:10 +08:00
a94f9ad2a8
Summary: fix(autoupdater): Fix bizarrely broken code in autoupdater fix(urls): Use nilas.com instead of inboxapp fix(show-main-window): Cmd-1 is the mac standard fix(autoupdater): TESTS Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1199
39 lines
No EOL
1.3 KiB
CoffeeScript
39 lines
No EOL
1.3 KiB
CoffeeScript
remote = require 'remote'
|
|
{Actions} = require 'inbox-exports'
|
|
ipc = require('ipc')
|
|
|
|
module.exports =
|
|
|
|
activate: (@state) ->
|
|
# Populate our initial state directly from the auto update manager.
|
|
updater = remote.getGlobal('atomApplication').autoUpdateManager
|
|
@_unlisten = Actions.notificationActionTaken.listen(@_onNotificationActionTaken, @)
|
|
|
|
if updater.getState() is 'update-available'
|
|
@displayNotification(updater.releaseVersion)
|
|
|
|
# Watch for state changes via a command the auto-update manager fires.
|
|
# This is necessary because binding callbacks through `remote` is dangerous
|
|
@_command = atom.commands.add 'atom-workspace', 'window:update-available', (event, version, releaseNotes) =>
|
|
@displayNotification(version)
|
|
|
|
displayNotification: (version) ->
|
|
version = if version then "(#{version})" else ''
|
|
Actions.postNotification
|
|
type: 'success',
|
|
sticky: true
|
|
message: "An update to Edgehill is available #{version} - Restart now to update!",
|
|
icon: 'fa-flag',
|
|
actions: [{
|
|
label: 'Install'
|
|
id: 'release-bar:install-update'
|
|
}]
|
|
|
|
deactivate: ->
|
|
@_command.dispose()
|
|
@_unlisten()
|
|
|
|
_onNotificationActionTaken: ({notification, action}) ->
|
|
if action.id is 'release-bar:install-update'
|
|
ipc.send 'command', 'application:install-update'
|
|
true |