NTP-9276 | Nearby cases fix (#996)

This commit is contained in:
Mantri Ramkishor
2024-11-05 19:44:16 +05:30
committed by GitHub
4 changed files with 11 additions and 14 deletions

View File

@@ -134,8 +134,8 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
def VERSION_CODE = 209
def VERSION_NAME = "2.14.9"
def VERSION_CODE = 211
def VERSION_NAME = "2.14.11"
android {
ndkVersion rootProject.ext.ndkVersion

View File

@@ -1,7 +1,7 @@
{
"name": "AV_APP",
"version": "2.14.9",
"buildNumber": "209",
"version": "2.14.11",
"buildNumber": "211",
"private": true,
"scripts": {
"android:dev": "yarn move:dev && react-native run-android",

View File

@@ -1,6 +1,6 @@
import { CLICKSTREAM_EVENT_NAMES } from '@common/Constants';
import { getDistanceFromLatLonInKm, isFunction } from '@components/utlis/commonFunctions';
import { IGeoLocation } from '@interfaces/addressGeolocation.types';
import { IGeoLocation, IGeolocationCoordinate } from '@interfaces/addressGeolocation.types';
import { addClickstreamEvent } from '@services/clickstreamEventService';
import {
Address,
@@ -88,13 +88,9 @@ export const sectionListTranformData = (agentList: IReportee[]): ISectionListDat
return result;
};
export const getAddressLocation = (addresses: Address[] | undefined) => {
if (!addresses?.length) return null;
for (const address of addresses) {
if (address?.location?.latitude && address?.location?.longitude) {
return address.location;
}
export const getAddressLocation = (address?: IGeolocationCoordinate) => {
if(address?.latitude && address?.longitude) {
return address;
}
return null;
};
@@ -108,7 +104,7 @@ export const getNearByCases = (
let caseIds: Array<string> = [];
casesList?.forEach((pinnedId) => {
const caseDetail = caseDetails?.[pinnedId.caseReferenceId];
const addressLocation = getAddressLocation(caseDetail?.addresses);
const addressLocation = getAddressLocation(caseDetail?.addressLocation);
if (addressLocation) {
const distanceInKm = getDistanceFromLatLonInKm(addressLocation, deviceGeolocationCoordinate);
@@ -194,7 +190,7 @@ export const updateNearbyCasesListAndLocation = (
let caseIdsToDistancesFromCurrentLocationMap: Map<string, number> = new Map();
allCasesList?.forEach((pinnedId) => {
const caseDetail = caseDetails?.[pinnedId?.caseReferenceId] || {};
const addressLocation = getAddressLocation(caseDetail?.addresses);
const addressLocation = getAddressLocation(caseDetail?.addressLocation);
if (addressLocation) {
const distanceInKm = getDistanceFromLatLonInKm(
addressLocation,

View File

@@ -286,6 +286,7 @@ export interface CaseDetail {
dpdBucket: string;
dpdCycle: string;
addresses?: Address[];
addressLocation?: IGeolocationCoordinate;
currentAllocationReferenceId: string;
customerReferenceId: string;
caseViewCreatedAt?: number;