Skip to content

Commit

Permalink
Merge pull request Expensify#52703 from software-mansion-labs/war-in/…
Browse files Browse the repository at this point in the history
…distinguish-between-staging-prod-env-upgrade-modal

[No QA] Update force upgrade modal
  • Loading branch information
Julesssss authored Nov 21, 2024
2 parents 00a81dc + ef4f0a2 commit 0029614
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,9 @@ const translations = {
updateRequiredView: {
updateRequired: 'Update required',
pleaseInstall: 'Please update to the latest version of New Expensify',
pleaseInstallExpensifyClassic: 'Please install the latest version of Expensify',
toGetLatestChanges: 'For mobile or desktop, download and install the latest version. For web, refresh your browser.',
newAppNotAvailable: 'The New Expensify app is no longer available.',
},
initialSettingsPage: {
about: 'About',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,9 @@ const translations = {
updateRequiredView: {
updateRequired: 'Actualización requerida',
pleaseInstall: 'Por favor, actualiza a la última versión de New Expensify',
pleaseInstallExpensifyClassic: 'Por favor, instala la última versión de Expensify',
toGetLatestChanges: 'Para móvil o escritorio, descarga e instala la última versión. Para la web, actualiza tu navegador.',
newAppNotAvailable: 'La App New Expensify ya no está disponible.',
},
initialSettingsPage: {
about: 'Acerca de',
Expand Down
6 changes: 5 additions & 1 deletion src/libs/actions/AppUpdate/updateApp/index.android.ts
Original file line number Diff line number Diff line change
@@ -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);
}
3 changes: 2 additions & 1 deletion src/libs/actions/AppUpdate/updateApp/index.desktop.ts
Original file line number Diff line number Diff line change
@@ -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);
}
6 changes: 5 additions & 1 deletion src/libs/actions/AppUpdate/updateApp/index.ios.ts
Original file line number Diff line number Diff line change
@@ -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);
}
3 changes: 2 additions & 1 deletion src/libs/actions/AppUpdate/updateApp/index.ts
Original file line number Diff line number Diff line change
@@ -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();
}
17 changes: 13 additions & 4 deletions src/pages/ErrorPage/UpdateRequiredView.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import {View} from 'react-native';
import {NativeModules, View} from 'react-native';
import Button from '@components/Button';
import Header from '@components/Header';
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';
Expand All @@ -19,6 +20,10 @@ function UpdateRequiredView() {
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();

const {isProduction} = useEnvironment();
const isStandaloneNewAppProduction = isProduction && !NativeModules.HybridAppModule;

return (
<View style={[styles.appBG, styles.h100, StyleUtils.getSafeAreaPadding(insets)]}>
<HeaderGap />
Expand All @@ -37,17 +42,21 @@ function UpdateRequiredView() {
<View style={[styles.ph5, styles.alignItemsCenter, styles.mt5]}>
<View style={styles.updateRequiredViewTextContainer}>
<View style={[styles.mb3]}>
<Text style={[styles.newKansasLarge, styles.textAlignCenter]}>{translate('updateRequiredView.pleaseInstall')}</Text>
<Text style={[styles.newKansasLarge, styles.textAlignCenter]}>
{isStandaloneNewAppProduction ? translate('updateRequiredView.pleaseInstallExpensifyClassic') : translate('updateRequiredView.pleaseInstall')}
</Text>
</View>
<View style={styles.mb5}>
<Text style={[styles.textAlignCenter, styles.textSupporting]}>{translate('updateRequiredView.toGetLatestChanges')}</Text>
<Text style={[styles.textAlignCenter, styles.textSupporting]}>
{isStandaloneNewAppProduction ? translate('updateRequiredView.newAppNotAvailable') : translate('updateRequiredView.toGetLatestChanges')}
</Text>
</View>
</View>
</View>
<Button
success
large
onPress={() => AppUpdate.updateApp()}
onPress={() => AppUpdate.updateApp(isProduction)}
text={translate('common.update')}
style={styles.updateRequiredViewTextContainer}
/>
Expand Down

0 comments on commit 0029614

Please sign in to comment.