From 0ddeb076bba590467b98027fcaae593aa5fe69ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Thu, 5 Jul 2018 04:44:38 -0700 Subject: [PATCH] Update notifications Summary: Instead of showing a modal alert, we are now showing a notification, when an update is available. Clicking the notification will restart Sonar and install the plugin. Otherwise, the update will be installed on the next start of Sonar. Reviewed By: jknoxville, priteshrnandgaonkar Differential Revision: D8732743 fbshipit-source-id: b9e73a0d5b0866ab79b1e17274c501eac2ef41cc --- src/chrome/AutoUpdateVersion.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/chrome/AutoUpdateVersion.js b/src/chrome/AutoUpdateVersion.js index a7b008ed5..e49e076b7 100644 --- a/src/chrome/AutoUpdateVersion.js +++ b/src/chrome/AutoUpdateVersion.js @@ -45,17 +45,11 @@ export default class AutoUpdateVersion extends Component<{}, State> { remote.autoUpdater.on('update-downloaded', () => { this.setState({updater: 'update-downloaded'}); - remote.dialog.showMessageBox( - { - title: 'Update available', - message: 'A new version of Sonar is available!', - detail: `You have Sonar ${version} which is outdated. Update to the latest version now.`, - buttons: ['Install and Restart'], - }, - () => { - remote.autoUpdater.quitAndInstall(); - }, - ); + const notification = new window.Notification('Update available', { + body: 'Restart Sonar to update to the latest version.', + requireInteraction: true, + }); + notification.onclick = remote.autoUpdater.quitAndInstall; }); remote.autoUpdater.on('error', error => { @@ -92,7 +86,9 @@ export default class AutoUpdateVersion extends Component<{}, State> { )} {this.state.updater === 'update-downloaded' && ( - + )}