diff options
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 2 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 8 | ||||
| -rw-r--r-- | gui/src/renderer/app.tsx | 1 | ||||
| -rw-r--r-- | gui/src/renderer/components/NotificationArea.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/containers/SettingsPage.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/containers/SupportPage.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/redux/settings/actions.ts | 14 | ||||
| -rw-r--r-- | gui/src/renderer/redux/settings/reducers.ts | 8 | ||||
| -rw-r--r-- | gui/src/renderer/redux/version/reducers.ts | 2 | ||||
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 2 |
10 files changed, 35 insertions, 12 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index 8fb299ebaa..494b9d9b4a 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -288,7 +288,6 @@ const tunnelStateSchema = oneOf( const appVersionInfoSchema = partialObject({ current_is_supported: boolean, - current_is_outdated: boolean, latest_stable: string, latest: string, }); @@ -337,6 +336,7 @@ const settingsSchema = partialObject({ allow_lan: boolean, auto_connect: boolean, block_when_disconnected: boolean, + show_beta_releases: maybe(boolean), bridge_settings: bridgeSettingsSchema, bridge_state: enumeration('on', 'auto', 'off'), relay_settings: relaySettingsSchema, diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 6e325156f3..741bca5493 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -91,6 +91,7 @@ class ApplicationMain { allowLan: false, autoConnect: false, blockWhenDisconnected: false, + showBetaReleases: undefined, relaySettings: { normal: { location: 'any', @@ -137,7 +138,6 @@ class ApplicationMain { private upgradeVersion: IAppUpgradeInfo = { currentIsSupported: true, - currentIsOutdated: false, latestStable: '', latest: '', nextUpgrade: undefined, @@ -739,16 +739,14 @@ class ApplicationMain { } private setLatestVersion(latestVersionInfo: IAppVersionInfo) { - function isBeta(version: string) { - return version.includes('-'); - } + const settings = this.settings; function nextUpgrade( current: string, latest: string, latestStable: string, ): string | undefined { - if (isBeta(current)) { + if (settings.showBetaReleases) { return current === latest ? undefined : latest; } else { return current === latestStable ? undefined : latestStable; diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index cabddb5fb3..7f77759154 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -577,6 +577,7 @@ export default class AppRenderer { reduxSettings.updateAllowLan(newSettings.allowLan); reduxSettings.updateEnableIpv6(newSettings.tunnelOptions.generic.enableIpv6); reduxSettings.updateBlockWhenDisconnected(newSettings.blockWhenDisconnected); + reduxSettings.updateShowBetaReleases(newSettings.showBetaReleases); reduxSettings.updateOpenVpnMssfix(newSettings.tunnelOptions.openvpn.mssfix); reduxSettings.updateWireguardMtu(newSettings.tunnelOptions.wireguard.mtu); reduxSettings.updateBridgeState(newSettings.bridgeState); diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx index f08eefbb75..678341f079 100644 --- a/gui/src/renderer/components/NotificationArea.tsx +++ b/gui/src/renderer/components/NotificationArea.tsx @@ -175,7 +175,7 @@ export default class NotificationArea extends Component<IProps, State> { }; } - if (version.currentIsOutdated && version.nextUpgrade) { + if (version.nextUpgrade && version.nextUpgrade !== version.current) { return { visible: true, type: 'update-available', diff --git a/gui/src/renderer/containers/SettingsPage.tsx b/gui/src/renderer/containers/SettingsPage.tsx index 77394739c3..563b9136fb 100644 --- a/gui/src/renderer/containers/SettingsPage.tsx +++ b/gui/src/renderer/containers/SettingsPage.tsx @@ -15,7 +15,9 @@ const mapStateToProps = (state: IReduxState, props: IAppContext) => ({ expiryLocale: state.userInterface.locale, appVersion: state.version.current, consistentVersion: state.version.consistent, - upToDateVersion: !state.version.currentIsOutdated, + upToDateVersion: state.settings.showBetaReleases + ? state.version.current === state.version.latest + : state.version.current === state.version.latestStable, isOffline: state.connection.isBlocked, }); const mapDispatchToProps = (dispatch: ReduxDispatch) => { diff --git a/gui/src/renderer/containers/SupportPage.tsx b/gui/src/renderer/containers/SupportPage.tsx index ceea145b06..d8227dd4ae 100644 --- a/gui/src/renderer/containers/SupportPage.tsx +++ b/gui/src/renderer/containers/SupportPage.tsx @@ -12,7 +12,9 @@ const mapStateToProps = (state: IReduxState) => ({ defaultMessage: state.support.message, accountHistory: state.account.accountHistory, isOffline: state.connection.isBlocked, - outdatedVersion: state.version.currentIsOutdated, + outdatedVersion: state.settings.showBetaReleases + ? state.version.current !== state.version.latest + : state.version.current !== state.version.latestStable, }); const mapDispatchToProps = (dispatch: ReduxDispatch) => { diff --git a/gui/src/renderer/redux/settings/actions.ts b/gui/src/renderer/redux/settings/actions.ts index dbc1407bbd..5a1972527e 100644 --- a/gui/src/renderer/redux/settings/actions.ts +++ b/gui/src/renderer/redux/settings/actions.ts @@ -37,6 +37,11 @@ export interface IUpdateBlockWhenDisconnectedAction { blockWhenDisconnected: boolean; } +export interface IUpdateShowBetaReleasesAction { + type: 'UPDATE_SHOW_BETA_NOTIFICATIONS'; + showBetaReleases?: boolean; +} + export interface IUpdateBridgeSettingsAction { type: 'UPDATE_BRIDGE_SETTINGS'; bridgeSettings: BridgeSettingsRedux; @@ -100,6 +105,7 @@ export type SettingsAction = | IUpdateAllowLanAction | IUpdateEnableIpv6Action | IUpdateBlockWhenDisconnectedAction + | IUpdateShowBetaReleasesAction | IUpdateBridgeSettingsAction | IUpdateBridgeStateAction | IUpdateOpenVpnMssfixAction @@ -165,6 +171,13 @@ function updateBlockWhenDisconnected( }; } +function updateShowBetaReleases(showBetaReleases?: boolean): IUpdateShowBetaReleasesAction { + return { + type: 'UPDATE_SHOW_BETA_NOTIFICATIONS', + showBetaReleases, + }; +} + function updateBridgeSettings(bridgeSettings: BridgeSettingsRedux): IUpdateBridgeSettingsAction { return { type: 'UPDATE_BRIDGE_SETTINGS', @@ -256,6 +269,7 @@ export default { updateAllowLan, updateEnableIpv6, updateBlockWhenDisconnected, + updateShowBetaReleases, updateBridgeSettings, updateBridgeState, updateOpenVpnMssfix, diff --git a/gui/src/renderer/redux/settings/reducers.ts b/gui/src/renderer/redux/settings/reducers.ts index 6038a2be28..d74cbd3b4f 100644 --- a/gui/src/renderer/redux/settings/reducers.ts +++ b/gui/src/renderer/redux/settings/reducers.ts @@ -126,6 +126,7 @@ export interface ISettingsReduxState { bridgeSettings: BridgeSettingsRedux; bridgeState: BridgeState; blockWhenDisconnected: boolean; + showBetaReleases?: boolean; openVpn: { mssfix?: number; }; @@ -166,6 +167,7 @@ const initialState: ISettingsReduxState = { }, bridgeState: 'auto', blockWhenDisconnected: false, + showBetaReleases: undefined, openVpn: {}, wireguard: {}, wireguardKeyState: { @@ -220,6 +222,12 @@ export default function( blockWhenDisconnected: action.blockWhenDisconnected, }; + case 'UPDATE_SHOW_BETA_NOTIFICATIONS': + return { + ...state, + showBetaReleases: action.showBetaReleases, + }; + case 'UPDATE_OPENVPN_MSSFIX': return { ...state, diff --git a/gui/src/renderer/redux/version/reducers.ts b/gui/src/renderer/redux/version/reducers.ts index e853bc569a..21de2bf2d8 100644 --- a/gui/src/renderer/redux/version/reducers.ts +++ b/gui/src/renderer/redux/version/reducers.ts @@ -3,7 +3,6 @@ import { ReduxAction } from '../store'; export interface IVersionReduxState { current: string; currentIsSupported: boolean; - currentIsOutdated: boolean; latest?: string; latestStable?: string; nextUpgrade?: string; @@ -13,7 +12,6 @@ export interface IVersionReduxState { const initialState: IVersionReduxState = { current: '', currentIsSupported: true, - currentIsOutdated: false, latest: undefined, latestStable: undefined, nextUpgrade: undefined, diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index 404762d962..ac1e7584f6 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -279,7 +279,6 @@ export interface IShadowsocksProxySettings { export interface IAppVersionInfo { currentIsSupported: boolean; - currentIsOutdated: boolean; latestStable: string; latest: string; } @@ -289,6 +288,7 @@ export interface ISettings { allowLan: boolean; autoConnect: boolean; blockWhenDisconnected: boolean; + showBetaReleases?: boolean; relaySettings: RelaySettings; tunnelOptions: ITunnelOptions; bridgeSettings: BridgeSettings; |
