Skip to content

Commit 09c7822

Browse files
committed
Use latest gps data when reverse geocode fails
1 parent 26bb9d9 commit 09c7822

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/setup/backgroundLocationTrackingTask/index.native.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ async function updateStartAddress(gpsPoints: GPSPoint[][], isOffline: boolean) {
5252
// To avoid race conditions, we need to get the latest gpsDraftDetails, because reverse geocoding may even take a few seconds
5353
const gpsDraftDetailsPromiseResult = await OnyxUtils.get(ONYXKEYS.GPS_DRAFT_DETAILS).catch(() => undefined);
5454
const updatedGpsDraftDetails = gpsDraftDetailsPromiseResult ?? undefined;
55+
const updatedGpsPoints = updatedGpsDraftDetails ? getGpsPoints(updatedGpsDraftDetails) : gpsPoints;
5556

5657
if (address !== null) {
57-
setStartWaypointAddress({value: address, type: 'address'}, tripSegmentIndex, updatedGpsDraftDetails ? getGpsPoints(updatedGpsDraftDetails) : gpsPoints);
58-
return;
58+
setStartWaypointAddress({value: address, type: 'address'}, tripSegmentIndex, updatedGpsPoints);
59+
} else {
60+
setStartWaypointAddress({value: coordinatesToString({lat: startPoint.lat, long: startPoint.long}), type: 'coordinates'}, tripSegmentIndex, updatedGpsPoints);
5961
}
6062
}
6163

0 commit comments

Comments
 (0)