Merge pull request #422 from medici/feat/tp-29438

maps navigation URl change TP-29438
This commit is contained in:
Himanshu Kansal
2023-05-25 13:14:01 +05:30
committed by GitHub Enterprise
3 changed files with 11 additions and 6 deletions

View File

@@ -320,6 +320,12 @@ export const getMaxByPropFromList = (arr: GenericType, prop: string) => {
return arr.find((x: GenericType) => x[prop] == max);
};
export const getGoogleMapUrl = (latitude: string | number, longitude: string | number) => {
if (!latitude || !longitude) return;
return `https://www.google.com/maps/search/${latitude},+${longitude}`;
}
export const isValidAmountEntered = (value: number) => {
return typeof value === 'number' && !isNaN(value);
};

View File

@@ -7,7 +7,7 @@ import {
BUSINESS_TIME_FORMAT,
dateFormat,
} from '../../../RN-UI-LIB/src/utlis/dates';
import { sanitizeString } from '../../components/utlis/commonFunctions';
import { getGoogleMapUrl, sanitizeString } from '../../components/utlis/commonFunctions';
import { IGeoLocation } from '../../types/addressGeolocation.types';
import { addClickstreamEvent } from '../../services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
@@ -30,7 +30,7 @@ const GeolocationItem = ({ geolocationItem, showSeparator = true }: IGeolocation
latitude: geolocationItem.latitude,
longitude: geolocationItem.longitude,
});
const geolocationUrl = `http://maps.google.com/?q=${geolocationItem?.latitude},${geolocationItem?.longitude}`;
const geolocationUrl = getGoogleMapUrl(geolocationItem?.latitude, geolocationItem?.longitude);
if (!geolocationUrl) return;
return Linking.openURL(geolocationUrl);

View File

@@ -8,7 +8,7 @@ import {
BUSINESS_TIME_FORMAT,
dateFormat,
} from '../../../../RN-UI-LIB/src/utlis/dates';
import { sanitizeString } from '../../../components/utlis/commonFunctions';
import { getGoogleMapUrl, sanitizeString } from '../../../components/utlis/commonFunctions';
import { FIELD_FEEDBACKS, ICallingFeedback, IFeedback } from '../../../types/feedback.types';
import { Address as IAddress } from '../interface';
import MapIcon from '../../../../RN-UI-LIB/src/Icons/MapIcon';
@@ -42,9 +42,8 @@ const openGeolocation = (latitude: string, longitude: string) => {
latitude: latitude,
longitude: longitude,
});
if (!latitude || !longitude) return;
const geolocationUrl = `http://maps.google.com/?q=${latitude},${longitude}`;
const geolocationUrl = getGoogleMapUrl(latitude, longitude);
if (!geolocationUrl) return;
return Linking.openURL(geolocationUrl);
};