Merge pull request #422 from medici/feat/tp-29438
maps navigation URl change TP-29438
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user