diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-02-07 18:01:09 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-02-09 15:59:58 +0100 |
| commit | 15b6d4840ebbb9b8cc364e59ca32c273dbab0104 (patch) | |
| tree | 81b4de48bff51654c47470a5a8668bed50aab8cb /gui/src | |
| parent | ed81bda75445b88337e6d52792a507efc8415661 (diff) | |
| download | mullvadvpn-15b6d4840ebbb9b8cc364e59ca32c273dbab0104.tar.xz mullvadvpn-15b6d4840ebbb9b8cc364e59ca32c273dbab0104.zip | |
Open correct part of download page when running a beta version
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/config.json | 1 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 10 | ||||
| -rw-r--r-- | gui/src/renderer/components/Settings.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/components/Support.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/containers/SettingsPage.tsx | 1 | ||||
| -rw-r--r-- | gui/src/renderer/containers/SupportPage.tsx | 1 | ||||
| -rw-r--r-- | gui/src/renderer/redux/version/reducers.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 1 | ||||
| -rw-r--r-- | gui/src/shared/notifications/unsupported-version.ts | 8 | ||||
| -rw-r--r-- | gui/src/shared/notifications/update-available.ts | 8 |
10 files changed, 34 insertions, 7 deletions
diff --git a/gui/src/config.json b/gui/src/config.json index f5d4de5d74..a647c947c1 100644 --- a/gui/src/config.json +++ b/gui/src/config.json @@ -4,6 +4,7 @@ "manageKeys": "https://mullvad.net/account/ports/", "faq": "https://mullvad.net/help/tag/mullvad-app/", "download": "https://mullvad.net/download/", + "betaDownload": "https://mullvad.net/download/#beta", "supportEmail": "support@mullvad.net" }, "colors": { diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index b3e2ef0e10..601f58f232 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -861,7 +861,13 @@ class ApplicationMain { } private setLatestVersion(latestVersionInfo: IAppVersionInfo) { - this.upgradeVersion = latestVersionInfo; + const suggestedIsBeta = + latestVersionInfo.suggestedUpgrade !== undefined && + IS_BETA.test(latestVersionInfo.suggestedUpgrade); + this.upgradeVersion = { + ...latestVersionInfo, + suggestedIsBeta, + }; // notify user to update the app if it became unsupported const notificationProviders = [ @@ -869,9 +875,11 @@ class ApplicationMain { supported: latestVersionInfo.supported, consistent: this.currentVersion.isConsistent, suggestedUpgrade: latestVersionInfo.suggestedUpgrade, + suggestedIsBeta, }), new UpdateAvailableNotificationProvider({ suggestedUpgrade: latestVersionInfo.suggestedUpgrade, + suggestedIsBeta, }), ]; const notificationProvider = notificationProviders.find((notificationProvider) => diff --git a/gui/src/renderer/components/Settings.tsx b/gui/src/renderer/components/Settings.tsx index 9c4c36a0a6..189e7a159c 100644 --- a/gui/src/renderer/components/Settings.tsx +++ b/gui/src/renderer/components/Settings.tsx @@ -33,6 +33,7 @@ export interface IProps { appVersion: string; consistentVersion: boolean; upToDateVersion: boolean; + suggestedIsBeta: boolean; isOffline: boolean; onQuit: () => void; onClose: () => void; @@ -85,7 +86,8 @@ export default class Settings extends React.Component<IProps> { ); } - private openDownloadLink = () => this.props.onExternalLink(links.download); + private openDownloadLink = () => + this.props.onExternalLink(this.props.suggestedIsBeta ? links.betaDownload : links.download); private openFaqLink = () => this.props.onExternalLink(links.faq); private renderQuitButton() { diff --git a/gui/src/renderer/components/Support.tsx b/gui/src/renderer/components/Support.tsx index 448cbccbdb..109997163b 100644 --- a/gui/src/renderer/components/Support.tsx +++ b/gui/src/renderer/components/Support.tsx @@ -58,6 +58,7 @@ interface ISupportProps { collectProblemReport: (accountsToRedact: string[]) => Promise<string>; sendProblemReport: (email: string, message: string, savedReport: string) => Promise<void>; outdatedVersion: boolean; + suggestedIsBeta: boolean; onExternalLink: (url: string) => void; } @@ -272,7 +273,8 @@ export default class Support extends React.Component<ISupportProps, ISupportStat this.setState({ showOutdatedVersionWarning: false }); }; - private openDownloadLink = () => this.props.onExternalLink(links.download); + private openDownloadLink = () => + this.props.onExternalLink(this.props.suggestedIsBeta ? links.betaDownload : links.download); private renderOutdateVersionWarningDialog() { const message = messages.pgettext( diff --git a/gui/src/renderer/containers/SettingsPage.tsx b/gui/src/renderer/containers/SettingsPage.tsx index fd05ca8720..7d233e9f06 100644 --- a/gui/src/renderer/containers/SettingsPage.tsx +++ b/gui/src/renderer/containers/SettingsPage.tsx @@ -14,6 +14,7 @@ const mapStateToProps = (state: IReduxState, props: IAppContext) => ({ appVersion: state.version.current, consistentVersion: state.version.consistent, upToDateVersion: state.version.suggestedUpgrade ? false : true, + suggestedIsBeta: state.version.suggestedIsBeta ?? false, isOffline: state.connection.isBlocked, }); const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => { diff --git a/gui/src/renderer/containers/SupportPage.tsx b/gui/src/renderer/containers/SupportPage.tsx index bc2267881a..94053f1ccd 100644 --- a/gui/src/renderer/containers/SupportPage.tsx +++ b/gui/src/renderer/containers/SupportPage.tsx @@ -13,6 +13,7 @@ const mapStateToProps = (state: IReduxState) => ({ accountHistory: state.account.accountHistory, isOffline: state.connection.isBlocked, outdatedVersion: state.version.suggestedUpgrade ? true : false, + suggestedIsBeta: state.version.suggestedIsBeta ?? false, }); const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext & RouteComponentProps) => { diff --git a/gui/src/renderer/redux/version/reducers.ts b/gui/src/renderer/redux/version/reducers.ts index 96e8ab0aa3..1128c82bac 100644 --- a/gui/src/renderer/redux/version/reducers.ts +++ b/gui/src/renderer/redux/version/reducers.ts @@ -5,6 +5,7 @@ export interface IVersionReduxState { supported: boolean; isBeta: boolean; suggestedUpgrade?: string; + suggestedIsBeta?: boolean; consistent: boolean; } @@ -13,6 +14,7 @@ const initialState: IVersionReduxState = { supported: true, isBeta: false, suggestedUpgrade: undefined, + suggestedIsBeta: false, consistent: true, }; @@ -26,6 +28,7 @@ export default function ( ...state, supported: action.latestInfo.supported, suggestedUpgrade: action.latestInfo.suggestedUpgrade, + suggestedIsBeta: action.latestInfo.suggestedIsBeta, }; case 'UPDATE_VERSION': diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index 597220e6c8..07a75c07ff 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -291,6 +291,7 @@ export interface IShadowsocksProxySettings { export interface IAppVersionInfo { supported: boolean; suggestedUpgrade?: string; + suggestedIsBeta?: boolean; } export interface ISettings { diff --git a/gui/src/shared/notifications/unsupported-version.ts b/gui/src/shared/notifications/unsupported-version.ts index f324c38291..2560119c4c 100644 --- a/gui/src/shared/notifications/unsupported-version.ts +++ b/gui/src/shared/notifications/unsupported-version.ts @@ -11,6 +11,7 @@ interface UnsupportedVersionNotificationContext { supported: boolean; consistent: boolean; suggestedUpgrade?: string; + suggestedIsBeta?: boolean; } export class UnsupportedVersionNotificationProvider @@ -27,7 +28,7 @@ export class UnsupportedVersionNotificationProvider critical: true, action: { type: 'open-url', - url: links.download, + url: this.context.suggestedIsBeta ? links.betaDownload : links.download, text: messages.pgettext('notifications', 'Upgrade'), }, presentOnce: { value: true, name: this.constructor.name }, @@ -40,7 +41,10 @@ export class UnsupportedVersionNotificationProvider indicator: 'error', title: messages.pgettext('in-app-notifications', 'UNSUPPORTED VERSION'), subtitle: this.getMessage(), - action: { type: 'open-url', url: links.download }, + action: { + type: 'open-url', + url: this.context.suggestedIsBeta ? links.betaDownload : links.download, + }, }; } diff --git a/gui/src/shared/notifications/update-available.ts b/gui/src/shared/notifications/update-available.ts index 220f371e88..83c5d2348d 100644 --- a/gui/src/shared/notifications/update-available.ts +++ b/gui/src/shared/notifications/update-available.ts @@ -9,6 +9,7 @@ import { interface UpdateAvailableNotificationContext { suggestedUpgrade?: string; + suggestedIsBeta?: boolean; } export class UpdateAvailableNotificationProvider @@ -28,7 +29,10 @@ export class UpdateAvailableNotificationProvider 'in-app-notifications', 'Install the latest app version to stay up to date.', ), - action: { type: 'open-url', url: links.download }, + action: { + type: 'open-url', + url: this.context.suggestedIsBeta ? links.betaDownload : links.download, + }, }; } @@ -41,7 +45,7 @@ export class UpdateAvailableNotificationProvider critical: false, action: { type: 'open-url', - url: links.download, + url: this.context.suggestedIsBeta ? links.betaDownload : links.download, text: messages.pgettext('notifications', 'Upgrade'), }, presentOnce: { value: true, name: this.constructor.name }, |
