diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-07-06 13:17:46 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-12 10:09:19 +0200 |
| commit | 17d77726bffdebd4977ff9d39d5ef60acaf861f1 (patch) | |
| tree | 662dd298b064e994282dd33c5d0f229685e81663 /gui/src/renderer | |
| parent | f3191b3d5d50b6aec641d0d0167f86085eba31c1 (diff) | |
| download | mullvadvpn-17d77726bffdebd4977ff9d39d5ef60acaf861f1.tar.xz mullvadvpn-17d77726bffdebd4977ff9d39d5ef60acaf861f1.zip | |
Update usages of platform and node env in renderer
Diffstat (limited to 'gui/src/renderer')
| -rw-r--r-- | gui/src/renderer/app.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/components/AdvancedSettings.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/components/CustomScrollbars.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/HeaderBar.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/NavigationBarStyles.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/PlatformWindow.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/Preferences.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/components/SplitTunnelingSettings.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/context.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/redux/settings/reducers.ts | 2 |
10 files changed, 15 insertions, 15 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index 681086ee0a..5b4f4be972 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -560,7 +560,7 @@ export default class AppRenderer { let expectedContentHeight = 568; // The app content is 12px taller on macOS to fit the top arrow. - if (window.platform === 'darwin' && !this.guiSettings.unpinnedWindow) { + if (window.env.platform === 'darwin' && !this.guiSettings.unpinnedWindow) { expectedContentHeight += 12; } @@ -673,7 +673,7 @@ export default class AppRenderer { } private async autoConnect() { - if (window.runningInDevelopment) { + if (window.env.development) { log.info('Skip autoconnect in development'); } else if (this.autoConnected) { log.info('Skip autoconnect because it was done before'); diff --git a/gui/src/renderer/components/AdvancedSettings.tsx b/gui/src/renderer/components/AdvancedSettings.tsx index 77c815fe61..62232b6b8c 100644 --- a/gui/src/renderer/components/AdvancedSettings.tsx +++ b/gui/src/renderer/components/AdvancedSettings.tsx @@ -441,11 +441,11 @@ export default class AdvancedSettings extends React.Component<IProps, IState> { </Cell.CellButton> </StyledButtonCellGroup> - {(window.platform === 'linux' || window.platform === 'win32') && ( + {(window.env.platform === 'linux' || window.env.platform === 'win32') && ( <StyledButtonCellGroup> <Cell.CellButton onClick={this.props.onViewSplitTunneling}> <Cell.Label> - {window.platform === 'win32' && <StyledBetaLabel />} + {window.env.platform === 'win32' && <StyledBetaLabel />} {messages.pgettext('advanced-settings-view', 'Split tunneling')} </Cell.Label> <Cell.Icon height={12} width={7} source="icon-chevron" /> diff --git a/gui/src/renderer/components/CustomScrollbars.tsx b/gui/src/renderer/components/CustomScrollbars.tsx index 2b5119839c..3dacd26626 100644 --- a/gui/src/renderer/components/CustomScrollbars.tsx +++ b/gui/src/renderer/components/CustomScrollbars.tsx @@ -47,7 +47,7 @@ interface IScrollbarUpdateContext { export default class CustomScrollbars extends React.Component<IProps, IState> { public static defaultProps: IProps = { // auto-hide on macOS by default - autoHide: window.platform === 'darwin', + autoHide: window.env.platform === 'darwin', trackPadding: { x: 2, y: 2 }, }; diff --git a/gui/src/renderer/components/HeaderBar.tsx b/gui/src/renderer/components/HeaderBar.tsx index f3a69f5af2..0dcd2e7ea9 100644 --- a/gui/src/renderer/components/HeaderBar.tsx +++ b/gui/src/renderer/components/HeaderBar.tsx @@ -31,7 +31,7 @@ interface IHeaderBarContainerProps { const HeaderBarContainer = styled.header({}, (props: IHeaderBarContainerProps) => ({ padding: '12px 16px', - paddingTop: window.platform === 'darwin' && !props.unpinnedWindow ? '24px' : '12px', + paddingTop: window.env.platform === 'darwin' && !props.unpinnedWindow ? '24px' : '12px', backgroundColor: headerBarStyleColorMap[props.barStyle ?? HeaderBarStyle.default], })); diff --git a/gui/src/renderer/components/NavigationBarStyles.tsx b/gui/src/renderer/components/NavigationBarStyles.tsx index f8ac87f3e2..52aefe323d 100644 --- a/gui/src/renderer/components/NavigationBarStyles.tsx +++ b/gui/src/renderer/components/NavigationBarStyles.tsx @@ -20,7 +20,7 @@ export const StyledNavigationItems = styled.div({ export const StyledNavigationBar = styled.nav((props: { unpinnedWindow: boolean }) => ({ flex: 0, padding: '12px', - paddingTop: window.platform === 'darwin' && !props.unpinnedWindow ? '24px' : '12px', + paddingTop: window.env.platform === 'darwin' && !props.unpinnedWindow ? '24px' : '12px', })); export const StyledNavigationBarWrapper = styled.div({ diff --git a/gui/src/renderer/components/PlatformWindow.tsx b/gui/src/renderer/components/PlatformWindow.tsx index 83aa7b3f7f..9b18f5f726 100644 --- a/gui/src/renderer/components/PlatformWindow.tsx +++ b/gui/src/renderer/components/PlatformWindow.tsx @@ -10,7 +10,7 @@ interface IPlatformWindowProps { export default styled.div({}, (props: IPlatformWindowProps) => { let mask: string | undefined; - if (window.platform === 'darwin' && !props.unpinnedWindow) { + if (window.env.platform === 'darwin' && !props.unpinnedWindow) { const arrowPositionCss = props.arrowPosition !== undefined ? `${props.arrowPosition - ARROW_WIDTH * 0.5}px` : '50%'; diff --git a/gui/src/renderer/components/Preferences.tsx b/gui/src/renderer/components/Preferences.tsx index c91330aee0..ebaa2da359 100644 --- a/gui/src/renderer/components/Preferences.tsx +++ b/gui/src/renderer/components/Preferences.tsx @@ -225,8 +225,8 @@ export default class Preferences extends React.Component<IProps> { </Cell.Footer> </AriaInputGroup> - {(window.platform === 'win32' || - (window.platform === 'darwin' && window.runningInDevelopment)) && ( + {(window.env.platform === 'win32' || + (window.env.platform === 'darwin' && window.env.development)) && ( <AriaInputGroup> <Cell.Container> <AriaLabel> diff --git a/gui/src/renderer/components/SplitTunnelingSettings.tsx b/gui/src/renderer/components/SplitTunnelingSettings.tsx index d6f2bbbdcf..30948dae35 100644 --- a/gui/src/renderer/components/SplitTunnelingSettings.tsx +++ b/gui/src/renderer/components/SplitTunnelingSettings.tsx @@ -102,13 +102,13 @@ interface IPlatformSplitTunnelingSettingsProps { } function PlatformSpecificSplitTunnelingSettings(props: IPlatformSplitTunnelingSettingsProps) { - switch (window.platform) { + switch (window.env.platform) { case 'linux': return <LinuxSplitTunnelingSettings {...props} />; case 'win32': return <WindowsSplitTunnelingSettings {...props} />; default: - throw new Error(`Split tunneling not implemented on ${window.platform}`); + throw new Error(`Split tunneling not implemented on ${window.env.platform}`); } } diff --git a/gui/src/renderer/context.tsx b/gui/src/renderer/context.tsx index d4b20daeb1..341ddda893 100644 --- a/gui/src/renderer/context.tsx +++ b/gui/src/renderer/context.tsx @@ -6,7 +6,7 @@ export interface IAppContext { } export const AppContext = React.createContext<IAppContext | undefined>(undefined); -if (window.runningInDevelopment) { +if (window.env.development) { AppContext.displayName = 'AppContext'; } @@ -34,7 +34,7 @@ export default function withAppContext<Props>(BaseComponent: React.ComponentType ); }; - if (window.runningInDevelopment) { + if (window.env.development) { wrappedComponent.displayName = 'withAppContext(' + (BaseComponent.displayName || BaseComponent.name) + ')'; } diff --git a/gui/src/renderer/redux/settings/reducers.ts b/gui/src/renderer/redux/settings/reducers.ts index 1b07e805fa..8f61721a6e 100644 --- a/gui/src/renderer/redux/settings/reducers.ts +++ b/gui/src/renderer/redux/settings/reducers.ts @@ -149,7 +149,7 @@ const initialState: ISettingsReduxState = { autoConnect: true, monochromaticIcon: false, startMinimized: false, - unpinnedWindow: window.platform !== 'win32' && window.platform !== 'darwin', + unpinnedWindow: window.env.platform !== 'win32' && window.env.platform !== 'darwin', browsedForSplitTunnelingApplications: [], }, relaySettings: { |
