@@ -937,7 +937,7 @@ function initMoneyRequest({reportID, policy, isFromGlobalCreate, currentIouReque
937937 let requestCategory : string | null = null ;
938938
939939 // Add initial empty waypoints when starting a distance expense
940- if ( newIouRequestType === CONST . IOU . REQUEST_TYPE . DISTANCE ) {
940+ if ( newIouRequestType === CONST . IOU . REQUEST_TYPE . DISTANCE || newIouRequestType === CONST . IOU . REQUEST_TYPE . DISTANCE_MAP ) {
941941 comment . waypoints = {
942942 waypoint0 : { keyForList : 'start_waypoint' } ,
943943 waypoint1 : { keyForList : 'stop_waypoint' } ,
@@ -1020,6 +1020,20 @@ function startMoneyRequest(iouType: ValueOf<typeof CONST.IOU.TYPE>, reportID: st
10201020 }
10211021}
10221022
1023+ function startDistanceRequest ( iouType : ValueOf < typeof CONST . IOU . TYPE > , reportID : string , requestType ?: IOURequestType , skipConfirmation = false , backToReport ?: string ) {
1024+ clearMoneyRequest ( CONST . IOU . OPTIMISTIC_TRANSACTION_ID , skipConfirmation ) ;
1025+ switch ( requestType ) {
1026+ case CONST . IOU . REQUEST_TYPE . DISTANCE_MAP :
1027+ Navigation . navigate ( ROUTES . DISTANCE_REQUEST_CREATE_TAB_MAP . getRoute ( CONST . IOU . ACTION . CREATE , iouType , CONST . IOU . OPTIMISTIC_TRANSACTION_ID , reportID , backToReport ) ) ;
1028+ return ;
1029+ case CONST . IOU . REQUEST_TYPE . DISTANCE_MANUAL :
1030+ Navigation . navigate ( ROUTES . DISTANCE_REQUEST_CREATE_TAB_MANUAL . getRoute ( CONST . IOU . ACTION . CREATE , iouType , CONST . IOU . OPTIMISTIC_TRANSACTION_ID , reportID , backToReport ) ) ;
1031+ return ;
1032+ default :
1033+ Navigation . navigate ( ROUTES . DISTANCE_REQUEST_CREATE . getRoute ( CONST . IOU . ACTION . CREATE , iouType , CONST . IOU . OPTIMISTIC_TRANSACTION_ID , reportID , backToReport ) ) ;
1034+ }
1035+ }
1036+
10231037function setMoneyRequestAmount ( transactionID : string , amount : number , currency : string , shouldShowOriginalAmount = false ) {
10241038 Onyx . merge ( `${ ONYXKEYS . COLLECTION . TRANSACTION_DRAFT } ${ transactionID } ` , { amount, currency, shouldShowOriginalAmount} ) ;
10251039}
@@ -3355,7 +3369,8 @@ function getMoneyRequestInformation(moneyRequestInformation: MoneyRequestInforma
33553369 }
33563370
33573371 // STEP 3: Build an optimistic transaction with the receipt
3358- const isDistanceRequest = existingTransaction && existingTransaction . iouRequestType === CONST . IOU . REQUEST_TYPE . DISTANCE ;
3372+ const isDistanceRequest =
3373+ existingTransaction && ( existingTransaction . iouRequestType === CONST . IOU . REQUEST_TYPE . DISTANCE || existingTransaction . iouRequestType === CONST . IOU . REQUEST_TYPE . DISTANCE_MAP ) ;
33593374 let optimisticTransaction = buildOptimisticTransaction ( {
33603375 existingTransactionID,
33613376 existingTransaction,
@@ -12162,5 +12177,6 @@ export {
1216212177 updateSplitExpenseField ,
1216312178 reopenReport ,
1216412179 retractReport ,
12180+ startDistanceRequest ,
1216512181} ;
1216612182export type { GPSPoint as GpsPoint , IOURequestType , StartSplitBilActionParams , CreateTrackExpenseParams , RequestMoneyInformation , ReplaceReceipt } ;
0 commit comments