diff options
author | Bennett <hello@vantezzen.io> | 2020-09-23 00:27:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 23:27:09 +0100 |
commit | 04116a087b84dd84f4461f74f079833c57dfa479 (patch) | |
tree | 63e47294856b65bedf5ca6ed92a3b0f3b386d323 | |
parent | Upgrading to Electron 9 (#809) (diff) | |
download | ferdium-app-04116a087b84dd84f4461f74f079833c57dfa479.tar.gz ferdium-app-04116a087b84dd84f4461f74f079833c57dfa479.tar.zst ferdium-app-04116a087b84dd84f4461f74f079833c57dfa479.zip |
Update adaptable dark mode to work on all platforms (#834)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 6 | ||||
-rw-r--r-- | src/index.js | 8 | ||||
-rw-r--r-- | src/stores/UIStore.js | 18 |
3 files changed, 14 insertions, 18 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index ba7cb7317..031203308 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -12,7 +12,7 @@ import PremiumFeatureContainer from '../../ui/PremiumFeatureContainer'; | |||
12 | import Input from '../../ui/Input'; | 12 | import Input from '../../ui/Input'; |
13 | 13 | ||
14 | import { FRANZ_TRANSLATION } from '../../../config'; | 14 | import { FRANZ_TRANSLATION } from '../../../config'; |
15 | import { isMac, isWindows } from '../../../environment'; | 15 | import { isMac } from '../../../environment'; |
16 | 16 | ||
17 | const { | 17 | const { |
18 | systemPreferences, | 18 | systemPreferences, |
@@ -472,8 +472,8 @@ export default @observer class EditSettingsForm extends Component { | |||
472 | 472 | ||
473 | <Hr /> | 473 | <Hr /> |
474 | 474 | ||
475 | {(isMac || isWindows) && <Toggle field={form.$('adaptableDarkMode')} />} | 475 | <Toggle field={form.$('adaptableDarkMode')} /> |
476 | {!((isMac || isWindows) && isAdaptableDarkModeEnabled) && <Toggle field={form.$('darkMode')} />} | 476 | {!isAdaptableDarkModeEnabled && <Toggle field={form.$('darkMode')} />} |
477 | {(isDarkmodeEnabled || isAdaptableDarkModeEnabled) && ( | 477 | {(isDarkmodeEnabled || isAdaptableDarkModeEnabled) && ( |
478 | <> | 478 | <> |
479 | <Toggle field={form.$('universalDarkMode')} /> | 479 | <Toggle field={form.$('universalDarkMode')} /> |
diff --git a/src/index.js b/src/index.js index dac8ec770..e39434a3b 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -332,7 +332,7 @@ const createWindow = () => { | |||
332 | e.preventDefault(); | 332 | e.preventDefault(); |
333 | 333 | ||
334 | if (isValidExternalURL(url)) { | 334 | if (isValidExternalURL(url)) { |
335 | shell.openExternal(url); | 335 | shell.openExternal(url); |
336 | } | 336 | } |
337 | }); | 337 | }); |
338 | 338 | ||
@@ -411,10 +411,10 @@ ipcMain.on('feature-basic-auth-credentials', (e, { user, password }) => { | |||
411 | authCallback = noop; | 411 | authCallback = noop; |
412 | }); | 412 | }); |
413 | 413 | ||
414 | ipcMain.on('open-browser-window', (e, {disposition, url}, serviceId) => { | 414 | ipcMain.on('open-browser-window', (e, { disposition, url }, serviceId) => { |
415 | if (disposition === 'foreground-tab') { | 415 | if (disposition === 'foreground-tab') { |
416 | let serviceSession = session.fromPartition(`persist:service-${serviceId}`) | 416 | const serviceSession = session.fromPartition(`persist:service-${serviceId}`); |
417 | let child = new BrowserWindow({ parent: mainWindow, webPreferences: {session: serviceSession}}); | 417 | const child = new BrowserWindow({ parent: mainWindow, webPreferences: { session: serviceSession } }); |
418 | child.show(); | 418 | child.show(); |
419 | child.loadURL(url); | 419 | child.loadURL(url); |
420 | } | 420 | } |
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js index f6e059bfb..ba2cffb73 100644 --- a/src/stores/UIStore.js +++ b/src/stores/UIStore.js | |||
@@ -12,9 +12,7 @@ const { nativeTheme, systemPreferences } = remote; | |||
12 | export default class UIStore extends Store { | 12 | export default class UIStore extends Store { |
13 | @observable showServicesUpdatedInfoBar = false; | 13 | @observable showServicesUpdatedInfoBar = false; |
14 | 14 | ||
15 | @observable isOsDarkThemeActive = (isMac || isWindows) | 15 | @observable isOsDarkThemeActive = nativeTheme.shouldUseDarkColors; |
16 | ? nativeTheme.shouldUseDarkColors | ||
17 | : false; | ||
18 | 16 | ||
19 | constructor(...args) { | 17 | constructor(...args) { |
20 | super(...args); | 18 | super(...args); |
@@ -63,16 +61,14 @@ export default class UIStore extends Store { | |||
63 | } | 61 | } |
64 | 62 | ||
65 | @computed get isDarkThemeActive() { | 63 | @computed get isDarkThemeActive() { |
66 | const isMacOrWindowsWithAdaptableInDarkMode = (isMac || isWindows) | 64 | const isWithAdaptableInDarkMode = this.stores.settings.all.app.adaptableDarkMode |
67 | && this.stores.settings.all.app.adaptableDarkMode | ||
68 | && this.isOsDarkThemeActive; | 65 | && this.isOsDarkThemeActive; |
69 | const isMacOrWindowsWithoutAdaptableInDarkMode = (isMac || isWindows) | 66 | const isWithoutAdaptableInDarkMode = this.stores.settings.all.app.darkMode |
70 | && this.stores.settings.all.app.darkMode | ||
71 | && !this.stores.settings.all.app.adaptableDarkMode; | 67 | && !this.stores.settings.all.app.adaptableDarkMode; |
72 | const isMacOrWindowsNotInDarkMode = !(isMac || isWindows) && this.stores.settings.all.app.darkMode; | 68 | const isInDarkMode = this.stores.settings.all.app.darkMode; |
73 | return !!(isMacOrWindowsWithAdaptableInDarkMode | 69 | return !!(isWithAdaptableInDarkMode |
74 | || isMacOrWindowsWithoutAdaptableInDarkMode | 70 | || isWithoutAdaptableInDarkMode |
75 | || isMacOrWindowsNotInDarkMode); | 71 | || isInDarkMode); |
76 | } | 72 | } |
77 | 73 | ||
78 | @computed get theme() { | 74 | @computed get theme() { |