diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-04-04 15:57:42 +0200 |
|---|---|---|
| committer | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2025-05-28 13:25:25 +0200 |
| commit | bc385ff16011d91d5068d298f732e9f28690cd2d (patch) | |
| tree | 5d4afc9db9a0b32671e3bf2c690b734a704f39b7 | |
| parent | d2dea899d87eb254be6b0d1dd5e7fe02b7bf98b0 (diff) | |
| download | mullvadvpn-bc385ff16011d91d5068d298f732e9f28690cd2d.tar.xz mullvadvpn-bc385ff16011d91d5068d298f732e9f28690cd2d.zip | |
Update "Upgrade app" button to condition action based on platform
The action should be to open the download url on Linux
and to go to the App Upgrade route for Windows and Mac OS.
The "Upgrade app" button should only be disabled if the app
is offline when on Linux. Otherwise we should always be able
to navigate to the App Upgrade route.
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/components/ProblemReport.tsx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ProblemReport.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ProblemReport.tsx index 5c808fe8dc..bc1f028596 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ProblemReport.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ProblemReport.tsx @@ -15,6 +15,8 @@ import { import { messages } from '../../shared/gettext'; import { getDownloadUrl } from '../../shared/version'; import { useAppContext } from '../context'; +import { usePushAppUpgrade } from '../history/hooks'; +import { useIsPlatformLinux } from '../hooks'; import useActions from '../lib/actionsHook'; import { Button, Flex, Spinner } from '../lib/components'; import { FlexColumn } from '../lib/components/flex-column'; @@ -336,6 +338,7 @@ function OutdatedVersionWarningDialog() { const isOffline = useSelector((state) => state.connection.isBlocked); const suggestedIsBeta = useSelector((state) => state.version.suggestedIsBeta ?? false); const outdatedVersion = useSelector((state) => !!state.version.suggestedUpgrade); + const pushAppUpgrade = usePushAppUpgrade(); const [showOutdatedVersionWarning, setShowOutdatedVersionWarning] = useState(outdatedVersion); @@ -347,6 +350,16 @@ function OutdatedVersionWarningDialog() { await openUrl(getDownloadUrl(suggestedIsBeta)); }, [openUrl, suggestedIsBeta]); + const isLinux = useIsPlatformLinux(); + const upgradeAction = useCallback(async () => { + if (isLinux) { + await openDownloadLink(); + } else { + acknowledgeOutdatedVersion(); + pushAppUpgrade(); + } + }, [isLinux, openDownloadLink, pushAppUpgrade, acknowledgeOutdatedVersion]); + const outdatedVersionCancel = useCallback(() => { acknowledgeOutdatedVersion(); pop(); @@ -357,6 +370,8 @@ function OutdatedVersionWarningDialog() { 'You are using an old version of the app. Please upgrade and see if the problem still exists before sending a report.', ); + const disabled = isLinux && isOffline; + return ( <ModalAlert isOpen={showOutdatedVersionWarning} @@ -366,8 +381,8 @@ function OutdatedVersionWarningDialog() { <Button key="upgrade" variant="success" - disabled={isOffline} - onClick={openDownloadLink} + disabled={disabled} + onClick={upgradeAction} aria-description={messages.pgettext('accessibility', 'Opens externally')}> <Button.Text> { |
