This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
import i18n from './../i18n'; | ||
|
||
export default ({ autoUpdater, dialog }) => { | ||
try { | ||
autoUpdater.checkForUpdates(); | ||
setInterval(() => { | ||
autoUpdater.checkForUpdates(); | ||
}, 24 * 60 * 60 * 1000); | ||
autoUpdater.autoDownload = false; | ||
|
||
autoUpdater.on('update-downloaded', ({ version }) => { | ||
const dialogOpts = { | ||
type: 'info', | ||
buttons: [i18n.t('Update'), i18n.t('Later')], | ||
title: i18n.t('New version of Lisk Nano available'), | ||
message: i18n.t('Version {{version}} has been downloaded. To install the update and restart the application, click "{{buttonLabel}}" button.', { version, buttonLabel: i18n.t('Update') }), | ||
}; | ||
autoUpdater.checkForUpdates(); | ||
setInterval(() => { | ||
autoUpdater.checkForUpdates(); | ||
}, 24 * 60 * 60 * 1000); | ||
|
||
dialog.showMessageBox(dialogOpts, (pressedButtonIndex) => { | ||
if (pressedButtonIndex === 0) { | ||
autoUpdater.quitAndInstall(); | ||
} | ||
}); | ||
autoUpdater.on('update-available', () => { | ||
dialog.showMessageBox({ | ||
type: 'info', | ||
title: i18n.t('New version available'), | ||
message: i18n.t('There is a new version available, do you want update now?'), | ||
buttons: [i18n.t('Update now'), i18n.t('Later')], | ||
}, (buttonIndex) => { | ||
if (buttonIndex === 0) { | ||
autoUpdater.downloadUpdate(); | ||
} | ||
}); | ||
}); | ||
|
||
autoUpdater.on('error', (message) => { | ||
// eslint-disable-next-line no-console | ||
console.error('There was a problem updating the application'); | ||
// eslint-disable-next-line no-console | ||
console.error(message); | ||
autoUpdater.on('update-downloaded', () => { | ||
dialog.showMessageBox({ | ||
title: i18n.t('Install Updates'), | ||
message: i18n.t('Updates downloaded, application will be quit for update...'), | ||
}, () => { | ||
setImmediate(() => autoUpdater.quitAndInstall()); | ||
}); | ||
} catch (e) { | ||
// because autoUpdater doesn't work if the build is not signed | ||
// eslint-disable-next-line no-console | ||
console.log(e); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters