diff --git a/app/assets/data/firebaseEvents.ts b/app/assets/data/firebaseEvents.ts index 1500f93b7..ca7d6d5df 100644 --- a/app/assets/data/firebaseEvents.ts +++ b/app/assets/data/firebaseEvents.ts @@ -32,4 +32,5 @@ export const CHATBOT_FAQ_SELECTED="chatbot_faq_selected";//chatbot faq category export const EMAIL_SENT="email_sent";//Email Sent export const DONATE_OPENED="donate_opened";//Donate Event export const ARTICLE_SEARCHED="article_searched";//Article Searched Event -export const ACTIVITY_SEARCHED="activity_searched";//Activity Searched Event \ No newline at end of file +export const ACTIVITY_SEARCHED="activity_searched";//Activity Searched Event +export const TERMS_ACCEPTED="terms_accepted";//Terms accepted Event \ No newline at end of file diff --git a/app/components/ToggleRadiosBgColor.tsx b/app/components/ToggleRadiosBgColor.tsx index c2182fda9..be5553657 100644 --- a/app/components/ToggleRadiosBgColor.tsx +++ b/app/components/ToggleRadiosBgColor.tsx @@ -5,37 +5,36 @@ import Checkbox, { CheckboxActive, CheckboxItem } from './shared/CheckboxStyle'; import { FDirRow } from './shared/FlexBoxStyle'; import Icon from './shared/Icon'; import { RadioBoxContainer, RadioInnerBox, RadioOuter } from './shared/radio'; -const styles=StyleSheet.create({ - checkbox:{borderRadius: 50, borderWidth: 1}, - checkboxItem:{borderRadius: 50}, - heading3:{flexShrink:1}, - lastView:{flexDirection:'row',flex:1} - }) - -const ToggleRadiosBgColor = (props: any):any => { - const {options,tickColor,tickbgColor,defaultValue} = props; - const [checkedItem, setCheckedItem] = useState(defaultValue?defaultValue:null); - useEffect(()=>{ - setCheckedItem(defaultValue); - },[defaultValue]) +const styles = StyleSheet.create({ + checkbox: { borderRadius: 50, borderWidth: 1 }, + checkboxItem: { borderRadius: 50 }, + heading3: { flexShrink: 1 }, + lastView: { flexDirection: 'row', flex: 1 } +}) + +const ToggleRadiosBgColor = (props: any): any => { + const { options, tickColor, tickbgColor, defaultValue } = props; + const [checkedItem, setCheckedItem] = useState(defaultValue ? defaultValue : null); + useEffect(() => { + setCheckedItem(defaultValue); + }, [defaultValue]) return ( <> - - - {options.map((item: typeof options[0], index: number) => { - return ( - + + + {options.map((item: typeof options[0], index: number) => { + return ( + > { + onPress={(): any => { setCheckedItem(item); props.getCheckedItem(item); }}> - {(checkedItem?.title && checkedItem.title == item.title) ? ( - + {(checkedItem?.title && checkedItem.title == item.title) ? ( + ) : ( @@ -44,9 +43,8 @@ const ToggleRadiosBgColor = (props: any):any => { )} - - {(checkedItem?.title && checkedItem.title == item.title) ? ( + {(checkedItem?.title && checkedItem.title == item.title) ? ( {item.title} ) : ( {item.title} @@ -54,10 +52,9 @@ const ToggleRadiosBgColor = (props: any):any => { - - ); - })} - + ); + })} + ); }; diff --git a/app/redux/reducers/localizationSlice.ts b/app/redux/reducers/localizationSlice.ts index fb498b5c8..a9a0b1f52 100755 --- a/app/redux/reducers/localizationSlice.ts +++ b/app/redux/reducers/localizationSlice.ts @@ -92,7 +92,6 @@ export const localizationSlice = createSlice({ state, action: PayloadAction, ): any => { - console.log('Hiiiiiiiiii', action.payload); state.AppLayoutDirectionParams = action.payload; }, }, diff --git a/app/screens/Terms.tsx b/app/screens/Terms.tsx index 11b938ce0..f4782a62c 100755 --- a/app/screens/Terms.tsx +++ b/app/screens/Terms.tsx @@ -23,7 +23,9 @@ import { bgcolorWhite2, secondaryBtnColor } from '@styles/style'; import VectorImage from 'react-native-vector-image'; import { activityLogo, adviceLogo, bebboLogoShapeNew, toolsLogo } from '@dynamicImportsClass/dynamicImports'; import FeatureTCView from '@components/shared/FeaturesTCView'; - +import { TERMS_ACCEPTED } from '@assets/data/firebaseEvents'; +import { logEvent } from '../services/EventSyncService'; +import useNetInfoHook from '../customHooks/useNetInfoHook'; type TermsNavigationProp = StackNavigationProp< RootStackParamList, @@ -76,14 +78,12 @@ const styles = StyleSheet.create({ const Terms = ({ navigation }: Props): any => { const themeContext = useContext(ThemeContext); const headerColor = themeContext?.colors.PRIMARY_REDESIGN_COLOR; - const termsTextColor = themeContext?.colors?.TERMS_TEXTCOLOR; - const [toggleCheckBox, setToggleCheckBox] = useState(false); - const [toggleCheckBox1, setToggleCheckBox1] = useState(false); - const [toggleCheckBox2, setToggleCheckBox2] = useState(true); const isButtonDisabled = (toggleCheckBox == false) const [loading, setLoading] = useState(true); const { t } = useTranslation(); + const netInfo = useNetInfoHook(); + const goToPrivacyPolicy = (): any => { navigation.navigate('PrivacyPolicy'); }; @@ -216,6 +216,8 @@ const Terms = ({ navigation }: Props): any => { const acceptTerms = async (): Promise => { if (acceptTermsFlag == false) { dispatch(setAcceptTerms(true)); + const eventData = { 'name': TERMS_ACCEPTED} + logEvent(eventData, netInfo.isConnected) } navigation.navigate('LoadingScreen', { apiJsonData: apiJsonData, diff --git a/app/screens/home/EditChildProfile.tsx b/app/screens/home/EditChildProfile.tsx index 061c236a7..8b7f9c246 100755 --- a/app/screens/home/EditChildProfile.tsx +++ b/app/screens/home/EditChildProfile.tsx @@ -207,11 +207,7 @@ const EditChildProfile = ({ route, navigation }: Props): any => { handleBack(); }, []); useFocusEffect( - React.useCallback(() => { - - console.log('childData is', childData) - console.log('childData is profiles', childData) if (childData != undefined && childData != null && childData != '' && childData.uuid != '') { setphotoUri(childData.photoUri); if (childData.photoUri != '' && childData.photoUri != null && childData.photoUri != undefined) { @@ -219,13 +215,11 @@ const EditChildProfile = ({ route, navigation }: Props): any => { } sendData(childData); } - console.log('childadata gender is', genders); - if(childData != undefined && childData != null && childData != '' && childData.uuid != '' && childData?.gender== 0 ) { - setDefaultGenderValue(genders.find((item: any) => item.id == girlChildGender)) - }else{ - setDefaultGenderValue(genders.find((item: any) => item.id == childData?.gender)) + if (childData != null && childData.uuid !== '' && childData?.gender === 0) { + setDefaultGenderValue(genders.find((item: any) => item.id === girlChildGender)) + } else { + setDefaultGenderValue(genders.find((item: any) => item.id === childData?.gender)) } - console.log(destPath) }, []), ); diff --git a/app/screens/home/bottomTabs/Articles.tsx b/app/screens/home/bottomTabs/Articles.tsx index 1ad6ddc6a..fc7b472e9 100755 --- a/app/screens/home/bottomTabs/Articles.tsx +++ b/app/screens/home/bottomTabs/Articles.tsx @@ -15,13 +15,13 @@ import { HomeDrawerNavigatorStackParamList } from '@navigation/types'; import { useFocusEffect, useIsFocused } from '@react-navigation/native'; import { StackNavigationProp } from '@react-navigation/stack'; import { articleColor, articlesTintcolor, bgColor1, bgcolorWhite2, greyCode } from '@styles/style'; -import { Heading3, Heading4Center, Heading6Bold, ShiftFromTopBottom5 } from '@styles/typography'; +import { Heading3, Heading4Center, Heading6Bold, ShiftFromBottom10, ShiftFromTopBottom5, SideRightSpacing20, SideSpacing10 } from '@styles/typography'; import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ActivityIndicator, Dimensions, - FlatList, Keyboard, KeyboardAvoidingView, Platform, Pressable, StyleSheet, Text, TextInput, TouchableOpacity, View + FlatList, Keyboard, KeyboardAvoidingView, Platform, Pressable, StyleSheet, Text, View } from 'react-native'; import FastImage from 'react-native-fast-image'; import { ThemeContext } from 'styled-components/native'; @@ -71,8 +71,8 @@ const styles = StyleSheet.create({ historyList: { backgroundColor: bgcolorWhite2, left: 0, - paddingBottom: 10, position: 'absolute', + paddingBottom: 10, right: 0, top: 51, zIndex: 1, @@ -104,9 +104,8 @@ const Articles = ({ route, navigation }: any): any => { const [flatListHeight, setFlatListHeight] = useState(0); const dispatch = useAppDispatch(); const flatListRef = useRef(null); - const flatListHistoryRef = useRef(null); - const windowWidthstyle = Dimensions.get('window').width; - const windowHeightstyle = Dimensions.get('window').height; + const windowWidthStyle = Dimensions.get('window').width; + const windowHeightStyle = Dimensions.get('window').height; const setIsModalOpened = async (varkey: any): Promise => { if (modalVisible == true) { const obj = { key: varkey, value: false }; @@ -186,16 +185,10 @@ const Articles = ({ route, navigation }: any): any => { const getSearchedKeywords = async (): Promise => { const realm = await dataRealmCommon.openRealm(); - if (realm != null) { - console.log('Seach History is...', realm?.objects('SearchHistory')) const unsynchronizedEvents: any = realm.objects('SearchHistory').sorted('createdAt', true).slice(0, 5).map(entry => entry.keyword); - console.log('Seach History is', unsynchronizedEvents) setSearchHistory(unsynchronizedEvents); - } - console.log('search history.......', searchHistory); - } //store previous searched keyword @@ -246,11 +239,6 @@ const Articles = ({ route, navigation }: any): any => { (state: any) => (state.articlesData.article.articles != '') ? JSON.parse(state.articlesData.article.articles) : state.articlesData.article.articles, ); const articleDataOld = articleDataall.filter((x: any) => articleCategoryArray.includes(x.category)); - const ActivitiesDataold = useAppSelector( - (state: any) => - state.utilsData.ActivitiesData != '' ? JSON.parse(state.utilsData.ActivitiesData) : [], - ); - const ActivitiesData = randomArrayShuffle(ActivitiesDataold) const VideoArticlesDataall = useAppSelector( (state: any) => state.utilsData.VideoArticlesData != '' ? JSON.parse(state.utilsData.VideoArticlesData) : [], @@ -281,19 +269,15 @@ const Articles = ({ route, navigation }: any): any => { }; const showSelectedBracketData = (item: any): any => { - - console.log('On age selected', item) if (item && item?.id !== null) { const eventData = { 'name': ADVICE_AGEGROUP_SELECTED, 'params': { age_id: item.id } } logEvent(eventData, netInfo.isConnected) setCurrentSelectedChildId(item.id); setIsSearchedQueryText(true) const filteredData = articleData.filter((x: any) => x.child_age.includes(item.id)); - console.log('On age selected....', filteredData.length) setSelectedChildActivitiesData(filteredData); setCurrentChildSelected(false) } else { - console.log('On de selected....', articleData.length) setCurrentSelectedChildId(0); setIsSearchedQueryText(true) setSelectedChildActivitiesData(articleData); @@ -346,29 +330,20 @@ const Articles = ({ route, navigation }: any): any => { } else { filteredResults = aggregatedResults.filter((x: any) => itemId.includes(x.category)); } - //const filteredResults = aggregatedResults.filter((x: any) => x.child_age.includes(currentSelectedChildId) && itemId.includes(x.category)); setfilteredData(filteredResults); setLoadingArticle(false) setIsSearchedQueryText(false) toTop() } else { const results = searchIndex.search(queryText); - console.log('LLSLSLs Results length is', results.length) let filteredResults: any = null; if (currentSelectedChildId != 0) { - console.log('currentSelectedChildId Results length is', itemId) setSelectedCategoryId(itemId); const categoryFilteredData = results.filter((x: any) => itemId.includes(x.category)); - console.log('categoryFilteredData Results length is', categoryFilteredData?.length) - console.log('categoryFilteredData Results length is....', categoryFilteredData) filteredResults = categoryFilteredData.filter((x: any) => x.child_age.includes(currentSelectedChildId)); - console.log('currentSelectedChildId Results length is 1', filteredResults?.length) } else { - console.log('currentSelectedChildId Results length is....', currentSelectedChildId) filteredResults = results.filter((x: any) => itemId.includes(x.category)); } - //const filteredResults = results.filter((x: any) => x.child_age.includes(currentSelectedChildId) && itemId.includes(x.category)); - console.log('LLLSSS filteredResults length is', filteredResults.length) setfilteredData(filteredResults); setLoadingArticle(false) setIsSearchedQueryText(false) @@ -384,11 +359,7 @@ const Articles = ({ route, navigation }: any): any => { setshowNoData(true); }, 200); } else { - console.log('selectedChildActivitiesData article data is', selectedChildActivitiesData?.length) let newArticleData: any = selectedChildActivitiesData.length > 0 ? selectedChildActivitiesData : []; - console.log('new article data is', newArticleData?.length) - let titleData = []; - let bodyData = []; if (queryText != "" && queryText != undefined && queryText != null) { const keywords = queryText.trim().toLowerCase().split(' ').filter((word: any) => word.trim() !== ''); if (keywords.length > 1) { @@ -404,21 +375,18 @@ const Articles = ({ route, navigation }: any): any => { } else { filteredResults = aggregatedResults; } - //const filteredResults = aggregatedResults.filter((x: any) => x.child_age.includes(currentSelectedChildId)); setfilteredData(filteredResults); setLoadingArticle(false) setIsSearchedQueryText(false) toTop() } else { const results = searchIndex.search(queryText); - console.log('sdsd Results length is', results.length) let filteredResults: any = null; if (currentSelectedChildId != 0) { filteredResults = results.filter((x: any) => x.child_age.includes(currentSelectedChildId)); } else { filteredResults = results; } - console.log('sdsd filteredResults length is', filteredResults.length) setfilteredData(filteredResults); setLoadingArticle(false) setIsSearchedQueryText(false) @@ -447,7 +415,6 @@ const Articles = ({ route, navigation }: any): any => { } useFocusEffect( React.useCallback(() => { - console.log('UseFocusEffect Articles two'); const showSubscription = Keyboard.addListener("keyboardDidShow", () => { setKeyboardStatus(true); }); @@ -465,28 +432,8 @@ const Articles = ({ route, navigation }: any): any => { }, []) ); - useEffect(() => { - console.log('reefrence for flatlist is', flatListHistoryRef.current) - const handleClickOutside = (event: any) => { - if (flatListHistoryRef.current && !flatListHistoryRef.current.contains(event.target)) { - setHistoryVisible(false); // Hide dropdown if click is outside - } - }; - - // if (historyVisible) { - // document.addEventListener('mousedown', handleClickOutside); - // } else { - // document.removeEventListener('mousedown', handleClickOutside); - // } - - // return () => { - // document.removeEventListener('mousedown', handleClickOutside); - // }; - - }, [searchHistory, flatListHistoryRef]) useFocusEffect( React.useCallback(() => { - console.log('Applied another focus effect') if (route.params?.backClicked != 'yes') { setshowNoData(false); if (route.params?.currentSelectedChildId && route.params?.currentSelectedChildId != 0) { @@ -497,7 +444,6 @@ const Articles = ({ route, navigation }: any): any => { } else { console.log("else if route params 0", route.params, activityTaxonomyId); - const firstChildDevData = childAge.filter((x: any) => x.id == activityTaxonomyId); showSelectedBracketData(firstChildDevData[0]); } @@ -511,39 +457,19 @@ const Articles = ({ route, navigation }: any): any => { }, [activeChild?.uuid, languageCode, route.params?.currentSelectedChildId, activityTaxonomyId]) ); const onFilterArrayChange = (newFilterArray: any): any => { - console.log('onFilterArrayChange is selected', newFilterArray?.length) setFilterArray(newFilterArray) } useFocusEffect( React.useCallback(() => { - console.log("useFocusEffect called route.params?.backClicked", route.params?.backClicked); - console.log('isCurrentChildSelected is', isCurrentChildSelected) - //setLoadingArticle(true); - // if (queryText == '') { - // setLoadingArticle(true); - // if (route.params?.categoryArray) { - // setFilterArray(route.params?.categoryArray); - // setFilteredArticleData(route.params?.categoryArray); - // } - // else { - // setFilterArray([]); - // setFilteredArticleData([]); - // } - // setIsSearchedQueryText(false) - - // } else { - console.log('isSerachedQueryText', isSerachedQueryText) if (isSerachedQueryText || queryText == '') { setLoadingArticle(true); async function fetchData(): Promise { - console.log('route category data', route.params?.categoryArray) if (route.params?.categoryArray) { setFilterArray(route.params?.categoryArray); setFilteredArticleData(route.params?.categoryArray); } else { - console.log('route category data in else') setFilterArray([]); setFilteredArticleData([]); } @@ -555,7 +481,6 @@ const Articles = ({ route, navigation }: any): any => { setLoadingArticle(false); } } - // } }, [selectedChildActivitiesData, route.params?.categoryArray, languageCode, queryText, isSerachedQueryText])) const [searchIndex, setSearchIndex] = useState(null); @@ -571,7 +496,6 @@ const Articles = ({ route, navigation }: any): any => { useEffect(() => { async function initializeSearchIndex() { try { - console.log('articles all datas',articleData.length) const processedArticles = preprocessArticles(articleData); const searchIndex = new MiniSearch({ processTerm: (term) => suffixes(term, 3), @@ -623,11 +547,7 @@ const Articles = ({ route, navigation }: any): any => { setLoadingArticle(true); await new Promise(resolve => setTimeout(resolve, 0)); Keyboard.dismiss(); - let artData: any; - let combineDartArr: []; - let newvideoArticleData; if (queryText != "" && queryText != undefined && queryText != null) { - console.log('on search list method') const keywords = queryText.trim().toLowerCase().split(' ').filter((word: any) => word.trim() !== ''); if (keywords.length > 1) { const resultsPromises = keywords.map(async (keyword: any) => { @@ -639,14 +559,10 @@ const Articles = ({ route, navigation }: any): any => { let filteredResults: any = null; if (selectedCategoryId.length > 0) { const categoryFilteredData = aggregatedResults.filter((x: any) => selectedCategoryId.includes(x.category)); - console.log('in acrticle categoryFilteredData Results length is', categoryFilteredData?.length) - console.log('in acrticle categoryFilteredData Results length is....', categoryFilteredData) filteredResults = categoryFilteredData.filter((x: any) => x.child_age.includes(currentSelectedChildId)); - console.log('in articlevcurrentSelectedChildId Results length is 1', filteredResults?.length) } else { filteredResults = aggregatedResults.filter((x: any) => x.child_age.includes(currentSelectedChildId)); } - /// const filteredResults = aggregatedResults.filter((x: any) => x.child_age.includes(currentSelectedChildId)); setfilteredData(filteredResults); setLoadingArticle(false) setIsSearchedQueryText(false) @@ -654,17 +570,12 @@ const Articles = ({ route, navigation }: any): any => { } else { const results = searchIndex.search(queryText); let filteredResults: any = null; - console.log('on search list method', selectedCategoryId) if (selectedCategoryId.length > 0) { const categoryFilteredData = results.filter((x: any) => selectedCategoryId.includes(x.category)); - console.log('in acrticle categoryFilteredData Results length is', categoryFilteredData?.length) - console.log('in acrticle categoryFilteredData Results length is....', categoryFilteredData) filteredResults = categoryFilteredData.filter((x: any) => x.child_age.includes(currentSelectedChildId)); - console.log('in articlevcurrentSelectedChildId Results length is 1', filteredResults?.length) } else { filteredResults = results.filter((x: any) => x.child_age.includes(currentSelectedChildId)); } - //const filteredResults = results.filter((x: any) => x.child_age.includes(currentSelectedChildId)); setfilteredData(filteredResults); setLoadingArticle(false) setIsSearchedQueryText(false) @@ -703,6 +614,7 @@ const Articles = ({ route, navigation }: any): any => { onPress={async (): Promise => { Keyboard.dismiss(); searchQueryText(item); + setHistoryVisible(false); setIsSearchedQueryText(true); await searchList(item); }} @@ -762,20 +674,20 @@ const Articles = ({ route, navigation }: any): any => { autoCorrect={false} clearButtonMode="always" onFocus={(): any => { + console.log('Onfocus of textinput') setHistoryVisible(true); }} - isFocused={(item: any) => { - console.log('is focus', item) - }} onChangeText={(queryText: any): any => { console.log('searched querytext is', queryText) if (queryText.replace(/\s/g, "") == "") { + console.log('closed click') searchQueryText(queryText.replace(/\s/g, '')); - setHistoryVisible(true); // await searchList(queryText) } else { searchQueryText(queryText); - setHistoryVisible(true); + if (!historyVisible) { + setHistoryVisible(true); + } } }} value={queryText} @@ -786,7 +698,6 @@ const Articles = ({ route, navigation }: any): any => { Keyboard.dismiss(); setIsSearchedQueryText(true) await searchList(queryText); - // setIsSearchedQueryText(true); }} multiline={false} // placeholder="Search for Keywords" @@ -796,20 +707,22 @@ const Articles = ({ route, navigation }: any): any => { /> { Platform.OS == 'android' && queryText.replace(/\s/g, "") != "" && - - => { - console.log('cleartext') - Keyboard.dismiss(); - searchQueryText(''); - setHistoryVisible(true); - }}> - - - + + + => { + console.log('cleartext') + Keyboard.dismiss(); + searchQueryText(''); + // setHistoryVisible(true); + }}> + + + + } @@ -822,50 +735,46 @@ const Articles = ({ route, navigation }: any): any => { ItemTintColor={backgroundColor} /> {searchHistory.length !== 0 && historyVisible && - - index.toString()} - //style={styles.historyList} - /> - - + + index.toString()} + /> + } - - - - {filteredData.length > 0 ? - { - console.log(e); - if (keyboardStatus == true) { - Keyboard.dismiss(); - } - }} - nestedScrollEnabled={true} - // keyboardDismissMode={"on-drag"} - // keyboardShouldPersistTaps='always' - removeClippedSubviews={true} // Unmount components when outside of window - initialNumToRender={4} // Reduce initial render amount - maxToRenderPerBatch={4} // Reduce number in each render batch - updateCellsBatchingPeriod={100} // Increase time between renders - windowSize={7} // Reduce the window size - // renderItem={({ item, index }) => } - renderItem={memoizedValue} - keyExtractor={(item): any => item.id.toString()} - /> - : {t('noDataTxt')}} + { + filteredData.length > 0 ? + { + console.log(e); + if (keyboardStatus == true) { + Keyboard.dismiss(); + } + }} + nestedScrollEnabled={true} + // keyboardDismissMode={"on-drag"} + // keyboardShouldPersistTaps='always' + removeClippedSubviews={true} // Unmount components when outside of window + initialNumToRender={4} // Reduce initial render amount + maxToRenderPerBatch={4} // Reduce number in each render batch + updateCellsBatchingPeriod={100} // Increase time between renders + windowSize={7} // Reduce the window size + // renderItem={({ item, index }) => } + renderItem={memoizedValue} + keyExtractor={(item): any => item.id.toString()} + /> + : {t('noDataTxt')} + } diff --git a/app/screens/localization/CountryLanguageConfirmation.tsx b/app/screens/localization/CountryLanguageConfirmation.tsx index c13836373..88a85e091 100755 --- a/app/screens/localization/CountryLanguageConfirmation.tsx +++ b/app/screens/localization/CountryLanguageConfirmation.tsx @@ -44,7 +44,6 @@ import RNRestart from 'react-native-restart'; import { localization, sponsors } from '@dynamicImportsClass/dynamicImports'; import * as RNLocalize from "react-native-localize"; import { secondaryBtnColor } from '@styles/style'; -import { ColorChannel } from '@shopify/react-native-skia'; type CountryLanguageConfirmationNavigationProp = StackNavigationProp< RootStackParamList, @@ -117,7 +116,6 @@ const CountryLanguageConfirmation = ({ route }: Props): any => { const { t, i18n } = useTranslation(); console.log(I18nManager.isRTL, "---is rtl val"); useEffect(() => { - console.log('Route Params is here......', countrySelectedId,locale,languageCode); if (!route.params.language) { console.log('Language data not available'); } else if (Array.isArray(route.params.language)) { @@ -136,7 +134,6 @@ const CountryLanguageConfirmation = ({ route }: Props): any => { return languageCode; }; const getCountryByCountryCode = (countryCode: any): any => { - console.log('Here Country code is', countryCode) const normalizedCountryCode = countryCode.toLowerCase(); // Normalize to lowercase for case-insensitive comparison for (const country of localization) { for (const language of country.languages) { @@ -196,17 +193,11 @@ const CountryLanguageConfirmation = ({ route }: Props): any => { newCountryLocale = selectedDefaultCountry; } } else { - console.log('My route is',route.params) if (Object.keys(route.params).length === 0) { - console.log('newCountry id is', countryId) newCountryLocale = selectedDefaultCountry; newCountryId = countryId; } else { - // setCountry(props.route.params.country) - // newCountryId = route.params.country.countryId; - console.log('Language is from params', route.params.language) if (route.params != undefined) { - console.log('Language is from params', route.params.country.countryId) newCountryLocale = route.params.language.luxonLocale; newCountryId = route.params.country.countryId; } else { @@ -228,46 +219,46 @@ const CountryLanguageConfirmation = ({ route }: Props): any => { const foundCountry = getCountryByCountryCode(RNLocalize.getCountry()); console.log('Found country is', foundCountry) if (foundCountry != undefined && foundCountry != null) { - if (countrySelectedId==0) { - setCountryData(foundCountry); - const languagesWithLuxonLocale = foundCountry?.languages?.filter((lang: any) => lang.luxonLocale === selectedDefaultCountry || extractLanguageCode(lang.luxonLocale) === selectedLanguage); - if (languagesWithLuxonLocale?.length != 0) { - setNewLanguage(languagesWithLuxonLocale[0]); + if (countrySelectedId == 0) { + setCountryData(foundCountry); + const languagesWithLuxonLocale = foundCountry?.languages?.filter((lang: any) => lang.luxonLocale === selectedDefaultCountry || extractLanguageCode(lang.luxonLocale) === selectedLanguage); + if (languagesWithLuxonLocale?.length != 0) { + setNewLanguage(languagesWithLuxonLocale[0]); + } else { + const selectedLanData = foundCountry?.languages?.filter((lang: any) => lang.languageCode === languageCode); + if (selectedLanData?.length > 0) { + setNewLanguage(selectedLanData[0]) } else { - const selectedLanData = foundCountry?.languages?.filter((lang: any) => lang.languageCode === languageCode); - if(selectedLanData.length>0){ - setNewLanguage(selectedLanData[0]) - }else{ - setNewLanguage(foundCountry.languages[0]) - } + setNewLanguage(foundCountry?.languages[0]) } + } + } else { + setCountryData(selectedCountry); + const languagesWithLuxonLocale = selectedCountry?.languages?.filter((lang: any) => lang.locale === locale); + if (languagesWithLuxonLocale?.length != 0) { + setNewLanguage(languagesWithLuxonLocale[0]) } else { - setCountryData(selectedCountry); - const languagesWithLuxonLocale = selectedCountry?.languages?.filter((lang: any) => lang.locale === locale); - if (languagesWithLuxonLocale?.length != 0) { - setNewLanguage(languagesWithLuxonLocale[0]) + const selectedLanData = selectedCountry?.languages?.filter((lang: any) => lang.languageCode === languageCode); + if (selectedLanData.length > 0) { + setNewLanguage(selectedLanData[0]) } else { - const selectedLanData = selectedCountry?.languages?.filter((lang: any) => lang.languageCode === languageCode); - if(selectedLanData.length>0){ - setNewLanguage(selectedLanData[0]) - }else{ - setNewLanguage(foundCountry.languages[0]) - } + setNewLanguage(foundCountry?.languages[0]) } + } } } else { setCountryData(selectedCountry); - let filteredLanguage:any= null; - if(selectedLocale !== ''){ - filteredLanguage = selectedCountry?.languages?.filter((lang:any)=>lang.locale === locale); - }else{ - filteredLanguage = selectedCountry?.languages?.filter((lang:any) => lang.luxonLocale === selectedDefaultCountry || extractLanguageCode(lang.luxonLocale) === selectedLanguage); + let filteredLanguage: any = null; + if (selectedLocale !== '') { + filteredLanguage = selectedCountry?.languages?.filter((lang: any) => lang.locale === locale); + } else { + filteredLanguage = selectedCountry?.languages?.filter((lang: any) => lang.luxonLocale === selectedDefaultCountry || extractLanguageCode(lang.luxonLocale) === selectedLanguage); } - if(filteredLanguage.length > 0){ + if (filteredLanguage?.length > 0) { setNewLanguage(filteredLanguage[0]); - }else{ + } else { setNewLanguage(selectedCountry?.languages[0]); - } + } } } }, [isVisible]); @@ -326,14 +317,11 @@ const CountryLanguageConfirmation = ({ route }: Props): any => { ], }); } else { - console.log(newLanguage, "..newLanguage"); if (Object.keys(route.params).length !== 0) { - console.log(route.params, "routeparams"); dispatch(onLocalizationSelect(route.params)); dispatch(setInfoModalOpened({ key: 'dailyMessageNotification', value: '' })); analytics().setUserProperties({ country: route.params.country.displayName, language: newLanguage.displayName }) } else { - console.log(countryData, "countryData"); dispatch(onLocalizationSelect(countryData)); dispatch(setInfoModalOpened({ key: 'dailyMessageNotification', value: '' })); analytics().setUserProperties({ country: countryData.displayName, language: newLanguage.displayName })