Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Improve update dialog message
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Nov 16, 2017
1 parent aef3e51 commit 1ad7346
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/src/modules/autoUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export default ({ autoUpdater, dialog }) => {
autoUpdater.checkForUpdates();
}, 24 * 60 * 60 * 1000);

autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
autoUpdater.on('update-downloaded', ({ version }) => {
const dialogOpts = {
type: 'info',
buttons: [i18n.t('Restart'), i18n.t('Later')],
buttons: [i18n.t('Update'), i18n.t('Later')],
title: i18n.t('New version of Lisk Nano available'),
message: i18n.t('Version {{version}} has been downloaded. Please restart the application to apply the updates.', { version: releaseName }),
message: i18n.t('Version {{version}} has been downloaded. To install the update and restart the application, click "{{buttonLabel}}" button.', { version, buttonLabel: i18n.t('Update') }),
};

dialog.showMessageBox(dialogOpts, (pressedButtonIndex) => {
Expand Down
10 changes: 4 additions & 6 deletions app/src/modules/autoUpdater.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import sinon, { spy } from 'sinon'; // eslint-disable-line import/no-extraneous-
import autoUpdater from './autoUpdater';

describe('autoUpdater', () => {
const event = {};
const releaseNotes = '';
const releaseName = '1.2.3';
const version = '1.2.3';
let params;
let callbacks;
let clock;
Expand Down Expand Up @@ -60,22 +58,22 @@ describe('autoUpdater', () => {
const dialogSpy = spy(params.dialog, 'showMessageBox');

autoUpdater(params);
callbacks['update-downloaded'](event, releaseNotes, releaseName);
callbacks['update-downloaded']({ version });

expect(dialogSpy).to.have.been.calledWith();
});

it('should params.autoUpdater.quitAndInstall() in params.dialog.showMessageBox callback if the first button was pressed', () => {
autoUpdater(params);
callbacks['update-downloaded'](event, releaseNotes, releaseName);
callbacks['update-downloaded']({ version });
callbacks.dialog(0);

expect(params.autoUpdater.quitAndInstall).to.have.been.calledWithExactly();
});

it('should not params.autoUpdater.quitAndInstall() in params.dialog.showMessageBox callback if the second button was pressed', () => {
autoUpdater(params);
callbacks['update-downloaded'](event, releaseNotes, releaseName);
callbacks['update-downloaded']({ version });
callbacks.dialog(1);

expect(params.autoUpdater.quitAndInstall).to.not.have.been.calledWith();
Expand Down
4 changes: 2 additions & 2 deletions i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
"Repeat the transaction": "Repeat the transaction",
"Report Issue...": "Report Issue...",
"Required": "Required",
"Restart": "Restart",
"Result": "Result",
"Result copied to clipboard": "Result copied to clipboard",
"Reward": "Reward",
Expand Down Expand Up @@ -167,12 +166,13 @@
"URL is invalid": "URL is invalid",
"Unable to connect to the node": "Unable to connect to the node",
"Undo": "Undo",
"Update": "Update",
"Uptime": "Uptime",
"Upvotes:": "Upvotes:",
"Username": "Username",
"Verify message": "Verify message",
"Version": "Version",
"Version {{version}} has been downloaded. Please restart the application to apply the updates.": "Version {{version}} has been downloaded. Please restart the application to apply the updates.",
"Version {{version}} has been downloaded. To install the update and restart the application, click \"{{buttonLabel}}\" button.": "Version {{version}} has been downloaded. To install the update and restart the application, click \"{{buttonLabel}}\" button.",
"View": "View",
"Vote": "Vote",
"Vote for delegates": "Vote for delegates",
Expand Down

0 comments on commit 1ad7346

Please sign in to comment.