From 30e721579d733a017a330b58de8c89e51e6c4b21 Mon Sep 17 00:00:00 2001 From: GCyganek Date: Wed, 10 Dec 2025 16:06:57 +0100 Subject: [PATCH 1/2] Add GPS key to Onyx --- src/ONYXKEYS.ts | 4 ++++ src/types/onyx/GpsDraftDetails.ts | 36 +++++++++++++++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 src/types/onyx/GpsDraftDetails.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index f800cb6f5b41..e239451b06f3 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -83,6 +83,9 @@ const ONYXKEYS = { */ PERSONAL_DETAILS_METADATA: 'personalDetailsMetadata', + /** GPS points stored for the GPS distance expense before they're accepted by the user */ + GPS_DRAFT_DETAILS: 'gpsDraftDetails', + /** Contains all the info for Tasks */ TASK: 'task', @@ -1135,6 +1138,7 @@ type OnyxValuesMapping = { [ONYXKEYS.STASHED_CREDENTIALS]: OnyxTypes.Credentials; [ONYXKEYS.MODAL]: OnyxTypes.Modal; [ONYXKEYS.IS_OPEN_APP_FAILURE_MODAL_OPEN]: boolean; + [ONYXKEYS.GPS_DRAFT_DETAILS]: OnyxTypes.GpsDraftDetails; [ONYXKEYS.FULLSCREEN_VISIBILITY]: boolean; [ONYXKEYS.NETWORK]: OnyxTypes.Network; [ONYXKEYS.NEW_GROUP_CHAT_DRAFT]: OnyxTypes.NewGroupChatDraft; diff --git a/src/types/onyx/GpsDraftDetails.ts b/src/types/onyx/GpsDraftDetails.ts new file mode 100644 index 000000000000..9889162ed4f3 --- /dev/null +++ b/src/types/onyx/GpsDraftDetails.ts @@ -0,0 +1,36 @@ +/** + * Stores data from GPS trip (GPS distance request) + */ +type GpsDraftDetails = { + /** Captured GPS points */ + gpsPoints: Array<{ + /** Longitude */ + lat: number; + /** Latitude */ + long: number; + }>; + + /** Distance between all consecutive points from gpsPoints in meters */ + distanceInMeters: number; + + /** Start address derived from coordinates of the first point from gpsPoints */ + startAddress: { + /** Start address string shown to the user */ + value: string; + /** Is start address value a human readable address or stringified coordinates */ + type: 'coordinates' | 'address'; + }; + + /** End address derived from coordinates of the last point from gpsPoints */ + endAddress: { + /** End address string shown to the user */ + value: string; + /** Is end address value a human readable address or stringified coordinates */ + type: 'coordinates' | 'address'; + }; + + /** Is GPS trip in progress */ + isTracking: boolean; +}; + +export default GpsDraftDetails; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index fd9f07829025..a1e57eebd55e 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -40,6 +40,7 @@ import type ExportTemplate from './ExportTemplate'; import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import type {FundList} from './Fund'; import type Fund from './Fund'; +import type GpsDraftDetails from './GpsDraftDetails'; import type HybridApp from './HybridApp'; import type ImportedSpreadsheet from './ImportedSpreadsheet'; import type ImportedSpreadsheetMemberData from './ImportedSpreadsheetMemberData'; @@ -165,6 +166,7 @@ export type { Fund, FundID, FundList, + GpsDraftDetails, IntroSelected, IssueNewCard, AddNewCompanyCardFeed, From 503b19cf7ccea779428290198d25d695787edad7 Mon Sep 17 00:00:00 2001 From: GCyganek Date: Thu, 11 Dec 2025 15:59:15 +0100 Subject: [PATCH 2/2] Fix comments --- src/types/onyx/GpsDraftDetails.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types/onyx/GpsDraftDetails.ts b/src/types/onyx/GpsDraftDetails.ts index 9889162ed4f3..58becee852af 100644 --- a/src/types/onyx/GpsDraftDetails.ts +++ b/src/types/onyx/GpsDraftDetails.ts @@ -4,13 +4,13 @@ type GpsDraftDetails = { /** Captured GPS points */ gpsPoints: Array<{ - /** Longitude */ - lat: number; /** Latitude */ + lat: number; + /** Longitude */ long: number; }>; - /** Distance between all consecutive points from gpsPoints in meters */ + /** Sum of geodesic distances between all consecutive points from gpsPoints in meters */ distanceInMeters: number; /** Start address derived from coordinates of the first point from gpsPoints */