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..58becee852af --- /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<{ + /** Latitude */ + lat: number; + /** Longitude */ + long: number; + }>; + + /** 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 */ + 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,