-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA][Manual distance] Add quick action support for manual distance #69390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4ddd8fa
feat: add quick action support for manual distance
dominictb c4c5684
Merge branch 'feat/64849-2' of github.com-dominictb:dominictb/epsf-ap…
dominictb bcad481
Merge branch 'main' of github.com-dominictb:dominictb/epsf-app into f…
dominictb d9e06bc
Merge branch 'main' of github.com-dominictb:dominictb/epsf-app into f…
dominictb d98c088
feat: decide map or manual request type based on lastDistanceExpenseT…
dominictb 3a7e0f5
remove redundant changes
dominictb b15a0a2
suppor track case
dominictb 9f19ce2
Merge branch 'main' of github.com-dominictb:dominictb/epsf-app into f…
dominictb 6c0ce0a
use isMapDistanceRequest util
dominictb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,12 +1,25 @@ | ||||
| import {generateReportID} from '@libs/ReportUtils'; | ||||
| import CONST from '@src/CONST'; | ||||
| import type {DistanceExpenseType} from '@src/types/onyx/IOU'; | ||||
| import type {QuickActionName} from '@src/types/onyx/QuickAction'; | ||||
| import type QuickAction from '@src/types/onyx/QuickAction'; | ||||
| import type {IOURequestType} from './IOU'; | ||||
| import {startDistanceRequest, startMoneyRequest} from './IOU'; | ||||
| import {startOutCreateTaskQuickAction} from './Task'; | ||||
|
|
||||
| function getQuickActionRequestType(action: QuickActionName | undefined): IOURequestType | undefined { | ||||
| type NavigateToQuickActionParams = { | ||||
| isValidReport: boolean; | ||||
| quickAction: QuickAction; | ||||
| selectOption: (onSelected: () => void, shouldRestrictAction: boolean) => void; | ||||
| isManualDistanceTrackingEnabled?: boolean; | ||||
| lastDistanceExpenseType?: DistanceExpenseType; | ||||
| }; | ||||
|
|
||||
| function getQuickActionRequestType( | ||||
| action: QuickActionName | undefined, | ||||
| lastDistanceExpenseType?: DistanceExpenseType, | ||||
| isManualDistanceTrackingEnabled?: boolean, | ||||
|
Comment on lines
+19
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm... I think it would be better to add these as a object.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's already an object parameter:
|
||||
| ): IOURequestType | undefined { | ||||
| if (!action) { | ||||
| return; | ||||
| } | ||||
|
|
@@ -17,22 +30,22 @@ function getQuickActionRequestType(action: QuickActionName | undefined): IOURequ | |||
| } else if ([CONST.QUICK_ACTIONS.REQUEST_SCAN, CONST.QUICK_ACTIONS.SPLIT_SCAN, CONST.QUICK_ACTIONS.TRACK_SCAN].some((a) => a === action)) { | ||||
| requestType = CONST.IOU.REQUEST_TYPE.SCAN; | ||||
| } else if ([CONST.QUICK_ACTIONS.REQUEST_DISTANCE, CONST.QUICK_ACTIONS.SPLIT_DISTANCE, CONST.QUICK_ACTIONS.TRACK_DISTANCE].some((a) => a === action)) { | ||||
| requestType = CONST.IOU.REQUEST_TYPE.DISTANCE; | ||||
| if (isManualDistanceTrackingEnabled) { | ||||
| requestType = lastDistanceExpenseType ?? CONST.IOU.REQUEST_TYPE.DISTANCE_MAP; | ||||
| } else { | ||||
| requestType = CONST.IOU.REQUEST_TYPE.DISTANCE; | ||||
| } | ||||
| } else if (action === CONST.QUICK_ACTIONS.PER_DIEM) { | ||||
| requestType = CONST.IOU.REQUEST_TYPE.PER_DIEM; | ||||
| } | ||||
|
|
||||
| return requestType; | ||||
| } | ||||
|
|
||||
| function navigateToQuickAction( | ||||
| isValidReport: boolean, | ||||
| quickAction: QuickAction, | ||||
| selectOption: (onSelected: () => void, shouldRestrictAction: boolean) => void, | ||||
| isManualDistanceTrackingEnabled?: boolean, | ||||
| ) { | ||||
| function navigateToQuickAction(params: NavigateToQuickActionParams) { | ||||
| const {isValidReport, quickAction, selectOption, isManualDistanceTrackingEnabled, lastDistanceExpenseType} = params; | ||||
| const reportID = isValidReport && quickAction?.chatReportID ? quickAction?.chatReportID : generateReportID(); | ||||
| const requestType = getQuickActionRequestType(quickAction?.action); | ||||
| const requestType = getQuickActionRequestType(quickAction?.action, lastDistanceExpenseType, isManualDistanceTrackingEnabled); | ||||
|
|
||||
| switch (quickAction?.action) { | ||||
| case CONST.QUICK_ACTIONS.REQUEST_MANUAL: | ||||
|
|
||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: We only need to set this value when IOU request type is manual since map is the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really important though, and maybe this is more clear