diff options
author | 2018-02-22 17:03:33 +0100 | |
---|---|---|
committer | 2018-02-22 17:03:33 +0100 | |
commit | 136be27ef9185f48262d3ff0e7f754bb5590de45 (patch) | |
tree | 790bbd79821a8e355e277c04616d39a7b280f8c1 | |
parent | remove electron frame for Windows testing on macOS (diff) | |
download | ferdium-app-136be27ef9185f48262d3ff0e7f754bb5590de45.tar.gz ferdium-app-136be27ef9185f48262d3ff0e7f754bb5590de45.tar.zst ferdium-app-136be27ef9185f48262d3ff0e7f754bb5590de45.zip |
override platform in code and simulate different environment
[MINOR] REFACTOR rename `FRANZ_PLATFORM` to `OS_PLATFORM`
[MINOR] FIX propTypes for `electron-react-titlebar`
-rw-r--r-- | .vscode/launch.json | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/environment.js | 11 | ||||
-rw-r--r-- | src/index.html | 2 | ||||
-rw-r--r-- | src/index.js | 2 | ||||
-rw-r--r-- | src/lib/Menu.js | 2 |
6 files changed, 13 insertions, 8 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index 9bd373a4d..f6c20b520 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json | |||
@@ -10,7 +10,7 @@ | |||
10 | "protocol": "inspector", | 10 | "protocol": "inspector", |
11 | "env": { | 11 | "env": { |
12 | "NODE_ENV": "development", | 12 | "NODE_ENV": "development", |
13 | "FRANZ_PLATFORM": "win32" | 13 | "OS_PLATFORM": "win32" |
14 | } | 14 | } |
15 | }, | 15 | }, |
16 | { | 16 | { |
diff --git a/package.json b/package.json index 60e45f7f6..7922eff03 100644 --- a/package.json +++ b/package.json | |||
@@ -13,7 +13,7 @@ | |||
13 | "start": "electron ./build", | 13 | "start": "electron ./build", |
14 | "start:local": "cross-env LOCAL_API=1 yarn start", | 14 | "start:local": "cross-env LOCAL_API=1 yarn start", |
15 | "start:live": "cross-env LIVE_API=1 yarn start", | 15 | "start:live": "cross-env LIVE_API=1 yarn start", |
16 | "dev": "cross-env NODE_ENV=development FRANZ_PLATFORM=win32 gulp dev", | 16 | "dev": "cross-env NODE_ENV=development OS_PLATFORM=win32 gulp dev", |
17 | "lint": "eslint src", | 17 | "lint": "eslint src", |
18 | "sign": "gulp sign", | 18 | "sign": "gulp sign", |
19 | "prebuild": "gulp build", | 19 | "prebuild": "gulp build", |
diff --git a/src/environment.js b/src/environment.js index e185120c0..4dca0807d 100644 --- a/src/environment.js +++ b/src/environment.js | |||
@@ -4,9 +4,14 @@ export const isDevMode = Boolean(process.execPath.match(/[\\/]electron/)); | |||
4 | export const useLiveAPI = process.env.LIVE_API; | 4 | export const useLiveAPI = process.env.LIVE_API; |
5 | export const useLocalAPI = process.env.LOCAL_API; | 5 | export const useLocalAPI = process.env.LOCAL_API; |
6 | 6 | ||
7 | export const isMac = process.platform === 'darwin'; | 7 | let platform = process.platform; |
8 | export const isWindows = process.platform === 'win32'; | 8 | if (process.env.OS_PLATFORM) { |
9 | export const isLinux = process.platform === 'linux'; | 9 | platform = process.env.OS_PLATFORM; |
10 | } | ||
11 | |||
12 | export const isMac = platform === 'darwin'; | ||
13 | export const isWindows = platform === 'win32'; | ||
14 | export const isLinux = platform === 'linux'; | ||
10 | 15 | ||
11 | export const ctrlKey = isMac ? '⌘' : 'Ctrl'; | 16 | export const ctrlKey = isMac ? '⌘' : 'Ctrl'; |
12 | 17 | ||
diff --git a/src/index.html b/src/index.html index bb10d2eaf..6c259e5be 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -11,7 +11,7 @@ | |||
11 | <div class="dev-warning">DEV MODE</div> | 11 | <div class="dev-warning">DEV MODE</div> |
12 | <div id="root"></div> | 12 | <div id="root"></div> |
13 | <script> | 13 | <script> |
14 | document.querySelector('body').classList.add(process.env.FRANZ_PLATFORM ? process.env.FRANZ_PLATFORM : process.platform); | 14 | document.querySelector('body').classList.add(process.env.OS_PLATFORM ? process.env.OS_PLATFORM : process.platform); |
15 | 15 | ||
16 | const { isDevMode } = require('./environment'); | 16 | const { isDevMode } = require('./environment'); |
17 | if (isDevMode) { | 17 | if (isDevMode) { |
diff --git a/src/index.js b/src/index.js index 170353fb0..e8818af96 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -72,7 +72,7 @@ const createWindow = () => { | |||
72 | height: mainWindowState.height, | 72 | height: mainWindowState.height, |
73 | minWidth: 600, | 73 | minWidth: 600, |
74 | minHeight: 500, | 74 | minHeight: 500, |
75 | titleBarStyle: process.env.FRANZ_PLATFORM || process.platform === 'win32' ? '' : 'hidden', | 75 | titleBarStyle: process.env.OS_PLATFORM || process.platform === 'win32' ? '' : 'hidden', |
76 | frame: false, | 76 | frame: false, |
77 | backgroundColor: '#3498db', | 77 | backgroundColor: '#3498db', |
78 | autoHideMenuBar: true, | 78 | autoHideMenuBar: true, |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index ed21315d8..d043dee87 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -126,7 +126,7 @@ export default class FranzMenu { | |||
126 | } | 126 | } |
127 | 127 | ||
128 | get template() { | 128 | get template() { |
129 | return this.currentTemplate; | 129 | return this.currentTemplate.toJS(); |
130 | } | 130 | } |
131 | 131 | ||
132 | _build() { | 132 | _build() { |