- {this.props.t('You can select up to {{count}} delegates in one voting turn.', { count: maxCountOfVotesInOneTurn })} -
-- {this.props.t('You can vote for up to {{count}} delegates in total.', { count: maxCountOfVotes })} -
-diff --git a/Jenkinsfile b/Jenkinsfile
index 73c104ba8..92d08dba3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -148,8 +148,13 @@ node('lisk-nano-01'){
}
milestone 1
/* notify of success if previous build failed */
- if (currentBuild.getPreviousBuild().result == 'FAILURE') {
- slackSend color: 'good', message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}> was sucessful.", channel: '#lisk-nano-jenkins'
+ previous_build = currentBuild.getPreviousBuild()
+ if (previous_build != null && previous_build.result == 'FAILURE') {
+ def pr_branch = ''
+ if (env.CHANGE_BRANCH != null) {
+ pr_branch = " (${env.CHANGE_BRANCH})"
+ }
+ slackSend color: 'good', message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch} was successful.", channel: '#lisk-nano-jenkins'
}
}
}
diff --git a/app/main.js b/app/main.js
index 707588a87..3e5055a1e 100644
--- a/app/main.js
+++ b/app/main.js
@@ -1,13 +1,23 @@
const electron = require('electron'); // eslint-disable-line import/no-extraneous-dependencies
const path = require('path');
+const buildMenu = require('./menu');
-const { app } = electron;
-const { BrowserWindow } = electron;
-const { Menu } = electron;
-const { ipcMain } = electron;
+const { app, BrowserWindow, Menu, ipcMain } = electron;
let win;
+let isUILoaded = false;
+let eventStack = [];
+
const copyright = `Copyright © 2016 - ${new Date().getFullYear()} Lisk Foundation`;
+const protocolName = 'lisk';
+
+const sendUrlToRouter = (url) => {
+ if (isUILoaded && win && win.webContents) {
+ win.webContents.send('openUrl', url);
+ } else {
+ eventStack.push({ event: 'openUrl', value: url });
+ }
+};
function createWindow() {
const { width, height } = electron.screen.getPrimaryDisplay().workAreaSize;
@@ -25,134 +35,11 @@ function createWindow() {
win.on('blur', () => win.webContents.send('blur'));
win.on('focus', () => win.webContents.send('focus'));
- win.webContents.openDevTools();
-
- const template = [
- {
- label: 'Edit',
- submenu: [
- {
- role: 'undo',
- },
- {
- role: 'redo',
- },
- {
- type: 'separator',
- },
- {
- role: 'cut',
- },
- {
- role: 'copy',
- },
- {
- role: 'paste',
- },
- {
- role: 'selectall',
- },
- ],
- },
- {
- label: 'View',
- submenu: [
- {
- role: 'reload',
- },
- {
- role: 'togglefullscreen',
- },
- ],
- },
- {
- label: 'Window',
- submenu: [
- {
- role: 'minimize',
- },
- ],
- },
- {
- label: 'Help',
- submenu: [
- {
- label: 'Lisk Website',
- click() {
- electron.shell.openExternal('https://lisk.io');
- },
- },
- {
- label: 'Lisk Chat',
- click() {
- electron.shell.openExternal('https://lisk.chat');
- },
- },
- {
- label: 'Lisk Explorer',
- click() {
- electron.shell.openExternal('https://explorer.lisk.io');
- },
- },
- {
- label: 'Lisk Forum',
- click() {
- electron.shell.openExternal('https://forum.lisk.io');
- },
- },
- {
- type: 'separator',
- },
- {
- label: 'Report Issue...',
- click() {
- electron.shell.openExternal('https://lisk.zendesk.com/hc/en-us/requests/new');
- },
- },
- {
- label: 'What\'s New...',
- click() {
- electron.shell.openExternal('https://github.com/LiskHQ/lisk-nano/releases');
- },
- },
- ],
- },
- ];
-
- if (process.platform === 'darwin') {
- const name = app.getName();
-
- template.unshift({
- label: name,
- submenu: [
- {
- role: 'about',
- label: 'About',
- },
- {
- role: 'quit',
- label: 'Quit',
- },
- ],
- });
- } else {
- template[template.length - 1].submenu.push({
- label: 'About',
- click(item, focusedWindow) {
- if (focusedWindow) {
- const options = {
- buttons: ['OK'],
- icon: `${__dirname}/assets/lisk.png`,
- message: `Lisk Nano\nVersion ${app.getVersion()}\n${copyright}`,
- };
- electron.dialog.showMessageBox(focusedWindow, options, () => {});
- }
- },
- });
+ if (process.platform === 'win32') {
+ sendUrlToRouter(process.argv.slice(1));
}
- const menu = Menu.buildFromTemplate(template);
- Menu.setApplicationMenu(menu);
+ Menu.setApplicationMenu(buildMenu(app, copyright));
win.loadURL(`file://${__dirname}/dist/index.html`);
@@ -183,6 +70,15 @@ function createWindow() {
selectionMenu.popup(win);
}
});
+
+ // Resolve all events from stack when dom is ready
+ win.webContents.on('did-finish-load', () => {
+ isUILoaded = true;
+ if (eventStack.length > 0) {
+ eventStack.forEach(({ event, value }) => win.webContents.send(event, value));
+ eventStack = [];
+ }
+ });
}
app.on('ready', createWindow);
@@ -207,6 +103,32 @@ app.on('activate', () => {
}
});
+// Set app protocol
+app.setAsDefaultProtocolClient(protocolName);
+
+// Force single instance application
+const isSecondInstance = app.makeSingleInstance((argv) => {
+ if (process.platform === 'win32') {
+ sendUrlToRouter(argv.slice(1));
+ }
+ if (win) {
+ if (win.isMinimized()) win.restore();
+ win.focus();
+ }
+});
+
+if (isSecondInstance) {
+ app.quit();
+}
+
+app.on('will-finish-launching', () => {
+ // Protocol handler for MacOS
+ app.on('open-url', (event, url) => {
+ event.preventDefault();
+ sendUrlToRouter(url);
+ });
+});
+
app.on('login', (event, webContents, request, authInfo, callback) => {
global.myTempFunction = callback;
event.preventDefault();
@@ -216,3 +138,4 @@ app.on('login', (event, webContents, request, authInfo, callback) => {
ipcMain.on('proxyCredentialsEntered', (event, username, password) => {
global.myTempFunction(username, password);
});
+
diff --git a/app/menu.js b/app/menu.js
new file mode 100644
index 000000000..d461ffd87
--- /dev/null
+++ b/app/menu.js
@@ -0,0 +1,129 @@
+const electron = require('electron'); // eslint-disable-line import/no-extraneous-dependencies
+
+const { Menu } = electron;
+
+const template = [
+ {
+ label: 'Edit',
+ submenu: [
+ {
+ role: 'undo',
+ },
+ {
+ role: 'redo',
+ },
+ {
+ type: 'separator',
+ },
+ {
+ role: 'cut',
+ },
+ {
+ role: 'copy',
+ },
+ {
+ role: 'paste',
+ },
+ {
+ role: 'selectall',
+ },
+ ],
+ },
+ {
+ label: 'View',
+ submenu: [
+ {
+ role: 'reload',
+ },
+ {
+ role: 'togglefullscreen',
+ },
+ ],
+ },
+ {
+ label: 'Window',
+ submenu: [
+ {
+ role: 'minimize',
+ },
+ ],
+ },
+ {
+ label: 'Help',
+ submenu: [
+ {
+ label: 'Lisk Website',
+ click() {
+ electron.shell.openExternal('https://lisk.io');
+ },
+ },
+ {
+ label: 'Lisk Chat',
+ click() {
+ electron.shell.openExternal('https://lisk.chat');
+ },
+ },
+ {
+ label: 'Lisk Explorer',
+ click() {
+ electron.shell.openExternal('https://explorer.lisk.io');
+ },
+ },
+ {
+ label: 'Lisk Forum',
+ click() {
+ electron.shell.openExternal('https://forum.lisk.io');
+ },
+ },
+ {
+ type: 'separator',
+ },
+ {
+ label: 'Report Issue...',
+ click() {
+ electron.shell.openExternal('https://lisk.zendesk.com/hc/en-us/requests/new');
+ },
+ },
+ {
+ label: 'What\'s New...',
+ click() {
+ electron.shell.openExternal('https://github.com/LiskHQ/lisk-nano/releases');
+ },
+ },
+ ],
+ },
+];
+
+module.exports = (app, copyright) => {
+ if (process.platform === 'darwin') {
+ const name = app.getName();
+ template.unshift({
+ label: name,
+ submenu: [
+ {
+ role: 'about',
+ label: 'About',
+ },
+ {
+ role: 'quit',
+ label: 'Quit',
+ },
+ ],
+ });
+ } else {
+ template[template.length - 1].submenu.push({
+ label: 'About',
+ click(item, focusedWindow) {
+ if (focusedWindow) {
+ const options = {
+ buttons: ['OK'],
+ icon: `${__dirname}/assets/lisk.png`,
+ message: `Lisk Nano\nVersion ${app.getVersion()}\n${copyright}`,
+ };
+ electron.dialog.showMessageBox(focusedWindow, options, () => {});
+ }
+ },
+ });
+ }
+ return Menu.buildFromTemplate(template);
+};
diff --git a/package.json b/package.json
index 0ed1f2fb0..14ed57ef4 100644
--- a/package.json
+++ b/package.json
@@ -132,6 +132,10 @@
"build": {
"appId": "io.lisk.nano",
"productName": "Lisk Nano",
+ "protocols": {
+ "name": "lisk-nano",
+ "schemes": ["lisk"]
+ },
"artifactName": "lisk-nano-${os}-${arch}-${version}.${ext}",
"linux": {
"target": [
diff --git a/src/components/actionBar/index.js b/src/components/actionBar/index.js
index b5b443cbb..34eb8a62e 100644
--- a/src/components/actionBar/index.js
+++ b/src/components/actionBar/index.js
@@ -12,7 +12,8 @@ export const ActionBarRaw = ({
+ onClick={secondaryButton.onClick}
+ type={secondaryButton.type || 'button'} />
- {this.props.t('You can select up to {{count}} delegates in one voting turn.', { count: maxCountOfVotesInOneTurn })} -
-- {this.props.t('You can vote for up to {{count}} delegates in total.', { count: maxCountOfVotes })} -
-