Permalink
Browse files

fix(macOS): Fix touchbar related crash on macOS 10.12.1 and lower

Closes #70
  • Loading branch information...
adlk committed Nov 20, 2017
1 parent d8fe163 commit 9e9a2eddd11d2ff8481c1e66215d916a50995f0c
Showing with 15 additions and 6 deletions.
  1. +1 −0 package.json
  2. +14 −6 src/lib/TouchBar.js
@@ -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"
@@ -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;

0 comments on commit 9e9a2ed

Please sign in to comment.