From 24df2a7dc4599683de7cbc3ce2df766932543f77 Mon Sep 17 00:00:00 2001 From: Felix Hallenberg Date: Sun, 6 Oct 2024 11:52:01 +0300 Subject: [PATCH] WIP Show modal if version not big enough - Use storeurl as a build config --- README.md | 23 ++++++++++++----------- appcenter-pre-build.sh | 1 + config.template.android.json | 1 + config.template.ios.json | 1 + src/Screens/Main/Tabs.tsx | 19 ++++++++++++++++--- src/api/config.ts | 1 + src/localization/en.ts | 4 ++++ src/localization/fi.ts | 4 ++++ 8 files changed, 40 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1812dae7..bfdd5809 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,18 @@ cp config.template.ios.json config.json You can edit the config file as suited: -| Parameter | Description | -| -------------- | ---------------------------------| -| `baseUrl` | Ylitse API base URL | -| `loginUrl` | Ylitse service login URL | -| `feedBackUrl` | Feedback form URL | -| `termsUrl` | Terms and conditions URL | -| `userGuideUrl` | User's manual URL | -| `apuuUrl` | Apuu-chat URL | -| `sekasinUrl` | Sekasin-chat URL | -| `saferSpaceUrl` | Principals of a safer space URL | -| `messageFetchDelay`| Delay between polling | +| Parameter | Description | +| ----------------- | ---------------------------------------| +| `baseUrl` | Ylitse API base URL | +| `loginUrl` | Ylitse service login URL | +| `feedBackUrl` | Feedback form URL | +| `termsUrl` | Terms and conditions URL | +| `userGuideUrl` | User's manual URL | +| `apuuUrl` | Apuu-chat URL | +| `sekasinUrl` | Sekasin-chat URL | +| `saferSpaceUrl` | Principals of a safer space URL | +| `storeUrl` | App marketplace URL (build specific) | +| `messageFetchDelay`| Delay between polling | ### Running on iOS diff --git a/appcenter-pre-build.sh b/appcenter-pre-build.sh index 76d8e472..fc3b0cf1 100644 --- a/appcenter-pre-build.sh +++ b/appcenter-pre-build.sh @@ -12,6 +12,7 @@ tee config.json > /dev/null <; const Main = ({ navigation, route }: Props) => { const dispatch = ReactRedux.useDispatch>(); const initialRouteName = route.params?.initial; + const appClient = getClient(); const isAppVersionBigEnough = ReactRedux.useSelector( - selectIsVersionBigEnough(getClient()), + selectIsVersionBigEnough(appClient), ); const handleRefetchData = () => { @@ -61,6 +65,8 @@ const Main = ({ navigation, route }: Props) => { callback: handleRefetchData, }); + const openStore = () => RN.Linking.openURL(storeUrl); + React.useEffect(() => { navigation.dispatch(state => { const routes = state.routes.filter(r => !r.name.includes('Onboarding')); @@ -77,8 +83,6 @@ const Main = ({ navigation, route }: Props) => { dispatch({ type: 'minimumVersion/get/start', payload: undefined }); }, []); - console.log('is app version is big enough:', isAppVersionBigEnough); - return ( <> { onAnswer={handleAnswer} /> )} + {isAppVersionBigEnough && ( + + )} ); }; diff --git a/src/api/config.ts b/src/api/config.ts index b1dd0e50..7b79370d 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -9,3 +9,4 @@ export const apuuUrl = config.apuuUrl; export const sekasinUrl = config.sekasinUrl; export const saferSpaceUrl = config.saferSpaceUrl; export const messageFetchDelay = config.messageFetchDelay; +export const storeUrl = config.storeUrl; diff --git a/src/localization/en.ts b/src/localization/en.ts index 3ac01472..27ad6335 100644 --- a/src/localization/en.ts +++ b/src/localization/en.ts @@ -159,6 +159,10 @@ export const messages: { [key in MessageId]: string } = { 'SOS-Lapsikylä representative will contact you after the investigation.', 'main.userreport.title': 'Report', + 'main.version.not.big.enough.button': 'Store', + 'main.version.not.big.enough.text': 'You must update', + 'main.version.not.big.enough.title': 'Version not big enough', + 'meta.back': 'Back', 'meta.blank': ' ', 'meta.cancel': 'Cancel', diff --git a/src/localization/fi.ts b/src/localization/fi.ts index 3565f01d..a220c75f 100644 --- a/src/localization/fi.ts +++ b/src/localization/fi.ts @@ -159,6 +159,10 @@ export const messages = { 'SOS-Lapsikylän työntekijä selvittää tilanteen ja ottaa sinuun yhteyttä.', 'main.userreport.title': 'Ilmianna', + 'main.version.not.big.enough.button': 'Kauppaan', + 'main.version.not.big.enough.text': 'Sinun taytyy paivittaa', + 'main.version.not.big.enough.title': 'Versio ei ole tarpeeksi iso', + 'meta.back': 'Takaisin', 'meta.blank': ' ', 'meta.cancel': 'Peru',