From aebf5c39870a5e5a66d345bdc5d9c87d8d8e82ee Mon Sep 17 00:00:00 2001 From: Samil Abud Date: Mon, 27 May 2024 20:35:34 -0400 Subject: [PATCH 001/724] Fixed Desktop - Task - Error occurs when update long content for task description for second time --- src/libs/actions/Task.ts | 2 +- src/pages/tasks/TaskDescriptionPage.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index 1d4415f72f4b..41dab874b495 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -435,7 +435,7 @@ function reopenTask(taskReport: OnyxEntry) { function editTask(report: OnyxTypes.Report, {title, description}: OnyxTypes.Task) { // Create the EditedReportAction on the task const editTaskReportAction = ReportUtils.buildOptimisticEditedTaskFieldReportAction({title, description}); - + console.log({editTaskReportAction, len: description?.length}); // Sometimes title or description is undefined, so we need to check for that, and we provide it to multiple functions const reportName = (title ?? report?.reportName)?.trim(); diff --git a/src/pages/tasks/TaskDescriptionPage.tsx b/src/pages/tasks/TaskDescriptionPage.tsx index c48746c81239..7abfaee4d2dd 100644 --- a/src/pages/tasks/TaskDescriptionPage.tsx +++ b/src/pages/tasks/TaskDescriptionPage.tsx @@ -37,9 +37,10 @@ function TaskDescriptionPage({report, currentUserPersonalDetails}: TaskDescripti const validate = useCallback((values: FormOnyxValues): FormInputErrors => { const errors = {}; + const parsedDescription = ReportUtils.getParsedComment(values?.description); - if (values?.description && values.description?.length > CONST.DESCRIPTION_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'description', ['common.error.characterLimitExceedCounter', {length: values.description.length, limit: CONST.DESCRIPTION_LIMIT}]); + if (parsedDescription && parsedDescription?.length > CONST.DESCRIPTION_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'description', ['common.error.characterLimitExceedCounter', {length: parsedDescription.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; From 49691ca8095d8c4cc47016631b9e1e31c0899e88 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 5 Jun 2024 01:12:45 +0530 Subject: [PATCH 002/724] Associate crashes with user info --- src/Expensify.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index ddc4b5f88a69..3e07c47463a0 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -37,6 +37,7 @@ import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/Popo import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu'; import type {Route} from './ROUTES'; import type {ScreenShareRequest, Session} from './types/onyx'; +import crashlytics from "@react-native-firebase/crashlytics"; Onyx.registerLogger(({level, message}) => { if (level === 'alert') { @@ -216,6 +217,13 @@ function Expensify({ Audio.setAudioModeAsync({playsInSilentModeIOS: true}); }, []); + useEffect(() => { + if (!isAuthenticated) { + return + } + crashlytics().setUserId(Number(session?.accountID).toString()) + }, [isAuthenticated, session?.accountID]) + // Display a blank page until the onyx migration completes if (!isOnyxMigrated) { return null; From c68d70742cfabb299c0233a9bbdea3e4b87a45cf Mon Sep 17 00:00:00 2001 From: Samil Abud Date: Tue, 4 Jun 2024 21:09:07 -0400 Subject: [PATCH 003/724] Fixed eslint issue --- src/libs/actions/Task.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index 063ec053838d..a774a4052980 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -434,7 +434,6 @@ function reopenTask(taskReport: OnyxEntry) { function editTask(report: OnyxTypes.Report, {title, description}: OnyxTypes.Task) { // Create the EditedReportAction on the task const editTaskReportAction = ReportUtils.buildOptimisticEditedTaskFieldReportAction({title, description}); - console.log({editTaskReportAction, len: description?.length}); // Sometimes title or description is undefined, so we need to check for that, and we provide it to multiple functions const reportName = (title ?? report?.reportName)?.trim(); From 5023b92feb26a21a114438cdc55363dd81bf04b0 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 6 Jun 2024 16:04:13 +0700 Subject: [PATCH 004/724] fix: app goes back to confirmation page from category page --- src/ROUTES.ts | 4 ++-- src/libs/Navigation/types.ts | 1 + src/libs/ReportUtils.ts | 2 +- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 5a8f4a2cd4d0..622106bdb01c 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -346,8 +346,8 @@ const ROUTES = { }, MONEY_REQUEST_STEP_CONFIRMATION: { route: ':action/:iouType/confirmation/:transactionID/:reportID', - getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string) => - `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}` as const, + getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, participantsAutoAssigned?: boolean) => + `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}${participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''}` as const, }, MONEY_REQUEST_STEP_AMOUNT: { route: ':action/:iouType/amount/:transactionID/:reportID', diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 2267d2d38fb7..d4de39b993de 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -613,6 +613,7 @@ type MoneyRequestNavigatorParamList = { reportID: string; pageIndex?: string; backTo?: string; + participantsAutoAssigned?: string; }; [SCREENS.MONEY_REQUEST.STEP_SCAN]: { action: IOUAction; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index b128c6cf9153..73bcbc17769b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6728,7 +6728,7 @@ function createDraftWorkspaceAndNavigateToConfirmationScreen(transactionID: stri searchText: policyName, }, ]); - const iouConfirmationPageRoute = ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID); + const iouConfirmationPageRoute = ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, true); if (isCategorizing) { Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, iouConfirmationPageRoute)); } else { diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 939589598701..89afd72bd17e 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -65,7 +65,7 @@ function IOURequestStepConfirmation({ report: reportReal, reportDraft, route: { - params: {iouType, reportID, transactionID, action}, + params: {iouType, reportID, transactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute}, }, transaction, }: IOURequestStepConfirmationProps) { @@ -186,12 +186,12 @@ function IOURequestStepConfirmation({ const navigateBack = useCallback(() => { // If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken // back to the participants step - if (!transaction?.participantsAutoAssigned) { + if (!transaction?.participantsAutoAssigned && participantsAutoAssignedFromRoute !== 'true') { Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, reportID, undefined, action)); return; } IOUUtils.navigateToStartMoneyRequestStep(requestType, iouType, transactionID, reportID, action); - }, [transaction, iouType, requestType, transactionID, reportID, action]); + }, [transaction, iouType, requestType, transactionID, reportID, action, participantsAutoAssignedFromRoute]); const navigateToAddReceipt = useCallback(() => { Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams())); From 57422f82763c119375a43b04560040aeb2c170e8 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 6 Jun 2024 16:31:23 +0700 Subject: [PATCH 005/724] fix in category page --- src/libs/ReportUtils.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 73bcbc17769b..4389bc205f36 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6728,11 +6728,10 @@ function createDraftWorkspaceAndNavigateToConfirmationScreen(transactionID: stri searchText: policyName, }, ]); - const iouConfirmationPageRoute = ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, true); if (isCategorizing) { - Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, iouConfirmationPageRoute)); + Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID)); } else { - Navigation.navigate(iouConfirmationPageRoute); + Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, true)); } } From e7c695047e1114c5d61f6df7cb99c6d4894c5d36 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:44:39 +0530 Subject: [PATCH 006/724] Update --- src/Expensify.tsx | 7 ++---- src/components/TestToolMenu.tsx | 22 +++++++++++++++++-- src/libs/setCrashlyticsUserId/index.native.ts | 11 ++++++++++ src/libs/setCrashlyticsUserId/index.ts | 4 ++++ src/libs/setCrashlyticsUserId/types.ts | 6 +++++ src/libs/testCrash/index.native.ts | 6 +++++ src/libs/testCrash/index.ts | 2 ++ 7 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 src/libs/setCrashlyticsUserId/index.native.ts create mode 100644 src/libs/setCrashlyticsUserId/index.ts create mode 100644 src/libs/setCrashlyticsUserId/types.ts create mode 100644 src/libs/testCrash/index.native.ts create mode 100644 src/libs/testCrash/index.ts diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 3e07c47463a0..060ea4492b17 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -37,7 +37,7 @@ import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/Popo import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu'; import type {Route} from './ROUTES'; import type {ScreenShareRequest, Session} from './types/onyx'; -import crashlytics from "@react-native-firebase/crashlytics"; +import setCrashlyticsUserId from "@libs/setCrashlyticsUserId"; Onyx.registerLogger(({level, message}) => { if (level === 'alert') { @@ -218,10 +218,7 @@ function Expensify({ }, []); useEffect(() => { - if (!isAuthenticated) { - return - } - crashlytics().setUserId(Number(session?.accountID).toString()) + setCrashlyticsUserId({isAuthenticated, accountID: session?.accountID}) }, [isAuthenticated, session?.accountID]) // Display a blank page until the onyx migration completes diff --git a/src/components/TestToolMenu.tsx b/src/components/TestToolMenu.tsx index e4d33957f7f1..bd2855523712 100644 --- a/src/components/TestToolMenu.tsx +++ b/src/components/TestToolMenu.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useState} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; @@ -19,6 +19,7 @@ import {withNetwork} from './OnyxProvider'; import Switch from './Switch'; import TestToolRow from './TestToolRow'; import Text from './Text'; +import testCrash from "@libs/testCrash"; type TestToolMenuOnyxProps = { /** User object in Onyx */ @@ -29,12 +30,19 @@ type TestToolMenuProps = TestToolMenuOnyxProps & { /** Network object in Onyx */ network: OnyxEntry; }; -const USER_DEFAULT: UserOnyx = {shouldUseStagingServer: undefined, isSubscribedToNewsletter: false, validated: false, isFromPublicDomain: false, isUsingExpensifyCard: false}; +const USER_DEFAULT: UserOnyx = { + shouldUseStagingServer: undefined, + isSubscribedToNewsletter: false, + validated: false, + isFromPublicDomain: false, + isUsingExpensifyCard: false +}; function TestToolMenu({user = USER_DEFAULT, network}: TestToolMenuProps) { const shouldUseStagingServer = user?.shouldUseStagingServer ?? ApiUtils.isUsingStagingApi(); const styles = useThemeStyles(); const {translate} = useLocalize(); + const {showDummyUndefinedView, setShowDummyUndefinedView} = useState(false) return ( <> @@ -103,6 +111,16 @@ function TestToolMenu({user = USER_DEFAULT, network}: TestToolMenuProps) { }} /> + + +