Skip to content
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

Skip confirmation page for Quick Actions #39413

Merged
merged 111 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
82a0f8c
set skip confirmation flag
Gonals Mar 26, 2024
a376116
add new params to handle skip
Gonals Mar 26, 2024
b08993e
changing branch
Gonals Mar 26, 2024
90f96da
Correctly set flag
Gonals Mar 26, 2024
d24012d
handle split
Gonals Mar 27, 2024
bd1f325
correctly set flag
Gonals Mar 27, 2024
33cba71
handle money request
Gonals Mar 27, 2024
63414c1
cleanup params
Gonals Mar 27, 2024
e964369
change branches
Gonals Mar 27, 2024
4d557c3
Merge branch 'main' into alberto-qabSkip
Gonals Mar 27, 2024
a3845e4
display correct button for send
Gonals Mar 27, 2024
39e4599
pass back payment method
Gonals Mar 27, 2024
cd8ee1d
wrap up send money
Gonals Mar 27, 2024
ca6d0ed
fix split
Gonals Mar 27, 2024
c5bafb2
changing branches
Gonals Mar 28, 2024
a8e58eb
Merge branch 'main' into alberto-qabSkip
Gonals Mar 28, 2024
dc656e0
Merge branch 'main' into alberto-qabSkip
Gonals Mar 29, 2024
2415362
conflicts
Gonals Apr 1, 2024
fea5996
remove console
Gonals Apr 1, 2024
2320f0a
handle distance requests
Gonals Apr 1, 2024
0ca3854
make distance work
Gonals Apr 1, 2024
5c7728b
handle splits
Gonals Apr 1, 2024
d0bd498
add params for receipt
Gonals Apr 2, 2024
c4465bc
more receipt handling
Gonals Apr 2, 2024
89ecee3
conflicts
Gonals Apr 3, 2024
e9d7d84
more fixes after merge main
Gonals Apr 3, 2024
0345b7d
set flag for task
Gonals Apr 3, 2024
3b7111c
wrap up task
Gonals Apr 3, 2024
6b9981f
add scan native
Gonals Apr 3, 2024
95bbf68
more scn native
Gonals Apr 3, 2024
80d0507
cleanup
Gonals Apr 3, 2024
7a23b4b
prettier
Gonals Apr 3, 2024
4350aaa
do not skip for manual workspace requests
Gonals Apr 3, 2024
53bde59
dont skip when categories are requires
Gonals Apr 3, 2024
b969e75
typescript
Gonals Apr 3, 2024
dc2216c
more typescript
Gonals Apr 3, 2024
98a4bad
lint
Gonals Apr 3, 2024
efe05a3
conflicts
Gonals Apr 4, 2024
724c833
more typescript
Gonals Apr 4, 2024
2575c8b
still typescript
Gonals Apr 4, 2024
f884c75
more typescript
Gonals Apr 4, 2024
43d5472
undo changes
Gonals Apr 4, 2024
6eb6b5b
use new onyx key
Gonals Apr 4, 2024
4200aaa
apply change to distance
Gonals Apr 4, 2024
2b6391e
apply changes to scan
Gonals Apr 4, 2024
d3496ee
prettier
Gonals Apr 4, 2024
86fb2c3
typing fixes
Gonals Apr 4, 2024
126a2d9
conflicts
Gonals Apr 4, 2024
c34e016
lint
Gonals Apr 4, 2024
9fa5802
remove extra param
Gonals Apr 4, 2024
af50329
Assign tax button update
Gonals Apr 4, 2024
0b5acd9
prettier
Gonals Apr 4, 2024
782f274
Display correct button if report is missing
Gonals Apr 4, 2024
a694117
go to user serlection if report is missing or archived
Gonals Apr 4, 2024
e9381e3
conflicts
Gonals Apr 8, 2024
3df8757
button style
Gonals Apr 8, 2024
07d22e3
pass payment method
Gonals Apr 8, 2024
356a8d5
remove extra param
Gonals Apr 8, 2024
c24fafc
prettier
Gonals Apr 8, 2024
a205dfb
conflicts
Gonals Apr 9, 2024
d573e25
typescript
Gonals Apr 9, 2024
fab20c2
lint
Gonals Apr 9, 2024
2a7b093
lint
Gonals Apr 9, 2024
b9b50ec
conflicts
Gonals Apr 10, 2024
fd74ff7
Merge branch 'main' into alberto-qabSkip
Gonals Apr 10, 2024
9adfcc3
Merge branch 'main' into alberto-qabSkip
Gonals Apr 11, 2024
b66a6b1
merge tons of conflicts
Gonals Apr 11, 2024
b12e867
better props
Gonals Apr 11, 2024
eca86e5
more props fixes
Gonals Apr 11, 2024
5e7ee15
typescript
Gonals Apr 11, 2024
4d090e7
prettier
Gonals Apr 11, 2024
af7c219
more typescript
Gonals Apr 11, 2024
0d451cc
types and bools
Gonals Apr 11, 2024
0c55b21
still fighting Typescript
Gonals Apr 11, 2024
0cb3f1f
add receipt type
Gonals Apr 11, 2024
699e93b
fix split flow
Gonals Apr 11, 2024
2df54af
typo
Gonals Apr 11, 2024
06b604f
add policy to props
Gonals Apr 11, 2024
10d7e3e
more onyx props fixes
Gonals Apr 11, 2024
76f0050
hopefully last one
Gonals Apr 11, 2024
d743b8f
lint
Gonals Apr 11, 2024
dcf1f68
import fixes
Gonals Apr 11, 2024
aeb636f
typoo
Gonals Apr 11, 2024
b0f5119
Merge branch 'main' into alberto-qabSkip
Gonals Apr 12, 2024
80961f4
Fix split
Gonals Apr 12, 2024
4ee284b
prettier
Gonals Apr 12, 2024
7c4897f
shorthand
Gonals Apr 12, 2024
4137caa
MORE conflicts
Gonals Apr 15, 2024
e355f28
first typescript cleanup round
Gonals Apr 15, 2024
860600c
prettier
Gonals Apr 15, 2024
d6e4090
lint
Gonals Apr 15, 2024
4b29f37
hopefully final cleanup
Gonals Apr 15, 2024
566b057
fix skip distance
Gonals Apr 15, 2024
e0d4bda
more conflicts
Gonals Apr 16, 2024
aaf715f
Merge branch 'main' into alberto-qabSkip
Gonals Apr 16, 2024
cf99ea3
do not skip for track expenses (for now)
Gonals Apr 16, 2024
3eb8e34
remove uneeded param
Gonals Apr 16, 2024
84f8974
remove lint exceptions
Gonals Apr 16, 2024
d4905aa
readd them
Gonals Apr 16, 2024
d8f364a
add param type
Gonals Apr 16, 2024
575cdf7
removing last change
Gonals Apr 16, 2024
8bd923b
conflicts
Gonals Apr 16, 2024
d21fee6
conflicts
Gonals Apr 18, 2024
35798b9
Add label
Gonals Apr 18, 2024
af29274
fix conflict issue
Gonals Apr 18, 2024
d89c34c
undo last change. I was wrong
Gonals Apr 18, 2024
68b1ede
Update button copy
Gonals Apr 18, 2024
4ae3c5d
better buttons
Gonals Apr 18, 2024
6379702
lint
Gonals Apr 18, 2024
aa3a0cd
dependencies
Gonals Apr 18, 2024
1da8fd1
conflicts
Gonals Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ const ONYXKEYS = {
TRANSACTION: 'transactions_',
TRANSACTION_VIOLATIONS: 'transactionViolations_',
TRANSACTION_DRAFT: 'transactionsDraft_',

// Holds temporary transactions used during the creation and edit flow
SKIP_CONFIRMATION: 'skipConfirmation_',
TRANSACTION_BACKUP: 'transactionsBackup_',
SPLIT_TRANSACTION_DRAFT: 'splitTransactionDraft_',
PRIVATE_NOTES_DRAFT: 'privateNotesDraft_',
Expand Down Expand Up @@ -546,6 +545,7 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.SECURITY_GROUP]: OnyxTypes.SecurityGroup;
[ONYXKEYS.COLLECTION.TRANSACTION]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.TRANSACTION_DRAFT]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.SKIP_CONFIRMATION]: boolean;
Gonals marked this conversation as resolved.
Show resolved Hide resolved
[ONYXKEYS.COLLECTION.TRANSACTION_BACKUP]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS]: OnyxTypes.TransactionViolations;
[ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT]: OnyxTypes.Transaction;
Expand Down
18 changes: 11 additions & 7 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ function getReportPreviewAction(chatReportID: string, iouReportID: string): Onyx
* @param policy
* @param isFromGlobalCreate
* @param iouRequestType one of manual/scan/distance
* @param skipConfirmation if true, skip confirmation step
*/
function initMoneyRequest(reportID: string, policy: OnyxEntry<OnyxTypes.Policy>, isFromGlobalCreate: boolean, iouRequestType: IOURequestType = CONST.IOU.REQUEST_TYPE.MANUAL) {
// Generate a brand new transactionID
Expand Down Expand Up @@ -351,7 +352,8 @@ function createDraftTransaction(transaction: OnyxTypes.Transaction) {
Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transaction.transactionID}`, newTransaction);
}

function clearMoneyRequest(transactionID: string) {
function clearMoneyRequest(transactionID: string, skipConfirmation = false) {
Gonals marked this conversation as resolved.
Show resolved Hide resolved
Onyx.set(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`, skipConfirmation);
Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, null);
}

Expand All @@ -378,8 +380,8 @@ function updateMoneyRequestTypeParams(routes: StackNavigationState<ParamListBase
}

// eslint-disable-next-line @typescript-eslint/naming-convention
function startMoneyRequest(iouType: IOUType, reportID: string, requestType?: IOURequestType) {
clearMoneyRequest(CONST.IOU.OPTIMISTIC_TRANSACTION_ID);
function startMoneyRequest(iouType: ValueOf<typeof CONST.IOU.TYPE>, reportID: string, requestType?: IOURequestType, skipConfirmation = false) {
Gonals marked this conversation as resolved.
Show resolved Hide resolved
clearMoneyRequest(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, skipConfirmation);
switch (requestType) {
case CONST.IOU.REQUEST_TYPE.MANUAL:
Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE_TAB_MANUAL.getRoute(CONST.IOU.ACTION.CREATE, iouType, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, reportID));
Expand Down Expand Up @@ -1720,9 +1722,9 @@ function createDistanceRequest(
merchant: string,
billable: boolean | undefined,
validWaypoints: WaypointCollection,
policy: OnyxEntry<OnyxTypes.Policy>,
policyTagList: OnyxEntry<OnyxTypes.PolicyTagList>,
policyCategories: OnyxEntry<OnyxTypes.PolicyCategories>,
policy?: OnyxEntry<OnyxTypes.Policy>,
policyTagList?: OnyxEntry<OnyxTypes.PolicyTagList>,
policyCategories?: OnyxEntry<OnyxTypes.PolicyCategories>,
Gonals marked this conversation as resolved.
Show resolved Hide resolved
) {
// If the report is an iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function
const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report);
Expand Down Expand Up @@ -5799,7 +5801,7 @@ function replaceReceipt(transactionID: string, file: File, source: string) {
* @param transactionID of the transaction to set the participants of
* @param report attached to the transaction
*/
function setMoneyRequestParticipantsFromReport(transactionID: string, report: OnyxEntry<OnyxTypes.Report>) {
function setMoneyRequestParticipantsFromReport(transactionID: string, report: OnyxEntry<OnyxTypes.Report>): Participant[] {
// If the report is iou or expense report, we should get the chat report to set participant for expense
const chatReport = ReportUtils.isMoneyRequestReport(report) ? ReportUtils.getReport(report?.chatReportID) : report;
const currentUserAccountID = currentUserPersonalDetails.accountID;
Expand All @@ -5810,6 +5812,8 @@ function setMoneyRequestParticipantsFromReport(transactionID: string, report: On
: (chatReport?.participantAccountIDs ?? []).filter((accountID) => currentUserAccountID !== accountID).map((accountID) => ({accountID, selected: true}));

Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {participants, participantsAutoAssigned: true});

return participants;
}

function setMoneyRequestId(id: string) {
Expand Down
12 changes: 8 additions & 4 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ Onyx.connect({
/**
* Clears out the task info from the store
*/
function clearOutTaskInfo() {
Onyx.set(ONYXKEYS.TASK, null);
function clearOutTaskInfo(skipConfirmation = false) {
Gonals marked this conversation as resolved.
Show resolved Hide resolved
if (skipConfirmation) {
Onyx.set(ONYXKEYS.TASK, {skipConfirmation: true});
pecanoro marked this conversation as resolved.
Show resolved Hide resolved
} else {
Onyx.set(ONYXKEYS.TASK, null);
}
}

/**
Expand Down Expand Up @@ -724,8 +728,8 @@ function setParentReportID(parentReportID: string) {
/**
* Clears out the task info from the store and navigates to the NewTaskDetails page
*/
function clearOutTaskInfoAndNavigate(reportID?: string, chatReport?: OnyxEntry<OnyxTypes.Report>, accountID = 0) {
clearOutTaskInfo();
function clearOutTaskInfoAndNavigate(reportID?: string, chatReport?: OnyxEntry<OnyxTypes.Report>, accountID = 0, skipConfirmation = false) {
Gonals marked this conversation as resolved.
Show resolved Hide resolved
clearOutTaskInfo(skipConfirmation);
if (reportID && reportID !== '0') {
setParentReportID(reportID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,28 +158,28 @@ function FloatingActionButtonAndPopover(
const navigateToQuickAction = () => {
switch (quickAction?.action) {
case CONST.QUICK_ACTIONS.REQUEST_MANUAL:
IOU.startMoneyRequest(CONST.IOU.TYPE.REQUEST, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.MANUAL);
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.REQUEST, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.MANUAL, true);
return;
case CONST.QUICK_ACTIONS.REQUEST_SCAN:
IOU.startMoneyRequest(CONST.IOU.TYPE.REQUEST, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.SCAN);
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.REQUEST, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.SCAN, true);
return;
case CONST.QUICK_ACTIONS.REQUEST_DISTANCE:
IOU.startMoneyRequest(CONST.IOU.TYPE.REQUEST, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.DISTANCE);
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.REQUEST, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.DISTANCE, true);
return;
case CONST.QUICK_ACTIONS.SPLIT_MANUAL:
IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.MANUAL);
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.MANUAL, true);
return;
case CONST.QUICK_ACTIONS.SPLIT_SCAN:
IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.SCAN);
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.SCAN, true);
return;
case CONST.QUICK_ACTIONS.SPLIT_DISTANCE:
IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.DISTANCE);
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.DISTANCE, true);
return;
case CONST.QUICK_ACTIONS.SEND_MONEY:
IOU.startMoneyRequest(CONST.IOU.TYPE.SEND, quickAction?.chatReportID ?? '');
break;
IOU.startMoneyRequest(CONST.IOU.TYPE.SEND, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.MANUAL, true);
return;
case CONST.QUICK_ACTIONS.ASSIGN_TASK:
Task.clearOutTaskInfoAndNavigate(quickAction?.chatReportID, quickActionReport, quickAction.targetAccountID ?? 0);
Task.clearOutTaskInfoAndNavigate(quickAction?.chatReportID ?? '', quickActionReport, quickAction.targetAccountID ?? 0, true);
break;
case CONST.QUICK_ACTIONS.TRACK_MANUAL:
IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK_EXPENSE, quickAction?.chatReportID ?? '', CONST.IOU.REQUEST_TYPE.MANUAL);
Expand Down
Loading
Loading