From bc8c605cd27828d420cba5dff6cc55995c7c8e9a Mon Sep 17 00:00:00 2001 From: copios Date: Thu, 24 Jan 2019 16:18:04 +0900 Subject: [PATCH 1/4] chore(console): remove console.log calls in main --- app/main/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/main/index.js b/app/main/index.js index e2c5d1b..e0858c6 100644 --- a/app/main/index.js +++ b/app/main/index.js @@ -58,7 +58,6 @@ app.on('ready', async () => { }) mainWindow.webContents.on('will-navigate', () => { - console.log('will navigate') scanner.deactivate() }) @@ -75,7 +74,6 @@ app.on('ready', async () => { }) app.on('before-quit', () => { - console.log('before quit') PowerSaveBlocker.deactivate() }) @@ -111,6 +109,5 @@ ipcMain.on('print', (event, fileName) => { }) ipcMain.on('deactivate', () => { - console.log('deactivate') scanner.deactivate() }) From 8f2e781653238d0ae273f63583e8f5f1ca50387a Mon Sep 17 00:00:00 2001 From: copios Date: Thu, 24 Jan 2019 16:19:12 +0900 Subject: [PATCH 2/4] fix(send): extract webContents.send and guard against destruction --- app/main/services/bridge/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/main/services/bridge/index.js b/app/main/services/bridge/index.js index 24e02ad..a504a73 100644 --- a/app/main/services/bridge/index.js +++ b/app/main/services/bridge/index.js @@ -1,24 +1,34 @@ +const emit = (...args) => { + const webContents = args.shift() + + if (webContents.isDestroyed()) { + return + } + + webContents.send(...args) +} + export const onTransmitterData = (webContents) => { return (transmitter, transmitters) => { - webContents.send('transmitter-data', transmitter, transmitters) + emit(webContents, 'transmitter-data', transmitter, transmitters) } } export const onTransmitterAdded = (webContents) => { return (transmitter, transmitters) => { - webContents.send('transmitter-added', transmitter, transmitters) + emit(webContents, 'transmitter-added', transmitter, transmitters) } } export const onTransmitterRemoved = (webContents) => { return (transmitter, transmitters) => { - webContents.send('transmitter-removed', transmitter, transmitters) + emit(webContents, 'transmitter-removed', transmitter, transmitters) } } export const onReceiverAdded = (webContents) => { return (receiver, receivers) => { - webContents.send('receiver-added', receiver, receivers) + emit(webContents, 'receiver-added', receiver, receivers) receiver.on('transmitter-added', onTransmitterAdded(webContents)) receiver.on('transmitter-removed', onTransmitterRemoved(webContents)) receiver.on('transmitter-data', onTransmitterData(webContents)) @@ -27,7 +37,7 @@ export const onReceiverAdded = (webContents) => { export const onReceiverRemoved = (webContents) => { return (receiver, receivers) => { - webContents.send('receiver-removed', receiver, receivers) + emit(webContents, 'receiver-removed', receiver, receivers) } } From a8515ff40b2326d9f6a86ccc4e143bbe86d6984d Mon Sep 17 00:00:00 2001 From: copios Date: Thu, 24 Jan 2019 16:20:07 +0900 Subject: [PATCH 3/4] fix(name): ensure that name does not wrap and overflow is hidden --- app/renderer/styles/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/renderer/styles/index.js b/app/renderer/styles/index.js index 41b7a8a..ca5e580 100644 --- a/app/renderer/styles/index.js +++ b/app/renderer/styles/index.js @@ -59,6 +59,8 @@ export default (theme) => ({ }, cardName: { + whiteSpace: 'nowrap', + overflow: 'hidden', flexGrow: 1, marginLeft: theme.spacing.unit * 3, }, From 1aafe8570ea131b6d1bdbdf57ca9152716f0e97a Mon Sep 17 00:00:00 2001 From: copios Date: Fri, 25 Jan 2019 13:17:49 +0900 Subject: [PATCH 4/4] fix(training_score): round training score to two decimal places --- .../components/sensor/report/charts/training_score/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/renderer/components/sensor/report/charts/training_score/index.jsx b/app/renderer/components/sensor/report/charts/training_score/index.jsx index 0431282..1b671ff 100644 --- a/app/renderer/components/sensor/report/charts/training_score/index.jsx +++ b/app/renderer/components/sensor/report/charts/training_score/index.jsx @@ -51,7 +51,7 @@ class TrainingScoreChart extends Component { {segments({ opacity: 0.1 })} {segments({ limit: score })} - {label({ color: colors[zone], label: score.toString() })} + {label({ color: colors[zone], label: score.toFixed(2) })} ) }