-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[A/B Testing - Create Expense] Implement Create Expense Flow under hidden Beta #49007
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
grgia
merged 28 commits into
Expensify:main
from
fabioh8010:feature/combined-expense-flow-48787
Oct 1, 2024
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
3e0f77d
Add "Create Expense" item to Global Create menu
fabioh8010 96da7f1
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 ecbf217
Update getIconForAction() to account for create IOU type
fabioh8010 a04f4e4
Add create iou type to isValidMoneyRequestType() and delete temporary…
fabioh8010 80acc3b
Change canCreateRequest() to include create iou type if combined expe…
fabioh8010 dbe07eb
Add tab title for create iou type in IOURequestStartPage
fabioh8010 18f9585
Merge remote-tracking branch 'origin/main' into feature/combined-expe…
fabioh8010 67cb211
Navigate the user to participants page if they are using the combined…
fabioh8010 63aa38b
Add Track expense button to IOU participants page
fabioh8010 6b17906
Fix TS error
fabioh8010 093b947
Merge remote-tracking branch 'origin/main' into feature/combined-expe…
fabioh8010 d7f4032
Fix TS
fabioh8010 2eed579
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 2481082
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 5f21f65
Merge remote-tracking branch 'origin/main' into feature/combined-expe…
fabioh8010 ee62f9b
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 d58595c
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 575e4e6
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 8148fc1
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 c0c9d5e
Fix issue when submitting expense
fabioh8010 426599e
Fix ReportWelcomeText
fabioh8010 34b0536
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 539cf1d
Revert findSelfDMReportID change
fabioh8010 3c1f65f
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 5e52ce1
Add logic to only display track button if user has a self DM
fabioh8010 17b07c8
Merge branch 'main' into feature/combined-expense-flow-48787
fabioh8010 fcd7690
Rename GLOBAL_CREATE to CREATE
fabioh8010 fdf3949
Use allBetas from ReportUtils
fabioh8010 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
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
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 |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import {useOnyx, withOnyx} from 'react-native-onyx'; | |
| import type {SvgProps} from 'react-native-svg'; | ||
| import FloatingActionButton from '@components/FloatingActionButton'; | ||
| import * as Expensicons from '@components/Icon/Expensicons'; | ||
| import type {PopoverMenuItem} from '@components/PopoverMenu'; | ||
| import PopoverMenu from '@components/PopoverMenu'; | ||
| import Text from '@components/Text'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
|
|
@@ -186,7 +187,7 @@ function FloatingActionButtonAndPopover( | |
| const prevIsFocused = usePrevious(isFocused); | ||
| const {isOffline} = useNetwork(); | ||
|
|
||
| const {canUseSpotnanaTravel} = usePermissions(); | ||
| const {canUseSpotnanaTravel, canUseCombinedTrackSubmit} = usePermissions(); | ||
| const canSendInvoice = useMemo(() => PolicyUtils.canSendInvoice(allPolicies as OnyxCollection<OnyxTypes.Policy>, session?.email), [allPolicies, session?.email]); | ||
|
|
||
| const quickActionAvatars = useMemo(() => { | ||
|
|
@@ -348,9 +349,70 @@ function FloatingActionButtonAndPopover( | |
| showCreateMenu(); | ||
| } | ||
| }; | ||
|
|
||
| // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps | ||
| const selfDMReportID = useMemo(() => ReportUtils.findSelfDMReportID(), [isLoading]); | ||
|
|
||
| const expenseMenuItems = useMemo((): PopoverMenuItem[] => { | ||
| if (canUseCombinedTrackSubmit) { | ||
| return [ | ||
| { | ||
| icon: getIconForAction(CONST.IOU.TYPE.CREATE), | ||
| text: translate('iou.createExpense'), | ||
| onSelected: () => | ||
| interceptAnonymousUser(() => | ||
| IOU.startMoneyRequest( | ||
| CONST.IOU.TYPE.CREATE, | ||
| // When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used | ||
| // for all of the routes in the creation flow. | ||
| ReportUtils.generateReportID(), | ||
| ), | ||
| ), | ||
| }, | ||
| ]; | ||
| } | ||
|
|
||
| return [ | ||
| ...(selfDMReportID | ||
| ? [ | ||
| { | ||
| icon: getIconForAction(CONST.IOU.TYPE.TRACK), | ||
| text: translate('iou.trackExpense'), | ||
| onSelected: () => { | ||
| interceptAnonymousUser(() => | ||
| IOU.startMoneyRequest( | ||
| CONST.IOU.TYPE.TRACK, | ||
| // When starting to create a track expense from the global FAB, we need to retrieve selfDM reportID. | ||
| // If it doesn't exist, we generate a random optimistic reportID and use it for all of the routes in the creation flow. | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| ReportUtils.findSelfDMReportID() || ReportUtils.generateReportID(), | ||
| ), | ||
| ); | ||
| if (!hasSeenTrackTraining && !isOffline) { | ||
| setTimeout(() => { | ||
| Navigation.navigate(ROUTES.TRACK_TRAINING_MODAL); | ||
| }, CONST.ANIMATED_TRANSITION); | ||
| } | ||
| }, | ||
| }, | ||
| ] | ||
| : []), | ||
| { | ||
| icon: getIconForAction(CONST.IOU.TYPE.REQUEST), | ||
| text: translate('iou.submitExpense'), | ||
| onSelected: () => | ||
| interceptAnonymousUser(() => | ||
| IOU.startMoneyRequest( | ||
| CONST.IOU.TYPE.SUBMIT, | ||
| // When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used | ||
| // for all of the routes in the creation flow. | ||
| ReportUtils.generateReportID(), | ||
| ), | ||
| ), | ||
| }, | ||
| ]; | ||
| }, [canUseCombinedTrackSubmit, translate, selfDMReportID, hasSeenTrackTraining, isOffline]); | ||
|
|
||
| return ( | ||
| <View style={styles.flexGrow1}> | ||
| <PopoverMenu | ||
|
|
@@ -365,43 +427,7 @@ function FloatingActionButtonAndPopover( | |
| text: translate('sidebarScreen.fabNewChat'), | ||
| onSelected: () => interceptAnonymousUser(Report.startNewChat), | ||
| }, | ||
| ...(selfDMReportID | ||
| ? [ | ||
| { | ||
| icon: getIconForAction(CONST.IOU.TYPE.TRACK), | ||
| text: translate('iou.trackExpense'), | ||
|
Comment on lines
-368
to
-372
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. Where did you move this logic?
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. I moved to a variable called |
||
| onSelected: () => { | ||
| interceptAnonymousUser(() => | ||
| IOU.startMoneyRequest( | ||
| CONST.IOU.TYPE.TRACK, | ||
| // When starting to create a track expense from the global FAB, we need to retrieve selfDM reportID. | ||
| // If it doesn't exist, we generate a random optimistic reportID and use it for all of the routes in the creation flow. | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| ReportUtils.findSelfDMReportID() || ReportUtils.generateReportID(), | ||
| ), | ||
| ); | ||
| if (!hasSeenTrackTraining && !isOffline) { | ||
| setTimeout(() => { | ||
| Navigation.navigate(ROUTES.TRACK_TRAINING_MODAL); | ||
| }, CONST.ANIMATED_TRANSITION); | ||
| } | ||
| }, | ||
| }, | ||
| ] | ||
| : []), | ||
| { | ||
| icon: getIconForAction(CONST.IOU.TYPE.REQUEST), | ||
| text: translate('iou.submitExpense'), | ||
| onSelected: () => | ||
| interceptAnonymousUser(() => | ||
| IOU.startMoneyRequest( | ||
| CONST.IOU.TYPE.SUBMIT, | ||
| // When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used | ||
| // for all of the routes in the creation flow. | ||
| ReportUtils.generateReportID(), | ||
| ), | ||
| ), | ||
| }, | ||
| ...expenseMenuItems, | ||
| ...(canSendInvoice | ||
| ? [ | ||
| { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.