diff --git a/internal_packages/notification-mailto/lib/main.coffee b/internal_packages/notification-mailto/lib/main.coffee index fde5dc91a..1b78b5073 100644 --- a/internal_packages/notification-mailto/lib/main.coffee +++ b/internal_packages/notification-mailto/lib/main.coffee @@ -26,9 +26,12 @@ module.exports = icon: 'fa-inbox', actions: [{ label: 'Yes' + dismisses: true + default: true id: NOTIF_ACTION_YES },{ label: 'Not Now' + dismisses: true id: NOTIF_ACTION_NO }] diff --git a/internal_packages/notification-update-available/lib/main.cjsx b/internal_packages/notification-update-available/lib/main.cjsx index ba482e786..058012a5e 100644 --- a/internal_packages/notification-update-available/lib/main.cjsx +++ b/internal_packages/notification-update-available/lib/main.cjsx @@ -9,23 +9,52 @@ module.exports = updater = remote.getGlobal('application').autoUpdateManager @_unlisten = Actions.notificationActionTaken.listen(@_onNotificationActionTaken, @) + configVersion = atom.config.get("lastVersion") + currentVersion = atom.getVersion() + if configVersion and configVersion isnt currentVersion + atom.config.set("lastVersion", currentVersion) + @displayThanksNotification() + if updater.getState() is 'update-available' @displayNotification(updater.releaseVersion) atom.onUpdateAvailable ({releaseVersion, releaseNotes} = {}) => @displayNotification(releaseVersion) + displayThanksNotification: -> + Actions.postNotification + type: 'info' + tag: 'app-update' + sticky: true + message: "You're running the latest version of N1 - view the changelog to see what's new.", + icon: 'fa-magic' + actions: [{ + dismisses: true + label: 'Thanks' + id: 'release-bar:no-op' + },{ + default: true + dismisses: true + label: 'See What\'s New' + id: 'release-bar:view-changelog' + }] + displayNotification: (version) -> version = if version then "(#{version})" else '' Actions.postNotification type: 'info' tag: 'app-update' sticky: true - message: "An update to N1 is available #{version} - Restart now to update!", + message: "An update to N1 is available #{version} - click to update now!", icon: 'fa-flag' actions: [{ - label: 'Install' + label: 'Install Now' + dismisses: true + default: true id: 'release-bar:install-update' + },{ + label: 'See What\'s New' + id: 'release-bar:view-changelog' }] deactivate: -> @@ -35,3 +64,6 @@ module.exports = if action.id is 'release-bar:install-update' ipc.send 'command', 'application:install-update' true + if action.id is 'release-bar:view-changelog' + require('shell').openExternal('https://github.com/nylas/N1/blob/master/CHANGELOG.md') + false diff --git a/internal_packages/notifications/lib/notifications-sticky-bar.cjsx b/internal_packages/notifications/lib/notifications-sticky-bar.cjsx index 91d200d85..8d53c3f8b 100644 --- a/internal_packages/notifications/lib/notifications-sticky-bar.cjsx +++ b/internal_packages/notifications/lib/notifications-sticky-bar.cjsx @@ -8,15 +8,32 @@ class NotificationStickyItem extends React.Component render: => notif = @props.notification iconClass = if notif.icon then "fa #{notif.icon}" else "" + actionDefault = null actionComponents = notif.actions?.map (action) => - @_fireItemAction(notif, action)}>{action.label} + classname = "action " + if action.default + actionDefault = action + classname += "default" -
- {notif.message}{actionComponents} -
+ @_fireItemAction(notif, action)}> + {action.label} + + + if actionDefault +
@_fireItemAction(notif, actionDefault)}> + {notif.message}{actionComponents} +
+ else +
+ {notif.message}{actionComponents} +
_fireItemAction: (notification, action) => Actions.notificationActionTaken({notification, action}) + event.stopPropagation() class NotificationStickyBar extends React.Component diff --git a/internal_packages/notifications/lib/notifications-store.coffee b/internal_packages/notifications/lib/notifications-store.coffee index ff0c2f004..74da856c4 100644 --- a/internal_packages/notifications/lib/notifications-store.coffee +++ b/internal_packages/notifications/lib/notifications-store.coffee @@ -44,7 +44,7 @@ NotificationStore = Reflux.createStore # your package should listen to notificationActionTaken and check the # notification and action objects. @listenTo Actions.notificationActionTaken, ({notification, action}) => - @_removeNotification(notification)() + @_removeNotification(notification)() if action.dismisses @listenTo Actions.postNotification, (data) => @_postNotification(new Notification(data)) @listenTo Actions.multiWindowNotification, (data={}, context={}) => diff --git a/internal_packages/notifications/stylesheets/notifications.less b/internal_packages/notifications/stylesheets/notifications.less index 74cc1a8d9..cbf5ed6bb 100644 --- a/internal_packages/notifications/stylesheets/notifications.less +++ b/internal_packages/notifications/stylesheets/notifications.less @@ -148,34 +148,35 @@ .notifications-sticky-item { display:block; font-size: @font-size-base; - line-height: @line-height-base; - padding: @padding-base-vertical @padding-base-horizontal @padding-base-vertical @padding-base-horizontal; color:@text-color-inverse; border-top:1px solid rgba(0,0,0,0.25); border-bottom:1px solid rgba(0,0,0,0.25); + padding-left: @padding-base-horizontal; + line-height: @line-height-base * 1.5; a { float:right; - font-size:13px; - background-color: rgba(255,255,255,0.2); color:@text-color-inverse; - border-radius: 4px; - padding:1px; - padding-left:6px; - padding-right:6px; - margin-left:10px; - border-top:1px solid transparent; - border-bottom:none; + padding: 0 @padding-base-horizontal; } a:hover { - background-color: rgba(0,0,0,0.2); - border-top:1px solid rgba(0,0,0,0.35); + background-color: rgba(255,255,255,0.15); text-decoration:none; color:@text-color-inverse; } - + a.default { + background-color: rgba(0,0,0,0.15); + } + a.default:hover { + background-color: rgba(255,255,255,0.15); + } i { margin-right:@padding-base-horizontal; } + + &.has-default-action:hover { + -webkit-filter: brightness(110%); + cursor:default; + } } } body.platform-win32 { diff --git a/src/browser/auto-update-manager.coffee b/src/browser/auto-update-manager.coffee index ed83485de..b35c36a69 100644 --- a/src/browser/auto-update-manager.coffee +++ b/src/browser/auto-update-manager.coffee @@ -82,7 +82,7 @@ class AutoUpdateManager @setState(UnsupportedState) emitUpdateAvailableEvent: (windows...) -> - return unless @releaseVersion? and @releaseNotes + return unless @releaseVersion for atomWindow in windows atomWindow.sendMessage('update-available', {@releaseVersion, @releaseNotes}) @@ -95,7 +95,6 @@ class AutoUpdateManager @state check: ({hidePopups}={}) -> - console.log "Checking for updates..." unless hidePopups autoUpdater.once 'update-not-available', @onUpdateNotAvailable autoUpdater.once 'error', @onUpdateError diff --git a/src/browser/auto-updater-win32.coffee b/src/browser/auto-updater-win32.coffee index 89430d9c1..3a69c314f 100644 --- a/src/browser/auto-updater-win32.coffee +++ b/src/browser/auto-updater-win32.coffee @@ -51,12 +51,11 @@ class AutoUpdater @emit 'update-not-available' return + @emit 'update-available' @installUpdate (error) => if error? @emit 'update-not-available' return - - @emit 'update-available' - @emit 'update-downloaded', {}, update.releaseNotes, update.version, new Date(), 'https://atom.io', => @quitAndInstall() + @emit 'update-downloaded', {}, update.releaseNotes, update.version module.exports = new AutoUpdater() diff --git a/src/flux/actions.coffee b/src/flux/actions.coffee index c4bc54027..157907bfc 100644 --- a/src/flux/actions.coffee +++ b/src/flux/actions.coffee @@ -357,10 +357,13 @@ class Actions icon: 'fa-inbox', actions: [{ label: 'Yes' + default: true + dismisses: true id: NOTIF_ACTION_YES },{ - label: 'Not Now' - id: NOTIF_ACTION_NO + label: 'More Info' + dismisses: false + id: NOTIF_ACTION_MORE_INFO }] ``` diff --git a/src/flux/nylas-api.coffee b/src/flux/nylas-api.coffee index fa898b695..6fe8b1b96 100644 --- a/src/flux/nylas-api.coffee +++ b/src/flux/nylas-api.coffee @@ -231,6 +231,8 @@ class NylasAPI account and sign in again.", icon: 'fa-sign-out' actions: [{ + default: true + dismisses: true label: 'Unlink' id: '401:unlink' }] diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index c2a682214..9c942ee80 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -221,7 +221,7 @@ class WindowEventHandler icon: 'fa-flask' type: 'developer' sticky: true - actions: [{label: 'Thanks', id: 'ok'}] + actions: [{label: 'Thanks', id: 'ok', dismisses: true, default: true}] message: "N1 is running with debug flags enabled (slower). Packages in ~/.nylas/dev/packages will be loaded. Have fun!" else