From 1c77db756d6cad3dcadde8eddd318a177d43f0d7 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 18 Nov 2024 15:28:28 +0100 Subject: [PATCH 1/6] update force upgrade modal --- src/libs/actions/AppUpdate/updateApp/index.android.ts | 6 +++++- src/libs/actions/AppUpdate/updateApp/index.desktop.ts | 3 ++- src/libs/actions/AppUpdate/updateApp/index.ios.ts | 6 +++++- src/libs/actions/AppUpdate/updateApp/index.ts | 3 ++- src/pages/ErrorPage/UpdateRequiredView.tsx | 5 ++++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/AppUpdate/updateApp/index.android.ts b/src/libs/actions/AppUpdate/updateApp/index.android.ts index 3f2cde77f466..aac98a1928aa 100644 --- a/src/libs/actions/AppUpdate/updateApp/index.android.ts +++ b/src/libs/actions/AppUpdate/updateApp/index.android.ts @@ -1,6 +1,10 @@ import {Linking, NativeModules} from 'react-native'; import CONST from '@src/CONST'; -export default function updateApp() { +export default function updateApp(isProduction: boolean) { + if (isProduction) { + Linking.openURL(CONST.APP_DOWNLOAD_LINKS.OLD_DOT_ANDROID); + return; + } Linking.openURL(NativeModules.HybridAppModule ? CONST.APP_DOWNLOAD_LINKS.OLD_DOT_ANDROID : CONST.APP_DOWNLOAD_LINKS.ANDROID); } diff --git a/src/libs/actions/AppUpdate/updateApp/index.desktop.ts b/src/libs/actions/AppUpdate/updateApp/index.desktop.ts index 5c1ecbe05742..cbd961ff653b 100644 --- a/src/libs/actions/AppUpdate/updateApp/index.desktop.ts +++ b/src/libs/actions/AppUpdate/updateApp/index.desktop.ts @@ -1,5 +1,6 @@ import ELECTRON_EVENTS from '@desktop/ELECTRON_EVENTS'; -export default function updateApp() { +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export default function updateApp(isProduction: boolean) { window.electron.send(ELECTRON_EVENTS.SILENT_UPDATE); } diff --git a/src/libs/actions/AppUpdate/updateApp/index.ios.ts b/src/libs/actions/AppUpdate/updateApp/index.ios.ts index 930a57881128..608c7ab028ca 100644 --- a/src/libs/actions/AppUpdate/updateApp/index.ios.ts +++ b/src/libs/actions/AppUpdate/updateApp/index.ios.ts @@ -1,6 +1,10 @@ import {Linking, NativeModules} from 'react-native'; import CONST from '@src/CONST'; -export default function updateApp() { +export default function updateApp(isProduction: boolean) { + if (isProduction) { + Linking.openURL(CONST.APP_DOWNLOAD_LINKS.OLD_DOT_IOS); + return; + } Linking.openURL(NativeModules.HybridAppModule ? CONST.APP_DOWNLOAD_LINKS.OLD_DOT_IOS : CONST.APP_DOWNLOAD_LINKS.IOS); } diff --git a/src/libs/actions/AppUpdate/updateApp/index.ts b/src/libs/actions/AppUpdate/updateApp/index.ts index 8c2b191029a2..3b6d9e666bfa 100644 --- a/src/libs/actions/AppUpdate/updateApp/index.ts +++ b/src/libs/actions/AppUpdate/updateApp/index.ts @@ -1,6 +1,7 @@ /** * On web or mWeb we can simply refresh the page and the user should have the new version of the app downloaded. */ -export default function updateApp() { +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export default function updateApp(isProduction: boolean) { window.location.reload(); } diff --git a/src/pages/ErrorPage/UpdateRequiredView.tsx b/src/pages/ErrorPage/UpdateRequiredView.tsx index 494ff4899887..9f3c4b224759 100644 --- a/src/pages/ErrorPage/UpdateRequiredView.tsx +++ b/src/pages/ErrorPage/UpdateRequiredView.tsx @@ -6,6 +6,7 @@ import HeaderGap from '@components/HeaderGap'; import Lottie from '@components/Lottie'; import LottieAnimations from '@components/LottieAnimations'; import Text from '@components/Text'; +import useEnvironment from '@hooks/useEnvironment'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; @@ -19,6 +20,8 @@ function UpdateRequiredView() { const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); const {shouldUseNarrowLayout} = useResponsiveLayout(); + const {isProduction} = useEnvironment(); + return ( @@ -47,7 +50,7 @@ function UpdateRequiredView() {