Skip to content

Commit

Permalink
Resolve nativeapp PR Issues
Browse files Browse the repository at this point in the history
- Comment out handleGeoStationary code
- Remove conditional check for sms toast
- Rename EXCLUDED_COUNTRIES
  • Loading branch information
dhakalaashish committed Feb 27, 2024
1 parent 372a0bc commit dbd5f7a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions apps/nativeapp/app/components/phoneInput/PhoneInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PhoneNoInput from 'react-native-phone-number-input';
import {CountryCode} from 'react-native-country-picker-modal';

import {Colors, Typography} from '../../styles';
import {EXCLUDED_COUNTRIES, EXCLUDED_COUNTRIES_WHATSAPP} from '../../constants';
import {DISABLE_SMS_COUNTRY_CODE , DISABLE_WHATSAPP_COUNTRY_CODE} from '../../constants';

const IS_ANDROID = Platform.OS === 'android';

Expand Down Expand Up @@ -39,10 +39,10 @@ const PhoneInput = ({
inputValue(formattedValue);
if ((
verificationType === 'Sms' &&
EXCLUDED_COUNTRIES.includes(countryCode)
DISABLE_SMS_COUNTRY_CODE.includes(countryCode)
) || (
verificationType === 'Whatsapp' &&
EXCLUDED_COUNTRIES_WHATSAPP.includes(countryCode)
DISABLE_WHATSAPP_COUNTRY_CODE.includes(countryCode)
)) {
destinationFlag(true);
return;
Expand Down
8 changes: 4 additions & 4 deletions apps/nativeapp/app/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const POINT_RADIUS_ARR = [
{name: 'Within 1 km', value: 1000},
];

// Excluded countries for sms type alert methods
const EXCLUDED_COUNTRIES = [
// Disable sms and whatsapp alert methods for some countries
const DISABLE_SMS_COUNTRY_CODE = [
'RU',
'TJ',
'MG',
Expand All @@ -30,8 +30,8 @@ const EXCLUDED_COUNTRIES = [
'BZ',
];

const EXCLUDED_COUNTRIES_WHATSAPP = [
const DISABLE_WHATSAPP_COUNTRY_CODE = [
'IN'
]

export {WEB_URLS, RADIUS_ARR, POINT_RADIUS_ARR, EXCLUDED_COUNTRIES, EXCLUDED_COUNTRIES_WHATSAPP};
export {WEB_URLS, RADIUS_ARR, POINT_RADIUS_ARR, DISABLE_SMS_COUNTRY_CODE, DISABLE_WHATSAPP_COUNTRY_CODE};
30 changes: 15 additions & 15 deletions apps/nativeapp/app/screens/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -456,21 +456,21 @@ const Settings = ({navigation}) => {
});
};

const handleGeostationary = val => {
let detectionMethods = [...userDetails?.data?.detectionMethods];
if (!val) {
detectionMethods = detectionMethods.filter(el => el !== 'GEOSTATIONARY');
} else {
detectionMethods = [...detectionMethods, 'GEOSTATIONARY'];
}
updateUser.mutate({
json: {
body: {
detectionMethods,
},
},
});
};
// const handleGeostationary = val => {
// let detectionMethods = [...userDetails?.data?.detectionMethods];
// if (!val) {
// detectionMethods = detectionMethods.filter(el => el !== 'GEOSTATIONARY');
// } else {
// detectionMethods = [...detectionMethods, 'GEOSTATIONARY'];
// }
// updateUser.mutate({
// json: {
// body: {
// detectionMethods,
// },
// },
// });
// };

const handleWebhook = () => {
navigation.navigate('Verification', {
Expand Down
2 changes: 1 addition & 1 deletion apps/nativeapp/app/screens/Verification/Verification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Verification = ({navigation, route}) => {
(verificationType === 'Sms' && limitDestination)
) {
return toast.show(
`Apologies, ${verificationType === 'Sms' ? 'sms' : 'WhatsApp'} services to your region are currently unsupported. Please select a different method.`,
`Apologies, sms services to your region are currently unsupported. Please select a different method.`,
{
type: 'warning',
},
Expand Down

0 comments on commit dbd5f7a

Please sign in to comment.