From 9e9a2eddd11d2ff8481c1e66215d916a50995f0c Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 20 Nov 2017 14:20:33 +0100 Subject: [PATCH 1/3] fix(macOS): Fix touchbar related crash on macOS 10.12.1 and lower Closes #70 --- package.json | 1 + src/lib/TouchBar.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f9f6ca91c..ac9c96339 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "react-sortable-hoc": "^0.6.7", "react-tooltip": "^3.2.7", "route-parser": "^0.0.5", + "semver": "^5.4.1", "smoothscroll-polyfill": "^0.3.4", "tar": "^4.0.2", "uuid": "^3.0.1" diff --git a/src/lib/TouchBar.js b/src/lib/TouchBar.js index ad7849b8e..6831c7870 100644 --- a/src/lib/TouchBar.js +++ b/src/lib/TouchBar.js @@ -1,3 +1,5 @@ +import os from 'os'; +import semver from 'semver'; import { remote } from 'electron'; import { autorun } from 'mobx'; @@ -8,17 +10,23 @@ export default class FranzTouchBar { this.stores = stores; this.actions = actions; - this._initializeReactions(); - } - - _initializeReactions() { - this.build = autorun(this._build.bind(this)); + // Temporary fix for https://github.com/electron/electron/issues/10442 + // TODO: remove when we upgrade to electron 1.8.2 or later + try { + if (isMac && semver.gt(os.release(), '16.6.0')) { + this.build = autorun(this._build.bind(this)); + } + } catch (err) { + console.error(err); + } } _build() { const currentWindow = remote.getCurrentWindow(); - if (isMac && this.stores.user.isLoggedIn) { + currentWindow._setEscapeTouchBarItem = () => {}; + + if (this.stores.user.isLoggedIn) { const { TouchBar } = remote; const { TouchBarButton, TouchBarSpacer } = TouchBar; From 600e1b6e6fd64f5d6fe05017524f2ef0441d3035 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 20 Nov 2017 14:23:36 +0100 Subject: [PATCH 2/3] remove _setEscapeTouchBarItem test --- src/lib/TouchBar.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/TouchBar.js b/src/lib/TouchBar.js index 6831c7870..97c02d194 100644 --- a/src/lib/TouchBar.js +++ b/src/lib/TouchBar.js @@ -24,8 +24,6 @@ export default class FranzTouchBar { _build() { const currentWindow = remote.getCurrentWindow(); - currentWindow._setEscapeTouchBarItem = () => {}; - if (this.stores.user.isLoggedIn) { const { TouchBar } = remote; const { TouchBarButton, TouchBarSpacer } = TouchBar; From 723cd5a7d89438e7607522cc201906c9f1845de1 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 20 Nov 2017 14:33:00 +0100 Subject: [PATCH 3/3] fix linting issue --- src/components/ui/Subscription.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ui/Subscription.js b/src/components/ui/Subscription.js index 7f4c53d64..8bff72095 100644 --- a/src/components/ui/Subscription.js +++ b/src/components/ui/Subscription.js @@ -7,7 +7,6 @@ import Form from '../../lib/Form'; import Radio from '../ui/Radio'; import Button from '../ui/Button'; import Loader from '../ui/Loader'; -import { isWindows } from '../../environment'; import { required } from '../../helpers/validation-helpers';