diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-05-24 08:06:20 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-05-28 15:40:41 +0200 |
| commit | 60e66c60fc7ef47d988e7663bc486840d3a0330a (patch) | |
| tree | 3c0f1f2cd3ed1449c1d1bb42e86a915d5260b144 /gui/src | |
| parent | 86d9cc33442ea87f19b0d9a3d7fa30fad38700c4 (diff) | |
| download | mullvadvpn-60e66c60fc7ef47d988e7663bc486840d3a0330a.tar.xz mullvadvpn-60e66c60fc7ef47d988e7663bc486840d3a0330a.zip | |
Provide whether or not macOS 13 or newer to renderer
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/index.ts | 2 | ||||
| -rw-r--r-- | gui/src/main/platform-version.ts | 5 | ||||
| -rw-r--r-- | gui/src/renderer/app.tsx | 1 | ||||
| -rw-r--r-- | gui/src/renderer/components/Settings.tsx | 1 | ||||
| -rw-r--r-- | gui/src/renderer/redux/userinterface/actions.ts | 16 | ||||
| -rw-r--r-- | gui/src/renderer/redux/userinterface/reducers.ts | 8 | ||||
| -rw-r--r-- | gui/src/shared/ipc-schema.ts | 1 |
7 files changed, 33 insertions, 1 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 185497f0bc..d23575b1b9 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -55,6 +55,7 @@ import NotificationController, { NotificationControllerDelegate, NotificationSender, } from './notification-controller'; +import { isMacOs13OrNewer } from './platform-version'; import * as problemReport from './problem-report'; import { resolveBin } from './proc'; import ReconnectionBackoff from './reconnection-backoff'; @@ -765,6 +766,7 @@ class ApplicationMain forceShowChanges: CommandLineOptions.showChanges.match, navigationHistory: this.navigationHistory, currentApiAccessMethod: this.currentApiAccessMethod, + isMacOs13OrNewer: isMacOs13OrNewer(), })); IpcMainEventChannel.map.handleGetData(async () => ({ diff --git a/gui/src/main/platform-version.ts b/gui/src/main/platform-version.ts index 51f73fe75b..027434d8d9 100644 --- a/gui/src/main/platform-version.ts +++ b/gui/src/main/platform-version.ts @@ -5,6 +5,11 @@ export function isMacOs11OrNewer() { return process.platform === 'darwin' && major >= 20; } +export function isMacOs13OrNewer() { + const [major] = parseVersion(); + return process.platform === 'darwin' && major >= 22; +} + // Windows 11 has the internal version 10.0.22000+. export function isWindows11OrNewer() { const [major, minor, patch] = parseVersion(); diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index 95f7e3d0cf..3aa73698dc 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -245,6 +245,7 @@ export default class AppRenderer { this.storeAutoStart(initialState.autoStart); this.setChangelog(initialState.changelog, initialState.forceShowChanges); this.setCurrentApiAccessMethod(initialState.currentApiAccessMethod); + this.reduxActions.userInterface.setIsMacOs13OrNewer(initialState.isMacOs13OrNewer); if (initialState.macOsScrollbarVisibility !== undefined) { this.reduxActions.userInterface.setMacOsScrollbarVisibility( diff --git a/gui/src/renderer/components/Settings.tsx b/gui/src/renderer/components/Settings.tsx index 8f68a1c462..e188e11ade 100644 --- a/gui/src/renderer/components/Settings.tsx +++ b/gui/src/renderer/components/Settings.tsx @@ -26,6 +26,7 @@ export default function Support() { const loginState = useSelector((state) => state.account.status); const connectedToDaemon = useSelector((state) => state.userInterface.connectedToDaemon); + const isMacOs13OrNewer = useSelector((state) => state.userInterface.isMacOs13OrNewer); const showSubSettings = loginState.type === 'ok' && connectedToDaemon; diff --git a/gui/src/renderer/redux/userinterface/actions.ts b/gui/src/renderer/redux/userinterface/actions.ts index cc43990980..238835318e 100644 --- a/gui/src/renderer/redux/userinterface/actions.ts +++ b/gui/src/renderer/redux/userinterface/actions.ts @@ -56,6 +56,11 @@ export interface ISetSelectLocationView { selectLocationView: LocationType; } +export interface ISetIsMacOs13OrNewer { + type: 'SET_IS_MACOS13_OR_NEWER'; + isMacOs13OrNewer: boolean; +} + export type UserInterfaceAction = | IUpdateLocaleAction | IUpdateWindowArrowPositionAction @@ -67,7 +72,8 @@ export type UserInterfaceAction = | ISetChangelog | ISetForceShowChanges | ISetIsPerformingPostUpgrade - | ISetSelectLocationView; + | ISetSelectLocationView + | ISetIsMacOs13OrNewer; function updateLocale(locale: string): IUpdateLocaleAction { return { @@ -147,6 +153,13 @@ function setSelectLocationView(selectLocationView: LocationType): ISetSelectLoca }; } +function setIsMacOs13OrNewer(isMacOs13OrNewer: boolean): ISetIsMacOs13OrNewer { + return { + type: 'SET_IS_MACOS13_OR_NEWER', + isMacOs13OrNewer, + }; +} + export default { updateLocale, updateWindowArrowPosition, @@ -159,4 +172,5 @@ export default { setForceShowChanges, setIsPerformingPostUpgrade, setSelectLocationView, + setIsMacOs13OrNewer, }; diff --git a/gui/src/renderer/redux/userinterface/reducers.ts b/gui/src/renderer/redux/userinterface/reducers.ts index 622b7814aa..89427e9b06 100644 --- a/gui/src/renderer/redux/userinterface/reducers.ts +++ b/gui/src/renderer/redux/userinterface/reducers.ts @@ -15,6 +15,7 @@ export interface IUserInterfaceReduxState { forceShowChanges: boolean; isPerformingPostUpgrade: boolean; selectLocationView: LocationType; + isMacOs13OrNewer: boolean; } const initialState: IUserInterfaceReduxState = { @@ -28,6 +29,7 @@ const initialState: IUserInterfaceReduxState = { forceShowChanges: false, isPerformingPostUpgrade: false, selectLocationView: LocationType.exit, + isMacOs13OrNewer: true, }; export default function ( @@ -80,6 +82,12 @@ export default function ( selectLocationView: action.selectLocationView, }; + case 'SET_IS_MACOS13_OR_NEWER': + return { + ...state, + isMacOs13OrNewer: action.isMacOs13OrNewer, + }; + default: return state; } diff --git a/gui/src/shared/ipc-schema.ts b/gui/src/shared/ipc-schema.ts index b7f298b2bc..e33736bcf8 100644 --- a/gui/src/shared/ipc-schema.ts +++ b/gui/src/shared/ipc-schema.ts @@ -77,6 +77,7 @@ export interface IAppStateSnapshot { forceShowChanges: boolean; navigationHistory?: IHistoryObject; currentApiAccessMethod?: AccessMethodSetting; + isMacOs13OrNewer: boolean; } // The different types of requests are: |
