Skip to content

Commit

Permalink
Merge pull request #979 from UNICEFECAR/dynamicCountryChange
Browse files Browse the repository at this point in the history
Implement Dynamic country change
  • Loading branch information
DivyaniPatel96 authored Jul 24, 2024
2 parents b8ab33d + 8bc0232 commit dbf0d0c
Show file tree
Hide file tree
Showing 43 changed files with 1,808 additions and 1,118 deletions.
8 changes: 4 additions & 4 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

// declare const global: {HermesInternal: null | {}};
import 'react-native-gesture-handler';
import { ButtonPrimary, ButtonText } from '@components/shared/ButtonGlobal';
import { ButtonErrorText, ButtonPrimary } from '@components/shared/ButtonGlobal';
import crashlytics from '@react-native-firebase/crashlytics';
import { Action, ThunkAction } from '@reduxjs/toolkit';
import React from 'react';
import React, { useEffect } from 'react';
import {
ActivityIndicator, StyleSheet, Text,
View
Expand All @@ -29,8 +29,8 @@ import {
import { PersistGate } from 'redux-persist/integration/react';
import persistStore from 'redux-persist/lib/persistStore';
import { ThemeProvider } from 'styled-components/native';
import './app/localization/initI18next';
import AppNavigation from './app/navigation/AppNavigation';
import './app/localization/initI18next';
import configureAppStore from './app/redux/store';
import { googleAuth } from './app/services/googleAuth';
import { appTheme } from './app/styles/theme';
Expand Down Expand Up @@ -62,7 +62,7 @@ const CustomFallback = (props: { error: Error; resetError: Function }) => {
onPress={() => {
props.resetError();
}}>
<ButtonText>{('Try again')}</ButtonText>
<ButtonErrorText>{('Try again')}</ButtonErrorText>
</ButtonPrimary>
</View>
);
Expand Down
Binary file removed app/assets/appOfflineImages/albania/partner/IPH.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
44 changes: 30 additions & 14 deletions app/assets/translations/appOfflineData/apiConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const firstPeriodicSyncDays = 7;
export const secondPeriodicSyncDays = 30;
export const shareText = (String(buildFor) != buildForBebbo) ? '\nhttps://www.bebbo.app/foleja/share/' : '\nhttps://www.bebbo.app/share/';
export const shareTextButton = (String(buildFor) != buildForBebbo) ? 'https://www.bebbo.app/foleja/share/' : 'https://www.bebbo.app/share/';
export const bebboShareMailId = 'mailto:[email protected]';
export const folejaShareMailId = 'mailto:[email protected]';
// export const bebboShareMailId = 'mailto:[email protected]';
// export const folejaShareMailId = 'mailto:[email protected]';
export const maleData: any = {
"id": 37,
"name": "Male",
Expand All @@ -51,6 +51,8 @@ export const fiveYearFromNow = today;
export const restOfTheWorldCountryId = 126;
export const videoArticleMandatory = 0;
export const maxArticleSize = 5;
export const bebboName = 'Bebbo';
export const folejaName = 'Foleja';
export const appConfig = {
articles: 'articles',
videoArticles: 'video-articles',
Expand All @@ -70,20 +72,28 @@ export const appConfig = {
checkUpdate: 'check-update',
faqs: 'faqs',
archive: 'archive',
countryGroups: 'country-groups',
}
export const finalUrl = (apiEndpoint: string, selectedCountry: number | undefined, selectedLang: string): any => {
if (apiEndpoint == appConfig.sponsors) {
return apiUrlDevelop + '/' + apiEndpoint + '/' + selectedCountry;
}
if (apiEndpoint == appConfig.taxonomies) {
return apiUrlDevelop + '/' + apiEndpoint + '/' + selectedLang + '/all';
}
if (apiEndpoint == appConfig.checkUpdate) {
return apiUrlDevelop + '/' + apiEndpoint + '/' + selectedCountry;
}
return apiUrlDevelop + '/' + apiEndpoint + '/' + selectedLang;
}
export const finalUrl = (
apiEndpoint: string,
selectedCountry: number | undefined,
selectedLang: string
): string => {
const baseUrl = `${apiUrlDevelop}/${apiEndpoint}`;

switch (apiEndpoint) {
case appConfig.countryGroups:
return `${baseUrl}/${buildFor === String(buildForFoleja) ? folejaName : bebboName}`;
case appConfig.sponsors:
return `${baseUrl}/${selectedCountry}`;
case appConfig.taxonomies:
return `${baseUrl}/${selectedLang}/all`;
case appConfig.checkUpdate:
return `${baseUrl}/${selectedCountry}`;
default:
return `${baseUrl}/${selectedLang}`;
}
};

export const allApisObject = (isDatetimeReq: any, dateTimeObj: any): any => {
const allApiObject = [
Expand All @@ -93,6 +103,12 @@ export const allApisObject = (isDatetimeReq: any, dateTimeObj: any): any => {
postdata: {},
saveinDB: false,
},
{
apiEndpoint: appConfig.countryGroups,
method: 'get',
postdata: {},
saveinDB: false,
},
{
apiEndpoint: appConfig.taxonomies,
method: 'get',
Expand Down
Loading

0 comments on commit dbf0d0c

Please sign in to comment.