From 2e30b8bc74f43f3d0ed0074fbbbb0bd86de957c4 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 12 Jan 2024 12:47:49 +0100 Subject: [PATCH] fix: don't show domina mode on snap and for firefox #2977 --- electron/electronAPI.d.ts | 4 +++- electron/preload.ts | 1 + src/app/features/config/global-config-form-config.const.ts | 6 ++++-- src/app/util/is-snap.ts | 3 --- 4 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 src/app/util/is-snap.ts diff --git a/electron/electronAPI.d.ts b/electron/electronAPI.d.ts index 26fc5fa29..e165365d1 100644 --- a/electron/electronAPI.d.ts +++ b/electron/electronAPI.d.ts @@ -1,4 +1,4 @@ -import { IpcRendererEvent, OpenExternalOptions } from 'electron'; +import { IpcRendererEvent } from 'electron'; import { GlobalConfigState, TakeABreakConfig, @@ -50,6 +50,8 @@ export interface ElectronAPI { isMacOS(): boolean; + isSnap(): boolean; + // SEND // ---- reloadMainWin(): void; diff --git a/electron/preload.ts b/electron/preload.ts index 199243030..115d6428b 100644 --- a/electron/preload.ts +++ b/electron/preload.ts @@ -43,6 +43,7 @@ const ea: ElectronAPI = { }, getZoomFactor: () => webFrame.getZoomFactor(), isMacOS: () => process.platform === 'darwin', + isSnap: () => process && process.env && !!process.env.SNAP, // SEND // ---- diff --git a/src/app/features/config/global-config-form-config.const.ts b/src/app/features/config/global-config-form-config.const.ts index 258ec59a9..c4cb04d47 100644 --- a/src/app/features/config/global-config-form-config.const.ts +++ b/src/app/features/config/global-config-form-config.const.ts @@ -15,8 +15,8 @@ import { IS_ELECTRON } from '../../app.constants'; import { IS_ANDROID_WEB_VIEW } from '../../util/is-android-web-view'; import { TIMELINE_FORM_CFG } from './form-cfgs/timeline-form.const'; import { DOMINA_MODE_FORM } from './form-cfgs/domina-mode-form.const'; -import { isSnap } from '../../util/is-snap'; import { FOCUS_MODE_FORM_CFG } from './form-cfgs/focus-mode-form.const'; +import { IS_FIREFOX } from '../../util/is-firefox'; export const GLOBAL_CONFIG_FORM_CONFIG: ConfigFormConfig = [ LANGUAGE_SELECTION_FORM_FORM as GenericConfigFormSection, @@ -40,5 +40,7 @@ export const GLOBAL_PRODUCTIVITY_FORM_CONFIG: ConfigFormConfig = [ POMODORO_FORM_CFG as GenericConfigFormSection, EVALUATION_SETTINGS_FORM_CFG as GenericConfigFormSection, SIMPLE_COUNTER_FORM as GenericConfigFormSection, - ...(!IS_ELECTRON || !isSnap() ? [DOMINA_MODE_FORM as GenericConfigFormSection] : []), + ...(!window.ea?.isSnap() && !IS_FIREFOX + ? [DOMINA_MODE_FORM as GenericConfigFormSection] + : []), ].filter((cfg) => IS_ELECTRON || !cfg.isElectronOnly); diff --git a/src/app/util/is-snap.ts b/src/app/util/is-snap.ts deleted file mode 100644 index 4c4cd7fd8..000000000 --- a/src/app/util/is-snap.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const isSnap = (): boolean => { - return window && window.process && window.process.env && !!window.process.env.SNAP; -};