From 16cd28d32c98c15f9fe2022c2a17147702ea1f83 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 16 Nov 2023 16:13:07 +0700 Subject: [PATCH 01/10] fix category is reset after refreshing --- src/libs/actions/IOU.js | 2 ++ src/pages/iou/steps/MoneyRequestConfirmPage.js | 5 ----- .../MoneyRequestParticipantsPage.js | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 158c1960895a..112b40d4df55 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2929,6 +2929,8 @@ function navigateToNextPage(iou, iouType, report, path = '') { .map((accountID) => ({accountID, selected: true})) .value(); setMoneyRequestParticipants(participants); + resetMoneyRequestCategory(); + resetMoneyRequestTag(); } Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID)); return; diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 54a84f99fa55..c2697a02ca45 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -83,11 +83,6 @@ function MoneyRequestConfirmPage(props) { const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(props.report)), [props.report]); const isManualRequestDM = props.selectedTab === CONST.TAB.MANUAL && iouType === CONST.IOU.TYPE.REQUEST; - useEffect(() => { - IOU.resetMoneyRequestCategory(); - IOU.resetMoneyRequestTag(); - }, []); - useEffect(() => { const policyExpenseChat = _.find(participants, (participant) => participant.isPolicyExpenseChat); if (policyExpenseChat) { diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 7d38ee1c0282..5c80fa22269e 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -86,6 +86,8 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route, transaction}) { const navigateToConfirmationStep = (moneyRequestType) => { IOU.setMoneyRequestId(moneyRequestType); + IOU.resetMoneyRequestCategory(); + IOU.resetMoneyRequestTag(); Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, reportID)); }; From d3a43647acec53465f521940421187997d50a2d8 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 16 Nov 2023 22:37:48 +0700 Subject: [PATCH 02/10] reset tag and category after going back --- src/libs/actions/IOU.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 112b40d4df55..5e32e3fb2e88 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2929,9 +2929,9 @@ function navigateToNextPage(iou, iouType, report, path = '') { .map((accountID) => ({accountID, selected: true})) .value(); setMoneyRequestParticipants(participants); - resetMoneyRequestCategory(); - resetMoneyRequestTag(); } + resetMoneyRequestCategory(); + resetMoneyRequestTag(); Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID)); return; } From 18772c7f6055abf4fb1745e6e6a96af21a7171a0 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 16 Nov 2023 23:41:50 +0800 Subject: [PATCH 03/10] render the skeleton if the data is not ready yet --- src/pages/settings/InitialSettingsPage.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index 36c457f8e6ed..18d540923a30 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -325,12 +325,6 @@ function InitialSettingsPage(props) { ); }, [getDefaultMenuItems, props.betas, props.userWallet.currentBalance, translate, isExecuting, singleExecution]); - // On the very first sign in or after clearing storage these - // details will not be present on the first render so we'll just - // return nothing for now. - if (_.isEmpty(props.currentUserPersonalDetails)) { - return null; - } const headerContent = ( {_.isEmpty(props.currentUserPersonalDetails) || _.isUndefined(props.currentUserPersonalDetails.displayName) ? ( From 5f431230beb0bc9f1a93b9198a43682e29588a61 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Fri, 17 Nov 2023 01:05:43 +0700 Subject: [PATCH 04/10] revert last change --- src/libs/actions/IOU.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 5e32e3fb2e88..112b40d4df55 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2929,9 +2929,9 @@ function navigateToNextPage(iou, iouType, report, path = '') { .map((accountID) => ({accountID, selected: true})) .value(); setMoneyRequestParticipants(participants); + resetMoneyRequestCategory(); + resetMoneyRequestTag(); } - resetMoneyRequestCategory(); - resetMoneyRequestTag(); Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID)); return; } From a1191f5a81e8dc1e1388d2b7fd93d36f620349c4 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Fri, 17 Nov 2023 10:28:54 +0700 Subject: [PATCH 05/10] prevent highlight when long pressing text link --- .../AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js | 1 + .../pressableWithSecondaryInteractionPropTypes.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js index fc9cd1d7a043..763ca4615c6e 100644 --- a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js +++ b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js @@ -56,6 +56,7 @@ function BaseAnchorForCommentsOnly({onPressIn, onPressOut, href = '', rel = '', return ( { ReportActionContextMenu.showContextMenu( diff --git a/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js b/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js index 8e2fb5141091..935b8ece5933 100644 --- a/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js +++ b/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js @@ -51,6 +51,9 @@ const propTypes = { /** Whether the view needs to be rendered offscreen (for Android only) */ needsOffscreenAlphaCompositing: PropTypes.bool, + + /** Whether the text has a gray highlights on press down (for IOS only) */ + suppressHighlighting: PropTypes.bool, }; const defaultProps = { @@ -63,6 +66,7 @@ const defaultProps = { activeOpacity: 1, enableLongPressWithHover: false, needsOffscreenAlphaCompositing: false, + suppressHighlighting: false, }; export {propTypes, defaultProps}; From f300dbb6ace1e8f00908ed05969abeb97d167c23 Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Fri, 17 Nov 2023 07:27:34 +0100 Subject: [PATCH 06/10] fix image not downloading in offline mode --- src/CONST.ts | 1 + .../AttachmentCarousel/extractAttachmentsFromReport.js | 2 +- src/libs/fileDownload/index.js | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 69ca8256cc6f..a1424b28c15f 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -961,6 +961,7 @@ const CONST = { ATTACHMENT_SOURCE_ATTRIBUTE: 'data-expensify-source', ATTACHMENT_PREVIEW_ATTRIBUTE: 'src', ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE: 'data-name', + ATTACHMENT_LOCAL_URL_PREFIX: ['blob:', 'file:'], ATTACHMENT_PICKER_TYPE: { FILE: 'file', diff --git a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js index 28af6b511641..0f1fa15c99ca 100644 --- a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js +++ b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js @@ -54,7 +54,7 @@ function extractAttachmentsFromReport(parentReportAction, reportActions, transac if (TransactionUtils.hasReceipt(transaction)) { const {image} = ReceiptUtils.getThumbnailAndImageURIs(transaction); - const isLocalFile = typeof image === 'string' && (image.startsWith('blob:') || image.startsWith('file:')); + const isLocalFile = typeof image === 'string' && _.some(CONST.ATTACHMENT_LOCAL_URL_PREFIX, (prefix) => image.startsWith(prefix)); attachments.unshift({ source: tryResolveUrlFromApiRoot(image), isAuthTokenRequired: !isLocalFile, diff --git a/src/libs/fileDownload/index.js b/src/libs/fileDownload/index.js index d1fa968b665f..002594244def 100644 --- a/src/libs/fileDownload/index.js +++ b/src/libs/fileDownload/index.js @@ -1,6 +1,8 @@ +import _ from 'lodash'; import * as ApiUtils from '@libs/ApiUtils'; import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot'; import * as Link from '@userActions/Link'; +import CONST from '@src/CONST'; import * as FileUtils from './FileUtils'; /** @@ -11,7 +13,7 @@ import * as FileUtils from './FileUtils'; */ export default function fileDownload(url, fileName) { const resolvedUrl = tryResolveUrlFromApiRoot(url); - if (!resolvedUrl.startsWith(ApiUtils.getApiRoot())) { + if (!resolvedUrl.startsWith(ApiUtils.getApiRoot()) && !_.some(CONST.ATTACHMENT_LOCAL_URL_PREFIX, (prefix) => resolvedUrl.startsWith(prefix))) { // Different origin URLs might pose a CORS issue during direct downloads. // Opening in a new tab avoids this limitation, letting the browser handle the download. Link.openExternalLink(url); From bd1706af6536183d69bd89ba5bdf1c718df477c9 Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Fri, 17 Nov 2023 08:27:52 +0100 Subject: [PATCH 07/10] retrigger From 5e6adffd9edfa045e5ed80ab140400dd43ec1e00 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Fri, 17 Nov 2023 17:39:22 +0530 Subject: [PATCH 08/10] Use index as key --- src/components/MultipleAvatars.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index e867de7ddb97..e4e9d201ab1f 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -174,7 +174,7 @@ function MultipleAvatars({ > {[...avatars].splice(0, maxAvatarsInRow).map((icon, index) => ( Date: Fri, 17 Nov 2023 17:48:08 +0530 Subject: [PATCH 09/10] Suppress lint error --- src/components/MultipleAvatars.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index e4e9d201ab1f..93e292ce76db 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -174,6 +174,7 @@ function MultipleAvatars({ > {[...avatars].splice(0, maxAvatarsInRow).map((icon, index) => ( Date: Fri, 17 Nov 2023 17:53:33 +0530 Subject: [PATCH 10/10] Pass policyID for workspace avatar --- src/components/MultipleAvatars.tsx | 3 +-- src/pages/settings/InitialSettingsPage.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index 93e292ce76db..e867de7ddb97 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -174,8 +174,7 @@ function MultipleAvatars({ > {[...avatars].splice(0, maxAvatarsInRow).map((icon, index) => ( PolicyUtils.shouldShowPolicy(policy, props.network.isOffline)) .sortBy((policy) => policy.name.toLowerCase()) .map((policy) => ({ + id: policy.id, source: policy.avatar || ReportUtils.getDefaultWorkspaceAvatar(policy.name), name: policy.name, type: CONST.ICON_TYPE_WORKSPACE,