From c463bf97076452d3cf6272dbfb8044ade8111aea Mon Sep 17 00:00:00 2001
From: ojasjadhav2 <140224450+ojasjadhav2@users.noreply.github.com>
Date: Mon, 31 Jul 2023 20:40:40 +0530
Subject: [PATCH 001/201] migrated SwipableView > index.native.js
---
src/components/SwipeableView/index.native.js | 36 +++++++++-----------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/src/components/SwipeableView/index.native.js b/src/components/SwipeableView/index.native.js
index b4751789fcfe..f4a67ae1c059 100644
--- a/src/components/SwipeableView/index.native.js
+++ b/src/components/SwipeableView/index.native.js
@@ -1,4 +1,4 @@
-import React, {PureComponent} from 'react';
+import React, {useRef} from 'react';
import {PanResponder, View} from 'react-native';
import PropTypes from 'prop-types';
import CONST from '../../CONST';
@@ -10,33 +10,29 @@ const propTypes = {
onSwipeDown: PropTypes.func.isRequired,
};
-class SwipeableView extends PureComponent {
- constructor(props) {
- super(props);
-
- const minimumPixelDistance = CONST.COMPOSER_MAX_HEIGHT;
- this.oldY = 0;
- this.panResponder = PanResponder.create({
+function SwipeableView({children, onSwipeDown}) {
+ const minimumPixelDistance = CONST.COMPOSER_MAX_HEIGHT;
+ const oldYRef = useRef(0);
+ const panResponder = useRef(
+ PanResponder.create({
// The PanResponder gets focus only when the y-axis movement is over minimumPixelDistance
// & swip direction is downwards
onMoveShouldSetPanResponderCapture: (_event, gestureState) => {
- if (gestureState.dy - this.oldY > 0 && gestureState.dy > minimumPixelDistance) {
+ if (gestureState.dy - oldYRef.current > 0 && gestureState.dy > minimumPixelDistance) {
return true;
}
- this.oldY = gestureState.dy;
+ oldYRef.current = gestureState.dy;
},
// Calls the callback when the swipe down is released; after the completion of the gesture
- onPanResponderRelease: this.props.onSwipeDown,
- });
- }
-
- render() {
- return (
- // eslint-disable-next-line react/jsx-props-no-spreading
- {this.props.children}
- );
- }
+ onPanResponderRelease: onSwipeDown,
+ }),
+ ).current;
+
+ return (
+ // eslint-disable-next-line react/jsx-props-no-spreading
+ {children}
+ );
}
SwipeableView.propTypes = propTypes;
From 68a6ec66215c6bf3943a2df8252ea69d802c74de Mon Sep 17 00:00:00 2001
From: ojasjadhav2 <140224450+ojasjadhav2@users.noreply.github.com>
Date: Tue, 1 Aug 2023 23:28:48 +0530
Subject: [PATCH 002/201] added displayName
---
src/components/SwipeableView/index.native.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/SwipeableView/index.native.js b/src/components/SwipeableView/index.native.js
index f4a67ae1c059..6e96cfbbbc45 100644
--- a/src/components/SwipeableView/index.native.js
+++ b/src/components/SwipeableView/index.native.js
@@ -36,5 +36,6 @@ function SwipeableView({children, onSwipeDown}) {
}
SwipeableView.propTypes = propTypes;
+SwipeableView.displayName = 'SwipeableView';
export default SwipeableView;
From ef896f7c17337061de04034b046bbc637ba7ffbc Mon Sep 17 00:00:00 2001
From: ojasjadhav2 <140224450+ojasjadhav2@users.noreply.github.com>
Date: Sun, 6 Aug 2023 23:03:27 +0530
Subject: [PATCH 003/201] using props instead of spreading
---
src/components/SwipeableView/index.native.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/SwipeableView/index.native.js b/src/components/SwipeableView/index.native.js
index 6e96cfbbbc45..2f1148721af1 100644
--- a/src/components/SwipeableView/index.native.js
+++ b/src/components/SwipeableView/index.native.js
@@ -10,13 +10,13 @@ const propTypes = {
onSwipeDown: PropTypes.func.isRequired,
};
-function SwipeableView({children, onSwipeDown}) {
+function SwipeableView(props) {
const minimumPixelDistance = CONST.COMPOSER_MAX_HEIGHT;
const oldYRef = useRef(0);
const panResponder = useRef(
PanResponder.create({
// The PanResponder gets focus only when the y-axis movement is over minimumPixelDistance
- // & swip direction is downwards
+ // & swipe direction is downwards
onMoveShouldSetPanResponderCapture: (_event, gestureState) => {
if (gestureState.dy - oldYRef.current > 0 && gestureState.dy > minimumPixelDistance) {
return true;
@@ -25,13 +25,13 @@ function SwipeableView({children, onSwipeDown}) {
},
// Calls the callback when the swipe down is released; after the completion of the gesture
- onPanResponderRelease: onSwipeDown,
+ onPanResponderRelease: props.onSwipeDown,
}),
).current;
return (
// eslint-disable-next-line react/jsx-props-no-spreading
- {children}
+ {props.children}
);
}
From a3b0dd238e5e6a1375355d4bba11c510bb02e560 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Mon, 7 Aug 2023 16:23:21 -0400
Subject: [PATCH 004/201] Disable copy to clipboard for report previews
---
src/pages/home/report/ContextMenu/ContextMenuActions.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js
index 79e49efb6a03..449e10d35992 100644
--- a/src/pages/home/report/ContextMenu/ContextMenuActions.js
+++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js
@@ -169,6 +169,7 @@ export default [
shouldShow: (type, reportAction) =>
type === CONTEXT_MENU_TYPES.REPORT_ACTION &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU &&
+ reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKREOPENED &&
From f143e1fa72d6988fa294513117252a06ab184f42 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Tue, 8 Aug 2023 16:25:23 -0400
Subject: [PATCH 005/201] Show receipt image
---
src/components/ReportActionItem/ReportPreview.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index d5d85df5e7ee..37731d76aaf2 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -25,6 +25,7 @@ import refPropTypes from '../refPropTypes';
import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback';
import themeColors from '../../styles/themes/default';
import reportPropTypes from '../../pages/reportPropTypes';
+import RenderHTML from '../RenderHTML';
const propTypes = {
/** All the data of the action */
@@ -116,6 +117,10 @@ function ReportPreview(props) {
const previewMessage = props.translate(ReportUtils.isSettled(props.iouReportID) || props.iouReport.isWaitingOnBankAccount ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName});
const shouldShowSettlementButton =
!_.isEmpty(props.iouReport) && isCurrentUserManager && !ReportUtils.isSettled(props.iouReportID) && !props.iouReport.isWaitingOnBankAccount && reportTotal !== 0;
+
+ const receiptIDs = lodashGet(props.action, 'childLastReceiptTransactionIDs', '').split(',');
+ const receipts = _.filter(props.receipts, (transaction) => receiptIDs.includes(transaction.transactionID));
+
return (
+ `} />
@@ -179,6 +185,9 @@ export default compose(
iouReport: {
key: ({iouReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`,
},
+ receipts: {
+ key: ONYXKEYS.COLLECTION.TRANSACTION,
+ },
session: {
key: ONYXKEYS.SESSION,
},
From 04d0c3ba35f0753960ea7a6e9e25c5178f0d7c0b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Tue, 8 Aug 2023 17:21:28 -0400
Subject: [PATCH 006/201] Fix receipt image loading
---
.../HTMLEngineProvider/HTMLRenderers/ImageRenderer.js | 8 ++++----
src/components/ReportActionItem/ReportPreview.js | 8 +++++++-
src/libs/ReceiptUtils.js | 4 +++-
src/pages/iou/ReceiptSelector/index.js | 2 +-
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
index 103e653d7d88..643785ab09d1 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
@@ -33,11 +33,11 @@ function ImageRenderer(props) {
// Concierge responder attachments are uploaded to S3 without any access
// control and thus require no authToken to verify access.
//
- const isAttachment = Boolean(htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE]);
+ const isAttachmentOrReceipt = Boolean(htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE]);
// Files created/uploaded/hosted by App should resolve from API ROOT. Other URLs aren't modified
const previewSource = tryResolveUrlFromApiRoot(htmlAttribs.src);
- const source = tryResolveUrlFromApiRoot(isAttachment ? htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE] : htmlAttribs.src);
+ const source = tryResolveUrlFromApiRoot(isAttachmentOrReceipt ? htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE] : htmlAttribs.src);
const imageWidth = htmlAttribs['data-expensify-width'] ? parseInt(htmlAttribs['data-expensify-width'], 10) : undefined;
const imageHeight = htmlAttribs['data-expensify-height'] ? parseInt(htmlAttribs['data-expensify-height'], 10) : undefined;
@@ -47,7 +47,7 @@ function ImageRenderer(props) {
@@ -67,7 +67,7 @@ function ImageRenderer(props) {
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 37731d76aaf2..3931e2248dcd 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -26,6 +26,7 @@ import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback';
import themeColors from '../../styles/themes/default';
import reportPropTypes from '../../pages/reportPropTypes';
import RenderHTML from '../RenderHTML';
+import * as ReceiptUtils from '../../libs/ReceiptUtils';
const propTypes = {
/** All the data of the action */
@@ -134,7 +135,12 @@ function ReportPreview(props) {
accessibilityRole="button"
accessibilityLabel={props.translate('iou.viewDetails')}
>
- `} />
+
+ `} />
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index b8ec54c0e899..42114914f084 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -25,4 +25,6 @@ const validateReceipt = (file) => {
return true;
};
-export default {validateReceipt};
+export {
+ validateReceipt,
+};
diff --git a/src/pages/iou/ReceiptSelector/index.js b/src/pages/iou/ReceiptSelector/index.js
index c674878c2c73..392e96887f8b 100644
--- a/src/pages/iou/ReceiptSelector/index.js
+++ b/src/pages/iou/ReceiptSelector/index.js
@@ -19,7 +19,7 @@ import Receipt from '../../../libs/actions/Receipt';
import useWindowDimensions from '../../../hooks/useWindowDimensions';
import useLocalize from '../../../hooks/useLocalize';
import {DragAndDropContext} from '../../../components/DragAndDrop/Provider';
-import ReceiptUtils from '../../../libs/ReceiptUtils';
+import * as ReceiptUtils from '../../../libs/ReceiptUtils';
const propTypes = {
/** Information shown to the user when a receipt is not valid */
From 7466501076ff0380907e993999e7d7f17d92e533 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Tue, 8 Aug 2023 17:59:28 -0400
Subject: [PATCH 007/201] Begin styling for multiple receipts
---
.../ReportActionItem/ReportPreview.js | 50 +++++++++++--------
src/styles/styles.js | 11 ++++
2 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 3931e2248dcd..1519e4116d2e 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -135,29 +135,37 @@ function ReportPreview(props) {
accessibilityRole="button"
accessibilityLabel={props.translate('iou.viewDetails')}
>
-
- `} />
-
+
-
- {previewMessage}
-
-
-
-
- {displayAmount}
- {ReportUtils.isSettled(props.iouReportID) && (
-
- (
+
+
-
- )}
+ `} />
+
+ ))}
+
+
+
+
+ {previewMessage}
+
+
+
+
+ {displayAmount}
+ {ReportUtils.isSettled(props.iouReportID) && (
+
+
+
+ )}
+
{shouldShowSettlementButton && (
diff --git a/src/styles/styles.js b/src/styles/styles.js
index f7517cd3acb7..4b2db3483d71 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3645,6 +3645,17 @@ const styles = {
borderRadius: 16,
margin: 20,
},
+
+ reportPreviewBox: {
+ backgroundColor: themeColors.cardBG,
+ borderRadius: variables.componentBorderRadiusLarge,
+ maxWidth: variables.sideBarWidth,
+ width: '100%',
+ },
+
+ reportPreviewBoxText: {
+ padding: 16,
+ }
};
export default styles;
From 941d730532ec090e4e4e2f5d91d0388f1ac63864 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 9 Aug 2023 09:29:09 -0400
Subject: [PATCH 008/201] Fit images to container
---
.../HTMLEngineProvider/BaseHTMLEngineProvider.js | 2 +-
.../HTMLEngineProvider/HTMLRenderers/ImageRenderer.js | 11 ++++++++---
src/components/ReportActionItem/ReportPreview.js | 7 ++++---
src/components/ThumbnailImage.js | 8 +++++++-
src/styles/styles.js | 2 +-
5 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
index 5417f7af6820..e156c8bda3f4 100755
--- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
+++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
@@ -48,7 +48,7 @@ const customHTMLElementModels = {
'mention-here': defaultHTMLElementModels.span.extend({tagName: 'mention-here'}),
};
-const defaultViewProps = {style: [styles.alignItemsStart, styles.userSelectText]};
+const defaultViewProps = {style: [styles.alignItemsStart, styles.userSelectText, styles.w100, styles.h100]};
// We are using the explicit composite architecture for performance gains.
// Configuration for RenderHTML is handled in a top-level component providing
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
index 643785ab09d1..0ddd6c4657d7 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
@@ -43,19 +43,23 @@ function ImageRenderer(props) {
const imageHeight = htmlAttribs['data-expensify-height'] ? parseInt(htmlAttribs['data-expensify-height'], 10) : undefined;
const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true';
+ const shouldFitContainer = htmlAttribs['data-expensify-fit-container'] === 'true';
+ const fitContainerStyle = shouldFitContainer ? [styles.w100, styles.h100] : [];
+
return imagePreviewModalDisabled ? (
) : (
{({anchor, report, action, checkIfContextMenuActive}) => (
{
const route = ROUTES.getReportAttachmentRoute(report.reportID, source);
Navigation.navigate(route);
@@ -66,10 +70,11 @@ function ImageRenderer(props) {
>
)}
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 1519e4116d2e..4011c325fb71 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -136,13 +136,14 @@ function ReportPreview(props) {
accessibilityLabel={props.translate('iou.viewDetails')}
>
-
+
{_.map(receipts, ({receipt, transactionID}) => (
-
+
`} />
diff --git a/src/components/ThumbnailImage.js b/src/components/ThumbnailImage.js
index 970227636e46..5c24cbd82bbc 100644
--- a/src/components/ThumbnailImage.js
+++ b/src/components/ThumbnailImage.js
@@ -25,6 +25,8 @@ const propTypes = {
/** Height of the thumbnail image */
imageHeight: PropTypes.number,
+ shouldDynamicallyResize: PropTypes.bool,
+
...windowDimensionsPropTypes,
};
@@ -32,6 +34,7 @@ const defaultProps = {
style: {},
imageWidth: 200,
imageHeight: 200,
+ shouldDynamicallyResize: true,
};
class ThumbnailImage extends PureComponent {
@@ -91,9 +94,12 @@ class ThumbnailImage extends PureComponent {
}
render() {
+ const sizeStyles = this.props.shouldDynamicallyResize
+ ? [StyleUtils.getWidthAndHeightStyle(this.state.thumbnailWidth, this.state.thumbnailHeight)]
+ : [styles.w100, styles.h100];
return (
-
+
Date: Wed, 9 Aug 2023 11:53:46 -0400
Subject: [PATCH 009/201] Polish preview box on hover
---
.../HTMLRenderers/ImageRenderer.js | 5 +--
.../MoneyRequestConfirmationList.js | 39 +------------------
.../ReportActionItem/ReportPreview.js | 36 +++++++++++------
src/libs/ReceiptUtils.js | 37 ++++++++++++++++++
src/styles/styles.js | 22 +++++++++++
5 files changed, 87 insertions(+), 52 deletions(-)
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
index 0ddd6c4657d7..9a7f02220068 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
@@ -44,12 +44,11 @@ function ImageRenderer(props) {
const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true';
const shouldFitContainer = htmlAttribs['data-expensify-fit-container'] === 'true';
- const fitContainerStyle = shouldFitContainer ? [styles.w100, styles.h100] : [];
return imagePreviewModalDisabled ? (
{
- const {fileExtension} = FileUtils.splitExtensionFromFileName(receiptSource);
- const isReceiptImage = Str.isImage(props.receiptSource);
-
- if (isReceiptImage) {
- return receiptPath;
- }
-
- if (fileExtension === CONST.IOU.FILE_TYPES.HTML) {
- return ReceiptHTML;
- }
-
- if (fileExtension === CONST.IOU.FILE_TYPES.DOC || fileExtension === CONST.IOU.FILE_TYPES.DOCX) {
- return ReceiptDoc;
- }
-
- if (fileExtension === CONST.IOU.FILE_TYPES.SVG) {
- return ReceiptSVG;
- }
-
- return ReceiptGeneric;
- };
-
return (
) : (
-
- {_.map(receipts, ({receipt, transactionID}) => (
-
-
- `} />
-
- ))}
+
+ {_.map(receipts, ({receipt, filename, transactionID}) => {
+ const thumbnailURI = ReceiptUtils.getImageURI(`${receipt.source.replace('.jpg', '')}.1024.jpg`, filename);
+ const uri = ReceiptUtils.getImageURI(receipt.source, filename);
+
+ return (
+
+ {uri === receipt.source
+ ?
+ `} />
+ :
+ }
+
+ );
+ })}
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index 42114914f084..fdb2e180bba2 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -1,9 +1,14 @@
import lodashGet from 'lodash/get';
import _ from 'underscore';
+import Str from 'expensify-common/lib/str';
import * as FileUtils from './fileDownload/FileUtils';
import CONST from '../CONST';
import Receipt from './actions/Receipt';
import * as Localize from './Localize';
+import ReceiptHTML from '../../assets/images/receipt-html.png';
+import ReceiptDoc from '../../assets/images/receipt-doc.png';
+import ReceiptGeneric from '../../assets/images/receipt-generic.png';
+import ReceiptSVG from '../../assets/images/receipt-svg.png';
const validateReceipt = (file) => {
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', ''));
@@ -25,6 +30,38 @@ const validateReceipt = (file) => {
return true;
};
+
+/**
+ * Grab the appropriate receipt image URI based on file type
+ *
+ * @param {String} path URI to image, i.e. blob://new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg
+ * @param {String} filename of uploaded image or last part of remote URI
+ * @returns {*}
+ */
+const getImageURI = (path, filename) => {
+ const {fileExtension} = FileUtils.splitExtensionFromFileName(filename);
+ const isReceiptImage = Str.isImage(filename);
+
+ if (isReceiptImage) {
+ return path;
+ }
+
+ if (fileExtension === CONST.IOU.FILE_TYPES.HTML) {
+ return ReceiptHTML;
+ }
+
+ if (fileExtension === CONST.IOU.FILE_TYPES.DOC || fileExtension === CONST.IOU.FILE_TYPES.DOCX) {
+ return ReceiptDoc;
+ }
+
+ if (fileExtension === CONST.IOU.FILE_TYPES.SVG) {
+ return ReceiptSVG;
+ }
+
+ return ReceiptGeneric;
+};
+
export {
validateReceipt,
+ getImageURI,
};
diff --git a/src/styles/styles.js b/src/styles/styles.js
index dd4860047d2a..f5b2d883d845 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3653,6 +3653,28 @@ const styles = {
width: '100%',
},
+ reportPreviewBoxImages: {
+ flexDirection: 'row',
+ borderWidth: 2,
+ borderColor: themeColors.cardBG,
+ borderTopLeftRadius: variables.componentBorderRadiusLarge,
+ borderTopRightRadius: variables.componentBorderRadiusLarge,
+ overflow: 'hidden',
+ height: 200,
+ },
+
+ reportPreviewBoxImage: {
+ borderWidth: 1,
+ borderColor: themeColors.cardBG,
+ flex: 1,
+ width: '100%',
+ height: '100%',
+ },
+
+ reportPreviewBoxHoverBorder: {
+ borderColor: themeColors.border,
+ },
+
reportPreviewBoxText: {
padding: 16,
},
From f0ced3a749768b051648b9efc7b9ebaf13ef7cab Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 9 Aug 2023 12:01:40 -0400
Subject: [PATCH 010/201] Only apply full width when fitting container
---
.../HTMLEngineProvider/HTMLRenderers/ImageRenderer.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
index 9a7f02220068..2f4ee7780346 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
@@ -44,6 +44,7 @@ function ImageRenderer(props) {
const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true';
const shouldFitContainer = htmlAttribs['data-expensify-fit-container'] === 'true';
+ const sizingStyle = shouldFitContainer ? [styles.w100, styles.h100] : [];
return imagePreviewModalDisabled ? (
{({anchor, report, action, checkIfContextMenuActive}) => (
{
const route = ROUTES.getReportAttachmentRoute(report.reportID, source);
Navigation.navigate(route);
From e6954010031970e42f2e736931f3af4828011e74 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 9 Aug 2023 13:14:03 -0400
Subject: [PATCH 011/201] Add scanning in progress
---
src/CONST.js | 3 ++
.../ReportActionItem/ReportPreview.js | 29 +++++++++++++------
src/languages/en.js | 2 ++
src/languages/es.js | 2 ++
src/libs/ReceiptUtils.js | 13 ++++++---
5 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/src/CONST.js b/src/CONST.js
index 37a56b69f6d2..b2d5ff2b2956 100755
--- a/src/CONST.js
+++ b/src/CONST.js
@@ -1073,6 +1073,9 @@ const CONST = {
AMOUNT_MAX_LENGTH: 10,
RECEIPT_STATE: {
SCANREADY: 'SCANREADY',
+ SCANNING: 'SCANNING',
+ SCANCOMPLETE: 'SCANCOMPLETE',
+ SCANFAILED: 'SCANFAILED',
},
FILE_TYPES: {
HTML: 'html',
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 8ec7da4e57ff..4e57a806eb93 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {useMemo} from 'react';
import _ from 'underscore';
import {View} from 'react-native';
import PropTypes from 'prop-types';
@@ -99,9 +99,17 @@ function ReportPreview(props) {
const managerID = props.iouReport.managerID || props.action.actorAccountID || 0;
const isCurrentUserManager = managerID === lodashGet(props.session, 'accountID');
const reportTotal = ReportUtils.getMoneyRequestTotal(props.iouReport);
+
+ const iouSettled = ReportUtils.isSettled(props.iouReportID);
+ const receiptIDs = lodashGet(props.action, 'childLastReceiptTransactionIDs', '').split(',');
+ const receipts = _.filter(props.receipts, (transaction) => receiptIDs.includes(transaction.transactionID));
+ const isScanning = _.some(receipts, ({receipt}) => ReceiptUtils.isBeingScanned(receipt));
+
let displayAmount;
if (reportTotal) {
displayAmount = CurrencyUtils.convertToDisplayString(reportTotal, props.iouReport.currency);
+ } else if (isScanning) {
+ displayAmount = props.translate('iou.receiptScanning');
} else {
// If iouReport is not available, get amount from the action message (Ex: "Domain20821's Workspace owes $33.00" or "paid ₫60" or "paid -₫60 elsewhere")
displayAmount = '';
@@ -114,14 +122,17 @@ function ReportPreview(props) {
}
}
+ let previewMessage;
const managerName = ReportUtils.isPolicyExpenseChat(props.chatReport) ? ReportUtils.getPolicyName(props.chatReport) : ReportUtils.getDisplayNameForParticipant(managerID, true);
+ if (_.some(receipts, ({receipt}) => ReceiptUtils.isBeingScanned(receipt))) {
+ previewMessage = props.translate('iou.receipt');
+ } else {
+ previewMessage = props.translate(iouSettled || props.iouReport.isWaitingOnBankAccount ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName});
+ }
+
const bankAccountRoute = ReportUtils.getBankAccountRoute(props.chatReport);
- const previewMessage = props.translate(ReportUtils.isSettled(props.iouReportID) || props.iouReport.isWaitingOnBankAccount ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName});
const shouldShowSettlementButton =
- !_.isEmpty(props.iouReport) && isCurrentUserManager && !ReportUtils.isSettled(props.iouReportID) && !props.iouReport.isWaitingOnBankAccount && reportTotal !== 0;
-
- const receiptIDs = lodashGet(props.action, 'childLastReceiptTransactionIDs', '').split(',');
- const receipts = _.filter(props.receipts, (transaction) => receiptIDs.includes(transaction.transactionID));
+ !_.isEmpty(props.iouReport) && isCurrentUserManager && !iouSettled && !props.iouReport.isWaitingOnBankAccount && reportTotal !== 0;
return (
@@ -139,18 +150,18 @@ function ReportPreview(props) {
{_.map(receipts, ({receipt, filename, transactionID}) => {
- const thumbnailURI = ReceiptUtils.getImageURI(`${receipt.source.replace('.jpg', '')}.1024.jpg`, filename);
const uri = ReceiptUtils.getImageURI(receipt.source, filename);
+ const hasNoFallback = uri === receipt.source;
return (
- {uri === receipt.source
+ {hasNoFallback
?
diff --git a/src/languages/en.js b/src/languages/en.js
index f532512dca1e..810b60d4ec5a 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -379,6 +379,8 @@ export default {
pay: 'Pay',
viewDetails: 'View details',
pending: 'Pending',
+ receipt: 'Receipt',
+ receiptScanning: 'Scanning in progress...',
settledExpensify: 'Paid',
settledElsewhere: 'Paid elsewhere',
settledPaypalMe: 'Paid using Paypal.me',
diff --git a/src/languages/es.js b/src/languages/es.js
index 4cdfc4e32f14..656723c59ab0 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -378,6 +378,8 @@ export default {
pay: 'Pagar',
viewDetails: 'Ver detalles',
pending: 'Pendiente',
+ receipt: 'Recibo',
+ receiptScanning: 'Escaneo en progreso...',
settledExpensify: 'Pagado',
settledElsewhere: 'Pagado de otra forma',
settledPaypalMe: 'Pagado con PayPal.me',
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index fdb2e180bba2..9106e9af2be7 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -10,7 +10,7 @@ import ReceiptDoc from '../../assets/images/receipt-doc.png';
import ReceiptGeneric from '../../assets/images/receipt-generic.png';
import ReceiptSVG from '../../assets/images/receipt-svg.png';
-const validateReceipt = (file) => {
+function validateReceipt(file) {
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', ''));
if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
Receipt.setUploadReceiptError(true, Localize.translateLocal('attachmentPicker.wrongFileType'), Localize.translateLocal('attachmentPicker.notAllowedExtension'));
@@ -34,11 +34,11 @@ const validateReceipt = (file) => {
/**
* Grab the appropriate receipt image URI based on file type
*
- * @param {String} path URI to image, i.e. blob://new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg
- * @param {String} filename of uploaded image or last part of remote URI
+ * @param {String} path URI to image, i.e. blob://new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg
+ * @param {String} filename of uploaded image or last part of remote URI
* @returns {*}
*/
-const getImageURI = (path, filename) => {
+function getImageURI(path, filename) {
const {fileExtension} = FileUtils.splitExtensionFromFileName(filename);
const isReceiptImage = Str.isImage(filename);
@@ -61,7 +61,12 @@ const getImageURI = (path, filename) => {
return ReceiptGeneric;
};
+function isBeingScanned(receipt) {
+ return receipt.state === CONST.IOU.RECEIPT_STATE.SCANREADY || receipt.state === CONST.IOU.RECEIPT_STATE.SCANNING;
+}
+
export {
validateReceipt,
getImageURI,
+ isBeingScanned,
};
From 4ae0c8960bfc534d346cfca821aaeaaf52f57e75 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 9 Aug 2023 15:51:24 -0400
Subject: [PATCH 012/201] Fix thumbnail and add correct optimistic filename
---
src/components/ReportActionItem/ReportPreview.js | 2 +-
src/libs/TransactionUtils.js | 3 ++-
src/libs/actions/IOU.js | 2 +-
src/libs/fileDownload/FileUtils.js | 4 +++-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 4e57a806eb93..6e40f32c35a0 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -161,7 +161,7 @@ function ReportPreview(props) {
{hasNoFallback
?
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index f88f53467ae8..3e89d0fe87ef 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -15,7 +15,7 @@ import * as NumberUtils from './NumberUtils';
* @param {Object} [receipt]
* @returns {Object}
*/
-function buildOptimisticTransaction(amount, currency, reportID, comment = '', source = '', originalTransactionID = '', merchant = CONST.REPORT.TYPE.IOU, receipt = {}) {
+function buildOptimisticTransaction(amount, currency, reportID, comment = '', source = '', originalTransactionID = '', merchant = CONST.REPORT.TYPE.IOU, receipt = {}, filename = '') {
// transactionIDs are random, positive, 64-bit numeric strings.
// Because JS can only handle 53-bit numbers, transactionIDs are strings in the front-end (just like reportActionID)
const transactionID = NumberUtils.rand64();
@@ -38,6 +38,7 @@ function buildOptimisticTransaction(amount, currency, reportID, comment = '', so
created: DateUtils.getDBTime(),
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
receipt,
+ filename,
};
}
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 45fcd35eb839..65a8315f05bf 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -363,7 +363,7 @@ function requestMoney(report, amount, currency, payeeEmail, payeeAccountID, part
receiptObject.source = receipt.source;
receiptObject.state = CONST.IOU.RECEIPT_STATE.SCANREADY;
}
- const optimisticTransaction = TransactionUtils.buildOptimisticTransaction(amount, currency, iouReport.reportID, comment, '', '', undefined, receiptObject);
+ const optimisticTransaction = TransactionUtils.buildOptimisticTransaction(amount, currency, iouReport.reportID, comment, '', '', undefined, receiptObject, receipt.filename);
// STEP 4: Build optimistic reportActions. We need:
// 1. CREATED action for the chatReport
diff --git a/src/libs/fileDownload/FileUtils.js b/src/libs/fileDownload/FileUtils.js
index 4d714fff4f24..d194e7d6cdeb 100644
--- a/src/libs/fileDownload/FileUtils.js
+++ b/src/libs/fileDownload/FileUtils.js
@@ -152,8 +152,10 @@ const readFileAsync = (path, fileName) =>
return res.blob();
})
.then((blob) => {
- const file = new File([blob], cleanFileName(fileName));
+ const cleanName = cleanFileName(fileName)
+ const file = new File([blob], cleanName);
file.source = path;
+ file.filename = cleanName;
resolve(file);
})
.catch((e) => {
From 2e957083b92f20d7bffffbf27a7aee7f8f5579d2 Mon Sep 17 00:00:00 2001
From: Stefan Nemeth
Date: Wed, 9 Aug 2023 23:13:33 +0200
Subject: [PATCH 013/201] When openOnAdminRoom is set, do not redirect first
time users to another chat
---
src/libs/ReportUtils.js | 19 +++++++++---------
src/libs/actions/Welcome.js | 40 ++++++++++++++++++++++---------------
2 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 8b3a0cacffca..89a7a789f1ee 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -485,11 +485,20 @@ function findLastAccessedReport(reports, ignoreDomainRooms, policies, isFirstTim
// since the Concierge report would be incorrectly selected over the deep-linked report in the logic below.
let sortedReports = sortReportsByLastRead(reports);
+ let adminReport;
+ if (openOnAdminRoom) {
+ adminReport = _.find(sortedReports, (report) => {
+ const chatType = getChatType(report);
+ return chatType === CONST.REPORT.CHAT_TYPE.POLICY_ADMINS;
+ });
+ }
+
if (isFirstTimeNewExpensifyUser) {
if (sortedReports.length === 1) {
return sortedReports[0];
}
- return _.find(sortedReports, (report) => !isConciergeChatReport(report));
+
+ return adminReport || _.find(sortedReports, (report) => !isConciergeChatReport(report));
}
if (ignoreDomainRooms) {
@@ -502,14 +511,6 @@ function findLastAccessedReport(reports, ignoreDomainRooms, policies, isFirstTim
);
}
- let adminReport;
- if (openOnAdminRoom) {
- adminReport = _.find(sortedReports, (report) => {
- const chatType = getChatType(report);
- return chatType === CONST.REPORT.CHAT_TYPE.POLICY_ADMINS;
- });
- }
-
return adminReport || _.last(sortedReports);
}
diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js
index f7063fb61308..e06ee12aa4b3 100644
--- a/src/libs/actions/Welcome.js
+++ b/src/libs/actions/Welcome.js
@@ -116,25 +116,33 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) {
const isWorkspaceRoute = topRoute.name === 'Settings' && topRoute.params.path.includes('workspace');
const transitionRoute = _.find(routes, (route) => route.name === SCREENS.TRANSITION_BETWEEN_APPS);
const exitingToWorkspaceRoute = lodashGet(transitionRoute, 'params.exitTo', '') === 'workspace/new';
+ const openOnAdminRoom = lodashGet(topRoute, 'params.openOnAdminRoom', false);
const isDisplayingWorkspaceRoute = isWorkspaceRoute || exitingToWorkspaceRoute;
- // We want to display the Workspace chat first since that means a user is already in a Workspace and doesn't need to create another one
- const workspaceChatReport = _.find(
- allReports,
- (report) => ReportUtils.isPolicyExpenseChat(report) && report.ownerAccountID === currentUserAccountID && report.statusNum !== CONST.REPORT.STATUS.CLOSED,
- );
- if (workspaceChatReport && !isDisplayingWorkspaceRoute) {
- // This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat
- Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false);
- Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID));
-
- // If showPopoverMenu exists and returns true then it opened the Popover Menu successfully, and we can update isFirstTimeNewExpensifyUser
- // so the Welcome logic doesn't run again
- if (showPopoverMenu()) {
- isFirstTimeNewExpensifyUser = false;
+ // If we already opened the workspace settings or want the admin room to stay open, do not
+ // navigate away to the workspace chat report
+ const shouldNavigateToWorkspaceChat = !isDisplayingWorkspaceRoute && !openOnAdminRoom;
+
+ if (shouldNavigateToWorkspaceChat) {
+ // We want to display the Workspace chat first since that means a user is already in a Workspace and doesn't need to create another one
+ const workspaceChatReport = _.find(
+ allReports,
+ (report) => ReportUtils.isPolicyExpenseChat(report) && report.ownerAccountID === currentUserAccountID && report.statusNum !== CONST.REPORT.STATUS.CLOSED,
+ );
+
+ if (workspaceChatReport) {
+ // This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat
+ Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false);
+ Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID));
+
+ // If showPopoverMenu exists and returns true then it opened the Popover Menu successfully, and we can update isFirstTimeNewExpensifyUser
+ // so the Welcome logic doesn't run again
+ if (showPopoverMenu()) {
+ isFirstTimeNewExpensifyUser = false;
+ }
+
+ return;
}
-
- return;
}
// If user is not already an admin of a free policy and we are not navigating them to their workspace or creating a new workspace via workspace/new then
From 5140fede8076c1469f280d44e4d54b7406fe8ce3 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 9 Aug 2023 23:47:51 -0400
Subject: [PATCH 014/201] Fix filename when not present
---
src/components/ReportActionItem/ReportPreview.js | 6 +++---
src/libs/actions/IOU.js | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 6e40f32c35a0..7d30900bed62 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -147,8 +147,8 @@ function ReportPreview(props) {
accessibilityRole="button"
accessibilityLabel={props.translate('iou.viewDetails')}
>
-
-
+
+
{_.map(receipts, ({receipt, filename, transactionID}) => {
const uri = ReceiptUtils.getImageURI(receipt.source, filename);
const hasNoFallback = uri === receipt.source;
@@ -156,7 +156,7 @@ function ReportPreview(props) {
return (
{hasNoFallback
?
Date: Thu, 10 Aug 2023 00:30:26 -0400
Subject: [PATCH 015/201] Rename IOUPreview to MoneyRequestPreview
---
src/ONYXKEYS.js | 2 +-
.../ReportActionItem/MoneyRequestAction.js | 10 +++++-----
.../{IOUPreview.js => MoneyRequestPreview.js} | 14 +++++++-------
src/components/ReportActionItem/ReportPreview.js | 2 +-
src/libs/actions/IOU.js | 2 +-
src/pages/home/report/ReportActionItem.js | 2 +-
src/styles/styles.js | 8 ++++----
7 files changed, 20 insertions(+), 20 deletions(-)
rename src/components/ReportActionItem/{IOUPreview.js => MoneyRequestPreview.js} (96%)
diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js
index 4a255538c786..f60ca9f3120f 100755
--- a/src/ONYXKEYS.js
+++ b/src/ONYXKEYS.js
@@ -33,7 +33,7 @@ export default {
// Credentials to authenticate the user
CREDENTIALS: 'credentials',
- // Contains loading data for the IOU feature (MoneyRequestModal, IOUDetail, & IOUPreview Components)
+ // Contains loading data for the IOU feature (MoneyRequestModal, IOUDetail, & MoneyRequestPreview Components)
IOU: 'iou',
// Keeps track if there is modal currently visible or not
diff --git a/src/components/ReportActionItem/MoneyRequestAction.js b/src/components/ReportActionItem/MoneyRequestAction.js
index 5790e55b2c78..9bb342a6b735 100644
--- a/src/components/ReportActionItem/MoneyRequestAction.js
+++ b/src/components/ReportActionItem/MoneyRequestAction.js
@@ -10,7 +10,7 @@ import compose from '../../libs/compose';
import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes';
import networkPropTypes from '../networkPropTypes';
import iouReportPropTypes from '../../pages/iouReportPropTypes';
-import IOUPreview from './IOUPreview';
+import MoneyRequestPreview from './MoneyRequestPreview';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import styles from '../../styles/styles';
@@ -87,7 +87,7 @@ const defaultProps = {
function MoneyRequestAction(props) {
const isSplitBillAction = lodashGet(props.action, 'originalMessage.type', '') === CONST.IOU.REPORT_ACTION_TYPE.SPLIT;
- const onIOUPreviewPressed = () => {
+ const onMoneyRequestPreviewPressed = () => {
if (isSplitBillAction) {
const reportActionID = lodashGet(props.action, 'reportActionID', '0');
Navigation.navigate(ROUTES.getSplitBillDetailsRoute(props.chatReportID, reportActionID));
@@ -141,7 +141,7 @@ function MoneyRequestAction(props) {
return isDeletedParentAction ? (
${props.translate('parentReportAction.deletedRequest')}`} />
) : (
-
);
diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
similarity index 96%
rename from src/components/ReportActionItem/IOUPreview.js
rename to src/components/ReportActionItem/MoneyRequestPreview.js
index 85a0b22ac327..5488df581335 100644
--- a/src/components/ReportActionItem/IOUPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -124,7 +124,7 @@ const defaultProps = {
shouldShowPendingConversionMessage: false,
};
-function IOUPreview(props) {
+function MoneyRequestPreview(props) {
if (_.isEmpty(props.iouReport) && !props.isBillSplit) {
return null;
}
@@ -186,7 +186,7 @@ function IOUPreview(props) {
errorRowStyles={[styles.mbn1]}
needsOffscreenAlphaCompositing
>
-
+
{getPreviewHeaderText()}
@@ -216,7 +216,7 @@ function IOUPreview(props) {
)}
{props.isBillSplit && (
-
+
-
+
{_.map(receipts, ({receipt, filename, transactionID}) => {
const uri = ReceiptUtils.getImageURI(receipt.source, filename);
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 0f8ac015d5a1..85022a503071 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -809,7 +809,7 @@ function deleteMoneyRequest(transactionID, reportAction, isSingleTransactionView
// STEP 2: Decide if we need to:
// 1. Delete the transactionThread - delete if there are no visible comments in the thread
- // 2. Update the iouPreview to show [Deleted request] - update if the transactionThread exists AND it isn't being deleted
+ // 2. Update the moneyRequestPreview to show [Deleted request] - update if the transactionThread exists AND it isn't being deleted
const shouldDeleteTransactionThread = transactionThreadID ? ReportActionsUtils.getLastVisibleMessage(transactionThreadID).lastMessageText.length === 0 : false;
const shouldShowDeletedRequestMessage = transactionThreadID && !shouldDeleteTransactionThread;
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 05e57c592b9f..b25efda7ebc8 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -238,7 +238,7 @@ function ReportActionItem(props) {
// IOUDetails only exists when we are sending money
const isSendingMoney = originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && _.has(originalMessage, 'IOUDetails');
- // Show the IOUPreview for when request was created, bill was split or money was sent
+ // Show the MoneyRequestPreview for when request was created, bill was split or money was sent
if (
props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU &&
originalMessage &&
diff --git a/src/styles/styles.js b/src/styles/styles.js
index f5b2d883d845..42c75f510435 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -2640,7 +2640,7 @@ const styles = {
maxWidth: variables.sideBarWidth,
},
- iouPreviewBox: {
+ moneyRequestPreviewBox: {
backgroundColor: themeColors.cardBG,
borderRadius: variables.componentBorderRadiusLarge,
padding: 16,
@@ -2648,11 +2648,11 @@ const styles = {
width: '100%',
},
- iouPreviewBoxHover: {
+ moneyRequestPreviewBoxHover: {
backgroundColor: themeColors.border,
},
- iouPreviewBoxLoading: {
+ moneyRequestPreviewBoxLoading: {
// When a new IOU request arrives it is very briefly in a loading state, so set the minimum height of the container to 94 to match the rendered height after loading.
// Otherwise, the IOU request pay button will not be fully visible and the user will have to scroll up to reveal the entire IOU request container.
// See https://github.com/Expensify/App/issues/10283.
@@ -2660,7 +2660,7 @@ const styles = {
width: '100%',
},
- iouPreviewBoxAvatar: {
+ moneyRequestPreviewBoxAvatar: {
marginRight: -10,
marginBottom: 0,
},
From 3f7acbeb98382dba26fb5e9c89384c0d1b310c4a Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 10 Aug 2023 14:44:03 -0400
Subject: [PATCH 016/201] Implement whispers
---
.../ReportActionItem/ReportPreview.js | 7 +-
src/libs/ReportActionsUtils.js | 64 +++++++++++++++++++
src/libs/TransactionUtils.js | 12 +++-
src/libs/actions/IOU.js | 2 +-
src/pages/home/report/ReportActionItem.js | 2 +-
5 files changed, 79 insertions(+), 8 deletions(-)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 6475ddc99b2c..b2f6822d9585 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -27,6 +27,7 @@ import themeColors from '../../styles/themes/default';
import reportPropTypes from '../../pages/reportPropTypes';
import RenderHTML from '../RenderHTML';
import * as ReceiptUtils from '../../libs/ReceiptUtils';
+import * as ReportActionUtils from '../../libs/ReportActionsUtils';
import Image from '../Image';
const propTypes = {
@@ -101,8 +102,7 @@ function ReportPreview(props) {
const reportTotal = ReportUtils.getMoneyRequestTotal(props.iouReport);
const iouSettled = ReportUtils.isSettled(props.iouReportID);
- const receiptIDs = lodashGet(props.action, 'childLastReceiptTransactionIDs', '').split(',');
- const receipts = _.filter(props.receipts, (transaction) => receiptIDs.includes(transaction.transactionID));
+ const receipts = ReportActionUtils.getReportPreviewTransactions(props.action);
const isScanning = _.some(receipts, ({receipt}) => ReceiptUtils.isBeingScanned(receipt));
let displayAmount;
@@ -223,9 +223,6 @@ export default compose(
iouReport: {
key: ({iouReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`,
},
- receipts: {
- key: ONYXKEYS.COLLECTION.TRANSACTION,
- },
session: {
key: ONYXKEYS.SESSION,
},
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index 3cd5621e5e32..4fe5f1929fcc 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -10,6 +10,8 @@ import ONYXKEYS from '../ONYXKEYS';
import Log from './Log';
import * as CurrencyUtils from './CurrencyUtils';
import isReportMessageAttachment from './isReportMessageAttachment';
+import * as TransactionUtils from './TransactionUtils';
+import * as ReceiptUtils from './ReceiptUtils';
const allReports = {};
Onyx.connect({
@@ -37,6 +39,19 @@ Onyx.connect({
},
});
+const allTransactions = {};
+Onyx.connect({
+ key: ONYXKEYS.COLLECTION.TRANSACTION,
+ callback: (actions, key) => {
+ if (!key || !actions) {
+ return;
+ }
+
+ const transactionID = CollectionUtils.extractCollectionItemID(key);
+ allTransactions[transactionID] = actions;
+ },
+});
+
let isNetworkOffline = false;
Onyx.connect({
key: ONYXKEYS.NETWORK,
@@ -561,6 +576,53 @@ function isMessageDeleted(reportAction) {
return lodashGet(reportAction, ['message', 0, 'isDeletedParentAction'], false);
}
+/**
+ * Get the transactions related to a report preview
+ *
+ * @param {Object} reportPreviewAction
+ * @returns {Object}
+ */
+function getReportPreviewTransactions(reportPreviewAction) {
+ const transactionIDs = lodashGet(reportPreviewAction, ['childLastReceiptTransactionIDs'], '').split(',');
+ return _.reduce(transactionIDs, (transactions, transactionID) => {
+ const transaction = allTransactions[transactionID];
+ if (transaction) {
+ transactions.push(transaction);
+ }
+ return transactions;
+ }, []);
+}
+
+/**
+ * @param {Object} iouReportAction
+ * @returns {Object}
+ */
+function getTransaction(iouReportAction) {
+ const transactionID = lodashGet(iouReportAction, ['originalMessage', 'IOUTransactionID']);
+ return allTransactions[transactionID] || {};
+}
+
+
+/**
+ * Checks if the IOU or expense report has either no smartscanned receipts or at least one is already done scanning
+ *
+ * @param {Object|null} reportAction
+ * @returns {Boolean}
+ */
+function hasReadyMoneyRequests(reportAction) {
+ if (isReportPreviewAction(reportAction)) {
+ const transactions = getReportPreviewTransactions(reportAction);
+ return _.some(transactions, (transaction) => !TransactionUtils.hasReceipt(transaction) || !ReceiptUtils.isBeingScanned(transaction.receipt));
+ }
+
+ if (isMoneyRequestAction(reportAction)) {
+ const transaction = getTransaction(reportAction);
+ return !TransactionUtils.hasReceipt(transaction) || !ReceiptUtils.isBeingScanned(transaction.receipt);
+ }
+
+ return true;
+}
+
export {
getSortedReportActions,
getLastVisibleAction,
@@ -593,4 +655,6 @@ export {
isWhisperAction,
isPendingRemove,
getReportAction,
+ getReportPreviewTransactions,
+ hasReadyMoneyRequests,
};
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 3e89d0fe87ef..71881236696f 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -1,3 +1,4 @@
+import _ from 'underscore';
import CONST from '../CONST';
import DateUtils from './DateUtils';
import * as NumberUtils from './NumberUtils';
@@ -42,6 +43,15 @@ function buildOptimisticTransaction(amount, currency, reportID, comment = '', so
};
}
-export default {
+/**
+ * @param {Object|null} transaction
+ * @returns {Boolean}
+ */
+function hasReceipt(transaction) {
+ return _.has(transaction, 'receipt');
+}
+
+export {
buildOptimisticTransaction,
+ hasReceipt,
};
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 85022a503071..fda08ab912df 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -16,7 +16,7 @@ import * as ReportActionsUtils from '../ReportActionsUtils';
import * as IOUUtils from '../IOUUtils';
import * as OptionsListUtils from '../OptionsListUtils';
import DateUtils from '../DateUtils';
-import TransactionUtils from '../TransactionUtils';
+import * as TransactionUtils from '../TransactionUtils';
import * as ErrorUtils from '../ErrorUtils';
import * as UserUtils from '../UserUtils';
import * as Report from './Report';
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index b25efda7ebc8..42a9998e0ae1 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -495,7 +495,7 @@ function ReportActionItem(props) {
const hasErrors = !_.isEmpty(props.action.errors);
const whisperedToAccountIDs = props.action.whisperedToAccountIDs || [];
- const isWhisper = whisperedToAccountIDs.length > 0;
+ const isWhisper = whisperedToAccountIDs.length > 0 || !ReportActionsUtils.hasReadyMoneyRequests(props.action);
const isMultipleParticipant = whisperedToAccountIDs.length > 1;
const isWhisperOnlyVisibleByUser = isWhisper && ReportUtils.isCurrentUserTheOnlyParticipant(whisperedToAccountIDs);
const whisperedToPersonalDetails = isWhisper ? _.filter(props.personalDetailsList, (details) => _.includes(whisperedToAccountIDs, details.accountID)) : [];
From 0f25a34ba31477a72d92d91d45e26f6c79486343 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 10 Aug 2023 15:34:35 -0400
Subject: [PATCH 017/201] Update MoneyRequestPreview for receipts
---
.../ReportActionItem/MoneyRequestPreview.js | 140 ++++++++++++------
.../ReportActionItem/ReportPreview.js | 6 +-
src/libs/ReportActionsUtils.js | 1 +
src/libs/TransactionUtils.js | 2 +-
src/styles/styles.js | 19 ++-
5 files changed, 114 insertions(+), 54 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index 5488df581335..0932ef47dfb5 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -28,6 +28,11 @@ import * as IOUUtils from '../../libs/IOUUtils';
import * as ReportUtils from '../../libs/ReportUtils';
import refPropTypes from '../refPropTypes';
import PressableWithFeedback from '../Pressable/PressableWithoutFeedback';
+import * as ReportActionUtils from '../../libs/ReportActionsUtils';
+import * as TransactionUtils from '../../libs/TransactionUtils';
+import * as ReceiptUtils from '../../libs/ReceiptUtils';
+import RenderHTML from '../RenderHTML';
+import Image from '../Image';
const propTypes = {
/** The active IOUReport, used for Onyx subscription */
@@ -143,6 +148,10 @@ function MoneyRequestPreview(props) {
const requestCurrency = moneyRequestAction.currency;
const requestComment = moneyRequestAction.comment.trim();
+ const transaction = ReportActionUtils.getTransaction(props.action);
+ const hasReceipt = TransactionUtils.hasReceipt(transaction);
+ const isScanning = !ReportActionUtils.hasReadyMoneyRequests(props.action);
+
const getSettledMessage = () => {
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
case CONST.IOU.PAYMENT_TYPE.PAYPAL_ME:
@@ -161,6 +170,10 @@ function MoneyRequestPreview(props) {
};
const getPreviewHeaderText = () => {
+ if (isScanning) {
+ return props.translate('iou.receipt');
+ }
+
if (props.isBillSplit) {
return props.translate('iou.split');
}
@@ -174,6 +187,32 @@ function MoneyRequestPreview(props) {
return message;
};
+ const getDisplayAmountText = () => {
+ if (isScanning) {
+ return props.translate('iou.receiptScanning');
+ }
+
+ return CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency);
+ }
+
+ const renderReceipt = ({receipt, filename}) => {
+ const uri = ReceiptUtils.getImageURI(receipt.source, filename);
+ const hasNoFallback = uri === receipt.source;
+
+ if (hasNoFallback) {
+ return (
+
+ `} />
+ );
+ }
+ return ();
+ }
+
const childContainer = (
-
-
-
- {getPreviewHeaderText()}
- {Boolean(getSettledMessage()) && (
- <>
-
- {getSettledMessage()}
- >
- )}
+
+ {hasReceipt && (
+
+ {renderReceipt(transaction)}
-
-
-
- {CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency)}
- {ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && (
-
-
+
+
+ {getPreviewHeaderText()}
+ {Boolean(getSettledMessage()) && (
+ <>
+
+ {getSettledMessage()}
+ >
+ )}
+
+
+
+
+ {getDisplayAmountText()}
+ {ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && (
+
+
+
+ )}
+
+ {props.isBillSplit && (
+
+
)}
- {props.isBillSplit && (
-
-
+
+
+ {!isCurrentUserManager && props.shouldShowPendingConversionMessage && (
+ {props.translate('iou.pendingConversionMessage')}
+ )}
+ {!_.isEmpty(requestComment) && {requestComment}}
- )}
-
-
-
- {!isCurrentUserManager && props.shouldShowPendingConversionMessage && (
- {props.translate('iou.pendingConversionMessage')}
+ {props.isBillSplit && !_.isEmpty(participantAccountIDs) && (
+
+ {props.translate('iou.amountEach', {
+ amount: CurrencyUtils.convertToDisplayString(IOUUtils.calculateAmount(participantAccountIDs.length - 1, requestAmount), requestCurrency),
+ })}
+
)}
- {!_.isEmpty(requestComment) && {requestComment}}
- {props.isBillSplit && !_.isEmpty(participantAccountIDs) && (
-
- {props.translate('iou.amountEach', {
- amount: CurrencyUtils.convertToDisplayString(IOUUtils.calculateAmount(participantAccountIDs.length - 1, requestAmount), requestCurrency),
- })}
-
- )}
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index b2f6822d9585..a2010ccecf71 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -103,7 +103,7 @@ function ReportPreview(props) {
const iouSettled = ReportUtils.isSettled(props.iouReportID);
const receipts = ReportActionUtils.getReportPreviewTransactions(props.action);
- const isScanning = _.some(receipts, ({receipt}) => ReceiptUtils.isBeingScanned(receipt));
+ const isScanning = !ReportActionUtils.hasReadyMoneyRequests(props.action);
let displayAmount;
if (reportTotal) {
@@ -148,7 +148,7 @@ function ReportPreview(props) {
accessibilityLabel={props.translate('iou.viewDetails')}
>
-
+
{_.map(receipts, ({receipt, filename, transactionID}) => {
const uri = ReceiptUtils.getImageURI(receipt.source, filename);
const hasNoFallback = uri === receipt.source;
@@ -156,7 +156,7 @@ function ReportPreview(props) {
return (
{hasNoFallback
?
Date: Thu, 10 Aug 2023 17:43:25 -0400
Subject: [PATCH 018/201] Refactor thumbnail/image for receipts
---
.../MoneyRequestConfirmationList.js | 2 +-
.../ReportActionItem/MoneyRequestPreview.js | 13 +++++-----
.../ReportActionItem/ReportPreview.js | 12 ++++------
src/libs/ReceiptUtils.js | 24 +++++++++++--------
src/libs/actions/IOU.js | 2 +-
src/libs/fileDownload/FileUtils.js | 1 -
src/pages/iou/ReceiptSelector/index.js | 3 +--
7 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js
index 5b12c8da4052..94b7a53dc795 100755
--- a/src/components/MoneyRequestConfirmationList.js
+++ b/src/components/MoneyRequestConfirmationList.js
@@ -332,7 +332,7 @@ function MoneyRequestConfirmationList(props) {
{!_.isEmpty(props.receiptPath) ? (
) : (
{
- const uri = ReceiptUtils.getImageURI(receipt.source, filename);
- const hasNoFallback = uri === receipt.source;
-
- if (hasNoFallback) {
+ const {thumbnail, image} = ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename);
+ console.log(thumbnail, image);
+ if (thumbnail) {
return (
`} />
);
}
- return ();
+ return ();
}
const childContainer = (
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index a2010ccecf71..0abb6d824f91 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -150,23 +150,21 @@ function ReportPreview(props) {
{_.map(receipts, ({receipt, filename, transactionID}) => {
- const uri = ReceiptUtils.getImageURI(receipt.source, filename);
- const hasNoFallback = uri === receipt.source;
-
+ const {thumbnail, image} = ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename);
return (
- {hasNoFallback
+ {thumbnail
?
`} />
- :
+ :
}
);
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index 9106e9af2be7..9dd83ed48e87 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -32,33 +32,37 @@ function validateReceipt(file) {
/**
- * Grab the appropriate receipt image URI based on file type
+ * Grab the appropriate receipt image and thumbnail URIs based on file type
*
* @param {String} path URI to image, i.e. blob://new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg
* @param {String} filename of uploaded image or last part of remote URI
- * @returns {*}
+ * @returns {Object}
*/
-function getImageURI(path, filename) {
+function getThumbnailAndImageURIs(path, filename) {
+ if (path.startsWith('blob://')) {
+ return {thumbnail: null, image: path};
+ }
+
const {fileExtension} = FileUtils.splitExtensionFromFileName(filename);
const isReceiptImage = Str.isImage(filename);
if (isReceiptImage) {
- return path;
+ return {thumbnail: `${path}.1024.jpg`, image: path};
}
+ let image = ReceiptGeneric;
if (fileExtension === CONST.IOU.FILE_TYPES.HTML) {
- return ReceiptHTML;
+ image = ReceiptHTML;
}
if (fileExtension === CONST.IOU.FILE_TYPES.DOC || fileExtension === CONST.IOU.FILE_TYPES.DOCX) {
- return ReceiptDoc;
+ image = ReceiptDoc;
}
if (fileExtension === CONST.IOU.FILE_TYPES.SVG) {
- return ReceiptSVG;
+ image = ReceiptSVG;
}
-
- return ReceiptGeneric;
+ return {thumbnail: null, image};
};
function isBeingScanned(receipt) {
@@ -67,6 +71,6 @@ function isBeingScanned(receipt) {
export {
validateReceipt,
- getImageURI,
+ getThumbnailAndImageURIs,
isBeingScanned,
};
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index fda08ab912df..6b9190c999c9 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -363,7 +363,7 @@ function requestMoney(report, amount, currency, payeeEmail, payeeAccountID, part
if (receipt && receipt.source) {
receiptObject.source = receipt.source;
receiptObject.state = CONST.IOU.RECEIPT_STATE.SCANREADY;
- filename = receipt.filename;
+ filename = receipt.name;
}
const optimisticTransaction = TransactionUtils.buildOptimisticTransaction(amount, currency, iouReport.reportID, comment, '', '', undefined, receiptObject, filename);
diff --git a/src/libs/fileDownload/FileUtils.js b/src/libs/fileDownload/FileUtils.js
index d194e7d6cdeb..962923241b62 100644
--- a/src/libs/fileDownload/FileUtils.js
+++ b/src/libs/fileDownload/FileUtils.js
@@ -155,7 +155,6 @@ const readFileAsync = (path, fileName) =>
const cleanName = cleanFileName(fileName)
const file = new File([blob], cleanName);
file.source = path;
- file.filename = cleanName;
resolve(file);
})
.catch((e) => {
diff --git a/src/pages/iou/ReceiptSelector/index.js b/src/pages/iou/ReceiptSelector/index.js
index 392e96887f8b..b693b299eac3 100644
--- a/src/pages/iou/ReceiptSelector/index.js
+++ b/src/pages/iou/ReceiptSelector/index.js
@@ -99,8 +99,7 @@ function ReceiptSelector(props) {
return;
}
- const filePath = URL.createObjectURL(file);
- IOU.setMoneyRequestReceipt(filePath, file.name);
+ IOU.setMoneyRequestReceipt(file.uri, file.name);
IOU.navigateToNextPage(iou, iouType, reportID, report);
};
From fb4120ee101b29c28570729df1f4c31a253a7eb9 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 10 Aug 2023 18:32:55 -0400
Subject: [PATCH 019/201] Update request header, disable receipt modal, update
image URI blob check
---
src/components/ReportActionItem/MoneyRequestPreview.js | 2 +-
src/components/ReportActionItem/ReportPreview.js | 1 +
src/libs/ReceiptUtils.js | 4 ++--
src/libs/ReportUtils.js | 4 ++++
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index f1b34ae652b9..7be5a6cbe7d2 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -197,7 +197,6 @@ function MoneyRequestPreview(props) {
const renderReceipt = ({receipt, filename}) => {
const {thumbnail, image} = ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename);
- console.log(thumbnail, image);
if (thumbnail) {
return (
`} />
);
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 0abb6d824f91..7676bff77a40 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -162,6 +162,7 @@ function ReportPreview(props) {
src="${thumbnail}"
data-expensify-source="${image}"
data-expensify-fit-container="true"
+ data-expensify-preview-modal-disabled="true"
/>
`} />
:
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index 9dd83ed48e87..e973c85f02d8 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -34,12 +34,12 @@ function validateReceipt(file) {
/**
* Grab the appropriate receipt image and thumbnail URIs based on file type
*
- * @param {String} path URI to image, i.e. blob://new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg
+ * @param {String} path URI to image, i.e. blob:new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg
* @param {String} filename of uploaded image or last part of remote URI
* @returns {Object}
*/
function getThumbnailAndImageURIs(path, filename) {
- if (path.startsWith('blob://')) {
+ if (path.startsWith('blob:')) {
return {thumbnail: null, image: path};
}
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 3fd1236e26ae..bf9f263c6c57 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1259,6 +1259,10 @@ function getTransactionReportName(reportAction) {
return Localize.translateLocal('parentReportAction.deletedRequest');
}
+ if (!ReportActionsUtils.hasReadyMoneyRequests(reportAction)) {
+ return Localize.translateLocal('iou.receiptScanning');
+ }
+
return Localize.translateLocal(ReportActionsUtils.isSentMoneyReportAction(reportAction) ? 'iou.threadSentMoneyReportName' : 'iou.threadRequestReportName', {
formattedAmount: ReportActionsUtils.getFormattedAmount(reportAction),
comment: lodashGet(reportAction, 'originalMessage.comment'),
From b6280f2e5a7563b59f0ce19c8adedd8948790405 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 10 Aug 2023 18:34:22 -0400
Subject: [PATCH 020/201] Update scan in progress string
---
src/languages/en.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/languages/en.js b/src/languages/en.js
index 810b60d4ec5a..f6e445537aeb 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -380,7 +380,7 @@ export default {
viewDetails: 'View details',
pending: 'Pending',
receipt: 'Receipt',
- receiptScanning: 'Scanning in progress...',
+ receiptScanning: 'Scan in progress...',
settledExpensify: 'Paid',
settledElsewhere: 'Paid elsewhere',
settledPaypalMe: 'Paid using Paypal.me',
From a7fe6c8d2dc17c141a6fc6d37ffc1fdbcc34ded3 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 10 Aug 2023 19:10:03 -0400
Subject: [PATCH 021/201] Add receipt in money request view
---
.../ReportActionItem/MoneyRequestView.js | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index dc8916bdaecb..26333b9ca3db 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -20,6 +20,9 @@ import DateUtils from '../../libs/DateUtils';
import * as CurrencyUtils from '../../libs/CurrencyUtils';
import EmptyStateBackgroundImage from '../../../assets/images/empty-state_background-fade.png';
import useLocalize from '../../hooks/useLocalize';
+import * as TransactionUtils from '../../libs/TransactionUtils';
+import * as ReceiptUtils from '../../libs/ReceiptUtils';
+import RenderHTML from '../RenderHTML';
const propTypes = {
/** The report currently being looked at */
@@ -49,6 +52,13 @@ function MoneyRequestView(props) {
const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID);
const {translate} = useLocalize();
+ const transaction = ReportActionsUtils.getTransaction(parentReportAction)
+ const hasReceipt = TransactionUtils.hasReceipt(transaction);
+ let receiptUris;
+ if (hasReceipt) {
+ receiptUris = ReceiptUtils.getThumbnailAndImageURIs(transaction.receipt.source, transaction.filename);
+ }
+
return (
@@ -58,6 +68,18 @@ function MoneyRequestView(props) {
style={[StyleUtils.getReportWelcomeBackgroundImageStyle(true)]}
/>
+ {hasReceipt && (
+
+
+ `} />
+
+ )}
Date: Thu, 10 Aug 2023 20:05:42 -0400
Subject: [PATCH 022/201] Add receipt whisper to details
---
.../ReportActionItem/MoneyRequestView.js | 35 +++++++++++++------
.../ReportActionItem/ReportPreview.js | 2 +-
src/languages/en.js | 4 ++-
src/languages/es.js | 4 ++-
src/styles/styles.js | 21 +++++++++++
5 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 26333b9ca3db..45187cc092d5 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -23,6 +23,8 @@ import useLocalize from '../../hooks/useLocalize';
import * as TransactionUtils from '../../libs/TransactionUtils';
import * as ReceiptUtils from '../../libs/ReceiptUtils';
import RenderHTML from '../RenderHTML';
+import withLocalize from '../withLocalize';
+import Text from '../Text';
const propTypes = {
/** The report currently being looked at */
@@ -69,16 +71,28 @@ function MoneyRequestView(props) {
/>
{hasReceipt && (
-
-
- `} />
-
+ <>
+
+
+ `} />
+
+
+
+
+ {props.translate('iou.receiptWhisperTitle')}
+
+
+ {props.translate('iou.receiptWhisperText')}
+
+
+
+ >
)}
`${ONYXKEYS.COLLECTION.REPORT}${props.report.parentReportID}`,
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 7676bff77a40..d3f4e66bcfeb 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -1,4 +1,4 @@
-import React, {useMemo} from 'react';
+import React from 'react';
import _ from 'underscore';
import {View} from 'react-native';
import PropTypes from 'prop-types';
diff --git a/src/languages/en.js b/src/languages/en.js
index f6e445537aeb..04138cbde8df 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -380,7 +380,9 @@ export default {
viewDetails: 'View details',
pending: 'Pending',
receipt: 'Receipt',
- receiptScanning: 'Scan in progress...',
+ receiptScanning: 'Scan in progress…',
+ receiptWhisperTitle: 'Receipt scanning…',
+ receiptWhisperText: 'Only you can see this receipt when it\'s scanning. Check back later or enter the details now.',
settledExpensify: 'Paid',
settledElsewhere: 'Paid elsewhere',
settledPaypalMe: 'Paid using Paypal.me',
diff --git a/src/languages/es.js b/src/languages/es.js
index 656723c59ab0..7828acb0e084 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -379,7 +379,9 @@ export default {
viewDetails: 'Ver detalles',
pending: 'Pendiente',
receipt: 'Recibo',
- receiptScanning: 'Escaneo en progreso...',
+ receiptScanning: 'Escaneo en progreso…',
+ receiptWhisperTitle: 'Escaneo de recibos…',
+ receiptWhisperText: 'Solo tú puedes ver este recibo cuando se está escaneando. Vuelve más tarde o ingresa los detalles ahora.',
settledExpensify: 'Pagado',
settledElsewhere: 'Pagado de otra forma',
settledPaypalMe: 'Pagado con PayPal.me',
diff --git a/src/styles/styles.js b/src/styles/styles.js
index c945f7fee990..9ac0559b1105 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3691,6 +3691,27 @@ const styles = {
reportPreviewBoxText: {
padding: 16,
},
+
+ moneyRequestViewReceipt: {
+ marginHorizontal: 20,
+ marginVertical: 8,
+ borderWidth: 2,
+ borderColor: themeColors.border,
+ borderRadius: variables.componentBorderRadiusCard,
+ overflow: 'hidden',
+ height: 300,
+ },
+
+ moneyRequestViewReceiptWhisper: {
+ flexDirection: 'row',
+ marginHorizontal: 20,
+ marginVertical: 8,
+ paddingHorizontal: 20,
+ paddingVertical: 12,
+ justifyContent: 'space-between',
+ backgroundColor: themeColors.border,
+ borderRadius: variables.componentBorderRadiusCard,
+ }
};
export default styles;
From 57be23d9ad0aa6ae8d9e994e21bf634e42792376 Mon Sep 17 00:00:00 2001
From: dukenv0307
Date: Fri, 11 Aug 2023 10:41:15 +0700
Subject: [PATCH 023/201] update context menu correctly for thread first chat
---
src/pages/home/report/ReportActionItem.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 3c71b8bc62f3..283222692421 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -204,7 +204,7 @@ function ReportActionItem(props) {
}
setIsContextMenuActive(true);
-
+ const originalReport = ReportUtils.getReport(ReportUtils.getOriginalReportID(props.report.reportID, props.action));
const selection = SelectionScraper.getCurrentSelection();
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.REPORT_ACTION,
@@ -216,8 +216,8 @@ function ReportActionItem(props) {
props.draftMessage,
() => {},
toggleContextMenuFromActiveReportAction,
- ReportUtils.isArchivedRoom(props.report),
- ReportUtils.chatIncludesChronos(props.report),
+ ReportUtils.isArchivedRoom(originalReport),
+ ReportUtils.chatIncludesChronos(originalReport),
);
},
[props.draftMessage, props.action, props.report, toggleContextMenuFromActiveReportAction],
@@ -506,6 +506,7 @@ function ReportActionItem(props) {
const isWhisperOnlyVisibleByUser = isWhisper && ReportUtils.isCurrentUserTheOnlyParticipant(whisperedToAccountIDs);
const whisperedToPersonalDetails = isWhisper ? _.filter(props.personalDetailsList, (details) => _.includes(whisperedToAccountIDs, details.accountID)) : [];
const displayNamesWithTooltips = isWhisper ? ReportUtils.getDisplayNamesWithTooltips(whisperedToPersonalDetails, isMultipleParticipant) : [];
+ const originalReport = ReportUtils.getReport(ReportUtils.getOriginalReportID(props.report.reportID, props.action));
return (
Date: Fri, 11 Aug 2023 19:06:45 +0200
Subject: [PATCH 024/201] refactored DateUtils, timezone fixes, additional
tests, removed all usage of moment
---
src/CONST.js | 5 +
src/components/AutoUpdateTime.js | 14 +-
.../ReportActionItem/ChronosOOOListActions.js | 10 +-
src/libs/DateUtils.js | 143 ++++++++++++++----
src/pages/home/report/ParticipantLocalTime.js | 13 +-
tests/unit/DateUtilsTest.js | 86 ++++++-----
6 files changed, 185 insertions(+), 86 deletions(-)
diff --git a/src/CONST.js b/src/CONST.js
index 56102c7641f7..bfb57a5feaed 100755
--- a/src/CONST.js
+++ b/src/CONST.js
@@ -181,6 +181,11 @@ const CONST = {
MOMENT_FORMAT_STRING: 'YYYY-MM-DD',
SQL_DATE_TIME: 'YYYY-MM-DD HH:mm:ss',
FNS_FORMAT_STRING: 'yyyy-MM-dd',
+ LOCAL_TIME_FORMAT: 'h:mm a',
+ WEEKDAY_TIME_FORMAT: 'eeee',
+ FNS_TIMEZONE_FORMAT_STRING: "yyyy-MM-dd'T'HH:mm:ssXXX",
+ FNS_DB_FORMAT_STRING: 'yyyy-MM-dd HH:mm:ss.SSS',
+ LONG_DATE_FORMAT_WITH_WEEKDAY: 'eeee, MMMM d, yyyy',
UNIX_EPOCH: '1970-01-01 00:00:00.000',
MAX_DATE: '9999-12-31',
MIN_DATE: '0001-01-01',
diff --git a/src/components/AutoUpdateTime.js b/src/components/AutoUpdateTime.js
index a522a3e6dcdc..cb15cb20b4ea 100644
--- a/src/components/AutoUpdateTime.js
+++ b/src/components/AutoUpdateTime.js
@@ -27,21 +27,13 @@ function AutoUpdateTime(props) {
* @returns {moment} Returns the locale moment object
*/
const getCurrentUserLocalTime = useCallback(
- () => DateUtils.getLocalMomentFromDatetime(props.preferredLocale, null, props.timezone.selected),
+ () => DateUtils.getLocalDateFromDatetime(props.preferredLocale, null, props.timezone.selected),
[props.preferredLocale, props.timezone.selected],
);
const [currentUserLocalTime, setCurrentUserLocalTime] = useState(getCurrentUserLocalTime);
const minuteRef = useRef(new Date().getMinutes());
- const timezoneName = useMemo(() => {
- // With non-GMT timezone, moment.zoneAbbr() will return the name of that timezone, so we can use it directly.
- if (Number.isNaN(Number(currentUserLocalTime.zoneAbbr()))) {
- return currentUserLocalTime.zoneAbbr();
- }
-
- // With GMT timezone, moment.zoneAbbr() will return a number, so we need to display it as GMT {abbreviations} format, e.g.: GMT +07
- return `GMT ${currentUserLocalTime.zoneAbbr()}`;
- }, [currentUserLocalTime]);
+ const timezoneName = useMemo(() => DateUtils.getZoneAbbreviation(currentUserLocalTime, props.timezone.selected), [currentUserLocalTime, props.timezone.selected]);
useEffect(() => {
// If the any of the props that getCurrentUserLocalTime depends on change, we want to update the displayed time immediately
@@ -68,7 +60,7 @@ function AutoUpdateTime(props) {
{props.translate('detailsPage.localTime')}
- {currentUserLocalTime.format('LT')} {timezoneName}
+ {DateUtils.formatToLocalTime(currentUserLocalTime)} {timezoneName}
);
diff --git a/src/components/ReportActionItem/ChronosOOOListActions.js b/src/components/ReportActionItem/ChronosOOOListActions.js
index 3c9c65d8f254..61c504d122ff 100644
--- a/src/components/ReportActionItem/ChronosOOOListActions.js
+++ b/src/components/ReportActionItem/ChronosOOOListActions.js
@@ -37,8 +37,8 @@ function ChronosOOOListActions(props) {
{_.map(events, (event) => {
- const start = DateUtils.getLocalMomentFromDatetime(props.preferredLocale, lodashGet(event, 'start.date', ''));
- const end = DateUtils.getLocalMomentFromDatetime(props.preferredLocale, lodashGet(event, 'end.date', ''));
+ const start = DateUtils.getLocalDateFromDatetime(props.preferredLocale, lodashGet(event, 'start.date', ''));
+ const end = DateUtils.getLocalDateFromDatetime(props.preferredLocale, lodashGet(event, 'end.date', ''));
return (
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index d6330f4da076..21f606fa621c 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -679,7 +679,7 @@ export {
isWhisperAction,
isPendingRemove,
getReportAction,
- areAllRequestsBeingSmartscanned,
+ areAllRequestsBeingSmartScanned,
getNumberOfMoneyRequests,
getNumberOfScanningReceipts,
};
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 1d091e4a0b5a..ff435f4a479b 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1261,7 +1261,7 @@ function getTransactionReportName(reportAction) {
return Localize.translateLocal('parentReportAction.deletedRequest');
}
- if (!ReportActionsUtils.areAllRequestsBeingSmartscanned(reportAction)) {
+ if (!ReportActionsUtils.areAllRequestsBeingSmartScanned(reportAction)) {
return Localize.translateLocal('iou.receiptScanning');
}
diff --git a/src/styles/styles.js b/src/styles/styles.js
index 7992653ae832..47f18df7a54f 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3682,7 +3682,7 @@ const styles = {
backgroundColor: themeColors.border,
},
- reportPreviewBoxText: {
+ reportPreviewBoxBody: {
padding: 16,
},
From d8c58730674c0261b0da552b8fe26a366958cb33 Mon Sep 17 00:00:00 2001
From: dukenv0307 <129500732+dukenv0307@users.noreply.github.com>
Date: Wed, 16 Aug 2023 22:29:52 +0700
Subject: [PATCH 054/201] Update src/pages/home/report/ReportActionItem.js
Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com>
---
src/pages/home/report/ReportActionItem.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 1d437e37062c..f2eb4fd74417 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -131,7 +131,8 @@ function ReportActionItem(props) {
const textInputRef = useRef();
const popoverAnchorRef = useRef();
const downloadedPreviews = useRef([]);
- const originalReport = ReportUtils.getReport(ReportUtils.getOriginalReportID(props.report.reportID, props.action));
+ const originalReportID = ReportUtils.getOriginalReportID(props.report.reportID, props.action);
+ const originalReport = props.report.reportID === originalReportID ? props.report : ReportUtils.getReport(originalReportID);
useEffect(
() => () => {
From 431a372c453fab034285d03fc8d906ff340e69e2 Mon Sep 17 00:00:00 2001
From: dukenv0307 <129500732+dukenv0307@users.noreply.github.com>
Date: Wed, 16 Aug 2023 22:30:46 +0700
Subject: [PATCH 055/201] Update src/pages/home/report/ReportActionItem.js
Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com>
---
src/pages/home/report/ReportActionItem.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index f2eb4fd74417..853427f6abd2 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -230,7 +230,7 @@ function ReportActionItem(props) {
ReportUtils.chatIncludesChronos(originalReport),
);
},
- [props.draftMessage, props.action, props.report, toggleContextMenuFromActiveReportAction, originalReport],
+ [props.draftMessage, props.action, props.report.reportID, toggleContextMenuFromActiveReportAction, originalReport],
);
const toggleReaction = useCallback(
From 3be8a264bf3bb120bdbb71e6fd630403ebd053fa Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Wed, 16 Aug 2023 19:52:46 +0200
Subject: [PATCH 056/201] utc fux
---
src/libs/DateUtils.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libs/DateUtils.js b/src/libs/DateUtils.js
index 4548a5866e2f..da4f2103ce57 100644
--- a/src/libs/DateUtils.js
+++ b/src/libs/DateUtils.js
@@ -65,7 +65,7 @@ function getLocalDateFromDatetime(locale, datetime, currentSelectedTimezone = ti
if (!datetime) {
return utcToZonedTime(new Date(), currentSelectedTimezone);
}
- const parsedDatetime = new Date(`${datetime} UTC`);
+ const parsedDatetime = new Date(`${datetime}Z`);
return utcToZonedTime(parsedDatetime, currentSelectedTimezone);
}
From 6d026dd37640fb0096a7122c94d7a85afc9230cf Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 16 Aug 2023 13:56:04 -0400
Subject: [PATCH 057/201] Add maxWidth to receipt preview in money request view
---
src/styles/styles.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/styles/styles.js b/src/styles/styles.js
index 971b36387129..78ff4e85e766 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3744,6 +3744,7 @@ const styles = {
borderColor: themeColors.cardBG,
borderRadius: variables.componentBorderRadiusLarge,
height: 200,
+ maxWidth: 400,
},
};
From eb96c58ea97c4d73489771be406fb627dc7fd300 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 16 Aug 2023 14:34:29 -0400
Subject: [PATCH 058/201] Add arrow right on report preview/iou preview
---
src/components/ReportActionItem/MoneyRequestPreview.js | 5 ++++-
src/components/ReportActionItem/MoneyRequestView.js | 2 +-
src/components/ReportActionItem/ReportPreview.js | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index ef4194f78d21..1cbe57efe13a 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -152,6 +152,8 @@ function MoneyRequestPreview(props) {
const isScanning = !ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
const getSettledMessage = () => {
+ return 'test';
+
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
case CONST.IOU.PAYMENT_TYPE.PAYPAL_ME:
return props.translate('iou.settledPaypalMe');
@@ -225,10 +227,11 @@ function MoneyRequestPreview(props) {
height={4}
additionalStyles={[styles.mr1, styles.ml1]}
/>
- {getSettledMessage()}
+ {getSettledMessage()}
>
)}
+
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index c65302483342..76f53965633b 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -92,7 +92,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
if (ReportActionsUtils.isDeletedAction(parentReportAction)) {
return null;
}
-
+
const transaction = TransactionUtils.getTransaction(parentReportAction.originalMessage.IOUTransactionID);
const hasReceipt = TransactionUtils.hasReceipt(transaction);
let receiptURIs;
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 4f9574f86fcb..23e5767f8991 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -175,6 +175,7 @@ function ReportPreview(props) {
{getPreviewMessage()}
+
From 2fe3b2b588561a6257ade6d5e5ca8ab2cb8d3b61 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 16 Aug 2023 14:37:46 -0400
Subject: [PATCH 059/201] Remove test code
---
src/components/ReportActionItem/MoneyRequestPreview.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index 1cbe57efe13a..4b7740ae089f 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -152,8 +152,6 @@ function MoneyRequestPreview(props) {
const isScanning = !ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
const getSettledMessage = () => {
- return 'test';
-
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
case CONST.IOU.PAYMENT_TYPE.PAYPAL_ME:
return props.translate('iou.settledPaypalMe');
From 44fe68de26de27d6c9fb8f4becfa97b305c86586 Mon Sep 17 00:00:00 2001
From: Ishpaul Singh
Date: Thu, 17 Aug 2023 01:16:18 +0530
Subject: [PATCH 060/201] fix:copy-update admin only posting rooms
---
src/components/ReportWelcomeText.js | 28 +++++++++++++++++++---------
src/languages/en.js | 4 ++--
src/languages/es.js | 4 ++--
src/libs/ReportUtils.js | 4 ++--
4 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js
index e0e5d25a1643..4c08d090d167 100644
--- a/src/components/ReportWelcomeText.js
+++ b/src/components/ReportWelcomeText.js
@@ -54,6 +54,8 @@ function ReportWelcomeText(props) {
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(props.report);
const isChatRoom = ReportUtils.isChatRoom(props.report);
const isDefault = !(isChatRoom || isPolicyExpenseChat);
+ const isAdminsOnlyPostingRoom = ReportUtils.isAdminsOnlyPostingRoom(props.report);
+ const isAnnounceRoom = ReportUtils.isAnnounceRoom(props.report);
const participantAccountIDs = lodashGet(props.report, 'participantAccountIDs', []);
const isMultipleParticipant = participantAccountIDs.length > 1;
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(
@@ -65,7 +67,11 @@ function ReportWelcomeText(props) {
return (
<>
- {props.translate('reportActionsView.sayHello')}
+
+ {isAdminsOnlyPostingRoom || isAnnounceRoom
+ ? props.translate('reportActionsView.welcomeToRoom', {roomName: ReportUtils.getReportName(props.report)})
+ : props.translate('reportActionsView.sayHello')}
+
{isPolicyExpenseChat && (
@@ -84,14 +90,18 @@ function ReportWelcomeText(props) {
{isChatRoom && (
<>
{roomWelcomeMessage.phrase1}
- Navigation.navigate(ROUTES.getReportDetailsRoute(props.report.reportID))}
- suppressHighlighting
- >
- {ReportUtils.getReportName(props.report)}
-
- {roomWelcomeMessage.phrase2}
+ {!isAdminsOnlyPostingRoom && (
+ <>
+ Navigation.navigate(ROUTES.getReportDetailsRoute(props.report.reportID))}
+ suppressHighlighting
+ >
+ {ReportUtils.getReportName(props.report)}
+
+ {roomWelcomeMessage.phrase2}
+ >
+ )}
>
)}
{isDefault && (
diff --git a/src/languages/en.js b/src/languages/en.js
index 229166a3f858..7453deefffa2 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -291,8 +291,7 @@ export default {
beginningOfChatHistoryDomainRoomPartTwo: ' to chat with colleagues, share tips, and ask questions.',
beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}) => `Collaboration among ${workspaceName} admins starts here! 🎉\nUse `,
beginningOfChatHistoryAdminRoomPartTwo: ' to chat about topics such as workspace configurations and more.',
- beginningOfChatHistoryAdminOnlyPostingRoomPartOne: 'Use ',
- beginningOfChatHistoryAdminOnlyPostingRoomPartTwo: ({workspaceName}) => ` to hear about important announcements related to ${workspaceName}`,
+ beginningOfChatHistoryAdminOnlyPostingRoom: 'Only admins can send messages in this room.',
beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}) => `Collaboration between all ${workspaceName} members starts here! 🎉\nUse `,
beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}) => ` to chat about anything ${workspaceName} related.`,
beginningOfChatHistoryUserRoomPartOne: 'Collaboration starts here! 🎉\nUse this space to chat about anything ',
@@ -303,6 +302,7 @@ export default {
beginningOfChatHistoryPolicyExpenseChatPartThree: ' starts here! 🎉 This is the place to chat, request money and settle up.',
chatWithAccountManager: 'Chat with your account manager here',
sayHello: 'Say hello!',
+ welcomeToRoom: ({roomName}) => `Welcome to ${roomName}!`,
usePlusButton: '\n\nYou can also use the + button below to request money or assign a task!',
},
reportAction: {
diff --git a/src/languages/es.js b/src/languages/es.js
index 0e24a386cd14..7f211422a0c9 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -290,8 +290,7 @@ export default {
beginningOfChatHistoryDomainRoomPartTwo: ' para chatear con compañeros, compartir consejos o hacer una pregunta.',
beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}) => `Este es el lugar para que los administradores de ${workspaceName} colaboren! 🎉\nUsa `,
beginningOfChatHistoryAdminRoomPartTwo: ' para chatear sobre temas como la configuración del espacio de trabajo y mas.',
- beginningOfChatHistoryAdminOnlyPostingRoomPartOne: 'Utiliza ',
- beginningOfChatHistoryAdminOnlyPostingRoomPartTwo: ({workspaceName}) => ` para enterarte de anuncios importantes relacionados con ${workspaceName}`,
+ beginningOfChatHistoryAdminOnlyPostingRoom: 'Solo los administrators pueden enviar mensajes en esta sala.',
beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}) => `Este es el lugar para que todos los miembros de ${workspaceName} colaboren! 🎉\nUsa `,
beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}) => ` para chatear sobre cualquier cosa relacionada con ${workspaceName}.`,
beginningOfChatHistoryUserRoomPartOne: 'Este es el lugar para colaborar! 🎉\nUsa este espacio para chatear sobre cualquier cosa relacionada con ',
@@ -302,6 +301,7 @@ export default {
beginningOfChatHistoryPolicyExpenseChatPartThree: ' empieza aquí! 🎉 Este es el lugar donde chatear, pedir dinero y pagar.',
chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí',
sayHello: '¡Saluda!',
+ welcomeToRoom: ({roomName}) => `¡Bienvenido a ${roomName}!`,
usePlusButton: '\n\n¡También puedes usar el botón + de abajo para pedir dinero o asignar una tarea!',
},
reportAction: {
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 0b5158e49f88..85201212769a 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -773,8 +773,7 @@ function getRoomWelcomeMessage(report) {
welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartOne', {workspaceName});
welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartTwo');
} else if (isAdminsOnlyPostingRoom(report)) {
- welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoomPartOne');
- welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoomPartTwo', {workspaceName});
+ welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoom');
} else if (isAnnounceRoom(report)) {
welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartOne', {workspaceName});
welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartTwo', {workspaceName});
@@ -3168,6 +3167,7 @@ export {
sortReportsByLastRead,
isDefaultRoom,
isAdminRoom,
+ isAdminsOnlyPostingRoom,
isAnnounceRoom,
isUserCreatedPolicyRoom,
isChatRoom,
From 7181476bb46169089eeefacf36a595c6727a1d32 Mon Sep 17 00:00:00 2001
From: Ishpaul Singh
Date: Thu, 17 Aug 2023 01:24:12 +0530
Subject: [PATCH 061/201] code formatting
---
src/components/ReportWelcomeText.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js
index 4c08d090d167..3a177cbfb94b 100644
--- a/src/components/ReportWelcomeText.js
+++ b/src/components/ReportWelcomeText.js
@@ -95,7 +95,7 @@ function ReportWelcomeText(props) {
Navigation.navigate(ROUTES.getReportDetailsRoute(props.report.reportID))}
- suppressHighlighting
+ suppressHighlighting
>
{ReportUtils.getReportName(props.report)}
From 9ea46f91b72d3a3ae441704a3ebde90ce0ee866b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 16 Aug 2023 17:09:54 -0400
Subject: [PATCH 062/201] Attach URI to file for iOS uploads, change optimistic
update for whisper
---
src/libs/ReceiptUtils.js | 3 ++-
src/libs/ReportUtils.js | 3 ++-
src/libs/fileDownload/FileUtils.js | 1 +
src/styles/styles.js | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index 635537226815..b4451d338cd4 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -38,7 +38,8 @@ function validateReceipt(file) {
* @returns {Object}
*/
function getThumbnailAndImageURIs(path, filename) {
- if (path.startsWith('blob:')) {
+ // For local files, we won't have a thumbnail yet
+ if (path.startsWith('blob:') || path.startsWith('file:')) {
return {thumbnail: null, image: path};
}
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 13b730c5dfbc..9af39c7f5847 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1924,6 +1924,7 @@ function buildOptimisticIOUReportAction(
created: DateUtils.getDBTime(),
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
receipt,
+ whisperedToAccountIDs: !_.isEmpty(receipt) ? [currentUserAccountID] : [],
};
}
@@ -1959,7 +1960,7 @@ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', trans
created: DateUtils.getDBTime(),
accountID: iouReport.managerID || 0,
// The preview is initially whispered if created with a receipt, so the actor is the current user as well
- actorAccountID: hasReceipt ? currentUserAccountID : iouReport.managerID || 0,
+ actorAccountID: hasReceipt ? currentUserAccountID : (iouReport.managerID || 0),
childMoneyRequestCount: 1,
childLastMoneyRequestComment: comment,
childLastReceiptTransactionIDs: hasReceipt ? transaction.transactionID : '',
diff --git a/src/libs/fileDownload/FileUtils.js b/src/libs/fileDownload/FileUtils.js
index 4d714fff4f24..0b33bc406ece 100644
--- a/src/libs/fileDownload/FileUtils.js
+++ b/src/libs/fileDownload/FileUtils.js
@@ -154,6 +154,7 @@ const readFileAsync = (path, fileName) =>
.then((blob) => {
const file = new File([blob], cleanFileName(fileName));
file.source = path;
+ file.uri = path;
resolve(file);
})
.catch((e) => {
diff --git a/src/styles/styles.js b/src/styles/styles.js
index 78ff4e85e766..0b672350e274 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3708,7 +3708,7 @@ const styles = {
reportActionItemImagesMore: {
position: 'absolute',
- borderRadius: '50%',
+ borderRadius: 18,
backgroundColor: themeColors.cardBG,
width: 36,
height: 36,
From 739c3159eea84240a747aa698e2cbeef49a3b821 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 16 Aug 2023 17:48:51 -0400
Subject: [PATCH 063/201] Fix linting and prettier
---
.../ReportActionItem/MoneyRequestPreview.js | 11 +++++++----
.../ReportActionItem/MoneyRequestView.js | 1 -
src/libs/ReportUtils.js | 2 +-
src/libs/TransactionUtils.js | 15 +++++++++++++--
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index a8d2373542bf..1f3cf771ad93 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -142,7 +142,7 @@ function MoneyRequestPreview(props) {
const isCurrentUserManager = managerID === sessionAccountID;
const transaction = TransactionUtils.getLinkedTransaction(props.action);
- const {amount: requestAmount, currency: requestCurrency, comment: requestComment} = ReportUtils.getTransactionDetails(transaction);
+ const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = ReportUtils.getTransactionDetails(transaction);
const hasReceipt = TransactionUtils.hasReceipt(transaction);
const isScanning = !ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
@@ -250,9 +250,9 @@ function MoneyRequestPreview(props) {
)}
- {moneyRequestAction.merchant && (
+ {requestMerchant && (
- {moneyRequestAction.merchant}
+ {requestMerchant}
)}
@@ -265,7 +265,10 @@ function MoneyRequestPreview(props) {
{props.isBillSplit && !_.isEmpty(participantAccountIDs) && (
{props.translate('iou.amountEach', {
- amount: CurrencyUtils.convertToDisplayString(IOUUtils.calculateAmount(participantAccountIDs.length - 1, requestAmount, requestCurrency), requestCurrency),
+ amount: CurrencyUtils.convertToDisplayString(
+ IOUUtils.calculateAmount(participantAccountIDs.length - 1, requestAmount, requestCurrency),
+ requestCurrency,
+ ),
})}
)}
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 3d78c3761248..f78bd870106e 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -22,7 +22,6 @@ import iouReportPropTypes from '../../pages/iouReportPropTypes';
import * as CurrencyUtils from '../../libs/CurrencyUtils';
import EmptyStateBackgroundImage from '../../../assets/images/empty-state_background-fade.png';
import useLocalize from '../../hooks/useLocalize';
-import * as TransactionUtils from '../../libs/TransactionUtils';
import * as ReceiptUtils from '../../libs/ReceiptUtils';
import useWindowDimensions from '../../hooks/useWindowDimensions';
import Image from '../Image';
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index d8f9764401f0..8b821ac0696b 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1961,7 +1961,7 @@ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', trans
created: DateUtils.getDBTime(),
accountID: iouReport.managerID || 0,
// The preview is initially whispered if created with a receipt, so the actor is the current user as well
- actorAccountID: hasReceipt ? currentUserAccountID : (iouReport.managerID || 0),
+ actorAccountID: hasReceipt ? currentUserAccountID : iouReport.managerID || 0,
childMoneyRequestCount: 1,
childLastMoneyRequestComment: comment,
childLastReceiptTransactionIDs: hasReceipt ? transaction.transactionID : '',
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index ac2baf0539ff..432a3192d83f 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -203,5 +203,16 @@ function getAllReportTransactions(reportID) {
return _.filter(allTransactions, (transaction) => transaction.reportID === reportID);
}
-export {buildOptimisticTransaction, getUpdatedTransaction, getTransaction, getDescription, getAmount, getCurrency, getCreated, getLinkedTransaction, getAllReportTransactions, hasReceipt, getReportPreviewTransactionsWithReceipts};
-
+export {
+ buildOptimisticTransaction,
+ getUpdatedTransaction,
+ getTransaction,
+ getDescription,
+ getAmount,
+ getCurrency,
+ getCreated,
+ getLinkedTransaction,
+ getAllReportTransactions,
+ hasReceipt,
+ getReportPreviewTransactionsWithReceipts,
+};
From ecd553b9035597027e31c18d14abcf0900494350 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Wed, 16 Aug 2023 17:52:18 -0400
Subject: [PATCH 064/201] Remove identifier
---
src/components/ReportActionItem/MoneyRequestView.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index f78bd870106e..bd101f28207f 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -91,7 +91,6 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
return null;
}
- const transaction = TransactionUtils.getTransaction(parentReportAction.originalMessage.IOUTransactionID);
const hasReceipt = TransactionUtils.hasReceipt(transaction);
let receiptURIs;
if (hasReceipt) {
From fe987ff16f1ee9ea214b5e96cae92cb4473e44a6 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Wed, 16 Aug 2023 16:03:33 -0700
Subject: [PATCH 065/201] temp
---
package-lock.json | 31 +++++--------------------------
package.json | 2 +-
src/components/DistanceRequest.js | 12 ++++++++++++
3 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index c4165ec34101..d27c4dbed1cb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -104,7 +104,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "1.0.6",
+ "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
@@ -150,7 +150,6 @@
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.195",
"@types/mapbox-gl": "^2.7.13",
- "@types/metro-config": "^0.76.3",
"@types/mock-fs": "^4.13.1",
"@types/pusher-js": "^5.1.0",
"@types/react": "^18.2.12",
@@ -20390,16 +20389,6 @@
"integrity": "sha512-76CqzuD6Q7LC+AtbPqrvD9AqsN0k8bsYo2bM2J8pmNldP1aIPAbzUQ7QbobyXL4eLr1wK5x8FZFe8eF/ubRuBg==",
"dev": true
},
- "node_modules/@types/metro-config": {
- "version": "0.76.3",
- "resolved": "https://registry.npmjs.org/@types/metro-config/-/metro-config-0.76.3.tgz",
- "integrity": "sha512-tq9IyKm1JzNRpM7V7LALxXiAyTlV5eZwoqntpnRIbnqDsIyNlnPkWQEoX77f40pzcUuAH4CiHRDxW5VskPlgtQ==",
- "deprecated": "This is a stub types definition. metro-config provides its own type definitions, so you do not need this installed.",
- "dev": true,
- "dependencies": {
- "metro-config": "*"
- }
- },
"node_modules/@types/mime": {
"version": "3.0.1",
"dev": true,
@@ -43436,8 +43425,8 @@
},
"node_modules/react-native-x-maps": {
"version": "1.0.6",
- "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.6.tgz",
- "integrity": "sha512-aGqhdjBPDI6ZXhccjnetjA88eYFB5l8wtpY1ooGwEbiAUOaCqEWqeUHMI79q3VByBOgfP51gJOtpZbk9JOIKcw==",
+ "resolved": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#cbc30575c6a89e6607a3340918d1b4b4f3679ea3",
+ "license": "MIT",
"peerDependencies": {
"@math.gl/web-mercator": "^3.6.3",
"@rnmapbox/maps": "^10.0.11",
@@ -64513,15 +64502,6 @@
"integrity": "sha512-76CqzuD6Q7LC+AtbPqrvD9AqsN0k8bsYo2bM2J8pmNldP1aIPAbzUQ7QbobyXL4eLr1wK5x8FZFe8eF/ubRuBg==",
"dev": true
},
- "@types/metro-config": {
- "version": "0.76.3",
- "resolved": "https://registry.npmjs.org/@types/metro-config/-/metro-config-0.76.3.tgz",
- "integrity": "sha512-tq9IyKm1JzNRpM7V7LALxXiAyTlV5eZwoqntpnRIbnqDsIyNlnPkWQEoX77f40pzcUuAH4CiHRDxW5VskPlgtQ==",
- "dev": true,
- "requires": {
- "metro-config": "*"
- }
- },
"@types/mime": {
"version": "3.0.1",
"dev": true
@@ -80257,9 +80237,8 @@
}
},
"react-native-x-maps": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.6.tgz",
- "integrity": "sha512-aGqhdjBPDI6ZXhccjnetjA88eYFB5l8wtpY1ooGwEbiAUOaCqEWqeUHMI79q3VByBOgfP51gJOtpZbk9JOIKcw==",
+ "version": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#cbc30575c6a89e6607a3340918d1b4b4f3679ea3",
+ "from": "react-native-x-maps@github:Expensify/react-native-x-maps#hayata-test-new-version",
"requires": {}
},
"react-pdf": {
diff --git a/package.json b/package.json
index bfb47c805da0..865c7777f06f 100644
--- a/package.json
+++ b/package.json
@@ -144,7 +144,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "1.0.6",
+ "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 28ec8311c262..b0bffc696411 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -20,6 +20,17 @@ import BlockingView from './BlockingViews/BlockingView';
import useNetwork from '../hooks/useNetwork';
import useLocalize from '../hooks/useLocalize';
+const waypointsData = [
+ {
+ coordinate: [0, 37],
+ markerComponent: () => ,
+ },
+ {
+ coordinate: [0, 38],
+ markerComponent: () => ,
+ },
+];
+
const MAX_WAYPOINTS = 25;
const MAX_WAYPOINTS_TO_DISPLAY = 4;
@@ -167,6 +178,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
zoom: DEFAULT_ZOOM_LEVEL,
}}
style={styles.mapView}
+ waypoints={waypointsData}
/>
) : (
From b98ee9aff9175c191e1863f3fc73159636681f7a Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Wed, 16 Aug 2023 16:59:56 -0700
Subject: [PATCH 066/201] feat: display way points
---
src/components/DistanceRequest.js | 35 ++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index b0bffc696411..3099e7777ee5 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -20,17 +20,6 @@ import BlockingView from './BlockingViews/BlockingView';
import useNetwork from '../hooks/useNetwork';
import useLocalize from '../hooks/useLocalize';
-const waypointsData = [
- {
- coordinate: [0, 37],
- markerComponent: () => ,
- },
- {
- coordinate: [0, 38],
- markerComponent: () => ,
- },
-];
-
const MAX_WAYPOINTS = 25;
const MAX_WAYPOINTS_TO_DISPLAY = 4;
@@ -85,10 +74,32 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
const {translate} = useLocalize();
const waypoints = lodashGet(transaction, 'comment.waypoints', {});
- const waypointCoordinates = _.map(waypoints, (waypoint) => [waypoint.lat, waypoint.lng]);
const numberOfWaypoints = _.size(waypoints);
const lastWaypointIndex = numberOfWaypoints - 1;
+ const waypointsData = _.map(waypoints, (waypoint, key) => {
+ const index = Number(key.replace('waypoint', ''));
+ let MarkerComponent;
+ if (index === 0) {
+ MarkerComponent = Expensicons.DotIndicatorUnfilled;
+ } else if (index === lastWaypointIndex) {
+ MarkerComponent = Expensicons.Location;
+ } else {
+ MarkerComponent = Expensicons.DotIndicator;
+ }
+
+ return {
+ coordinate: [0, 0],
+ // coordinate: [waypoint.lat, waypoint.lng],
+ markerComponent: () => (
+
+ ),
+ };
+ });
+
// Show up to the max number of waypoints plus 1/2 of one to hint at scrolling
const halfMenuItemHeight = Math.floor(variables.baseMenuItemHeight / 2);
const scrollContainerMaxHeight = variables.baseMenuItemHeight * MAX_WAYPOINTS_TO_DISPLAY + halfMenuItemHeight;
From da602066bb7cb63243d5ecb0b2c05782619d5199 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Wed, 16 Aug 2023 22:02:37 -0700
Subject: [PATCH 067/201] chore: use SF coordinate for placeholder data
---
src/components/DistanceRequest.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 3099e7777ee5..0b2835571650 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -89,7 +89,8 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
}
return {
- coordinate: [0, 0],
+ coordinate: CONST.SF_COORDINATES,
+ // Because coordinates of test waypoints are undefined, the SF coordinate is used temporarily. The below line should be uncommented once waypoints in correct format are saved in the waypoints editor page
// coordinate: [waypoint.lat, waypoint.lng],
markerComponent: () => (
Date: Wed, 16 Aug 2023 23:34:09 -0700
Subject: [PATCH 068/201] style: run prettier
---
src/styles/styles.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/styles/styles.js b/src/styles/styles.js
index fbe865f5335d..c40b5ae0c47f 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -3697,7 +3697,7 @@ const styles = {
...flex.flex1,
borderRadius: variables.componentBorderRadiusLarge,
},
-
+
userReportStatusEmoji: {
fontSize: variables.fontSizeNormal,
marginRight: 4,
From 5e195504f96da09f55094942491c4c36a27b06c9 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Wed, 16 Aug 2023 23:34:29 -0700
Subject: [PATCH 069/201] fix: filter out undefined waypoints
---
src/components/DistanceRequest.js | 51 +++++++++++++++++--------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 0b2835571650..383d7a9c1c28 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -77,29 +77,34 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
const numberOfWaypoints = _.size(waypoints);
const lastWaypointIndex = numberOfWaypoints - 1;
- const waypointsData = _.map(waypoints, (waypoint, key) => {
- const index = Number(key.replace('waypoint', ''));
- let MarkerComponent;
- if (index === 0) {
- MarkerComponent = Expensicons.DotIndicatorUnfilled;
- } else if (index === lastWaypointIndex) {
- MarkerComponent = Expensicons.Location;
- } else {
- MarkerComponent = Expensicons.DotIndicator;
- }
-
- return {
- coordinate: CONST.SF_COORDINATES,
- // Because coordinates of test waypoints are undefined, the SF coordinate is used temporarily. The below line should be uncommented once waypoints in correct format are saved in the waypoints editor page
- // coordinate: [waypoint.lat, waypoint.lng],
- markerComponent: () => (
-
- ),
- };
- });
+ const waypointsData = _.filter(
+ _.map(waypoints, (waypoint, key) => {
+ if (waypoint.lng === undefined || waypoint.lat === undefined) {
+ return;
+ }
+
+ const index = Number(key.replace('waypoint', ''));
+ let MarkerComponent;
+ if (index === 0) {
+ MarkerComponent = Expensicons.DotIndicatorUnfilled;
+ } else if (index === lastWaypointIndex) {
+ MarkerComponent = Expensicons.Location;
+ } else {
+ MarkerComponent = Expensicons.DotIndicator;
+ }
+
+ return {
+ coordinate: [waypoint.lng, waypoint.lat],
+ markerComponent: () => (
+
+ ),
+ };
+ }),
+ (waypoint) => waypoint,
+ );
// Show up to the max number of waypoints plus 1/2 of one to hint at scrolling
const halfMenuItemHeight = Math.floor(variables.baseMenuItemHeight / 2);
From 206eb2bd297a23eefb49f833f33e1ab8b79e66c4 Mon Sep 17 00:00:00 2001
From: Agata Kosior
Date: Thu, 17 Aug 2023 09:00:05 +0200
Subject: [PATCH 070/201] feat: grey out the headers as soon as the user goes
offline
---
src/components/OfflineWithFeedback.js | 6 +-
.../ReportActionItem/MoneyRequestView.js | 55 +++++++++++--------
src/pages/home/report/ReportActionItem.js | 10 ++--
3 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/src/components/OfflineWithFeedback.js b/src/components/OfflineWithFeedback.js
index 820cce252205..2f99b21b6523 100644
--- a/src/components/OfflineWithFeedback.js
+++ b/src/components/OfflineWithFeedback.js
@@ -94,10 +94,10 @@ function OfflineWithFeedback(props) {
const errorMessages = _.omit(props.errors, (e) => e === null);
const hasErrorMessages = !_.isEmpty(errorMessages);
const isOfflinePendingAction = props.network.isOffline && props.pendingAction;
- const isUpdateOrDeleteError = hasErrors && (props.pendingAction === 'delete' || props.pendingAction === 'update');
- const isAddError = hasErrors && props.pendingAction === 'add';
+ const isUpdateOrDeleteError = hasErrors && (props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE);
+ const isAddError = hasErrors && props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD;
const needsOpacity = (isOfflinePendingAction && !isUpdateOrDeleteError) || isAddError;
- const needsStrikeThrough = props.network.isOffline && props.pendingAction === 'delete';
+ const needsStrikeThrough = props.network.isOffline && props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
const hideChildren = props.shouldHideOnDelete && !props.network.isOffline && props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && !hasErrors;
let children = props.children;
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index c05cf14f2fc1..17d219dce4fd 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -23,6 +23,7 @@ import * as CurrencyUtils from '../../libs/CurrencyUtils';
import EmptyStateBackgroundImage from '../../../assets/images/empty-state_background-fade.png';
import useLocalize from '../../hooks/useLocalize';
import useWindowDimensions from '../../hooks/useWindowDimensions';
+import OfflineWithFeedback from '../OfflineWithFeedback';
const propTypes = {
/** The report currently being looked at */
@@ -97,30 +98,36 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
style={[StyleUtils.getReportWelcomeBackgroundImageStyle(true)]}
/>
- Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))}
- />
- Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))}
- />
- Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))}
- />
+
+ Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))}
+ />
+ Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))}
+ />
+ Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))}
+ />
+
{shouldShowHorizontalRule && }
);
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 8700327a168a..323329590f3d 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -468,12 +468,10 @@ function ReportActionItem(props) {
const parentReportAction = ReportActionsUtils.getParentReportAction(props.report);
if (ReportActionsUtils.isTransactionThread(parentReportAction)) {
return (
-
-
-
+
);
}
if (ReportUtils.isTaskReport(props.report)) {
From eecfd01966cc3ad90445b9323ed54cf739c87e08 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Fri, 23 Jun 2023 10:56:45 +0200
Subject: [PATCH 071/201] Implement proposal changes
---
src/pages/workspace/WorkspaceInvitePage.js | 2 +-
src/pages/workspace/withPolicyAndFullscreenLoading.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js
index 6a49e043a54a..b5df569932b7 100644
--- a/src/pages/workspace/WorkspaceInvitePage.js
+++ b/src/pages/workspace/WorkspaceInvitePage.js
@@ -201,7 +201,7 @@ function WorkspaceInvitePage(props) {
const sections = didScreenTransitionEnd ? getSections() : [];
return (
Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
diff --git a/src/pages/workspace/withPolicyAndFullscreenLoading.js b/src/pages/workspace/withPolicyAndFullscreenLoading.js
index 29f1424a26f6..4a7d8135111c 100644
--- a/src/pages/workspace/withPolicyAndFullscreenLoading.js
+++ b/src/pages/workspace/withPolicyAndFullscreenLoading.js
@@ -8,7 +8,7 @@ import withPolicy, {policyPropTypes, policyDefaultProps} from './withPolicy';
import getComponentDisplayName from '../../libs/getComponentDisplayName';
import FullscreenLoadingIndicator from '../../components/FullscreenLoadingIndicator';
-export default function (WrappedComponent) {
+export default function (WrappedComponent, shouldHideIndicator) {
const propTypes = {
/** The HOC takes an optional ref as a prop and passes it as a ref to the wrapped component.
* That way, if a ref is passed to a component wrapped in the HOC, the ref is a reference to the wrapped component, not the HOC. */
@@ -27,7 +27,7 @@ export default function (WrappedComponent) {
};
function WithPolicyAndFullscreenLoading(props) {
- if (props.isLoadingReportData && _.isEmpty(props.policy)) {
+ if (props.isLoadingReportData && _.isEmpty(props.policy) && !shouldHideIndicator) {
return ;
}
From e1b32b03b7b4228a6484890361e3dbfab69090d8 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Fri, 7 Jul 2023 14:10:55 +0200
Subject: [PATCH 072/201] Code review changes
---
src/pages/workspace/WorkspaceMembersPage.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 64cd9d319beb..30601e8c5f8f 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -405,7 +405,7 @@ function WorkspaceMembersPage(props) {
>
{({safeAreaPaddingBottomStyle}) => (
Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
From aa42cd56baabfefdee1fe93ad85fcfb0f3cdf898 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Tue, 11 Jul 2023 14:14:16 +0200
Subject: [PATCH 073/201] Implement CR suggestions
---
src/components/WorkspaceMembersPlaceholder.js | 38 +++++++++++++++++++
src/pages/workspace/WorkspaceMembersPage.js | 19 +++++++---
2 files changed, 52 insertions(+), 5 deletions(-)
create mode 100644 src/components/WorkspaceMembersPlaceholder.js
diff --git a/src/components/WorkspaceMembersPlaceholder.js b/src/components/WorkspaceMembersPlaceholder.js
new file mode 100644
index 000000000000..def633ed1dbf
--- /dev/null
+++ b/src/components/WorkspaceMembersPlaceholder.js
@@ -0,0 +1,38 @@
+import React from 'react';
+import {View} from 'react-native';
+import PropTypes from 'prop-types';
+import styles from '../styles/styles';
+import Text from './Text';
+import ReportActionsSkeletonView from './ReportActionsSkeletonView';
+import CONST from '../CONST';
+
+const propTypes = {
+ dataLoaded: PropTypes.bool,
+ dataEmptyText: PropTypes.string,
+ skeletonHeight: PropTypes.number,
+};
+
+const defaultProps = {
+ dataLoaded: false,
+ dataEmptyText: undefined,
+ skeletonHeight: CONST.CHAT_SKELETON_VIEW.AVERAGE_ROW_HEIGHT,
+};
+
+function WorkspaceMembersPlaceholder(props) {
+ return props.dataLoaded && props.dataEmptyText ? (
+
+ {props.dataEmptyText}
+
+ ) : (
+
+ );
+}
+
+WorkspaceMembersPlaceholder.displayName = 'WorkspaceMembersPlaceholder';
+WorkspaceMembersPlaceholder.propTypes = propTypes;
+WorkspaceMembersPlaceholder.defaultProps = defaultProps;
+
+export default WorkspaceMembersPlaceholder;
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 30601e8c5f8f..637dc1d685f5 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -1,4 +1,4 @@
-import React, {useState, useEffect, useCallback} from 'react';
+import React, {useCallback, useEffect, useState} from 'react';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import {View} from 'react-native';
@@ -21,7 +21,7 @@ import ConfirmModal from '../../components/ConfirmModal';
import personalDetailsPropType from '../personalDetailsPropType';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions';
import OptionRow from '../../components/OptionRow';
-import {policyPropTypes, policyDefaultProps} from './withPolicy';
+import {policyDefaultProps, policyPropTypes} from './withPolicy';
import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading';
import CONST from '../../CONST';
import OfflineWithFeedback from '../../components/OfflineWithFeedback';
@@ -32,12 +32,13 @@ import * as UserUtils from '../../libs/UserUtils';
import FormHelpMessage from '../../components/FormHelpMessage';
import TextInput from '../../components/TextInput';
import KeyboardDismissingFlatList from '../../components/KeyboardDismissingFlatList';
-import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../components/withCurrentUserPersonalDetails';
+import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../components/withCurrentUserPersonalDetails';
import * as PolicyUtils from '../../libs/PolicyUtils';
import PressableWithFeedback from '../../components/Pressable/PressableWithFeedback';
import usePrevious from '../../hooks/usePrevious';
import Log from '../../libs/Log';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
+import WorkspaceMembersPlaceholder from '../../components/WorkspaceMembersPlaceholder';
const propTypes = {
/** All personal details asssociated with user */
@@ -80,6 +81,7 @@ function WorkspaceMembersPage(props) {
const [errors, setErrors] = useState({});
const [searchValue, setSearchValue] = useState('');
const prevIsOffline = usePrevious(props.network.isOffline);
+ const [skeletonHeight, setSkeletonHeight] = useState(0);
/**
* Get members for the current workspace
@@ -492,8 +494,15 @@ function WorkspaceMembersPage(props) {
/>
) : (
-
- {props.translate('workspace.common.memberNotFound')}
+ setSkeletonHeight(e.nativeEvent.layout.height)}
+ >
+
)}
From d73091fd920df7fb21fb205b20c210798788a0a5 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Thu, 20 Jul 2023 17:58:02 +0200
Subject: [PATCH 074/201] Code review changes
---
src/components/WorkspaceMembersPlaceholder.js | 38 -------------------
src/pages/workspace/WorkspaceInvitePage.js | 2 +-
src/pages/workspace/WorkspaceMembersPage.js | 19 +++-------
3 files changed, 7 insertions(+), 52 deletions(-)
delete mode 100644 src/components/WorkspaceMembersPlaceholder.js
diff --git a/src/components/WorkspaceMembersPlaceholder.js b/src/components/WorkspaceMembersPlaceholder.js
deleted file mode 100644
index def633ed1dbf..000000000000
--- a/src/components/WorkspaceMembersPlaceholder.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import React from 'react';
-import {View} from 'react-native';
-import PropTypes from 'prop-types';
-import styles from '../styles/styles';
-import Text from './Text';
-import ReportActionsSkeletonView from './ReportActionsSkeletonView';
-import CONST from '../CONST';
-
-const propTypes = {
- dataLoaded: PropTypes.bool,
- dataEmptyText: PropTypes.string,
- skeletonHeight: PropTypes.number,
-};
-
-const defaultProps = {
- dataLoaded: false,
- dataEmptyText: undefined,
- skeletonHeight: CONST.CHAT_SKELETON_VIEW.AVERAGE_ROW_HEIGHT,
-};
-
-function WorkspaceMembersPlaceholder(props) {
- return props.dataLoaded && props.dataEmptyText ? (
-
- {props.dataEmptyText}
-
- ) : (
-
- );
-}
-
-WorkspaceMembersPlaceholder.displayName = 'WorkspaceMembersPlaceholder';
-WorkspaceMembersPlaceholder.propTypes = propTypes;
-WorkspaceMembersPlaceholder.defaultProps = defaultProps;
-
-export default WorkspaceMembersPlaceholder;
diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js
index b5df569932b7..ce634ed3006a 100644
--- a/src/pages/workspace/WorkspaceInvitePage.js
+++ b/src/pages/workspace/WorkspaceInvitePage.js
@@ -201,7 +201,7 @@ function WorkspaceInvitePage(props) {
const sections = didScreenTransitionEnd ? getSections() : [];
return (
Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 637dc1d685f5..8cb2b0259366 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -32,13 +32,16 @@ import * as UserUtils from '../../libs/UserUtils';
import FormHelpMessage from '../../components/FormHelpMessage';
import TextInput from '../../components/TextInput';
import KeyboardDismissingFlatList from '../../components/KeyboardDismissingFlatList';
-import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../components/withCurrentUserPersonalDetails';
+import withCurrentUserPersonalDetails, {
+ withCurrentUserPersonalDetailsDefaultProps,
+ withCurrentUserPersonalDetailsPropTypes
+} from '../../components/withCurrentUserPersonalDetails';
import * as PolicyUtils from '../../libs/PolicyUtils';
import PressableWithFeedback from '../../components/Pressable/PressableWithFeedback';
import usePrevious from '../../hooks/usePrevious';
import Log from '../../libs/Log';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
-import WorkspaceMembersPlaceholder from '../../components/WorkspaceMembersPlaceholder';
+import OptionsListSkeletonView from "../../components/OptionsListSkeletonView";
const propTypes = {
/** All personal details asssociated with user */
@@ -81,7 +84,6 @@ function WorkspaceMembersPage(props) {
const [errors, setErrors] = useState({});
const [searchValue, setSearchValue] = useState('');
const prevIsOffline = usePrevious(props.network.isOffline);
- const [skeletonHeight, setSkeletonHeight] = useState(0);
/**
* Get members for the current workspace
@@ -494,16 +496,7 @@ function WorkspaceMembersPage(props) {
/>
) : (
- setSkeletonHeight(e.nativeEvent.layout.height)}
- >
-
-
+
)}
From c024893a394e750d29e29f3f3615c814da466470 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Thu, 20 Jul 2023 18:00:56 +0200
Subject: [PATCH 075/201] Lint fix
---
src/pages/workspace/WorkspaceMembersPage.js | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 8cb2b0259366..66077c62f2aa 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -32,16 +32,13 @@ import * as UserUtils from '../../libs/UserUtils';
import FormHelpMessage from '../../components/FormHelpMessage';
import TextInput from '../../components/TextInput';
import KeyboardDismissingFlatList from '../../components/KeyboardDismissingFlatList';
-import withCurrentUserPersonalDetails, {
- withCurrentUserPersonalDetailsDefaultProps,
- withCurrentUserPersonalDetailsPropTypes
-} from '../../components/withCurrentUserPersonalDetails';
+import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../components/withCurrentUserPersonalDetails';
import * as PolicyUtils from '../../libs/PolicyUtils';
import PressableWithFeedback from '../../components/Pressable/PressableWithFeedback';
import usePrevious from '../../hooks/usePrevious';
import Log from '../../libs/Log';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
-import OptionsListSkeletonView from "../../components/OptionsListSkeletonView";
+import OptionsListSkeletonView from '../../components/OptionsListSkeletonView';
const propTypes = {
/** All personal details asssociated with user */
@@ -496,7 +493,7 @@ function WorkspaceMembersPage(props) {
/>
) : (
-
+
)}
From 537c3399dc559ae5408a2956f99dc7ed5815441e Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Fri, 21 Jul 2023 12:03:37 +0200
Subject: [PATCH 076/201] fix app crashes on repro
---
src/pages/workspace/WorkspaceMembersPage.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 66077c62f2aa..9326eeb3ffee 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -94,7 +94,7 @@ function WorkspaceMembersPage(props) {
*/
const validateSelection = useCallback(() => {
const newErrors = {};
- const ownerAccountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins([props.policy.owner]));
+ const ownerAccountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins(props.policy.owner ? [props.policy.owner] : []));
_.each(selectedEmployees, (member) => {
if (member !== ownerAccountID && member !== props.session.accountID) {
return;
From 50f940dca2d7e416f2abb87c300e5bfacedd4f99 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Mon, 24 Jul 2023 17:59:15 +0200
Subject: [PATCH 077/201] Code review changes
---
src/components/WorkspaceMembersPlaceholder.js | 32 +++++++++++++++++++
src/pages/workspace/WorkspaceInvitePage.js | 10 ++++--
src/pages/workspace/WorkspaceMembersPage.js | 19 ++++++++---
.../withPolicyAndFullscreenLoading.js | 4 +--
4 files changed, 55 insertions(+), 10 deletions(-)
create mode 100644 src/components/WorkspaceMembersPlaceholder.js
diff --git a/src/components/WorkspaceMembersPlaceholder.js b/src/components/WorkspaceMembersPlaceholder.js
new file mode 100644
index 000000000000..b5a40f76ad6c
--- /dev/null
+++ b/src/components/WorkspaceMembersPlaceholder.js
@@ -0,0 +1,32 @@
+import React from 'react';
+import {View} from 'react-native';
+import PropTypes from 'prop-types';
+import styles from '../styles/styles';
+import Text from './Text';
+import OptionsListSkeletonView from './OptionsListSkeletonView';
+
+const propTypes = {
+ dataLoaded: PropTypes.bool,
+ dataEmptyText: PropTypes.string,
+};
+
+const defaultProps = {
+ dataLoaded: false,
+ dataEmptyText: undefined,
+};
+
+function WorkspaceMembersPlaceholder(props) {
+ return props.dataLoaded && props.dataEmptyText ? (
+
+ {props.dataEmptyText}
+
+ ) : (
+
+ );
+}
+
+WorkspaceMembersPlaceholder.displayName = 'WorkspaceMembersPlaceholder';
+WorkspaceMembersPlaceholder.propTypes = propTypes;
+WorkspaceMembersPlaceholder.defaultProps = defaultProps;
+
+export default WorkspaceMembersPlaceholder;
diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js
index ce634ed3006a..ce7983554139 100644
--- a/src/pages/workspace/WorkspaceInvitePage.js
+++ b/src/pages/workspace/WorkspaceInvitePage.js
@@ -15,8 +15,8 @@ import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButto
import OptionsSelector from '../../components/OptionsSelector';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import CONST from '../../CONST';
-import {policyPropTypes, policyDefaultProps} from './withPolicy';
-import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading';
+import * as Link from '../../libs/actions/Link';
+import withPolicy, {policyPropTypes, policyDefaultProps} from './withPolicy';
import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
import ROUTES from '../../ROUTES';
import * as Browser from '../../libs/Browser';
@@ -52,6 +52,7 @@ const propTypes = {
}),
}).isRequired,
+ isLoadingReportData: PropTypes.bool,
...policyPropTypes,
};
@@ -260,7 +261,7 @@ WorkspaceInvitePage.defaultProps = defaultProps;
WorkspaceInvitePage.displayName = 'WorkspaceInvitePage';
export default compose(
- withPolicyAndFullscreenLoading,
+ withPolicy,
withOnyx({
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
@@ -268,5 +269,8 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
+ isLoadingReportData: {
+ key: ONYXKEYS.IS_LOADING_REPORT_DATA,
+ },
}),
)(WorkspaceInvitePage);
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 9326eeb3ffee..9292398aa210 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -21,8 +21,7 @@ import ConfirmModal from '../../components/ConfirmModal';
import personalDetailsPropType from '../personalDetailsPropType';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions';
import OptionRow from '../../components/OptionRow';
-import {policyDefaultProps, policyPropTypes} from './withPolicy';
-import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading';
+import withPolicy, {policyDefaultProps, policyPropTypes} from './withPolicy';
import CONST from '../../CONST';
import OfflineWithFeedback from '../../components/OfflineWithFeedback';
import {withNetwork} from '../../components/OnyxProvider';
@@ -38,7 +37,7 @@ import PressableWithFeedback from '../../components/Pressable/PressableWithFeedb
import usePrevious from '../../hooks/usePrevious';
import Log from '../../libs/Log';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
-import OptionsListSkeletonView from '../../components/OptionsListSkeletonView';
+import WorkspaceMembersPlaceholder from '../../components/WorkspaceMembersPlaceholder';
const propTypes = {
/** All personal details asssociated with user */
@@ -59,6 +58,7 @@ const propTypes = {
accountID: PropTypes.number,
}),
+ isLoadingReportData: PropTypes.bool,
...policyPropTypes,
...withLocalizePropTypes,
...windowDimensionsPropTypes,
@@ -71,6 +71,7 @@ const defaultProps = {
session: {
accountID: 0,
},
+ isLoadingReportData: true,
...policyDefaultProps,
...withCurrentUserPersonalDetailsDefaultProps,
};
@@ -493,7 +494,12 @@ function WorkspaceMembersPage(props) {
/>
) : (
-
+
+
+
)}
@@ -509,7 +515,7 @@ WorkspaceMembersPage.displayName = 'WorkspaceMembersPage';
export default compose(
withLocalize,
withWindowDimensions,
- withPolicyAndFullscreenLoading,
+ withPolicy,
withNetwork(),
withOnyx({
personalDetails: {
@@ -518,6 +524,9 @@ export default compose(
session: {
key: ONYXKEYS.SESSION,
},
+ isLoadingReportData: {
+ key: ONYXKEYS.IS_LOADING_REPORT_DATA,
+ },
}),
withCurrentUserPersonalDetails,
)(WorkspaceMembersPage);
diff --git a/src/pages/workspace/withPolicyAndFullscreenLoading.js b/src/pages/workspace/withPolicyAndFullscreenLoading.js
index 4a7d8135111c..29f1424a26f6 100644
--- a/src/pages/workspace/withPolicyAndFullscreenLoading.js
+++ b/src/pages/workspace/withPolicyAndFullscreenLoading.js
@@ -8,7 +8,7 @@ import withPolicy, {policyPropTypes, policyDefaultProps} from './withPolicy';
import getComponentDisplayName from '../../libs/getComponentDisplayName';
import FullscreenLoadingIndicator from '../../components/FullscreenLoadingIndicator';
-export default function (WrappedComponent, shouldHideIndicator) {
+export default function (WrappedComponent) {
const propTypes = {
/** The HOC takes an optional ref as a prop and passes it as a ref to the wrapped component.
* That way, if a ref is passed to a component wrapped in the HOC, the ref is a reference to the wrapped component, not the HOC. */
@@ -27,7 +27,7 @@ export default function (WrappedComponent, shouldHideIndicator) {
};
function WithPolicyAndFullscreenLoading(props) {
- if (props.isLoadingReportData && _.isEmpty(props.policy) && !shouldHideIndicator) {
+ if (props.isLoadingReportData && _.isEmpty(props.policy)) {
return ;
}
From 5f70855b796f02224a6a5edf7104b0369c2c7a7b Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Wed, 26 Jul 2023 11:14:21 +0200
Subject: [PATCH 078/201] Post rebase cleanup
---
src/pages/workspace/WorkspaceInvitePage.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js
index ce7983554139..11386da34239 100644
--- a/src/pages/workspace/WorkspaceInvitePage.js
+++ b/src/pages/workspace/WorkspaceInvitePage.js
@@ -15,7 +15,6 @@ import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButto
import OptionsSelector from '../../components/OptionsSelector';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import CONST from '../../CONST';
-import * as Link from '../../libs/actions/Link';
import withPolicy, {policyPropTypes, policyDefaultProps} from './withPolicy';
import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
import ROUTES from '../../ROUTES';
From 9724466988bf91cbfd128a790af597968041a2cb Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Thu, 10 Aug 2023 14:03:54 +0200
Subject: [PATCH 079/201] Rename placeholder props
---
src/components/WorkspaceMembersPlaceholder.js | 14 +++++++-------
src/pages/workspace/WorkspaceMembersPage.js | 4 ++--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/components/WorkspaceMembersPlaceholder.js b/src/components/WorkspaceMembersPlaceholder.js
index b5a40f76ad6c..81ba6a51ecb0 100644
--- a/src/components/WorkspaceMembersPlaceholder.js
+++ b/src/components/WorkspaceMembersPlaceholder.js
@@ -6,19 +6,19 @@ import Text from './Text';
import OptionsListSkeletonView from './OptionsListSkeletonView';
const propTypes = {
- dataLoaded: PropTypes.bool,
- dataEmptyText: PropTypes.string,
+ isLoaded: PropTypes.bool,
+ emptyText: PropTypes.string,
};
const defaultProps = {
- dataLoaded: false,
- dataEmptyText: undefined,
+ isLoaded: false,
+ emptyText: undefined,
};
-function WorkspaceMembersPlaceholder(props) {
- return props.dataLoaded && props.dataEmptyText ? (
+function WorkspaceMembersPlaceholder({isLoaded, emptyText}) {
+ return isLoaded && emptyText ? (
- {props.dataEmptyText}
+ {emptyText}
) : (
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 9292398aa210..001de314e99b 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -496,8 +496,8 @@ function WorkspaceMembersPage(props) {
) : (
)}
From 55c86cfebe00fc9564072c6ffa52cd8f9e8d9946 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Thu, 10 Aug 2023 14:40:27 +0200
Subject: [PATCH 080/201] CR changes
---
src/pages/workspace/WorkspaceMembersPage.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 001de314e99b..701edc85a708 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -496,7 +496,7 @@ function WorkspaceMembersPage(props) {
) : (
From 860082d8cd932d8af410d9176ef8575ebb36f752 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Fri, 11 Aug 2023 11:07:35 +0200
Subject: [PATCH 081/201] Add loading members flags
---
src/ONYXKEYS.js | 6 ++
src/libs/actions/Policy.js | 72 ++++++++++++++++++---
src/pages/workspace/WorkspaceInvitePage.js | 5 +-
src/pages/workspace/WorkspaceMembersPage.js | 5 +-
4 files changed, 77 insertions(+), 11 deletions(-)
diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js
index 0eb00299d7c9..46e3afdefea4 100755
--- a/src/ONYXKEYS.js
+++ b/src/ONYXKEYS.js
@@ -192,6 +192,12 @@ export default {
// Is report data loading?
IS_LOADING_REPORT_DATA: 'isLoadingReportData',
+ // Is policy members loading?
+ IS_LOADING_POLICY_MEMBERS: 'isLoadingPolicyMembers',
+
+ // Is policy invite members loading?
+ IS_LOADING_INVITE_POLICY_MEMBERS: 'isLoadingInvitePolicyMembers',
+
// Is Keyboard shortcuts modal open?
IS_SHORTCUTS_MODAL_OPEN: 'isShortcutsModalOpen',
diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js
index 46cc71850ccb..873d56986991 100644
--- a/src/libs/actions/Policy.js
+++ b/src/libs/actions/Policy.js
@@ -1124,10 +1124,38 @@ function openWorkspaceMembersPage(policyID, clientMemberEmails) {
return;
}
- API.read('OpenWorkspaceMembersPage', {
- policyID,
- clientMemberEmails: JSON.stringify(clientMemberEmails),
- });
+ const onyxData = {
+ optimisticData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.IS_LOADING_POLICY_MEMBERS,
+ value: true,
+ },
+ ],
+ successData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.IS_LOADING_POLICY_MEMBERS,
+ value: false,
+ },
+ ],
+ failureData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.IS_LOADING_POLICY_MEMBERS,
+ value: false,
+ },
+ ],
+ };
+
+ API.read(
+ 'OpenWorkspaceMembersPage',
+ {
+ policyID,
+ clientMemberEmails: JSON.stringify(clientMemberEmails),
+ },
+ onyxData,
+ );
}
function openWorkspaceInvitePage(policyID, clientMemberEmails) {
@@ -1136,10 +1164,38 @@ function openWorkspaceInvitePage(policyID, clientMemberEmails) {
return;
}
- API.read('OpenWorkspaceInvitePage', {
- policyID,
- clientMemberEmails: JSON.stringify(clientMemberEmails),
- });
+ const onyxData = {
+ optimisticData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.IS_LOADING_INVITE_POLICY_MEMBERS,
+ value: true,
+ },
+ ],
+ successData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.IS_LOADING_INVITE_POLICY_MEMBERS,
+ value: false,
+ },
+ ],
+ failureData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.IS_LOADING_INVITE_POLICY_MEMBERS,
+ value: false,
+ },
+ ],
+ };
+
+ API.read(
+ 'OpenWorkspaceInvitePage',
+ {
+ policyID,
+ clientMemberEmails: JSON.stringify(clientMemberEmails),
+ },
+ onyxData,
+ );
}
/**
diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js
index 11386da34239..e464184e9e2b 100644
--- a/src/pages/workspace/WorkspaceInvitePage.js
+++ b/src/pages/workspace/WorkspaceInvitePage.js
@@ -1,4 +1,4 @@
-import React, {useState, useEffect, useMemo} from 'react';
+import React, {useEffect, useMemo, useState} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
@@ -15,7 +15,7 @@ import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButto
import OptionsSelector from '../../components/OptionsSelector';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import CONST from '../../CONST';
-import withPolicy, {policyPropTypes, policyDefaultProps} from './withPolicy';
+import withPolicy, {policyDefaultProps, policyPropTypes} from './withPolicy';
import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
import ROUTES from '../../ROUTES';
import * as Browser from '../../libs/Browser';
@@ -58,6 +58,7 @@ const propTypes = {
const defaultProps = {
personalDetails: {},
betas: [],
+ isLoadingReportData: true,
...policyDefaultProps,
};
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 701edc85a708..e3aaca9de34b 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -31,7 +31,10 @@ import * as UserUtils from '../../libs/UserUtils';
import FormHelpMessage from '../../components/FormHelpMessage';
import TextInput from '../../components/TextInput';
import KeyboardDismissingFlatList from '../../components/KeyboardDismissingFlatList';
-import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../components/withCurrentUserPersonalDetails';
+import withCurrentUserPersonalDetails, {
+ withCurrentUserPersonalDetailsDefaultProps,
+ withCurrentUserPersonalDetailsPropTypes,
+} from '../../components/withCurrentUserPersonalDetails';
import * as PolicyUtils from '../../libs/PolicyUtils';
import PressableWithFeedback from '../../components/Pressable/PressableWithFeedback';
import usePrevious from '../../hooks/usePrevious';
From 16da4e911080de7d2c4e8b01aac8e6891a5dbb34 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Fri, 11 Aug 2023 13:04:13 +0200
Subject: [PATCH 082/201] Cleanup
---
src/ONYXKEYS.js | 3 --
src/libs/actions/Policy.js | 46 ++++++---------------
src/pages/workspace/WorkspaceMembersPage.js | 5 +--
3 files changed, 14 insertions(+), 40 deletions(-)
diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js
index 46e3afdefea4..842daf027b4e 100755
--- a/src/ONYXKEYS.js
+++ b/src/ONYXKEYS.js
@@ -195,9 +195,6 @@ export default {
// Is policy members loading?
IS_LOADING_POLICY_MEMBERS: 'isLoadingPolicyMembers',
- // Is policy invite members loading?
- IS_LOADING_INVITE_POLICY_MEMBERS: 'isLoadingInvitePolicyMembers',
-
// Is Keyboard shortcuts modal open?
IS_SHORTCUTS_MODAL_OPEN: 'isShortcutsModalOpen',
diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js
index 873d56986991..59651611633a 100644
--- a/src/libs/actions/Policy.js
+++ b/src/libs/actions/Policy.js
@@ -584,7 +584,15 @@ function updateGeneralSettings(policyID, name, currency) {
},
];
- API.write('UpdateWorkspaceGeneralSettings', {policyID, workspaceName: name, currency}, {optimisticData, successData, failureData});
+ API.write(
+ 'UpdateWorkspaceGeneralSettings',
+ {policyID, workspaceName: name, currency},
+ {
+ optimisticData,
+ successData,
+ failureData,
+ },
+ );
}
/**
@@ -1164,38 +1172,10 @@ function openWorkspaceInvitePage(policyID, clientMemberEmails) {
return;
}
- const onyxData = {
- optimisticData: [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: ONYXKEYS.IS_LOADING_INVITE_POLICY_MEMBERS,
- value: true,
- },
- ],
- successData: [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: ONYXKEYS.IS_LOADING_INVITE_POLICY_MEMBERS,
- value: false,
- },
- ],
- failureData: [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: ONYXKEYS.IS_LOADING_INVITE_POLICY_MEMBERS,
- value: false,
- },
- ],
- };
-
- API.read(
- 'OpenWorkspaceInvitePage',
- {
- policyID,
- clientMemberEmails: JSON.stringify(clientMemberEmails),
- },
- onyxData,
- );
+ API.read('OpenWorkspaceInvitePage', {
+ policyID,
+ clientMemberEmails: JSON.stringify(clientMemberEmails),
+ });
}
/**
diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index e3aaca9de34b..701edc85a708 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -31,10 +31,7 @@ import * as UserUtils from '../../libs/UserUtils';
import FormHelpMessage from '../../components/FormHelpMessage';
import TextInput from '../../components/TextInput';
import KeyboardDismissingFlatList from '../../components/KeyboardDismissingFlatList';
-import withCurrentUserPersonalDetails, {
- withCurrentUserPersonalDetailsDefaultProps,
- withCurrentUserPersonalDetailsPropTypes,
-} from '../../components/withCurrentUserPersonalDetails';
+import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../components/withCurrentUserPersonalDetails';
import * as PolicyUtils from '../../libs/PolicyUtils';
import PressableWithFeedback from '../../components/Pressable/PressableWithFeedback';
import usePrevious from '../../hooks/usePrevious';
From f6348b8b095ac4f60f27947846e5f67e5ebbda12 Mon Sep 17 00:00:00 2001
From: Kamil Owczarz
Date: Wed, 16 Aug 2023 14:32:33 +0200
Subject: [PATCH 083/201] CR changes
---
src/ONYXKEYS.js | 3 ---
src/libs/actions/Policy.js | 36 ++++--------------------------------
2 files changed, 4 insertions(+), 35 deletions(-)
diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js
index 842daf027b4e..0eb00299d7c9 100755
--- a/src/ONYXKEYS.js
+++ b/src/ONYXKEYS.js
@@ -192,9 +192,6 @@ export default {
// Is report data loading?
IS_LOADING_REPORT_DATA: 'isLoadingReportData',
- // Is policy members loading?
- IS_LOADING_POLICY_MEMBERS: 'isLoadingPolicyMembers',
-
// Is Keyboard shortcuts modal open?
IS_SHORTCUTS_MODAL_OPEN: 'isShortcutsModalOpen',
diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js
index 59651611633a..b3292d33dc29 100644
--- a/src/libs/actions/Policy.js
+++ b/src/libs/actions/Policy.js
@@ -1132,38 +1132,10 @@ function openWorkspaceMembersPage(policyID, clientMemberEmails) {
return;
}
- const onyxData = {
- optimisticData: [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: ONYXKEYS.IS_LOADING_POLICY_MEMBERS,
- value: true,
- },
- ],
- successData: [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: ONYXKEYS.IS_LOADING_POLICY_MEMBERS,
- value: false,
- },
- ],
- failureData: [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: ONYXKEYS.IS_LOADING_POLICY_MEMBERS,
- value: false,
- },
- ],
- };
-
- API.read(
- 'OpenWorkspaceMembersPage',
- {
- policyID,
- clientMemberEmails: JSON.stringify(clientMemberEmails),
- },
- onyxData,
- );
+ API.read('OpenWorkspaceMembersPage', {
+ policyID,
+ clientMemberEmails: JSON.stringify(clientMemberEmails),
+ });
}
function openWorkspaceInvitePage(policyID, clientMemberEmails) {
From 2d254888c9abf4758f19df6acd5b56f6575fd579 Mon Sep 17 00:00:00 2001
From: Agata Kosior
Date: Thu, 17 Aug 2023 15:50:06 +0200
Subject: [PATCH 084/201] feat: create a function for getting a proper message
schema
---
src/libs/ReportUtils.js | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 1baf6eacb9da..db4a210845bf 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1190,7 +1190,10 @@ function getPolicyExpenseChatName(report, policy = undefined) {
function getMoneyRequestReportName(report, policy = undefined) {
const formattedAmount = CurrencyUtils.convertToDisplayString(getMoneyRequestTotal(report), report.currency);
const payerName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report.managerID);
- const payerPaidAmountMesssage = Localize.translateLocal('iou.payerPaidAmount', {payer: payerName, amount: formattedAmount});
+ const payerPaidAmountMesssage = Localize.translateLocal('iou.payerPaidAmount', {
+ payer: payerName,
+ amount: formattedAmount,
+ });
if (report.isWaitingOnBankAccount) {
return `${payerPaidAmountMesssage} • ${Localize.translateLocal('iou.pending')}`;
@@ -1288,6 +1291,29 @@ function getReportPreviewMessage(report, reportAction = {}) {
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount});
}
+/**
+ * Get the proper message schema for modified expense message.
+ *
+ * @param {String} newValue
+ * @param {String} oldValue
+ * @param {String} valueName
+ * @param {Boolean} valueInQuotes
+ * @returns {String}
+ */
+
+function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName, valueInQuotes) {
+ const newValueToDisplay = valueInQuotes ? `"${newValue}"` : newValue;
+ const oldValueToDisplay = valueInQuotes ? `"${oldValue}"` : oldValue;
+
+ if (!oldValue) {
+ return `set the request ${valueName} to ${newValueToDisplay}`;
+ }
+ if (!newValue) {
+ return `removed the request ${valueName} (previously ${oldValueToDisplay})`;
+ }
+ return `changed the request ${valueName} to ${newValueToDisplay} (previously ${oldValueToDisplay})`;
+}
+
/**
* Get the report action message when expense has been modified.
*
@@ -1312,17 +1338,17 @@ function getModifiedExpenseMessage(reportAction) {
const currency = reportActionOriginalMessage.currency;
const amount = CurrencyUtils.convertToDisplayString(reportActionOriginalMessage.amount, currency);
- return `changed the request to ${amount} (previously ${oldAmount})`;
+ return getProperSchemaForModifiedExpenseMessage(amount, oldAmount, 'amount', false);
}
const hasModifiedComment = _.has(reportActionOriginalMessage, 'oldComment') && _.has(reportActionOriginalMessage, 'newComment');
if (hasModifiedComment) {
- return `changed the request description to "${reportActionOriginalMessage.newComment}" (previously "${reportActionOriginalMessage.oldComment}")`;
+ return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.newComment, reportActionOriginalMessage.oldComment, 'description', true);
}
const hasModifiedMerchant = _.has(reportActionOriginalMessage, 'oldMerchant') && _.has(reportActionOriginalMessage, 'merchant');
if (hasModifiedMerchant) {
- return `changed the request merchant to "${reportActionOriginalMessage.merchant}" (previously "${reportActionOriginalMessage.oldMerchant}")`;
+ return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.merchant, reportActionOriginalMessage.oldMerchant, 'merchant', true);
}
const hasModifiedCreated = _.has(reportActionOriginalMessage, 'oldCreated') && _.has(reportActionOriginalMessage, 'created');
@@ -1330,7 +1356,7 @@ function getModifiedExpenseMessage(reportAction) {
// Take only the YYYY-MM-DD value as the original date includes timestamp
let formattedOldCreated = new Date(reportActionOriginalMessage.oldCreated);
formattedOldCreated = format(formattedOldCreated, CONST.DATE.FNS_FORMAT_STRING);
- return `changed the request date to ${reportActionOriginalMessage.created} (previously ${formattedOldCreated})`;
+ return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.created, formattedOldCreated, 'date', false);
}
}
From 0437df045f8851a3e5e307d7eeb6fd6243590c4e Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Thu, 17 Aug 2023 16:08:58 +0200
Subject: [PATCH 085/201] update timezones to Intl from moment
---
src/pages/settings/Profile/TimezoneSelectPage.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js
index 8ca0320783d4..517abe3fb468 100644
--- a/src/pages/settings/Profile/TimezoneSelectPage.js
+++ b/src/pages/settings/Profile/TimezoneSelectPage.js
@@ -1,7 +1,6 @@
import lodashGet from 'lodash/get';
import React, {useState, useRef} from 'react';
import _ from 'underscore';
-import moment from 'moment-timezone';
import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../components/withCurrentUserPersonalDetails';
import ScreenWrapper from '../../../components/ScreenWrapper';
import HeaderWithBackButton from '../../../components/HeaderWithBackButton';
@@ -37,7 +36,7 @@ function TimezoneSelectPage(props) {
const {translate} = useLocalize();
const timezone = useRef(getUserTimezone(props.currentUserPersonalDetails));
const allTimezones = useRef(
- _.chain(moment.tz.names())
+ _.chain(Intl.supportedValuesOf('timeZone'))
.filter((tz) => !tz.startsWith('Etc/GMT'))
.map((text) => ({
text,
From d5eb4724dce1344e22d7dd28a61fa0d65add0423 Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Thu, 17 Aug 2023 16:47:18 +0200
Subject: [PATCH 086/201] getStatusUntilDate rewrite to date-fns
---
src/CONST.js | 3 ++-
src/libs/DateUtils.js | 36 ++++++++++++++++++++++++++----------
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/CONST.js b/src/CONST.js
index 7ee7ab196fcd..31e38c69979f 100755
--- a/src/CONST.js
+++ b/src/CONST.js
@@ -123,9 +123,10 @@ const CONST = {
MOMENT_FORMAT_STRING: 'YYYY-MM-DD',
SQL_DATE_TIME: 'YYYY-MM-DD HH:mm:ss',
FNS_FORMAT_STRING: 'yyyy-MM-dd',
- LOCAL_TIME_FORMAT: 'h:mm a',
+ LOCAL_TIME_FORMAT: 'hh:mm a',
WEEKDAY_TIME_FORMAT: 'eeee',
MONTH_DAY_ABBR_FORMAT: 'MMM d',
+ SHORT_DATE_FORMAT: 'MM-dd',
MONTH_DAY_YEAR_ABBR_FORMAT: 'MMM d, yyyy',
FNS_TIMEZONE_FORMAT_STRING: "yyyy-MM-dd'T'HH:mm:ssXXX",
FNS_DB_FORMAT_STRING: 'yyyy-MM-dd HH:mm:ss.SSS',
diff --git a/src/libs/DateUtils.js b/src/libs/DateUtils.js
index 9c87392a9f4d..0767bc44c002 100644
--- a/src/libs/DateUtils.js
+++ b/src/libs/DateUtils.js
@@ -1,7 +1,23 @@
import lodashGet from 'lodash/get';
import {zonedTimeToUtc, utcToZonedTime, formatInTimeZone} from 'date-fns-tz';
import {es, enGB} from 'date-fns/locale';
-import {formatDistanceToNow, subMinutes, isBefore, subMilliseconds, isToday, isTomorrow, isYesterday, startOfWeek, endOfWeek, format, setDefaultOptions} from 'date-fns';
+import {
+ formatDistanceToNow,
+ subMinutes,
+ isBefore,
+ subMilliseconds,
+ isToday,
+ isTomorrow,
+ isYesterday,
+ startOfWeek,
+ endOfWeek,
+ format,
+ setDefaultOptions,
+ endOfDay,
+ isSameDay,
+ isAfter,
+ isSameYear,
+} from 'date-fns';
import _ from 'underscore';
import Onyx from 'react-native-onyx';
@@ -285,27 +301,27 @@ function getStatusUntilDate(inputDate) {
if (!inputDate) return '';
const {translateLocal} = Localize;
- const input = moment(inputDate, 'YYYY-MM-DD HH:mm:ss');
- const now = moment();
- const endOfToday = moment().endOf('day').format('YYYY-MM-DD HH:mm:ss');
+ const input = new Date(inputDate);
+ const now = new Date();
+ const endOfToday = endOfDay(now);
// If the date is equal to the end of today
- if (input.isSame(endOfToday)) {
+ if (isSameDay(input, endOfToday)) {
return translateLocal('statusPage.untilTomorrow');
}
// If it's a time on the same date
- if (input.isSame(now, 'day')) {
- return translateLocal('statusPage.untilTime', {time: input.format('hh:mm A')});
+ if (isSameDay(input, now)) {
+ return translateLocal('statusPage.untilTime', {time: format(input, CONST.DATE.LOCAL_TIME_FORMAT)});
}
// If it's further in the future than tomorrow but within the same year
- if (input.isAfter(now) && input.isSame(now, 'year')) {
- return translateLocal('statusPage.untilTime', {time: input.format('MM-DD hh:mm A')});
+ if (isAfter(input, now) && isSameYear(input, now)) {
+ return translateLocal('statusPage.untilTime', {time: format(input, `${CONST.DATE.SHORT_DATE_FORMAT} ${CONST.DATE.LOCAL_TIME_FORMAT}`)});
}
// If it's in another year
- return translateLocal('statusPage.untilTime', {time: input.format('YYYY-MM-DD hh:mm A')});
+ return translateLocal('statusPage.untilTime', {time: format(input, `${CONST.DATE.FNS_FORMAT_STRING} ${CONST.DATE.LOCAL_TIME_FORMAT}`)});
}
/**
From a5b6dffb5864761d6b9f2de7dcdc8892409e2d28 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 11:55:02 -0400
Subject: [PATCH 087/201] Address comments
---
src/components/HeaderWithBackButton/index.js | 2 +-
src/components/MoneyRequestHeader.js | 29 +--------------
src/components/MoneyRequestHeaderStatusBar.js | 37 +++++++++++++++++++
.../ReportActionItem/MoneyRequestPreview.js | 4 +-
.../ReportActionItemImages.js | 9 +++--
.../ReportActionItem/ReportPreview.js | 2 +-
src/libs/ReportActionsUtils.js | 8 ++--
src/libs/ReportUtils.js | 2 +-
src/libs/fileDownload/FileUtils.js | 2 +
src/styles/styles.js | 5 ---
10 files changed, 55 insertions(+), 45 deletions(-)
create mode 100644 src/components/MoneyRequestHeaderStatusBar.js
diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js
index 02579172653d..c178f6e500cb 100755
--- a/src/components/HeaderWithBackButton/index.js
+++ b/src/components/HeaderWithBackButton/index.js
@@ -54,7 +54,7 @@ function HeaderWithBackButton({
const {isKeyboardShown} = useKeyboardState();
return (
<>
-
+
{shouldShowBackButton && (
diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js
index 925c36411811..92c3ca41c94d 100644
--- a/src/components/MoneyRequestHeader.js
+++ b/src/components/MoneyRequestHeader.js
@@ -19,7 +19,7 @@ import * as IOU from '../libs/actions/IOU';
import * as ReportActionsUtils from '../libs/ReportActionsUtils';
import ConfirmModal from './ConfirmModal';
import useLocalize from '../hooks/useLocalize';
-import Text from './Text';
+import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar';
const propTypes = {
/** The report currently being looked at */
@@ -73,30 +73,6 @@ function MoneyRequestHeader(props) {
const isScanning = !ReportActionsUtils.areAllRequestsBeingSmartScanned(parentReportAction);
- const getStatusBar = () => (
-
-
- {translate('iou.receiptStatusTitle')}
-
-
- {translate('iou.receiptStatusText')}
-
-
- );
-
return (
<>
@@ -117,8 +93,7 @@ function MoneyRequestHeader(props) {
personalDetails={props.personalDetails}
shouldShowBackButton={props.isSmallScreenWidth}
onBackButtonPress={() => Navigation.goBack(ROUTES.HOME, false, true)}
- statusBar={isScanning ? getStatusBar() : null}
- shouldShowBorderBottom
+ statusBar={isScanning ? : null}
/>
+
+ {translate('iou.receiptStatusTitle')}
+
+
+ {translate('iou.receiptStatusText')}
+
+
+ );
+}
+
+MoneyRequestHeaderStatusBar.displayName = 'MoneyRequestHeaderStatusBar';
+
+export default MoneyRequestHeaderStatusBar;
\ No newline at end of file
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index 1f3cf771ad93..cda2cd5faad0 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -201,11 +201,11 @@ function MoneyRequestPreview(props) {
errorRowStyles={[styles.mbn1]}
needsOffscreenAlphaCompositing
>
-
+
{hasReceipt && (
)}
diff --git a/src/components/ReportActionItem/ReportActionItemImages.js b/src/components/ReportActionItem/ReportActionItemImages.js
index 57ded78c3fb1..57c03947c496 100644
--- a/src/components/ReportActionItem/ReportActionItemImages.js
+++ b/src/components/ReportActionItem/ReportActionItemImages.js
@@ -3,7 +3,6 @@ import {View} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
import styles from '../../styles/styles';
-import stylePropTypes from '../../styles/stylePropTypes';
import Text from '../Text';
import ReportActionItemImage from './ReportActionItemImage';
@@ -28,18 +27,20 @@ const propTypes = {
// eslint-disable-next-line react/require-default-props
total: PropTypes.number,
- hoverStyle: stylePropTypes,
+ /** if the corresponding report action item is hovered */
+ isHovered: PropTypes.boolean,
};
const defaultProps = {
- hoverStyle: {},
+ isHovered: false,
};
-function ReportActionItemImages({images, size, total, hoverStyle}) {
+function ReportActionItemImages({images, size, total, isHovered}) {
const numberOfShownImages = size || images.length;
const shownImages = images.slice(0, size);
const remaining = (total || images.length) - size;
+ const hoverStyle = isHovered ? styles.reportPreviewBoxHoverBorder : undefined;
return (
{_.map(shownImages, ({thumbnail, image}, index) => {
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 23e5767f8991..c5cf4a4d041b 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -167,7 +167,7 @@ function ReportPreview(props) {
images={_.map(transactions, ({receipt, filename}) => ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))}
size={3}
total={ReportActionUtils.getNumberOfMoneyRequests(props.action)}
- hoverStyle={props.isHovered || isScanning ? styles.reportPreviewBoxHoverBorder : undefined}
+ isHovered={props.isHovered || isScanning}
/>
)}
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index 12b92239c1ed..e20b660b9789 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -594,18 +594,18 @@ function areAllRequestsBeingSmartScanned(reportAction) {
const transactions = TransactionUtils.getReportPreviewTransactionsWithReceipts(reportAction);
// If we have more requests than requests with receipts, we have some manual requests
if (getNumberOfMoneyRequests(reportAction) > transactions.length) {
- return true;
+ return false;
}
- return _.some(transactions, (transaction) => !ReceiptUtils.isBeingScanned(transaction.receipt));
+ return _.all(transactions, (transaction) => !ReceiptUtils.isBeingScanned(transaction.receipt));
}
// If a money request action is not a scanning receipt
if (isMoneyRequestAction(reportAction)) {
const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return !TransactionUtils.hasReceipt(transaction) || !ReceiptUtils.isBeingScanned(transaction.receipt);
+ return TransactionUtils.hasReceipt(transaction) && !ReceiptUtils.isBeingScanned(transaction.receipt);
}
- return true;
+ return false;
}
/**
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 8b821ac0696b..a403a7118e65 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1240,7 +1240,7 @@ function getTransactionReportName(reportAction) {
return Localize.translateLocal('parentReportAction.deletedRequest');
}
- if (!ReportActionsUtils.areAllRequestsBeingSmartScanned(reportAction)) {
+ if (ReportActionsUtils.areAllRequestsBeingSmartScanned(reportAction)) {
return Localize.translateLocal('iou.receiptScanning');
}
diff --git a/src/libs/fileDownload/FileUtils.js b/src/libs/fileDownload/FileUtils.js
index 0b33bc406ece..01c3f7fcb834 100644
--- a/src/libs/fileDownload/FileUtils.js
+++ b/src/libs/fileDownload/FileUtils.js
@@ -154,6 +154,8 @@ const readFileAsync = (path, fileName) =>
.then((blob) => {
const file = new File([blob], cleanFileName(fileName));
file.source = path;
+ // For some reason, the File object on iOS does not have a uri property
+ // so images aren't uploaded correctly to the backend
file.uri = path;
resolve(file);
})
diff --git a/src/styles/styles.js b/src/styles/styles.js
index 1815614c594d..6a2354a559e7 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -2653,11 +2653,6 @@ const styles = {
padding: 16,
},
- moneyRequestPreviewBoxHover: {
- backgroundColor: themeColors.border,
- borderColor: themeColors.border,
- },
-
moneyRequestPreviewBoxLoading: {
// When a new IOU request arrives it is very briefly in a loading state, so set the minimum height of the container to 94 to match the rendered height after loading.
// Otherwise, the IOU request pay button will not be fully visible and the user will have to scroll up to reveal the entire IOU request container.
From f776dc5bc9c7ac8859c65977ff350b9071c24e91 Mon Sep 17 00:00:00 2001
From: Agata Kosior
Date: Thu, 17 Aug 2023 18:24:22 +0200
Subject: [PATCH 088/201] fix: remove request word from the message
---
src/libs/ReportUtils.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index db4a210845bf..54aee8ab4742 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1306,12 +1306,12 @@ function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName,
const oldValueToDisplay = valueInQuotes ? `"${oldValue}"` : oldValue;
if (!oldValue) {
- return `set the request ${valueName} to ${newValueToDisplay}`;
+ return `set the ${valueName} to ${newValueToDisplay}`;
}
if (!newValue) {
- return `removed the request ${valueName} (previously ${oldValueToDisplay})`;
+ return `removed the ${valueName} (previously ${oldValueToDisplay})`;
}
- return `changed the request ${valueName} to ${newValueToDisplay} (previously ${oldValueToDisplay})`;
+ return `changed the ${valueName} to ${newValueToDisplay} (previously ${oldValueToDisplay})`;
}
/**
From b28d952f536db5f377ab926139a95da342db7967 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 13:13:09 -0400
Subject: [PATCH 089/201] Move status bar component and fix conditions
---
src/components/HeaderWithBackButton/index.js | 180 +++++++++---------
src/components/MoneyRequestHeader.js | 4 +-
.../ReportActionItem/MoneyRequestAction.js | 2 +-
.../ReportActionItem/MoneyRequestPreview.js | 4 +-
.../ReportActionItem/ReportPreview.js | 2 +-
src/libs/ReportActionsUtils.js | 4 +-
src/libs/TransactionUtils.js | 2 +-
7 files changed, 97 insertions(+), 101 deletions(-)
diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js
index c178f6e500cb..6e6164f4c4fc 100755
--- a/src/components/HeaderWithBackButton/index.js
+++ b/src/components/HeaderWithBackButton/index.js
@@ -47,120 +47,116 @@ function HeaderWithBackButton({
},
threeDotsMenuItems = [],
children = null,
- statusBar = null,
}) {
const [isDownloadButtonActive, temporarilyDisableDownloadButton] = useThrottledButtonState();
const {translate} = useLocalize();
const {isKeyboardShown} = useKeyboardState();
return (
- <>
-
-
- {shouldShowBackButton && (
-
+
+
+ {shouldShowBackButton && (
+
+ {
+ if (isKeyboardShown) {
+ Keyboard.dismiss();
+ }
+ onBackButtonPress();
+ }}
+ style={[styles.touchableButtonImage]}
+ accessibilityRole="button"
+ accessibilityLabel={translate('common.back')}
+ >
+
+
+
+ )}
+ {shouldShowAvatarWithDisplay && (
+
+ )}
+ {!shouldShowAvatarWithDisplay && (
+
+ )}
+
+ {children}
+ {shouldShowDownloadButton && (
+
{
- if (isKeyboardShown) {
- Keyboard.dismiss();
+ onPress={(e) => {
+ // Blur the pressable in case this button triggers a Growl notification
+ // We do not want to overlap Growl with the Tooltip (#15271)
+ e.currentTarget.blur();
+
+ if (!isDownloadButtonActive) {
+ return;
}
- onBackButtonPress();
+
+ onDownloadButtonPress();
+ temporarilyDisableDownloadButton(true);
}}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
- accessibilityLabel={translate('common.back')}
+ accessibilityLabel={translate('common.download')}
+ >
+
+
+
+ )}
+ {shouldShowGetAssistanceButton && (
+
+ Navigation.navigate(ROUTES.getGetAssistanceRoute(guidesCallTaskID))}
+ style={[styles.touchableButtonImage]}
+ accessibilityRole="button"
+ accessibilityLabel={translate('getAssistancePage.questionMarkButtonTooltip')}
>
)}
- {shouldShowAvatarWithDisplay && (
- }
+ {shouldShowThreeDotsButton && (
+
)}
- {!shouldShowAvatarWithDisplay && (
-
+ {shouldShowCloseButton && (
+
+
+
+
+
)}
-
- {children}
- {shouldShowDownloadButton && (
-
- {
- // Blur the pressable in case this button triggers a Growl notification
- // We do not want to overlap Growl with the Tooltip (#15271)
- e.currentTarget.blur();
-
- if (!isDownloadButtonActive) {
- return;
- }
-
- onDownloadButtonPress();
- temporarilyDisableDownloadButton(true);
- }}
- style={[styles.touchableButtonImage]}
- accessibilityRole="button"
- accessibilityLabel={translate('common.download')}
- >
-
-
-
- )}
- {shouldShowGetAssistanceButton && (
-
- Navigation.navigate(ROUTES.getGetAssistanceRoute(guidesCallTaskID))}
- style={[styles.touchableButtonImage]}
- accessibilityRole="button"
- accessibilityLabel={translate('getAssistancePage.questionMarkButtonTooltip')}
- >
-
-
-
- )}
- {shouldShowPinButton && }
- {shouldShowThreeDotsButton && (
-
- )}
- {shouldShowCloseButton && (
-
-
-
-
-
- )}
-
- {statusBar}
- >
+
);
}
diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js
index 92c3ca41c94d..54ea27ea7e6d 100644
--- a/src/components/MoneyRequestHeader.js
+++ b/src/components/MoneyRequestHeader.js
@@ -71,7 +71,7 @@ function MoneyRequestHeader(props) {
setIsDeleteModalVisible(false);
}, [parentReportAction, setIsDeleteModalVisible]);
- const isScanning = !ReportActionsUtils.areAllRequestsBeingSmartScanned(parentReportAction);
+ const isScanning = ReportActionsUtils.areAllRequestsBeingSmartScanned(parentReportAction);
return (
<>
@@ -93,8 +93,8 @@ function MoneyRequestHeader(props) {
personalDetails={props.personalDetails}
shouldShowBackButton={props.isSmallScreenWidth}
onBackButtonPress={() => Navigation.goBack(ROUTES.HOME, false, true)}
- statusBar={isScanning ? : null}
/>
+ {isScanning && }
);
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index cda2cd5faad0..cbf60dc8a00c 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -144,7 +144,7 @@ function MoneyRequestPreview(props) {
const transaction = TransactionUtils.getLinkedTransaction(props.action);
const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = ReportUtils.getTransactionDetails(transaction);
const hasReceipt = TransactionUtils.hasReceipt(transaction);
- const isScanning = !ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
+ const isScanning = ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
const getSettledMessage = () => {
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
@@ -201,7 +201,7 @@ function MoneyRequestPreview(props) {
errorRowStyles={[styles.mbn1]}
needsOffscreenAlphaCompositing
>
-
+
{hasReceipt && (
0;
- const isScanning = hasReceipts && !ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
+ const isScanning = hasReceipts && ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
const hasOnlyOneReceiptRequest = numberOfRequests === 1 && hasReceipts;
const previewSubtitle = hasOnlyOneReceiptRequest
? transactions[0].merchant
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index e20b660b9789..63cc48e5db66 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -596,13 +596,13 @@ function areAllRequestsBeingSmartScanned(reportAction) {
if (getNumberOfMoneyRequests(reportAction) > transactions.length) {
return false;
}
- return _.all(transactions, (transaction) => !ReceiptUtils.isBeingScanned(transaction.receipt));
+ return _.all(transactions, (transaction) => ReceiptUtils.isBeingScanned(transaction.receipt));
}
// If a money request action is not a scanning receipt
if (isMoneyRequestAction(reportAction)) {
const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return TransactionUtils.hasReceipt(transaction) && !ReceiptUtils.isBeingScanned(transaction.receipt);
+ return TransactionUtils.hasReceipt(transaction) && ReceiptUtils.isBeingScanned(transaction.receipt);
}
return false;
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 432a3192d83f..a9d6f49fd8f2 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -179,7 +179,7 @@ function getReportPreviewTransactionsWithReceipts(reportPreviewAction) {
transactionIDs,
(transactions, transactionID) => {
const transaction = getTransaction(transactionID);
- if (!_.isEmpty(transaction)) {
+ if (hasReceipt(transaction)) {
transactions.push(transaction);
}
return transactions;
From 6c8be7125daa2a6687c01029d356f03872908372 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 13:13:43 -0400
Subject: [PATCH 090/201] Fix prettier
---
src/components/MoneyRequestHeaderStatusBar.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/MoneyRequestHeaderStatusBar.js b/src/components/MoneyRequestHeaderStatusBar.js
index acbed940aaf5..488c122ce5bc 100644
--- a/src/components/MoneyRequestHeaderStatusBar.js
+++ b/src/components/MoneyRequestHeaderStatusBar.js
@@ -34,4 +34,4 @@ function MoneyRequestHeaderStatusBar() {
MoneyRequestHeaderStatusBar.displayName = 'MoneyRequestHeaderStatusBar';
-export default MoneyRequestHeaderStatusBar;
\ No newline at end of file
+export default MoneyRequestHeaderStatusBar;
From 25c91a09415f46f61f893ad9a0c5d0de63a7c941 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 13:44:56 -0400
Subject: [PATCH 091/201] Remove dependency cycle by moving
getNumberOfScanningReceipts and areAllReceiptsBeingSmartScanned to
ReportUtils
---
src/components/MoneyRequestHeader.js | 4 +-
.../ReportActionItem/MoneyRequestPreview.js | 3 +-
.../ReportActionItem/ReportPreview.js | 4 +-
src/languages/en.js | 5 +-
src/languages/es.js | 5 +-
src/libs/ReceiptUtils.js | 6 +-
src/libs/ReportActionsUtils.js | 64 +++----------------
src/libs/ReportUtils.js | 58 ++++++++++++++++-
src/libs/TransactionUtils.js | 5 ++
.../PopoverReportActionContextMenu.js | 4 +-
10 files changed, 84 insertions(+), 74 deletions(-)
diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js
index 54ea27ea7e6d..1efafd6eda5c 100644
--- a/src/components/MoneyRequestHeader.js
+++ b/src/components/MoneyRequestHeader.js
@@ -71,7 +71,7 @@ function MoneyRequestHeader(props) {
setIsDeleteModalVisible(false);
}, [parentReportAction, setIsDeleteModalVisible]);
- const isScanning = ReportActionsUtils.areAllRequestsBeingSmartScanned(parentReportAction);
+ const isScanning = ReportUtils.areAllRequestsBeingSmartScanned(parentReportAction);
return (
<>
@@ -83,7 +83,7 @@ function MoneyRequestHeader(props) {
threeDotsMenuItems={[
{
icon: Expensicons.Trashcan,
- text: translate('reportActionContextMenu.deleteAction', {isMoneyRequest: ReportActionsUtils.isMoneyRequestAction(parentReportAction)}),
+ text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}),
onSelected: () => setIsDeleteModalVisible(true),
},
]}
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index cbf60dc8a00c..48a4fba9d6a8 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -29,7 +29,6 @@ import * as ReportUtils from '../../libs/ReportUtils';
import * as TransactionUtils from '../../libs/TransactionUtils';
import refPropTypes from '../refPropTypes';
import PressableWithFeedback from '../Pressable/PressableWithoutFeedback';
-import * as ReportActionUtils from '../../libs/ReportActionsUtils';
import * as ReceiptUtils from '../../libs/ReceiptUtils';
import ReportActionItemImages from './ReportActionItemImages';
@@ -144,7 +143,7 @@ function MoneyRequestPreview(props) {
const transaction = TransactionUtils.getLinkedTransaction(props.action);
const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = ReportUtils.getTransactionDetails(transaction);
const hasReceipt = TransactionUtils.hasReceipt(transaction);
- const isScanning = ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
+ const isScanning = ReportUtils.areAllRequestsBeingSmartScanned(props.action);
const getSettledMessage = () => {
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index c10fdd233f7a..ccd0cf466d7f 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -103,12 +103,12 @@ function ReportPreview(props) {
const iouSettled = ReportUtils.isSettled(props.iouReportID);
const numberOfRequests = ReportActionUtils.getNumberOfMoneyRequests(props.action);
- const numberOfScanningReceipts = ReportActionUtils.getNumberOfScanningReceipts(props.iouReport);
+ const numberOfScanningReceipts = ReportUtils.getNumberOfScanningReceipts(props.iouReport);
const moneyRequestComment = lodashGet(props.action, 'childLastMoneyRequestComment', '');
const transactions = TransactionUtils.getReportPreviewTransactionsWithReceipts(props.action);
const hasReceipts = transactions.length > 0;
- const isScanning = hasReceipts && ReportActionUtils.areAllRequestsBeingSmartScanned(props.action);
+ const isScanning = hasReceipts && ReportUtils.areAllRequestsBeingSmartScanned(props.action);
const hasOnlyOneReceiptRequest = numberOfRequests === 1 && hasReceipts;
const previewSubtitle = hasOnlyOneReceiptRequest
? transactions[0].merchant
diff --git a/src/languages/en.js b/src/languages/en.js
index ae69e0441537..1cd97988e552 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -1,5 +1,6 @@
import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST';
import CONST from '../CONST';
+import * as ReportActionsUtils from '../libs/ReportActionsUtils';
/* eslint-disable max-len */
export default {
@@ -275,8 +276,8 @@ export default {
markAsUnread: 'Mark as unread',
markAsRead: 'Mark as read',
editComment: 'Edit comment',
- deleteAction: ({isMoneyRequest}) => `Delete ${isMoneyRequest ? 'request' : 'comment'}`,
- deleteConfirmation: ({isMoneyRequest}) => `Are you sure you want to delete this ${isMoneyRequest ? 'request' : 'comment'}?`,
+ deleteAction: ({action}) => `Delete ${ReportActionsUtils.isMoneyRequest(action) ? 'request' : 'comment'}`,
+ deleteConfirmation: ({action}) => `Are you sure you want to delete this ${ReportActionsUtils.isMoneyRequest(action) ? 'request' : 'comment'}?`,
onlyVisible: 'Only visible to',
replyInThread: 'Reply in thread',
flagAsOffensive: 'Flag as offensive',
diff --git a/src/languages/es.js b/src/languages/es.js
index ef0616b41d92..e1a84486759f 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -1,4 +1,5 @@
import CONST from '../CONST';
+import * as ReportActionsUtils from '../libs/ReportActionsUtils';
/* eslint-disable max-len */
export default {
@@ -274,8 +275,8 @@ export default {
markAsUnread: 'Marcar como no leído',
markAsRead: 'Marcar como leído',
editComment: 'Editar comentario',
- deleteAction: ({isMoneyRequest = false}) => `Eliminar ${isMoneyRequest ? 'pedido' : 'comentario'}`,
- deleteConfirmation: ({isMoneyRequest = false}) => `¿Estás seguro de que quieres eliminar este ${isMoneyRequest ? 'pedido' : 'comentario'}`,
+ deleteAction: ({action}) => `Eliminar ${ReportActionsUtils.isMoneyRequest(action) ? 'pedido' : 'comentario'}`,
+ deleteConfirmation: ({action}) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequest(action) ? 'pedido' : 'comentario'}`,
onlyVisible: 'Visible sólo para',
replyInThread: 'Responder en el hilo',
flagAsOffensive: 'Marcar como ofensivo',
diff --git a/src/libs/ReceiptUtils.js b/src/libs/ReceiptUtils.js
index b4451d338cd4..c1c028073690 100644
--- a/src/libs/ReceiptUtils.js
+++ b/src/libs/ReceiptUtils.js
@@ -65,8 +65,4 @@ function getThumbnailAndImageURIs(path, filename) {
return {thumbnail: null, image};
}
-function isBeingScanned(receipt) {
- return receipt.state === CONST.IOU.RECEIPT_STATE.SCANREADY || receipt.state === CONST.IOU.RECEIPT_STATE.SCANNING;
-}
-
-export {validateReceipt, getThumbnailAndImageURIs, isBeingScanned};
+export {validateReceipt, getThumbnailAndImageURIs};
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index 63cc48e5db66..ca78dcc62a21 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -9,8 +9,6 @@ import CONST from '../CONST';
import ONYXKEYS from '../ONYXKEYS';
import Log from './Log';
import isReportMessageAttachment from './isReportMessageAttachment';
-import * as TransactionUtils from './TransactionUtils';
-import * as ReceiptUtils from './ReceiptUtils';
const allReports = {};
Onyx.connect({
@@ -579,64 +577,19 @@ function getNumberOfMoneyRequests(reportPreviewAction) {
}
/**
- * For report previews and money request actions, we display a "Receipt scan in progress" indicator
- * instead of the report total only when we have no report total ready to show. This is the case when
- * all requests are receipts that are being SmartScanned. As soon as we have a non-receipt request,
- * or as soon as one receipt request is done scanning, we have at least one
- * "ready" money request, and we remove this indicator to show the partial report total.
- *
- * @param {Object|null} reportAction
+ * @param {*} reportAction
* @returns {Boolean}
*/
-function areAllRequestsBeingSmartScanned(reportAction) {
- // If a report preview has at least one manual request or at least one scanned receipt
- if (isReportPreviewAction(reportAction)) {
- const transactions = TransactionUtils.getReportPreviewTransactionsWithReceipts(reportAction);
- // If we have more requests than requests with receipts, we have some manual requests
- if (getNumberOfMoneyRequests(reportAction) > transactions.length) {
- return false;
- }
- return _.all(transactions, (transaction) => ReceiptUtils.isBeingScanned(transaction.receipt));
- }
-
- // If a money request action is not a scanning receipt
- if (isMoneyRequestAction(reportAction)) {
- const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return TransactionUtils.hasReceipt(transaction) && ReceiptUtils.isBeingScanned(transaction.receipt);
- }
-
- return false;
-}
-
-/**
- * Returns the number of receipts associated with an IOU report that are still being scanned.
- * Note that we search the IOU report for this number, since scanning receipts will be whispers
- * in the IOU report for only the submitter and we can get an accurate count.
- *
- * @param {Object|null} iouReport
- * @returns {Number}
- */
-function getNumberOfScanningReceipts(iouReport) {
- const reportActions = lodashGet(allReportActions, lodashGet(iouReport, 'reportID'), []);
- return _.reduce(
- reportActions,
- (count, reportAction) => {
- if (!isMoneyRequestAction(reportAction)) {
- return count;
- }
- const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return count + Number(TransactionUtils.hasReceipt(transaction) && ReceiptUtils.isBeingScanned(transaction.receipt));
- },
- 0,
- );
+function isSplitBillAction(reportAction) {
+ return lodashGet(reportAction, 'originalMessage.type', '') === CONST.IOU.REPORT_ACTION_TYPE.SPLIT;
}
/**
- * @param {*} reportAction
- * @returns {Boolean}
+ * @param {*} reportID
+ * @returns {[Object]}
*/
-function isSplitBillAction(reportAction) {
- return lodashGet(reportAction, 'originalMessage.type', '') === CONST.IOU.REPORT_ACTION_TYPE.SPLIT;
+function getAllReportActions(reportID) {
+ return lodashGet(allReportActions, reportID, []);
}
export {
@@ -672,8 +625,7 @@ export {
isWhisperAction,
isPendingRemove,
getReportAction,
- areAllRequestsBeingSmartScanned,
getNumberOfMoneyRequests,
- getNumberOfScanningReceipts,
isSplitBillAction,
+ getAllReportActions,
};
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index a403a7118e65..f79e2c0933dc 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1229,6 +1229,36 @@ function getTransactionDetails(transaction) {
};
}
+/**
+ * For report previews and money request actions, we display a "Receipt scan in progress" indicator
+ * instead of the report total only when we have no report total ready to show. This is the case when
+ * all requests are receipts that are being SmartScanned. As soon as we have a non-receipt request,
+ * or as soon as one receipt request is done scanning, we have at least one
+ * "ready" money request, and we remove this indicator to show the partial report total.
+ *
+ * @param {Object|null} reportAction
+ * @returns {Boolean}
+ */
+function areAllRequestsBeingSmartScanned(reportAction) {
+ // If a report preview has at least one manual request or at least one scanned receipt
+ if (ReportActionsUtils.isReportPreviewAction(reportAction)) {
+ const transactions = TransactionUtils.getReportPreviewTransactionsWithReceipts(reportAction);
+ // If we have more requests than requests with receipts, we have some manual requests
+ if (ReportActionsUtils.getNumberOfMoneyRequests(reportAction) > transactions.length) {
+ return false;
+ }
+ return _.all(transactions, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction.receipt));
+ }
+
+ // If a money request action is not a scanning receipt
+ if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
+ const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
+ return TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction.receipt);
+ }
+
+ return false;
+}
+
/**
* Given a parent IOU report action get report name for the LHN.
*
@@ -1240,7 +1270,7 @@ function getTransactionReportName(reportAction) {
return Localize.translateLocal('parentReportAction.deletedRequest');
}
- if (ReportActionsUtils.areAllRequestsBeingSmartScanned(reportAction)) {
+ if (areAllRequestsBeingSmartScanned(reportAction)) {
return Localize.translateLocal('iou.receiptScanning');
}
@@ -3154,6 +3184,30 @@ function getTaskAssigneeChatOnyxData(accountID, assigneeEmail, assigneeAccountID
};
}
+/**
+ * Returns the number of receipts associated with an IOU report that are still being scanned.
+ * Note that we search the IOU report for this number, since scanning receipts will be whispers
+ * in the IOU report for only the submitter and we can get an accurate count.
+ *
+ * @param {Object|null} iouReport
+ * @returns {Number}
+ */
+function getNumberOfScanningReceipts(iouReport) {
+ const reportID = lodashGet(iouReport, 'reportID');
+ const reportActions = ReportActionsUtils.getAllReportActions(reportID);
+ return _.reduce(
+ reportActions,
+ (count, reportAction) => {
+ if (!ReportActionsUtils.isMoneyRequestAction(reportAction)) {
+ return count;
+ }
+ const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
+ return count + Number(TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction.receipt));
+ },
+ 0,
+ );
+}
+
export {
getReportParticipantsTitle,
isReportMessageAttachment,
@@ -3279,4 +3333,6 @@ export {
getTransactionReportName,
getTransactionDetails,
getTaskAssigneeChatOnyxData,
+ areAllRequestsBeingSmartScanned,
+ getNumberOfScanningReceipts,
};
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index a9d6f49fd8f2..1cd2729b1ad6 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -203,6 +203,10 @@ function getAllReportTransactions(reportID) {
return _.filter(allTransactions, (transaction) => transaction.reportID === reportID);
}
+function isReceiptBeingScanned(transaction) {
+ return transaction.receipt.state === CONST.IOU.RECEIPT_STATE.SCANREADY || transaction.receipt.state === CONST.IOU.RECEIPT_STATE.SCANNING;
+}
+
export {
buildOptimisticTransaction,
getUpdatedTransaction,
@@ -214,5 +218,6 @@ export {
getLinkedTransaction,
getAllReportTransactions,
hasReceipt,
+ isReceiptBeingScanned,
getReportPreviewTransactionsWithReceipts,
};
diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
index 9f2ea19f3711..81858564b416 100644
--- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
+++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
@@ -322,7 +322,7 @@ class PopoverReportActionContextMenu extends React.Component {
/>
Date: Thu, 17 Aug 2023 13:57:25 -0400
Subject: [PATCH 092/201] Update Spanish translations
---
src/languages/es.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/languages/es.js b/src/languages/es.js
index e1a84486759f..a7d3f249a824 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -383,9 +383,9 @@ export default {
pending: 'Pendiente',
deleteReceipt: 'Eliminar recibo',
receiptScanning: 'Escaneo de recibo en curso…',
- receiptStatusTitle: 'Escaneado…',
- receiptStatusText: 'Solo tú puedes ver este recibo cuando se está escaneando. Vuelve más tarde o ingresa los detalles ahora.',
- requestCount: ({count, scanningReceipts = 0}) => `${count} solicitudes${scanningReceipts > 0 ? `, ${scanningReceipts} escaneo` : ''}`,
+ receiptStatusTitle: 'Escaneando…',
+ receiptStatusText: 'Solo tú puedes ver este recibo cuando se está escaneando. Vuelve más tarde o introduce los detalles ahora.',
+ requestCount: ({count, scanningReceipts = 0}) => `${count} solicitudes${scanningReceipts > 0 ? `, ${scanningReceipts} escaneando` : ''}`,
deleteRequest: 'Eliminar pedido',
deleteConfirmation: '¿Estás seguro de que quieres eliminar este pedido?',
settledExpensify: 'Pagado',
From 69b1e8fb94b2d7961ede507456171fdfcf86495a Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 13:58:39 -0400
Subject: [PATCH 093/201] Fix typo
---
src/languages/en.js | 4 ++--
src/languages/es.js | 4 ++--
src/libs/ReportUtils.js | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/languages/en.js b/src/languages/en.js
index 1cd97988e552..d284e997c801 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -276,8 +276,8 @@ export default {
markAsUnread: 'Mark as unread',
markAsRead: 'Mark as read',
editComment: 'Edit comment',
- deleteAction: ({action}) => `Delete ${ReportActionsUtils.isMoneyRequest(action) ? 'request' : 'comment'}`,
- deleteConfirmation: ({action}) => `Are you sure you want to delete this ${ReportActionsUtils.isMoneyRequest(action) ? 'request' : 'comment'}?`,
+ deleteAction: ({action}) => `Delete ${ReportActionsUtils.isMoneyRequestAction(action) ? 'request' : 'comment'}`,
+ deleteConfirmation: ({action}) => `Are you sure you want to delete this ${ReportActionsUtils.isMoneyRequestAction(action) ? 'request' : 'comment'}?`,
onlyVisible: 'Only visible to',
replyInThread: 'Reply in thread',
flagAsOffensive: 'Flag as offensive',
diff --git a/src/languages/es.js b/src/languages/es.js
index a7d3f249a824..49f92937ec2c 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -275,8 +275,8 @@ export default {
markAsUnread: 'Marcar como no leído',
markAsRead: 'Marcar como leído',
editComment: 'Editar comentario',
- deleteAction: ({action}) => `Eliminar ${ReportActionsUtils.isMoneyRequest(action) ? 'pedido' : 'comentario'}`,
- deleteConfirmation: ({action}) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequest(action) ? 'pedido' : 'comentario'}`,
+ deleteAction: ({action}) => `Eliminar ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`,
+ deleteConfirmation: ({action}) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`,
onlyVisible: 'Visible sólo para',
replyInThread: 'Responder en el hilo',
flagAsOffensive: 'Marcar como ofensivo',
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index f79e2c0933dc..0999f6063aa0 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1247,13 +1247,13 @@ function areAllRequestsBeingSmartScanned(reportAction) {
if (ReportActionsUtils.getNumberOfMoneyRequests(reportAction) > transactions.length) {
return false;
}
- return _.all(transactions, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction.receipt));
+ return _.all(transactions, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction));
}
// If a money request action is not a scanning receipt
if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction.receipt);
+ return TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);
}
return false;
@@ -3202,7 +3202,7 @@ function getNumberOfScanningReceipts(iouReport) {
return count;
}
const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return count + Number(TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction.receipt));
+ return count + Number(TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction));
},
0,
);
From 51558571b96f19c4d176c7a26741c5e5ff87548b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 14:27:24 -0400
Subject: [PATCH 094/201] Show number of additional scanning receipts in
overlay
---
src/components/ReportActionItem/ReportPreview.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index ccd0cf466d7f..5b96f4c7d078 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -166,7 +166,7 @@ function ReportPreview(props) {
ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))}
size={3}
- total={ReportActionUtils.getNumberOfMoneyRequests(props.action)}
+ total={ReportUtils.getNumberOfScanningReceipts(props.iouReport)}
isHovered={props.isHovered || isScanning}
/>
)}
From cc483cce04b76ae4748c50dce3b3a6b45a3839c1 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 14:57:56 -0400
Subject: [PATCH 095/201] Separate last 3 receipts to display from total number
of receipts in an IOU report
---
src/components/MoneyRequestHeader.js | 4 +-
.../ReportActionItem/MoneyRequestPreview.js | 2 +-
.../ReportActionItemImages.js | 2 +-
.../ReportActionItem/ReportPreview.js | 13 ++--
src/libs/ReportUtils.js | 65 +++++++++++++------
src/libs/TransactionUtils.js | 22 -------
6 files changed, 58 insertions(+), 50 deletions(-)
diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js
index 1efafd6eda5c..60d8a121d4bb 100644
--- a/src/components/MoneyRequestHeader.js
+++ b/src/components/MoneyRequestHeader.js
@@ -20,6 +20,7 @@ import * as ReportActionsUtils from '../libs/ReportActionsUtils';
import ConfirmModal from './ConfirmModal';
import useLocalize from '../hooks/useLocalize';
import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar';
+import * as TransactionUtils from '../libs/TransactionUtils';
const propTypes = {
/** The report currently being looked at */
@@ -71,7 +72,8 @@ function MoneyRequestHeader(props) {
setIsDeleteModalVisible(false);
}, [parentReportAction, setIsDeleteModalVisible]);
- const isScanning = ReportUtils.areAllRequestsBeingSmartScanned(parentReportAction);
+ const transaction = TransactionUtils.getLinkedTransaction(parentReportAction);
+ const isScanning = TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);
return (
<>
diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index 48a4fba9d6a8..53fe2e052b8a 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -143,7 +143,7 @@ function MoneyRequestPreview(props) {
const transaction = TransactionUtils.getLinkedTransaction(props.action);
const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = ReportUtils.getTransactionDetails(transaction);
const hasReceipt = TransactionUtils.hasReceipt(transaction);
- const isScanning = ReportUtils.areAllRequestsBeingSmartScanned(props.action);
+ const isScanning = hasReceipt && TransactionUtils.isReceiptBeingScanned(transaction);
const getSettledMessage = () => {
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
diff --git a/src/components/ReportActionItem/ReportActionItemImages.js b/src/components/ReportActionItem/ReportActionItemImages.js
index 57c03947c496..a5dcc0ccaea2 100644
--- a/src/components/ReportActionItem/ReportActionItemImages.js
+++ b/src/components/ReportActionItem/ReportActionItemImages.js
@@ -28,7 +28,7 @@ const propTypes = {
total: PropTypes.number,
/** if the corresponding report action item is hovered */
- isHovered: PropTypes.boolean,
+ isHovered: PropTypes.bool,
};
const defaultProps = {
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 5b96f4c7d078..6ccafca75818 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -27,7 +27,6 @@ import themeColors from '../../styles/themes/default';
import reportPropTypes from '../../pages/reportPropTypes';
import * as ReceiptUtils from '../../libs/ReceiptUtils';
import * as ReportActionUtils from '../../libs/ReportActionsUtils';
-import * as TransactionUtils from '../../libs/TransactionUtils';
import ReportActionItemImages from './ReportActionItemImages';
const propTypes = {
@@ -106,12 +105,14 @@ function ReportPreview(props) {
const numberOfScanningReceipts = ReportUtils.getNumberOfScanningReceipts(props.iouReport);
const moneyRequestComment = lodashGet(props.action, 'childLastMoneyRequestComment', '');
- const transactions = TransactionUtils.getReportPreviewTransactionsWithReceipts(props.action);
- const hasReceipts = transactions.length > 0;
- const isScanning = hasReceipts && ReportUtils.areAllRequestsBeingSmartScanned(props.action);
+ const transactionsWithReceipts = ReportUtils.getTransactionsWithReceipts(props.iouReport);
+ const hasReceipts = transactionsWithReceipts.length > 0;
+ const isScanning = hasReceipts && ReportUtils.areAllRequestsBeingSmartScanned(props.iouReport, props.action);
+ const lastThreeTransactionsWithReceipts = ReportUtils.getReportPreviewDisplayTransactions(props.action);
+
const hasOnlyOneReceiptRequest = numberOfRequests === 1 && hasReceipts;
const previewSubtitle = hasOnlyOneReceiptRequest
- ? transactions[0].merchant
+ ? transactionsWithReceipts[0].merchant
: props.translate('iou.requestCount', {
count: numberOfRequests,
scanningReceipts: numberOfScanningReceipts,
@@ -164,7 +165,7 @@ function ReportPreview(props) {
{hasReceipts && (
ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))}
+ images={_.map(lastThreeTransactionsWithReceipts, ({receipt, filename}) => ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))}
size={3}
total={ReportUtils.getNumberOfScanningReceipts(props.iouReport)}
isHovered={props.isHovered || isScanning}
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 0999f6063aa0..51c023e132bb 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1230,33 +1230,47 @@ function getTransactionDetails(transaction) {
}
/**
- * For report previews and money request actions, we display a "Receipt scan in progress" indicator
+ * Gets all transactions on an IOU report with a receipt
+ *
+ * @param {Object|null} iouReport
+ * @returns {[Object]}
+ */
+function getTransactionsWithReceipts(iouReport) {
+ const reportID = lodashGet(iouReport, 'reportID');
+ const reportActions = ReportActionsUtils.getAllReportActions(reportID);
+ return _.reduce(
+ reportActions,
+ (transactions, action) => {
+ if (ReportActionsUtils.isMoneyRequestAction(action)) {
+ const transaction = TransactionUtils.getLinkedTransaction(action);
+ if (TransactionUtils.hasReceipt(transaction)) {
+ transactions.push(transaction);
+ }
+ }
+ return transactions;
+ },
+ [],
+ );
+}
+
+/**
+ * For report previews, we display a "Receipt scan in progress" indicator
* instead of the report total only when we have no report total ready to show. This is the case when
* all requests are receipts that are being SmartScanned. As soon as we have a non-receipt request,
* or as soon as one receipt request is done scanning, we have at least one
* "ready" money request, and we remove this indicator to show the partial report total.
*
- * @param {Object|null} reportAction
+ * @param {Object|null} iouReport
+ * @param {Object|null} reportPreviewAction the preview action associated with the IOU report
* @returns {Boolean}
*/
-function areAllRequestsBeingSmartScanned(reportAction) {
- // If a report preview has at least one manual request or at least one scanned receipt
- if (ReportActionsUtils.isReportPreviewAction(reportAction)) {
- const transactions = TransactionUtils.getReportPreviewTransactionsWithReceipts(reportAction);
- // If we have more requests than requests with receipts, we have some manual requests
- if (ReportActionsUtils.getNumberOfMoneyRequests(reportAction) > transactions.length) {
- return false;
- }
- return _.all(transactions, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction));
- }
-
- // If a money request action is not a scanning receipt
- if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
- const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);
+function areAllRequestsBeingSmartScanned(iouReport, reportPreviewAction) {
+ const transactions = getTransactionsWithReceipts(iouReport);
+ // If we have more requests than requests with receipts, we have some manual requests
+ if (ReportActionsUtils.getNumberOfMoneyRequests(reportPreviewAction) > transactions.length) {
+ return false;
}
-
- return false;
+ return _.all(transactions, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction));
}
/**
@@ -3208,6 +3222,17 @@ function getNumberOfScanningReceipts(iouReport) {
);
}
+/**
+ * Get the last 3 transactions with receipts of an IOU report that will be displayed on the report preview
+ *
+ * @param {Object} reportPreviewAction
+ * @returns {Object}
+ */
+function getReportPreviewDisplayTransactions(reportPreviewAction) {
+ const transactionIDs = lodashGet(reportPreviewAction, ['childLastReceiptTransactionIDs'], '').split(',');
+ return _.map(transactionIDs, (transactionID) => TransactionUtils.getTransaction(transactionID));
+}
+
export {
getReportParticipantsTitle,
isReportMessageAttachment,
@@ -3335,4 +3360,6 @@ export {
getTaskAssigneeChatOnyxData,
areAllRequestsBeingSmartScanned,
getNumberOfScanningReceipts,
+ getReportPreviewDisplayTransactions,
+ getTransactionsWithReceipts,
};
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 1cd2729b1ad6..de6a497693f7 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -167,27 +167,6 @@ function getCreated(transaction) {
return '';
}
-/**
- * Get the transactions related to a report preview with receipts
- *
- * @param {Object} reportPreviewAction
- * @returns {Object}
- */
-function getReportPreviewTransactionsWithReceipts(reportPreviewAction) {
- const transactionIDs = lodashGet(reportPreviewAction, ['childLastReceiptTransactionIDs'], '').split(',');
- return _.reduce(
- transactionIDs,
- (transactions, transactionID) => {
- const transaction = getTransaction(transactionID);
- if (hasReceipt(transaction)) {
- transactions.push(transaction);
- }
- return transactions;
- },
- [],
- );
-}
-
/**
* Get the details linked to the IOU reportAction
*
@@ -219,5 +198,4 @@ export {
getAllReportTransactions,
hasReceipt,
isReceiptBeingScanned,
- getReportPreviewTransactionsWithReceipts,
};
From 24fdf8c046b1f9e73634e50878e26fc297cb1997 Mon Sep 17 00:00:00 2001
From: Ishpaul Singh
Date: Fri, 18 Aug 2023 01:03:25 +0530
Subject: [PATCH 096/201] fix spanish copy
---
src/languages/es.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/languages/es.js b/src/languages/es.js
index 7f211422a0c9..80f95a118201 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -290,7 +290,7 @@ export default {
beginningOfChatHistoryDomainRoomPartTwo: ' para chatear con compañeros, compartir consejos o hacer una pregunta.',
beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}) => `Este es el lugar para que los administradores de ${workspaceName} colaboren! 🎉\nUsa `,
beginningOfChatHistoryAdminRoomPartTwo: ' para chatear sobre temas como la configuración del espacio de trabajo y mas.',
- beginningOfChatHistoryAdminOnlyPostingRoom: 'Solo los administrators pueden enviar mensajes en esta sala.',
+ beginningOfChatHistoryAdminOnlyPostingRoom: 'Solo los administradores pueden enviar mensajes en esta sala.',
beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}) => `Este es el lugar para que todos los miembros de ${workspaceName} colaboren! 🎉\nUsa `,
beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}) => ` para chatear sobre cualquier cosa relacionada con ${workspaceName}.`,
beginningOfChatHistoryUserRoomPartOne: 'Este es el lugar para colaborar! 🎉\nUsa este espacio para chatear sobre cualquier cosa relacionada con ',
From 53467ef45f74124f396578ae6404f6d669844f25 Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Thu, 17 Aug 2023 22:16:38 +0200
Subject: [PATCH 097/201] test improve
---
tests/unit/DateUtilsTest.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/unit/DateUtilsTest.js b/tests/unit/DateUtilsTest.js
index 305ffdb8f487..42aeff67820c 100644
--- a/tests/unit/DateUtilsTest.js
+++ b/tests/unit/DateUtilsTest.js
@@ -54,19 +54,19 @@ describe('DateUtils', () => {
it('should return the date in calendar time when calling datetimeToCalendarTime', () => {
const today = setMinutes(setHours(new Date(), 14), 32);
- expect(DateUtils.datetimeToCalendarTime(LOCALE, today)).toBe('Today at 2:32 PM');
+ expect(DateUtils.datetimeToCalendarTime(LOCALE, today)).toBe('Today at 02:32 PM');
const tomorrow = addDays(setMinutes(setHours(new Date(), 14), 32), 1);
- expect(DateUtils.datetimeToCalendarTime(LOCALE, tomorrow)).toBe('Tomorrow at 2:32 PM');
+ expect(DateUtils.datetimeToCalendarTime(LOCALE, tomorrow)).toBe('Tomorrow at 02:32 PM');
const yesterday = setMinutes(setHours(subDays(new Date(), 1), 7), 43);
- expect(DateUtils.datetimeToCalendarTime(LOCALE, yesterday)).toBe('Yesterday at 7:43 AM');
+ expect(DateUtils.datetimeToCalendarTime(LOCALE, yesterday)).toBe('Yesterday at 07:43 AM');
const date = setMinutes(setHours(new Date('2022-11-05'), 10), 17);
expect(DateUtils.datetimeToCalendarTime(LOCALE, date)).toBe('Nov 5, 2022 at 10:17 AM');
const todayLowercaseDate = setMinutes(setHours(new Date(), 14), 32);
- expect(DateUtils.datetimeToCalendarTime(LOCALE, todayLowercaseDate, false, undefined, true)).toBe('today at 2:32 PM');
+ expect(DateUtils.datetimeToCalendarTime(LOCALE, todayLowercaseDate, false, undefined, true)).toBe('today at 02:32 PM');
});
it('should update timezone if automatic and selected timezone do not match', () => {
From 7687d7f7bd3950dfa6ee455c50f429833faad72b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 16:32:05 -0400
Subject: [PATCH 098/201] Remove getNumberOfScanningReceipts
---
.../ReportActionItem/ReportPreview.js | 5 +--
src/libs/ReportUtils.js | 33 ++++---------------
2 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js
index 6ccafca75818..21d45c10c8a2 100644
--- a/src/components/ReportActionItem/ReportPreview.js
+++ b/src/components/ReportActionItem/ReportPreview.js
@@ -27,6 +27,7 @@ import themeColors from '../../styles/themes/default';
import reportPropTypes from '../../pages/reportPropTypes';
import * as ReceiptUtils from '../../libs/ReceiptUtils';
import * as ReportActionUtils from '../../libs/ReportActionsUtils';
+import * as TransactionUtils from '../../libs/TransactionUtils';
import ReportActionItemImages from './ReportActionItemImages';
const propTypes = {
@@ -102,10 +103,10 @@ function ReportPreview(props) {
const iouSettled = ReportUtils.isSettled(props.iouReportID);
const numberOfRequests = ReportActionUtils.getNumberOfMoneyRequests(props.action);
- const numberOfScanningReceipts = ReportUtils.getNumberOfScanningReceipts(props.iouReport);
const moneyRequestComment = lodashGet(props.action, 'childLastMoneyRequestComment', '');
const transactionsWithReceipts = ReportUtils.getTransactionsWithReceipts(props.iouReport);
+ const numberOfScanningReceipts = _.filter(transactionsWithReceipts, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction)).length;
const hasReceipts = transactionsWithReceipts.length > 0;
const isScanning = hasReceipts && ReportUtils.areAllRequestsBeingSmartScanned(props.iouReport, props.action);
const lastThreeTransactionsWithReceipts = ReportUtils.getReportPreviewDisplayTransactions(props.action);
@@ -167,7 +168,7 @@ function ReportPreview(props) {
ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))}
size={3}
- total={ReportUtils.getNumberOfScanningReceipts(props.iouReport)}
+ total={transactionsWithReceipts.length}
isHovered={props.isHovered || isScanning}
/>
)}
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 51c023e132bb..34308140c905 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -3198,30 +3198,6 @@ function getTaskAssigneeChatOnyxData(accountID, assigneeEmail, assigneeAccountID
};
}
-/**
- * Returns the number of receipts associated with an IOU report that are still being scanned.
- * Note that we search the IOU report for this number, since scanning receipts will be whispers
- * in the IOU report for only the submitter and we can get an accurate count.
- *
- * @param {Object|null} iouReport
- * @returns {Number}
- */
-function getNumberOfScanningReceipts(iouReport) {
- const reportID = lodashGet(iouReport, 'reportID');
- const reportActions = ReportActionsUtils.getAllReportActions(reportID);
- return _.reduce(
- reportActions,
- (count, reportAction) => {
- if (!ReportActionsUtils.isMoneyRequestAction(reportAction)) {
- return count;
- }
- const transaction = TransactionUtils.getTransaction(reportAction.originalMessage.IOUTransactionID);
- return count + Number(TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction));
- },
- 0,
- );
-}
-
/**
* Get the last 3 transactions with receipts of an IOU report that will be displayed on the report preview
*
@@ -3230,7 +3206,13 @@ function getNumberOfScanningReceipts(iouReport) {
*/
function getReportPreviewDisplayTransactions(reportPreviewAction) {
const transactionIDs = lodashGet(reportPreviewAction, ['childLastReceiptTransactionIDs'], '').split(',');
- return _.map(transactionIDs, (transactionID) => TransactionUtils.getTransaction(transactionID));
+ return _.reduce(transactionIDs, (transactions, transactionID) => {
+ const transaction = TransactionUtils.getTransaction(transactionID);
+ if (TransactionUtils.hasReceipt(transaction)) {
+ transactions.push(transaction);
+ }
+ return transactions;
+ }, []);
}
export {
@@ -3359,7 +3341,6 @@ export {
getTransactionDetails,
getTaskAssigneeChatOnyxData,
areAllRequestsBeingSmartScanned,
- getNumberOfScanningReceipts,
getReportPreviewDisplayTransactions,
getTransactionsWithReceipts,
};
From 47883244817e7bd48b69d3c769453baf5a5e847b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 16:53:19 -0400
Subject: [PATCH 099/201] Fix header name
---
src/libs/ReportUtils.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 34308140c905..42cfef8542a5 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1284,11 +1284,11 @@ function getTransactionReportName(reportAction) {
return Localize.translateLocal('parentReportAction.deletedRequest');
}
- if (areAllRequestsBeingSmartScanned(reportAction)) {
+ const transaction = TransactionUtils.getLinkedTransaction(reportAction);
+ if (TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction)) {
return Localize.translateLocal('iou.receiptScanning');
}
- const transaction = TransactionUtils.getLinkedTransaction(reportAction);
const {amount, currency, comment} = getTransactionDetails(transaction);
return Localize.translateLocal(ReportActionsUtils.isSentMoneyReportAction(reportAction) ? 'iou.threadSentMoneyReportName' : 'iou.threadRequestReportName', {
From 9c9bcc0e6d69cdbcea3a6afef3f71a79377c055e Mon Sep 17 00:00:00 2001
From: Carlos Martins
Date: Thu, 17 Aug 2023 15:59:56 -0500
Subject: [PATCH 100/201] add subscriber to MoneyRequestView
---
src/components/ReportActionItem/MoneyRequestView.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index c05cf14f2fc1..06da8acd6cd2 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -14,7 +14,6 @@ import MenuItemWithTopDescription from '../MenuItemWithTopDescription';
import styles from '../../styles/styles';
import * as ReportUtils from '../../libs/ReportUtils';
import * as ReportActionsUtils from '../../libs/ReportActionsUtils';
-import * as TransactionUtils from '../../libs/TransactionUtils';
import * as StyleUtils from '../../styles/StyleUtils';
import CONST from '../../CONST';
import * as Expensicons from '../Icon/Expensicons';
@@ -60,13 +59,12 @@ const defaultProps = {
},
};
-function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, policy, session}) {
+function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, policy, session, transaction}) {
const {isSmallScreenWidth} = useWindowDimensions();
const {translate} = useLocalize();
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
const moneyRequestReport = parentReport;
- const transaction = TransactionUtils.getLinkedTransaction(parentReportAction);
const {created: transactionDate, amount: transactionAmount, currency: transactionCurrency, comment: transactionDescription} = ReportUtils.getTransactionDetails(transaction);
const formattedTransactionAmount = transactionAmount && transactionCurrency && CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency);
@@ -142,5 +140,12 @@ export default compose(
session: {
key: ONYXKEYS.SESSION,
},
+ transaction: {
+ key: ({report}) => {
+ const parentReportAction = ReportActionsUtils.getParentReportAction(report);
+ const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], '');
+ return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
+ }
+ }
}),
)(MoneyRequestView);
From dec55b4ce54b3a4f7041038b915835eb37a01ff2 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Thu, 17 Aug 2023 17:05:51 -0400
Subject: [PATCH 101/201] Run prettier
---
src/libs/ReportUtils.js | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 42cfef8542a5..a272e258221b 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -3206,13 +3206,17 @@ function getTaskAssigneeChatOnyxData(accountID, assigneeEmail, assigneeAccountID
*/
function getReportPreviewDisplayTransactions(reportPreviewAction) {
const transactionIDs = lodashGet(reportPreviewAction, ['childLastReceiptTransactionIDs'], '').split(',');
- return _.reduce(transactionIDs, (transactions, transactionID) => {
- const transaction = TransactionUtils.getTransaction(transactionID);
- if (TransactionUtils.hasReceipt(transaction)) {
- transactions.push(transaction);
- }
- return transactions;
- }, []);
+ return _.reduce(
+ transactionIDs,
+ (transactions, transactionID) => {
+ const transaction = TransactionUtils.getTransaction(transactionID);
+ if (TransactionUtils.hasReceipt(transaction)) {
+ transactions.push(transaction);
+ }
+ return transactions;
+ },
+ [],
+ );
}
export {
From 116bc17f3da07a3dc6cf3df763b6f1cf4d1aa64a Mon Sep 17 00:00:00 2001
From: Carlos Martins
Date: Thu, 17 Aug 2023 16:13:19 -0500
Subject: [PATCH 102/201] subscribe to transaction
---
src/components/ReportActionItem/MoneyRequestView.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 06da8acd6cd2..f731450d1299 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -143,7 +143,7 @@ export default compose(
transaction: {
key: ({report}) => {
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
- const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], '');
+ const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], 0);
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
}
}
From 6fcbc9198d9cb7f8668a796024a5f63d27d96d0a Mon Sep 17 00:00:00 2001
From: Carlos Martins
Date: Thu, 17 Aug 2023 16:13:30 -0500
Subject: [PATCH 103/201] add propTypes
---
.../ReportActionItem/MoneyRequestView.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index f731450d1299..ad192dc18481 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -45,6 +45,17 @@ const propTypes = {
email: PropTypes.string,
}),
+ /** The transaction associated with the transactionThread */
+ transaction: PropTypes.shape({
+ transactionID: PropTypes.string,
+ amount: PropTypes.number,
+ created: PropTypes.string,
+ comment: PropTypes.shape({
+ comment: PropTypes.string
+ }),
+ currency: PropTypes.string,
+ }),
+
/** Whether we should display the horizontal rule below the component */
shouldShowHorizontalRule: PropTypes.bool.isRequired,
@@ -57,6 +68,11 @@ const defaultProps = {
session: {
email: null,
},
+ transaction: {
+ amount: 0,
+ currency: CONST.CURRENCY.USD,
+ comment: {comment: ''},
+ },
};
function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, policy, session, transaction}) {
From 691beed5c2f1d3b10601e99e00a8d186d0a75cc3 Mon Sep 17 00:00:00 2001
From: Stefan Nemeth
Date: Thu, 17 Aug 2023 23:21:06 +0200
Subject: [PATCH 104/201] Set NVP is first time user to false even when admin
chat should be opened
---
src/libs/actions/Welcome.js | 38 ++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js
index e06ee12aa4b3..6e6fe2512dff 100644
--- a/src/libs/actions/Welcome.js
+++ b/src/libs/actions/Welcome.js
@@ -123,26 +123,26 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) {
// navigate away to the workspace chat report
const shouldNavigateToWorkspaceChat = !isDisplayingWorkspaceRoute && !openOnAdminRoom;
- if (shouldNavigateToWorkspaceChat) {
- // We want to display the Workspace chat first since that means a user is already in a Workspace and doesn't need to create another one
- const workspaceChatReport = _.find(
- allReports,
- (report) => ReportUtils.isPolicyExpenseChat(report) && report.ownerAccountID === currentUserAccountID && report.statusNum !== CONST.REPORT.STATUS.CLOSED,
- );
-
- if (workspaceChatReport) {
- // This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat
- Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false);
- Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID));
-
- // If showPopoverMenu exists and returns true then it opened the Popover Menu successfully, and we can update isFirstTimeNewExpensifyUser
- // so the Welcome logic doesn't run again
- if (showPopoverMenu()) {
- isFirstTimeNewExpensifyUser = false;
- }
-
- return;
+ const workspaceChatReport = _.find(
+ allReports,
+ (report) => ReportUtils.isPolicyExpenseChat(report) && report.ownerAccountID === currentUserAccountID && report.statusNum !== CONST.REPORT.STATUS.CLOSED,
+ );
+
+ if (workspaceChatReport || openOnAdminRoom) {
+ // This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat
+ Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false);
+ }
+
+ if (shouldNavigateToWorkspaceChat && workspaceChatReport) {
+ Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID));
+
+ // If showPopoverMenu exists and returns true then it opened the Popover Menu successfully, and we can update isFirstTimeNewExpensifyUser
+ // so the Welcome logic doesn't run again
+ if (showPopoverMenu()) {
+ isFirstTimeNewExpensifyUser = false;
}
+
+ return;
}
// If user is not already an admin of a free policy and we are not navigating them to their workspace or creating a new workspace via workspace/new then
From b2feefe1e50459fdfff1ae352603c07c905eca75 Mon Sep 17 00:00:00 2001
From: Carlos Martins
Date: Thu, 17 Aug 2023 16:34:38 -0500
Subject: [PATCH 105/201] fix style
---
src/components/ReportActionItem/MoneyRequestView.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index ad192dc18481..478e3fd417ad 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -51,7 +51,7 @@ const propTypes = {
amount: PropTypes.number,
created: PropTypes.string,
comment: PropTypes.shape({
- comment: PropTypes.string
+ comment: PropTypes.string,
}),
currency: PropTypes.string,
}),
@@ -161,7 +161,7 @@ export default compose(
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], 0);
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
- }
- }
+ },
+ },
}),
)(MoneyRequestView);
From 180e4afa9407226dccca703f15825d0a85081f67 Mon Sep 17 00:00:00 2001
From: Carlos Martins
Date: Thu, 17 Aug 2023 16:45:02 -0500
Subject: [PATCH 106/201] create transactionPropTypes
---
.../ReportActionItem/MoneyRequestView.js | 11 +----
src/components/transactionPropTypes.js | 48 +++++++++++++++++++
2 files changed, 50 insertions(+), 9 deletions(-)
create mode 100644 src/components/transactionPropTypes.js
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 478e3fd417ad..f40f0e43d71b 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -22,6 +22,7 @@ import * as CurrencyUtils from '../../libs/CurrencyUtils';
import EmptyStateBackgroundImage from '../../../assets/images/empty-state_background-fade.png';
import useLocalize from '../../hooks/useLocalize';
import useWindowDimensions from '../../hooks/useWindowDimensions';
+import transactionPropTypes from '../transactionPropTypes';
const propTypes = {
/** The report currently being looked at */
@@ -46,15 +47,7 @@ const propTypes = {
}),
/** The transaction associated with the transactionThread */
- transaction: PropTypes.shape({
- transactionID: PropTypes.string,
- amount: PropTypes.number,
- created: PropTypes.string,
- comment: PropTypes.shape({
- comment: PropTypes.string,
- }),
- currency: PropTypes.string,
- }),
+ transaction: transactionPropTypes,
/** Whether we should display the horizontal rule below the component */
shouldShowHorizontalRule: PropTypes.bool.isRequired,
diff --git a/src/components/transactionPropTypes.js b/src/components/transactionPropTypes.js
new file mode 100644
index 000000000000..14bfc288f245
--- /dev/null
+++ b/src/components/transactionPropTypes.js
@@ -0,0 +1,48 @@
+import PropTypes from 'prop-types';
+
+export default PropTypes.shape({
+ /** The transaction id */
+ transactionID: PropTypes.string,
+
+ /** The iouReportID associated with the transaction */
+ reportID: PropTypes.string,
+
+ /** The original transaction amount */
+ amount: PropTypes.number,
+
+ /** The edited transaction amount */
+ modifiedAmount: PropTypes.number,
+
+ /** The original created data */
+ created: PropTypes.string,
+
+ /** The edited transaction date */
+ modifiedCreated: PropTypes.string,
+
+ /** The filename of the associated receipt */
+ filename: PropTypes.string,
+
+ /** The original merchant name */
+ merchant: PropTypes.string,
+
+ /** The edited merchant name */
+ modifiedMerchant: PropTypes.string,
+
+ /** The comment added to the transaction */
+ comment: PropTypes.shape({
+ comment: PropTypes.string,
+ }),
+
+ /** The original currency of the transaction */
+ currency: PropTypes.string,
+
+ /** The edited currency of the transaction */
+ modifiedCurrency: PropTypes.string,
+
+ /** The receipt object associated with the transaction */
+ receipt: PropTypes.shape({
+ receiptID: PropTypes.string,
+ source: PropTypes.string,
+ state: PropTypes.string,
+ }),
+});
From 342f344cd9cc75d186b9046b5078d9f9b50a5f45 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Thu, 17 Aug 2023 15:29:29 -0700
Subject: [PATCH 107/201] chore(deps): install new version of x-maps
---
package-lock.json | 13 +++++++------
package.json | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index d27c4dbed1cb..744313b60488 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -104,7 +104,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
+ "react-native-x-maps": "1.0.7",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
@@ -43424,9 +43424,9 @@
}
},
"node_modules/react-native-x-maps": {
- "version": "1.0.6",
- "resolved": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#cbc30575c6a89e6607a3340918d1b4b4f3679ea3",
- "license": "MIT",
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.7.tgz",
+ "integrity": "sha512-dfuEPWAXjESTTZ2tLFkYLHjd++s/goGvksiPib4a6DoPfF1HA6jXvasB9ddjG1iHMVmHY8Cvc2OVZTGNaAp0RA==",
"peerDependencies": {
"@math.gl/web-mercator": "^3.6.3",
"@rnmapbox/maps": "^10.0.11",
@@ -80237,8 +80237,9 @@
}
},
"react-native-x-maps": {
- "version": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#cbc30575c6a89e6607a3340918d1b4b4f3679ea3",
- "from": "react-native-x-maps@github:Expensify/react-native-x-maps#hayata-test-new-version",
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.7.tgz",
+ "integrity": "sha512-dfuEPWAXjESTTZ2tLFkYLHjd++s/goGvksiPib4a6DoPfF1HA6jXvasB9ddjG1iHMVmHY8Cvc2OVZTGNaAp0RA==",
"requires": {}
},
"react-pdf": {
diff --git a/package.json b/package.json
index 865c7777f06f..eac2aceb4466 100644
--- a/package.json
+++ b/package.json
@@ -144,7 +144,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
+ "react-native-x-maps": "1.0.7",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
From 8a896d25cbf79e00b245f0713c23a0cba43ea0b1 Mon Sep 17 00:00:00 2001
From: Rocio Perez-Cano
Date: Fri, 18 Aug 2023 00:39:01 +0200
Subject: [PATCH 108/201] Update semver to fix security issues
---
package-lock.json | 14 +++++++-------
package.json | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 652b28ab1777..485475989a2b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -44,7 +44,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
- "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#b60e464ca23e452eacffb93d471abed977b9abf0",
+ "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#4cc5f72b69bd77d2c8052a3c167d039e502a2796",
"fbjs": "^3.0.2",
"htmlparser2": "^7.2.0",
"jest-when": "^3.5.2",
@@ -109,7 +109,7 @@
"react-web-config": "^1.0.0",
"react-window": "^1.8.9",
"save": "^2.4.0",
- "semver": "^7.3.8",
+ "semver": "^7.5.2",
"shim-keyboard-event-key": "^1.0.3",
"underscore": "^1.13.1"
},
@@ -29231,8 +29231,8 @@
},
"node_modules/expensify-common": {
"version": "1.0.0",
- "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#b60e464ca23e452eacffb93d471abed977b9abf0",
- "integrity": "sha512-SA+1PDrST90MoWKNuqyfw7vT1c3S14JrrHCuk5l5m77k2T1Khu1lHPAw7sCUt0Yeoceq7JHL7zC4ZPhqVzDXwQ==",
+ "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#4cc5f72b69bd77d2c8052a3c167d039e502a2796",
+ "integrity": "sha512-nNYAweSE5bwjKyFTi9tz+p1z+gxkytCnIa8M11vnseV60ZzJespcwB/2SbWkdaAL5wpvcgHLlFTTGbPUwIiTvw==",
"license": "MIT",
"dependencies": {
"classnames": "2.3.1",
@@ -70049,9 +70049,9 @@
}
},
"expensify-common": {
- "version": "git+ssh://git@github.com/Expensify/expensify-common.git#b60e464ca23e452eacffb93d471abed977b9abf0",
- "integrity": "sha512-SA+1PDrST90MoWKNuqyfw7vT1c3S14JrrHCuk5l5m77k2T1Khu1lHPAw7sCUt0Yeoceq7JHL7zC4ZPhqVzDXwQ==",
- "from": "expensify-common@git+ssh://git@github.com/Expensify/expensify-common.git#b60e464ca23e452eacffb93d471abed977b9abf0",
+ "version": "git+ssh://git@github.com/Expensify/expensify-common.git#4cc5f72b69bd77d2c8052a3c167d039e502a2796",
+ "integrity": "sha512-nNYAweSE5bwjKyFTi9tz+p1z+gxkytCnIa8M11vnseV60ZzJespcwB/2SbWkdaAL5wpvcgHLlFTTGbPUwIiTvw==",
+ "from": "expensify-common@git+ssh://git@github.com/Expensify/expensify-common.git#4cc5f72b69bd77d2c8052a3c167d039e502a2796",
"requires": {
"classnames": "2.3.1",
"clipboard": "2.0.4",
diff --git a/package.json b/package.json
index 65930b9b97f8..7b80413fd31d 100644
--- a/package.json
+++ b/package.json
@@ -148,7 +148,7 @@
"react-web-config": "^1.0.0",
"react-window": "^1.8.9",
"save": "^2.4.0",
- "semver": "^7.3.8",
+ "semver": "^7.5.2",
"shim-keyboard-event-key": "^1.0.3",
"underscore": "^1.13.1"
},
From 92ecc77b86f7c9831b33cabb42cecbcb8692b333 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 00:32:15 +0100
Subject: [PATCH 109/201] Add getMerchant method
---
src/libs/TransactionUtils.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 90b6ca72bd4a..a4c0b1b554e6 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -167,6 +167,16 @@ function getCurrency(transaction) {
return lodashGet(transaction, 'currency', CONST.CURRENCY.USD);
}
+/**
+ * Return the merchant field from the transaction, return the modifiedMerchant if present.
+ *
+ * @param {Object} transaction
+ * @returns {String}
+ */
+function getMerchant(transaction) {
+ return lodashGet(transaction, 'modifiedMerchant', null) || lodashGet(transaction, 'merchant', '');
+}
+
/**
* Return the created field from the transaction, return the modifiedCreated if present.
*
@@ -196,4 +206,4 @@ function getAllReportTransactions(reportID) {
return _.filter(allTransactions, (transaction) => transaction.reportID === reportID);
}
-export {buildOptimisticTransaction, getUpdatedTransaction, getTransaction, getDescription, getAmount, getCurrency, getCreated, getLinkedTransaction, getAllReportTransactions};
+export {buildOptimisticTransaction, getUpdatedTransaction, getTransaction, getDescription, getAmount, getCurrency, getMerchant, getCreated, getLinkedTransaction, getAllReportTransactions};
From 4fc0e513ae096d0c01ef968af1667823cc99b04d Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 00:34:58 +0100
Subject: [PATCH 110/201] Set up money request merchant routes
---
src/ONYXKEYS.js | 1 +
src/ROUTES.js | 2 ++
src/libs/Navigation/AppNavigator/ModalStackNavigators.js | 7 +++++++
src/libs/Navigation/linkingConfig.js | 1 +
4 files changed, 11 insertions(+)
diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js
index 7ef5c68c3850..96e77347face 100755
--- a/src/ONYXKEYS.js
+++ b/src/ONYXKEYS.js
@@ -221,6 +221,7 @@ export default {
NEW_TASK_FORM: 'newTaskForm',
EDIT_TASK_FORM: 'editTaskForm',
MONEY_REQUEST_DESCRIPTION_FORM: 'moneyRequestDescriptionForm',
+ MONEY_REQUEST_MERCHANT_FORM: 'moneyRequestMerchantForm',
MONEY_REQUEST_AMOUNT_FORM: 'moneyRequestAmountForm',
MONEY_REQUEST_CREATED_FORM: 'moneyRequestCreatedForm',
NEW_CONTACT_METHOD_FORM: 'newContactMethodForm',
diff --git a/src/ROUTES.js b/src/ROUTES.js
index 6541bdfc2dab..7292839a8d1e 100644
--- a/src/ROUTES.js
+++ b/src/ROUTES.js
@@ -95,6 +95,7 @@ export default {
MONEY_REQUEST_CONFIRMATION: ':iouType/new/confirmation/:reportID?',
MONEY_REQUEST_CURRENCY: ':iouType/new/currency/:reportID?',
MONEY_REQUEST_DESCRIPTION: ':iouType/new/description/:reportID?',
+ MONEY_REQUEST_MERCHANT: ':iouType/new/merchant/:reportID?',
MONEY_REQUEST_MANUAL_TAB: ':iouType/new/:reportID?/manual',
MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan',
MONEY_REQUEST_DISTANCE_TAB: ':iouType/new/:reportID?/distance',
@@ -108,6 +109,7 @@ export default {
getMoneyRequestConfirmationRoute: (iouType, reportID = '') => `${iouType}/new/confirmation/${reportID}`,
getMoneyRequestCurrencyRoute: (iouType, reportID = '', currency, backTo) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`,
getMoneyRequestDescriptionRoute: (iouType, reportID = '') => `${iouType}/new/description/${reportID}`,
+ getMoneyRequestMerchantRoute: (iouType, reportID = '') => `${iouType}/new/merchant/${reportID}`,
getMoneyRequestDistanceTabRoute: (iouType, reportID = '') => `${iouType}/new/${reportID}/distance`,
getMoneyRequestWaypointRoute: (iouType, waypointIndex) => `${iouType}/new/waypoint/${waypointIndex}`,
SPLIT_BILL_DETAILS: `r/:reportID/split/:reportActionID`,
diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
index 03d1a9196a4e..a8765f43dbe7 100644
--- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
+++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
@@ -76,6 +76,13 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator([
},
name: 'Money_Request_Description',
},
+ {
+ getComponent: () => {
+ const MoneyRequestMerchantPage = require('../../../pages/iou/MoneyRequestMerchantPage').default;
+ return MoneyRequestMerchantPage;
+ },
+ name: 'Money_Request_Merchant',
+ },
{
getComponent: () => {
const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default;
diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js
index ae85699b844d..e80c9f4b9d9d 100644
--- a/src/libs/Navigation/linkingConfig.js
+++ b/src/libs/Navigation/linkingConfig.js
@@ -325,6 +325,7 @@ export default {
Money_Request_Confirmation: ROUTES.MONEY_REQUEST_CONFIRMATION,
Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY,
Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION,
+ Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT,
Money_Request_Waypoint: ROUTES.MONEY_REQUEST_WAYPOINT,
IOU_Send_Enable_Payments: ROUTES.IOU_SEND_ENABLE_PAYMENTS,
IOU_Send_Add_Bank_Account: ROUTES.IOU_SEND_ADD_BANK_ACCOUNT,
From 86c2be13ddf148ea4b8edc514372a699c7e05567 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 00:44:05 +0100
Subject: [PATCH 111/201] Add the MoneyRequestMerchantPage pagge
---
src/libs/actions/IOU.js | 8 ++
src/pages/iou/MoneyRequestMerchantPage.js | 136 ++++++++++++++++++++++
2 files changed, 144 insertions(+)
create mode 100644 src/pages/iou/MoneyRequestMerchantPage.js
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 13a9af5b42f6..603091f8705f 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -1705,6 +1705,13 @@ function setMoneyRequestDescription(comment) {
Onyx.merge(ONYXKEYS.IOU, {comment: comment.trim()});
}
+/**
+ * @param {String} merchant
+ */
+function setMoneyRequestMerchant(merchant) {
+ Onyx.merge(ONYXKEYS.IOU, {merchant: merchant.trim()});
+}
+
/**
* @param {Object[]} participants
*/
@@ -1779,6 +1786,7 @@ export {
setMoneyRequestAmount,
setMoneyRequestCurrency,
setMoneyRequestDescription,
+ setMoneyRequestMerchant,
setMoneyRequestParticipants,
setMoneyRequestReceipt,
createEmptyTransaction,
diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js
new file mode 100644
index 000000000000..c051a935ad83
--- /dev/null
+++ b/src/pages/iou/MoneyRequestMerchantPage.js
@@ -0,0 +1,136 @@
+import React, {Component} from 'react';
+import {View} from 'react-native';
+import {withOnyx} from 'react-native-onyx';
+import PropTypes from 'prop-types';
+import _ from 'underscore';
+import lodashGet from 'lodash/get';
+import TextInput from '../../components/TextInput';
+import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
+import ScreenWrapper from '../../components/ScreenWrapper';
+import HeaderWithBackButton from '../../components/HeaderWithBackButton';
+import Form from '../../components/Form';
+import ONYXKEYS from '../../ONYXKEYS';
+import styles from '../../styles/styles';
+import Navigation from '../../libs/Navigation/Navigation';
+import ROUTES from '../../ROUTES';
+import compose from '../../libs/compose';
+import * as IOU from '../../libs/actions/IOU';
+import optionPropTypes from '../../components/optionPropTypes';
+import CONST from '../../CONST';
+
+const propTypes = {
+ ...withLocalizePropTypes,
+
+ /** Onyx Props */
+ /** Holds data related to Money Request view state, rather than the underlying Money Request data. */
+ iou: PropTypes.shape({
+ id: PropTypes.string,
+ amount: PropTypes.number,
+ comment: PropTypes.string,
+ merchant: PropTypes.string,
+ participants: PropTypes.arrayOf(optionPropTypes),
+ }),
+};
+
+const defaultProps = {
+ iou: {
+ id: '',
+ amount: 0,
+ comment: '',
+ merchant: '',
+ participants: [],
+ },
+};
+
+class MoneyRequestMerchantPage extends Component {
+ constructor(props) {
+ super(props);
+
+ this.updateMerchant = this.updateMerchant.bind(this);
+ this.navigateBack = this.navigateBack.bind(this);
+ this.iouType = lodashGet(props.route, 'params.iouType', '');
+ this.reportID = lodashGet(props.route, 'params.reportID', '');
+ }
+
+ componentDidMount() {
+ const moneyRequestId = `${this.iouType}${this.reportID}`;
+ const shouldReset = this.props.iou.id !== moneyRequestId;
+ if (shouldReset) {
+ IOU.resetMoneyRequestInfo(moneyRequestId);
+ }
+
+ if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || shouldReset) {
+ Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
+ }
+ }
+
+ // eslint-disable-next-line rulesdir/prefer-early-return
+ componentDidUpdate(prevProps) {
+ // ID in Onyx could change by initiating a new request in a separate browser tab or completing a request
+ if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || prevProps.iou.id !== this.props.iou.id) {
+ // The ID is cleared on completing a request. In that case, we will do nothing.
+ if (this.props.iou.id) {
+ Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
+ }
+ }
+ }
+
+ navigateBack() {
+ Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(this.iouType, this.reportID));
+ }
+
+ /**
+ * Sets the money request comment by saving it to Onyx.
+ *
+ * @param {Object} value
+ * @param {String} value.moneyRequestMerchant
+ */
+ updateMerchant(value) {
+ IOU.setMoneyRequestMerchant(value.moneyRequestMerchant);
+ this.navigateBack();
+ }
+
+ render() {
+ return (
+ this.descriptionInputRef && this.descriptionInputRef.focus()}
+ >
+
+
+
+ );
+ }
+}
+
+MoneyRequestMerchantPage.propTypes = propTypes;
+MoneyRequestMerchantPage.defaultProps = defaultProps;
+
+export default compose(
+ withLocalize,
+ withOnyx({
+ iou: {key: ONYXKEYS.IOU},
+ }),
+)(MoneyRequestMerchantPage);
From ce56753111a2aad71871b3a61f98bef53c633056 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 00:53:50 +0100
Subject: [PATCH 112/201] Enable the merchant field
---
src/components/MoneyRequestConfirmationList.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js
index 2cc458d0e4ad..fd1a9d8cfbdc 100755
--- a/src/components/MoneyRequestConfirmationList.js
+++ b/src/components/MoneyRequestConfirmationList.js
@@ -413,11 +413,12 @@ function MoneyRequestConfirmationList(props) {
disabled
/>
Navigation.navigate(ROUTES.getMoneyRequestMerchantRoute(props.iouType, props.reportID))}
+ disabled={didConfirm || props.isReadOnly}
/>
>
)}
From 2c5f13eb8c1c574574ed081a0e2ce7fe13e2ea4c Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 01:09:27 +0100
Subject: [PATCH 113/201] Create MoneyRequestCreatedPage and relevant routes
---
src/ROUTES.js | 2 +
.../AppNavigator/ModalStackNavigators.js | 7 +
src/libs/Navigation/linkingConfig.js | 1 +
src/libs/actions/IOU.js | 8 ++
src/pages/iou/MoneyRequestCreatedPage.js | 129 ++++++++++++++++++
5 files changed, 147 insertions(+)
create mode 100644 src/pages/iou/MoneyRequestCreatedPage.js
diff --git a/src/ROUTES.js b/src/ROUTES.js
index 7292839a8d1e..207790e31d62 100644
--- a/src/ROUTES.js
+++ b/src/ROUTES.js
@@ -93,6 +93,7 @@ export default {
MONEY_REQUEST_AMOUNT: ':iouType/new/amount/:reportID?',
MONEY_REQUEST_PARTICIPANTS: ':iouType/new/participants/:reportID?',
MONEY_REQUEST_CONFIRMATION: ':iouType/new/confirmation/:reportID?',
+ MONEY_REQUEST_CREATED: ':iouType/new/date/:reportID?',
MONEY_REQUEST_CURRENCY: ':iouType/new/currency/:reportID?',
MONEY_REQUEST_DESCRIPTION: ':iouType/new/description/:reportID?',
MONEY_REQUEST_MERCHANT: ':iouType/new/merchant/:reportID?',
@@ -107,6 +108,7 @@ export default {
getMoneyRequestAmountRoute: (iouType, reportID = '') => `${iouType}/new/amount/${reportID}`,
getMoneyRequestParticipantsRoute: (iouType, reportID = '') => `${iouType}/new/participants/${reportID}`,
getMoneyRequestConfirmationRoute: (iouType, reportID = '') => `${iouType}/new/confirmation/${reportID}`,
+ getMoneyRequestCreatedRoute: (iouType, reportID = '') => `${iouType}/new/date/${reportID}`,
getMoneyRequestCurrencyRoute: (iouType, reportID = '', currency, backTo) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`,
getMoneyRequestDescriptionRoute: (iouType, reportID = '') => `${iouType}/new/description/${reportID}`,
getMoneyRequestMerchantRoute: (iouType, reportID = '') => `${iouType}/new/merchant/${reportID}`,
diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
index a8765f43dbe7..940569464229 100644
--- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
+++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
@@ -69,6 +69,13 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator([
},
name: 'Money_Request_Currency',
},
+ {
+ getComponent: () => {
+ const MoneyRequestCreatedPage = require('../../../pages/iou/MoneyRequestCreatedPage').default;
+ return MoneyRequestCreatedPage;
+ },
+ name: 'Money_Request_Created',
+ },
{
getComponent: () => {
const MoneyRequestDescriptionPage = require('../../../pages/iou/MoneyRequestDescriptionPage').default;
diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js
index e80c9f4b9d9d..3e7ed0b5fff4 100644
--- a/src/libs/Navigation/linkingConfig.js
+++ b/src/libs/Navigation/linkingConfig.js
@@ -323,6 +323,7 @@ export default {
Money_Request_Amount: ROUTES.MONEY_REQUEST_AMOUNT,
Money_Request_Participants: ROUTES.MONEY_REQUEST_PARTICIPANTS,
Money_Request_Confirmation: ROUTES.MONEY_REQUEST_CONFIRMATION,
+ Money_Request_Created: ROUTES.MONEY_REQUEST_CREATED,
Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY,
Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION,
Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT,
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 603091f8705f..b8b03ebc1632 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -1691,6 +1691,13 @@ function setMoneyRequestAmount(amount) {
Onyx.merge(ONYXKEYS.IOU, {amount});
}
+/**
+ * @param {String} created
+ */
+function setMoneyRequestCreated(created) {
+ Onyx.merge(ONYXKEYS.IOU, {created});
+}
+
/**
* @param {String} currency
*/
@@ -1784,6 +1791,7 @@ export {
resetMoneyRequestInfo,
setMoneyRequestId,
setMoneyRequestAmount,
+ setMoneyRequestCreated,
setMoneyRequestCurrency,
setMoneyRequestDescription,
setMoneyRequestMerchant,
diff --git a/src/pages/iou/MoneyRequestCreatedPage.js b/src/pages/iou/MoneyRequestCreatedPage.js
new file mode 100644
index 000000000000..1997343a713e
--- /dev/null
+++ b/src/pages/iou/MoneyRequestCreatedPage.js
@@ -0,0 +1,129 @@
+import React, {Component} from 'react';
+import {View} from 'react-native';
+import {withOnyx} from 'react-native-onyx';
+import PropTypes from 'prop-types';
+import _ from 'underscore';
+import lodashGet from 'lodash/get';
+import TextInput from '../../components/TextInput';
+import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
+import ScreenWrapper from '../../components/ScreenWrapper';
+import HeaderWithBackButton from '../../components/HeaderWithBackButton';
+import Form from '../../components/Form';
+import ONYXKEYS from '../../ONYXKEYS';
+import styles from '../../styles/styles';
+import Navigation from '../../libs/Navigation/Navigation';
+import ROUTES from '../../ROUTES';
+import compose from '../../libs/compose';
+import * as IOU from '../../libs/actions/IOU';
+import optionPropTypes from '../../components/optionPropTypes';
+import CONST from '../../CONST';
+import NewDatePicker from '../../components/NewDatePicker';
+
+const propTypes = {
+ ...withLocalizePropTypes,
+
+ /** Onyx Props */
+ /** Holds data related to Money Request view state, rather than the underlying Money Request data. */
+ iou: PropTypes.shape({
+ id: PropTypes.string,
+ amount: PropTypes.number,
+ comment: PropTypes.string,
+ participants: PropTypes.arrayOf(optionPropTypes),
+ }),
+};
+
+const defaultProps = {
+ iou: {
+ id: '',
+ amount: 0,
+ comment: '',
+ participants: [],
+ },
+};
+
+class MoneyRequestCreatedPage extends Component {
+ constructor(props) {
+ super(props);
+
+ this.updateDate = this.updateDate.bind(this);
+ this.navigateBack = this.navigateBack.bind(this);
+ this.iouType = lodashGet(props.route, 'params.iouType', '');
+ this.reportID = lodashGet(props.route, 'params.reportID', '');
+ }
+
+ componentDidMount() {
+ const moneyRequestId = `${this.iouType}${this.reportID}`;
+ const shouldReset = this.props.iou.id !== moneyRequestId;
+ if (shouldReset) {
+ IOU.resetMoneyRequestInfo(moneyRequestId);
+ }
+
+ if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || shouldReset) {
+ Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
+ }
+ }
+
+ // eslint-disable-next-line rulesdir/prefer-early-return
+ componentDidUpdate(prevProps) {
+ // ID in Onyx could change by initiating a new request in a separate browser tab or completing a request
+ if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || prevProps.iou.id !== this.props.iou.id) {
+ // The ID is cleared on completing a request. In that case, we will do nothing.
+ if (this.props.iou.id) {
+ Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
+ }
+ }
+ }
+
+ navigateBack() {
+ Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(this.iouType, this.reportID));
+ }
+
+ /**
+ * Sets the money request comment by saving it to Onyx.
+ *
+ * @param {Object} value
+ * @param {String} value.moneyRequestCreated
+ */
+ updateDate(value) {
+ IOU.setMoneyRequestCreated(value.moneyRequestCreated);
+ this.navigateBack();
+ }
+
+ render() {
+ return (
+
+
+
+
+ );
+ }
+}
+
+MoneyRequestCreatedPage.propTypes = propTypes;
+MoneyRequestCreatedPage.defaultProps = defaultProps;
+
+export default compose(
+ withLocalize,
+ withOnyx({
+ iou: {key: ONYXKEYS.IOU},
+ }),
+)(MoneyRequestCreatedPage);
From b76949a0f3d2ff8814f01b5d18f3910118abc3dc Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 01:42:45 +0100
Subject: [PATCH 114/201] Implementing the ability to set date for new request
---
src/components/MoneyRequestConfirmationList.js | 5 +++--
src/pages/iou/MoneyRequestCreatedPage.js | 10 +++++-----
src/pages/iou/MoneyRequestMerchantPage.js | 7 ++++---
src/pages/iou/ReceiptSelector/index.native.js | 6 +++++-
src/pages/iou/steps/MoneyRequestConfirmPage.js | 11 ++++++++---
src/pages/iou/steps/NewRequestAmountPage.js | 4 ++++
6 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js
index fd1a9d8cfbdc..bd05cf613ea0 100755
--- a/src/components/MoneyRequestConfirmationList.js
+++ b/src/components/MoneyRequestConfirmationList.js
@@ -406,11 +406,12 @@ function MoneyRequestConfirmationList(props) {
{showAllFields && (
<>
Navigation.navigate(ROUTES.getMoneyRequestCreatedRoute(props.iouType, props.reportID))}
+ disabled={didConfirm || props.isReadOnly}
/>
diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js
index c051a935ad83..5d39c0904f14 100644
--- a/src/pages/iou/MoneyRequestMerchantPage.js
+++ b/src/pages/iou/MoneyRequestMerchantPage.js
@@ -27,6 +27,7 @@ const propTypes = {
id: PropTypes.string,
amount: PropTypes.number,
comment: PropTypes.string,
+ created: PropTypes.string,
merchant: PropTypes.string,
participants: PropTypes.arrayOf(optionPropTypes),
}),
@@ -95,7 +96,7 @@ class MoneyRequestMerchantPage extends Component {
this.descriptionInputRef && this.descriptionInputRef.focus()}
+ onEntryTransitionEnd={() => this.merchantInputRef && this.merchantInputRef.focus()}
>
(this.descriptionInputRef = el)}
+ ref={(el) => (this.merchantInputRef = el)}
/>
diff --git a/src/pages/iou/ReceiptSelector/index.native.js b/src/pages/iou/ReceiptSelector/index.native.js
index 7eeab6e493bd..730e5d1e1dfb 100644
--- a/src/pages/iou/ReceiptSelector/index.native.js
+++ b/src/pages/iou/ReceiptSelector/index.native.js
@@ -38,7 +38,9 @@ const propTypes = {
iou: PropTypes.shape({
id: PropTypes.string,
amount: PropTypes.number,
- currency: PropTypes.string,
+ comment: PropTypes.string,
+ created: PropTypes.string,
+ merchant: PropTypes.string,
participants: PropTypes.arrayOf(participantPropTypes),
}),
};
@@ -54,6 +56,8 @@ const defaultProps = {
iou: {
id: '',
amount: 0,
+ merchant: '',
+ created: '',
currency: CONST.CURRENCY.USD,
participants: [],
},
diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js
index a81e3a8bf825..753d03e55d4e 100644
--- a/src/pages/iou/steps/MoneyRequestConfirmPage.js
+++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js
@@ -2,6 +2,7 @@ import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
+import {format} from 'date-fns';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import MoneyRequestConfirmationList from '../../../components/MoneyRequestConfirmationList';
@@ -30,9 +31,10 @@ const propTypes = {
iou: PropTypes.shape({
id: PropTypes.string,
amount: PropTypes.number,
- receiptPath: PropTypes.string,
- currency: PropTypes.string,
comment: PropTypes.string,
+ created: PropTypes.string,
+ currency: PropTypes.string,
+ merchant: PropTypes.string,
participants: PropTypes.arrayOf(
PropTypes.shape({
accountID: PropTypes.number,
@@ -42,6 +44,7 @@ const propTypes = {
selected: PropTypes.bool,
}),
),
+ receiptPath: PropTypes.string,
}),
/** Personal details of all users */
@@ -58,6 +61,8 @@ const defaultProps = {
amount: 0,
currency: CONST.CURRENCY.USD,
comment: '',
+ merchant: '',
+ created: format(new Date(), CONST.DATE.FNS_FORMAT_STRING),
participants: [],
},
...withCurrentUserPersonalDetailsDefaultProps,
@@ -260,7 +265,7 @@ function MoneyRequestConfirmPage(props) {
bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)}
iouMerchant={props.iou.merchant}
iouModifiedMerchant={props.iou.modifiedMerchant}
- iouDate={props.iou.date}
+ iouDate={props.iou.created}
/>
)}
diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js
index 6eda79654e77..e0199d72b01a 100644
--- a/src/pages/iou/steps/NewRequestAmountPage.js
+++ b/src/pages/iou/steps/NewRequestAmountPage.js
@@ -37,6 +37,8 @@ const propTypes = {
id: PropTypes.string,
amount: PropTypes.number,
currency: PropTypes.string,
+ merchant: PropTypes.string,
+ created: PropTypes.string,
participants: PropTypes.arrayOf(
PropTypes.shape({
accountID: PropTypes.number,
@@ -60,6 +62,8 @@ const defaultProps = {
iou: {
id: '',
amount: 0,
+ created: '',
+ merchant: '',
currency: CONST.CURRENCY.USD,
participants: [],
},
From c61a43fd882f1151caa3d04b16149ce113e395f5 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 02:04:57 +0100
Subject: [PATCH 115/201] Make sure the created is also reset
---
src/components/MoneyRequestConfirmationList.js | 3 ++-
src/libs/actions/IOU.js | 4 ++--
src/pages/iou/MoneyRequestCreatedPage.js | 5 +++--
src/pages/iou/steps/MoneyRequestConfirmPage.js | 3 +--
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js
index bd05cf613ea0..8c9e849b5e36 100755
--- a/src/components/MoneyRequestConfirmationList.js
+++ b/src/components/MoneyRequestConfirmationList.js
@@ -1,6 +1,7 @@
import React, {useCallback, useMemo, useReducer, useState} from 'react';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
+import {format} from 'date-fns';
import _ from 'underscore';
import {View} from 'react-native';
import Str from 'expensify-common/lib/str';
@@ -407,7 +408,7 @@ function MoneyRequestConfirmationList(props) {
<>
Navigation.navigate(ROUTES.getMoneyRequestCreatedRoute(props.iouType, props.reportID))}
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index b8b03ebc1632..3baaedee585d 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -72,7 +72,7 @@ Onyx.connect({
* @param {String} id
*/
function resetMoneyRequestInfo(id = '') {
- const date = currentDate || moment().format('YYYY-MM-DD');
+ const created = currentDate || moment().format('YYYY-MM-DD');
Onyx.merge(ONYXKEYS.IOU, {
id,
amount: 0,
@@ -80,7 +80,7 @@ function resetMoneyRequestInfo(id = '') {
comment: '',
participants: [],
merchant: '',
- date,
+ created,
receiptPath: '',
receiptSource: '',
});
diff --git a/src/pages/iou/MoneyRequestCreatedPage.js b/src/pages/iou/MoneyRequestCreatedPage.js
index 2e75063a539c..a582299d3128 100644
--- a/src/pages/iou/MoneyRequestCreatedPage.js
+++ b/src/pages/iou/MoneyRequestCreatedPage.js
@@ -1,11 +1,12 @@
import React, {Component} from 'react';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
+import {format} from 'date-fns';
import _ from 'underscore';
import lodashGet from 'lodash/get';
-import CONST from '../../CONST';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import ScreenWrapper from '../../components/ScreenWrapper';
+import CONST from '../../CONST';
import HeaderWithBackButton from '../../components/HeaderWithBackButton';
import Form from '../../components/Form';
import ONYXKEYS from '../../ONYXKEYS';
@@ -109,7 +110,7 @@ class MoneyRequestCreatedPage extends Component {
diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js
index 753d03e55d4e..3878aa6d340e 100644
--- a/src/pages/iou/steps/MoneyRequestConfirmPage.js
+++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js
@@ -2,7 +2,6 @@ import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
-import {format} from 'date-fns';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import MoneyRequestConfirmationList from '../../../components/MoneyRequestConfirmationList';
@@ -62,7 +61,7 @@ const defaultProps = {
currency: CONST.CURRENCY.USD,
comment: '',
merchant: '',
- created: format(new Date(), CONST.DATE.FNS_FORMAT_STRING),
+ created: '',
participants: [],
},
...withCurrentUserPersonalDetailsDefaultProps,
From dd7f3f4d34e66ee9dab3540be5afca248e595faa Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Thu, 17 Aug 2023 20:10:44 -0700
Subject: [PATCH 116/201] chore: use the code from test branch for the map lib
---
package-lock.json | 13 ++++++-------
package.json | 2 +-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 744313b60488..c11bb7cde369 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -104,7 +104,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "1.0.7",
+ "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
@@ -43424,9 +43424,9 @@
}
},
"node_modules/react-native-x-maps": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.7.tgz",
- "integrity": "sha512-dfuEPWAXjESTTZ2tLFkYLHjd++s/goGvksiPib4a6DoPfF1HA6jXvasB9ddjG1iHMVmHY8Cvc2OVZTGNaAp0RA==",
+ "version": "1.0.6",
+ "resolved": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#fe69c26a1a80c3b1f5ddeef389b5d1a179a94dfc",
+ "license": "MIT",
"peerDependencies": {
"@math.gl/web-mercator": "^3.6.3",
"@rnmapbox/maps": "^10.0.11",
@@ -80237,9 +80237,8 @@
}
},
"react-native-x-maps": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.7.tgz",
- "integrity": "sha512-dfuEPWAXjESTTZ2tLFkYLHjd++s/goGvksiPib4a6DoPfF1HA6jXvasB9ddjG1iHMVmHY8Cvc2OVZTGNaAp0RA==",
+ "version": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#fe69c26a1a80c3b1f5ddeef389b5d1a179a94dfc",
+ "from": "react-native-x-maps@github:Expensify/react-native-x-maps#hayata-test-new-version",
"requires": {}
},
"react-pdf": {
diff --git a/package.json b/package.json
index eac2aceb4466..865c7777f06f 100644
--- a/package.json
+++ b/package.json
@@ -144,7 +144,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "1.0.7",
+ "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
From b31cea81c6d493062024a26a5d633423246ca66f Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Thu, 17 Aug 2023 20:11:02 -0700
Subject: [PATCH 117/201] chore: update pod version
---
ios/Podfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 66482252f95e..505624b3c455 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -1276,4 +1276,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 845537d35601574adcd0794e17003ba7dbccdbfd
-COCOAPODS: 1.11.3
+COCOAPODS: 1.12.1
From 4e85d60bf5d976e2a5445a3036f781f25254ca24 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 14:38:24 +0200
Subject: [PATCH 118/201] migrate native AttachmentPicker to functional
component
---
.../AttachmentPicker/index.native.js | 376 +++++++++---------
1 file changed, 177 insertions(+), 199 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index b4b7d0b04c4e..15723b08578c 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -1,25 +1,22 @@
-/**
- * The react native image/document pickers work for iOS/Android, but we want to wrap them both within AttachmentPicker
- */
import _ from 'underscore';
-import React, {Component} from 'react';
-import {Alert, Linking, View} from 'react-native';
-import {launchImageLibrary} from 'react-native-image-picker';
+import React, {useEffect, useState, useRef} from 'react';
+import {View, Alert, Linking} from 'react-native';
import RNDocumentPicker from 'react-native-document-picker';
import RNFetchBlob from 'react-native-blob-util';
+import {launchImageLibrary} from 'react-native-image-picker';
import {propTypes as basePropTypes, defaultProps} from './attachmentPickerPropTypes';
-import styles from '../../styles/styles';
-import Popover from '../Popover';
-import MenuItem from '../MenuItem';
-import * as Expensicons from '../Icon/Expensicons';
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import compose from '../../libs/compose';
-import launchCamera from './launchCamera';
import CONST from '../../CONST';
import * as FileUtils from '../../libs/fileDownload/FileUtils';
-import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
+import * as Expensicons from '../Icon/Expensicons';
+import launchCamera from './launchCamera';
import KeyboardShortcut from '../../libs/KeyboardShortcut';
+import Popover from '../Popover';
+import MenuItem from '../MenuItem';
+import styles from '../../styles/styles';
+import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
const propTypes = {
...basePropTypes,
@@ -88,133 +85,26 @@ function getDataForUpload(fileData) {
});
}
-/**
- * This component renders a function as a child and
- * returns a "show attachment picker" method that takes
- * a callback. This is the ios/android implementation
- * opening a modal with attachment options
- */
-class AttachmentPicker extends Component {
- constructor(...args) {
- super(...args);
-
- this.state = {
- isVisible: false,
- focusedIndex: -1,
- };
-
- this.menuItemData = [
- {
- icon: Expensicons.Camera,
- textTranslationKey: 'attachmentPicker.takePhoto',
- pickAttachment: () => this.showImagePicker(launchCamera),
- },
- {
- icon: Expensicons.Gallery,
- textTranslationKey: 'attachmentPicker.chooseFromGallery',
- pickAttachment: () => this.showImagePicker(launchImageLibrary),
- },
- ];
-
- // When selecting an image on a native device, it would be redundant to have a second option for choosing a document,
- // so it is excluded in this case.
- if (this.props.type !== CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
- this.menuItemData.push({
- icon: Expensicons.Paperclip,
- textTranslationKey: 'attachmentPicker.chooseDocument',
- pickAttachment: () => this.showDocumentPicker(),
- });
- }
-
- this.close = this.close.bind(this);
- this.pickAttachment = this.pickAttachment.bind(this);
- this.removeKeyboardListener = this.removeKeyboardListener.bind(this);
- this.attachKeyboardListener = this.attachKeyboardListener.bind(this);
- }
-
- componentDidUpdate(prevState) {
- if (this.state.isVisible === prevState.isVisible) {
- return;
- }
-
- if (this.state.isVisible) {
- this.attachKeyboardListener();
- } else {
- this.removeKeyboardListener();
- }
- }
-
- componentWillUnmount() {
- this.removeKeyboardListener();
- }
-
- attachKeyboardListener() {
- const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
- this.unsubscribeEnterKey = KeyboardShortcut.subscribe(
- shortcutConfig.shortcutKey,
- () => {
- if (this.state.focusedIndex === -1) {
- return;
- }
- this.selectItem(this.menuItemData[this.state.focusedIndex]);
- this.setState({focusedIndex: -1}); // Reset the focusedIndex on selecting any menu
- },
- shortcutConfig.descriptionKey,
- shortcutConfig.modifiers,
- true,
- );
- }
-
- removeKeyboardListener() {
- if (!this.unsubscribeEnterKey) {
- return;
- }
- this.unsubscribeEnterKey();
- }
-
- /**
- * Handles the image/document picker result and
- * sends the selected attachment to the caller (parent component)
- *
- * @param {Array} attachments
- * @returns {Promise}
- */
- pickAttachment(attachments = []) {
- if (attachments.length === 0) {
- return;
- }
-
- const fileData = _.first(attachments);
-
- if (fileData.width === -1 || fileData.height === -1) {
- this.showImageCorruptionAlert();
- return;
- }
-
- return getDataForUpload(fileData)
- .then((result) => {
- this.completeAttachmentSelection(result);
- })
- .catch((error) => {
- this.showGeneralAlert(error.message);
- throw error;
- });
- }
+function AttachmentPicker(props) {
+ // const onPicked = useRef();
+ const completeAttachmentSelection = useRef();
+ const onModalHide = useRef();
+ const keyboardListener = useRef();
/**
* Inform the users when they need to grant camera access and guide them to settings
*/
- showPermissionsAlert() {
+ function showPermissionsAlert() {
Alert.alert(
- this.props.translate('attachmentPicker.cameraPermissionRequired'),
- this.props.translate('attachmentPicker.expensifyDoesntHaveAccessToCamera'),
+ props.translate('attachmentPicker.cameraPermissionRequired'),
+ props.translate('attachmentPicker.expensifyDoesntHaveAccessToCamera'),
[
{
- text: this.props.translate('common.cancel'),
+ text: props.translate('common.cancel'),
style: 'cancel',
},
{
- text: this.props.translate('common.settings'),
+ text: props.translate('common.settings'),
onPress: () => Linking.openSettings(),
},
],
@@ -222,15 +112,23 @@ class AttachmentPicker extends Component {
);
}
+ /**
+ * A generic handling when we don't know the exact reason for an error
+ *
+ */
+ function showGeneralAlert() {
+ Alert.alert(props.translate('attachmentPicker.attachmentError'), props.translate('attachmentPicker.errorWhileSelectingAttachment'));
+ }
+
/**
* Common image picker handling
*
* @param {function} imagePickerFunc - RNImagePicker.launchCamera or RNImagePicker.launchImageLibrary
* @returns {Promise}
*/
- showImagePicker(imagePickerFunc) {
+ function showImagePicker(imagePickerFunc) {
return new Promise((resolve, reject) => {
- imagePickerFunc(getImagePickerOptions(this.props.type), (response) => {
+ imagePickerFunc(getImagePickerOptions(props.type), (response) => {
if (response.didCancel) {
// When the user cancelled resolve with no attachment
return resolve();
@@ -238,10 +136,10 @@ class AttachmentPicker extends Component {
if (response.errorCode) {
switch (response.errorCode) {
case 'permission':
- this.showPermissionsAlert();
+ showPermissionsAlert();
return resolve();
default:
- this.showGeneralAlert();
+ showGeneralAlert();
break;
}
@@ -253,19 +151,28 @@ class AttachmentPicker extends Component {
});
}
- /**
- * A generic handling when we don't know the exact reason for an error
- *
- */
- showGeneralAlert() {
- Alert.alert(this.props.translate('attachmentPicker.attachmentError'), this.props.translate('attachmentPicker.errorWhileSelectingAttachment'));
- }
+ const [isVisible, setIsVisible] = useState(false);
+ const [focusedIndex, setFocusedIndex] = useState(-1);
+ const [menuItemData, setMenuItemData] = useState([
+ {
+ icon: Expensicons.Camera,
+ textTranslationKey: 'attachmentPicker.takePhoto',
+ pickAttachment: () => showImagePicker(launchCamera),
+ },
+ {
+ icon: Expensicons.Gallery,
+ textTranslationKey: 'attachmentPicker.chooseFromGallery',
+ pickAttachment: () => showImagePicker(launchImageLibrary),
+ },
+ ]);
+
+ // const [result, setResult] = useState()
/**
* An attachment error dialog when user selected malformed images
*/
- showImageCorruptionAlert() {
- Alert.alert(this.props.translate('attachmentPicker.attachmentError'), this.props.translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
+ function showImageCorruptionAlert() {
+ Alert.alert(props.translate('attachmentPicker.attachmentError'), props.translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
}
/**
@@ -273,43 +180,61 @@ class AttachmentPicker extends Component {
*
* @returns {Promise}
*/
- showDocumentPicker() {
+ function showDocumentPicker() {
return RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
if (RNDocumentPicker.isCancel(error)) {
return;
}
- this.showGeneralAlert(error.message);
+ showGeneralAlert(error.message);
throw error;
});
}
/**
- * Triggers the `onPicked` callback with the selected attachment
+ * Opens the attachment modal
+ *
+ * @param {function} onPickedHandler A callback that will be called with the selected attachment
*/
- completeAttachmentSelection() {
- if (!this.state.result) {
- return;
- }
-
- this.state.onPicked(this.state.result);
+ function open(onPickedHandler) {
+ completeAttachmentSelection.current = onPickedHandler;
+ setIsVisible(true);
}
/**
- * Opens the attachment modal
- *
- * @param {function} onPicked A callback that will be called with the selected attachment
+ * Closes the attachment modal
*/
- open(onPicked) {
- this.completeAttachmentSelection = onPicked;
- this.setState({isVisible: true});
+ function close() {
+ setIsVisible(false);
}
/**
- * Closes the attachment modal
+ * Handles the image/document picker result and
+ * sends the selected attachment to the caller (parent component)
+ *
+ * @param {Array} attachments
+ * @returns {Promise}
*/
- close() {
- this.setState({isVisible: false});
+ function pickAttachment(attachments = []) {
+ if (attachments.length === 0) {
+ return;
+ }
+
+ const fileData = _.first(attachments);
+
+ if (fileData.width === -1 || fileData.height === -1) {
+ showImageCorruptionAlert();
+ return;
+ }
+
+ return getDataForUpload(fileData)
+ .then((result) => {
+ completeAttachmentSelection.current(result);
+ })
+ .catch((error) => {
+ showGeneralAlert(error.message);
+ throw error;
+ });
}
/**
@@ -318,65 +243,118 @@ class AttachmentPicker extends Component {
* @param {Object} item - an item from this.menuItemData
* @param {Function} item.pickAttachment
*/
- selectItem(item) {
+ function selectItem(item) {
/* setTimeout delays execution to the frame after the modal closes
* without this on iOS closing the modal closes the gallery/camera as well */
- this.onModalHide = () =>
+ onModalHide.current = () =>
setTimeout(
() =>
item
.pickAttachment()
- .then(this.pickAttachment)
+ .then(pickAttachment)
.catch(console.error)
- .finally(() => delete this.onModalHide),
+ .finally(() => delete onModalHide.current),
200,
);
- this.close();
+ close();
+ }
+
+ function attachKeyboardListener() {
+ const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
+ keyboardListener.current = KeyboardShortcut.subscribe(
+ shortcutConfig.shortcutKey,
+ () => {
+ if (focusedIndex === -1) {
+ return;
+ }
+ selectItem(menuItemData[focusedIndex]);
+ setFocusedIndex(-1); // Reset the focusedIndex on selecting any menu
+ },
+ shortcutConfig.descriptionKey,
+ shortcutConfig.modifiers,
+ true,
+ );
}
+ function removeKeyboardListener() {
+ if (!keyboardListener.current) {
+ return;
+ }
+ keyboardListener.current();
+ }
+
+ useEffect(() => {
+ // When selecting an image on a native device, it would be redundant to have a second option for choosing a document,
+ // so it is excluded in this case.
+ if (props.type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
+ return;
+ }
+
+ setMenuItemData((oldMenuItemData) => [
+ ...oldMenuItemData,
+ {
+ icon: Expensicons.Paperclip,
+ textTranslationKey: 'attachmentPicker.chooseDocument',
+ pickAttachment: () => showDocumentPicker(),
+ },
+ ]);
+
+ return () => {
+ removeKeyboardListener();
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ useEffect(() => {
+ if (isVisible) {
+ attachKeyboardListener();
+ } else {
+ removeKeyboardListener();
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isVisible]);
+
/**
* Call the `children` renderProp with the interface defined in propTypes
*
* @returns {React.ReactNode}
*/
- renderChildren() {
- return this.props.children({
- openPicker: ({onPicked}) => this.open(onPicked),
+ function renderChildren() {
+ return props.children({
+ openPicker: ({onPicked}) => open(onPicked),
});
}
- render() {
- return (
- <>
-
-
- this.setState({focusedIndex: index})}
- >
- {_.map(this.menuItemData, (item, menuIndex) => (
-
-
-
- {this.renderChildren()}
- >
- );
- }
+ return (
+ <>
+ close()}
+ isVisible={isVisible}
+ anchorPosition={styles.createMenuPosition}
+ onModalHide={onModalHide.current}
+ >
+
+ setFocusedIndex(index)}
+ >
+ {_.map(menuItemData, (item, menuIndex) => (
+
+
+
+ {renderChildren()}
+ >
+ );
}
AttachmentPicker.propTypes = propTypes;
From acfd749f79da4d2cce8217d5d9f6f060e14712af Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 14:46:33 +0200
Subject: [PATCH 119/201] remove unnecessary comment
---
src/components/AttachmentPicker/index.native.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 15723b08578c..56c767da6c72 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -86,7 +86,6 @@ function getDataForUpload(fileData) {
}
function AttachmentPicker(props) {
- // const onPicked = useRef();
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
const keyboardListener = useRef();
From 1cd666a10f65d9778509a1d4a09d577b511caa1b Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:09:54 +0200
Subject: [PATCH 120/201] destructure props
---
.../AttachmentPicker/index.native.js | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 56c767da6c72..80eebc9d857d 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -85,7 +85,7 @@ function getDataForUpload(fileData) {
});
}
-function AttachmentPicker(props) {
+function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
const keyboardListener = useRef();
@@ -95,15 +95,15 @@ function AttachmentPicker(props) {
*/
function showPermissionsAlert() {
Alert.alert(
- props.translate('attachmentPicker.cameraPermissionRequired'),
- props.translate('attachmentPicker.expensifyDoesntHaveAccessToCamera'),
+ translate('attachmentPicker.cameraPermissionRequired'),
+ translate('attachmentPicker.expensifyDoesntHaveAccessToCamera'),
[
{
- text: props.translate('common.cancel'),
+ text: translate('common.cancel'),
style: 'cancel',
},
{
- text: props.translate('common.settings'),
+ text: translate('common.settings'),
onPress: () => Linking.openSettings(),
},
],
@@ -116,7 +116,7 @@ function AttachmentPicker(props) {
*
*/
function showGeneralAlert() {
- Alert.alert(props.translate('attachmentPicker.attachmentError'), props.translate('attachmentPicker.errorWhileSelectingAttachment'));
+ Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingAttachment'));
}
/**
@@ -127,7 +127,7 @@ function AttachmentPicker(props) {
*/
function showImagePicker(imagePickerFunc) {
return new Promise((resolve, reject) => {
- imagePickerFunc(getImagePickerOptions(props.type), (response) => {
+ imagePickerFunc(getImagePickerOptions(type), (response) => {
if (response.didCancel) {
// When the user cancelled resolve with no attachment
return resolve();
@@ -171,7 +171,7 @@ function AttachmentPicker(props) {
* An attachment error dialog when user selected malformed images
*/
function showImageCorruptionAlert() {
- Alert.alert(props.translate('attachmentPicker.attachmentError'), props.translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
+ Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
}
/**
@@ -286,7 +286,7 @@ function AttachmentPicker(props) {
useEffect(() => {
// When selecting an image on a native device, it would be redundant to have a second option for choosing a document,
// so it is excluded in this case.
- if (props.type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
+ if (type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
return;
}
@@ -320,7 +320,7 @@ function AttachmentPicker(props) {
* @returns {React.ReactNode}
*/
function renderChildren() {
- return props.children({
+ return children({
openPicker: ({onPicked}) => open(onPicked),
});
}
@@ -333,7 +333,7 @@ function AttachmentPicker(props) {
anchorPosition={styles.createMenuPosition}
onModalHide={onModalHide.current}
>
-
+
selectItem(item)}
focused={focusedIndex === menuIndex}
/>
From 2ad8277dcfcf2d6b96942ff8e6252571c021419c Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:12:22 +0200
Subject: [PATCH 121/201] refactor function declarations
---
.../AttachmentPicker/index.native.js | 40 ++++++++-----------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 80eebc9d857d..6303777f79b7 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -40,7 +40,7 @@ const imagePickerOptions = {
* @param {String} type
* @returns {Object}
*/
-function getImagePickerOptions(type) {
+const getImagePickerOptions = (type) => {
// mediaType property is one of the ImagePicker configuration to restrict types'
const mediaType = type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE ? 'photo' : 'mixed';
return {
@@ -64,7 +64,7 @@ const documentPickerOptions = {
* @param {Object} fileData
* @return {Promise}
*/
-function getDataForUpload(fileData) {
+const getDataForUpload = (fileData) => {
const fileName = fileData.fileName || fileData.name || 'chat_attachment';
const fileResult = {
name: FileUtils.cleanFileName(fileName),
@@ -93,7 +93,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
/**
* Inform the users when they need to grant camera access and guide them to settings
*/
- function showPermissionsAlert() {
+ const showPermissionsAlert = () => {
Alert.alert(
translate('attachmentPicker.cameraPermissionRequired'),
translate('attachmentPicker.expensifyDoesntHaveAccessToCamera'),
@@ -115,7 +115,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
* A generic handling when we don't know the exact reason for an error
*
*/
- function showGeneralAlert() {
+ const showGeneralAlert = () => {
Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingAttachment'));
}
@@ -125,8 +125,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
* @param {function} imagePickerFunc - RNImagePicker.launchCamera or RNImagePicker.launchImageLibrary
* @returns {Promise}
*/
- function showImagePicker(imagePickerFunc) {
- return new Promise((resolve, reject) => {
+ const showImagePicker = (imagePickerFunc) => new Promise((resolve, reject) => {
imagePickerFunc(getImagePickerOptions(type), (response) => {
if (response.didCancel) {
// When the user cancelled resolve with no attachment
@@ -147,8 +146,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
return resolve(response.assets);
});
- });
- }
+ })
const [isVisible, setIsVisible] = useState(false);
const [focusedIndex, setFocusedIndex] = useState(-1);
@@ -170,7 +168,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
/**
* An attachment error dialog when user selected malformed images
*/
- function showImageCorruptionAlert() {
+ const showImageCorruptionAlert = () => {
Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
}
@@ -179,23 +177,21 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
*
* @returns {Promise}
*/
- function showDocumentPicker() {
- return RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
+ const showDocumentPicker = () => RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
if (RNDocumentPicker.isCancel(error)) {
return;
}
showGeneralAlert(error.message);
throw error;
- });
- }
+ })
/**
* Opens the attachment modal
*
* @param {function} onPickedHandler A callback that will be called with the selected attachment
*/
- function open(onPickedHandler) {
+ const open = (onPickedHandler) => {
completeAttachmentSelection.current = onPickedHandler;
setIsVisible(true);
}
@@ -203,7 +199,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
/**
* Closes the attachment modal
*/
- function close() {
+ const close = () => {
setIsVisible(false);
}
@@ -214,7 +210,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
* @param {Array} attachments
* @returns {Promise}
*/
- function pickAttachment(attachments = []) {
+ const pickAttachment = (attachments = []) => {
if (attachments.length === 0) {
return;
}
@@ -242,7 +238,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
* @param {Object} item - an item from this.menuItemData
* @param {Function} item.pickAttachment
*/
- function selectItem(item) {
+ const selectItem = (item) => {
/* setTimeout delays execution to the frame after the modal closes
* without this on iOS closing the modal closes the gallery/camera as well */
onModalHide.current = () =>
@@ -259,7 +255,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
close();
}
- function attachKeyboardListener() {
+ const attachKeyboardListener = () => {
const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
keyboardListener.current = KeyboardShortcut.subscribe(
shortcutConfig.shortcutKey,
@@ -276,7 +272,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
);
}
- function removeKeyboardListener() {
+ const removeKeyboardListener = () => {
if (!keyboardListener.current) {
return;
}
@@ -319,11 +315,9 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
*
* @returns {React.ReactNode}
*/
- function renderChildren() {
- return children({
+ const renderChildren = () => children({
openPicker: ({onPicked}) => open(onPicked),
- });
- }
+ })
return (
<>
From d90c027632485514cab1a24f33f7571de64de942 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:13:08 +0200
Subject: [PATCH 122/201] remove unnecessary newline
---
src/components/AttachmentPicker/index.native.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 6303777f79b7..a7ca787c4e39 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -113,7 +113,6 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
/**
* A generic handling when we don't know the exact reason for an error
- *
*/
const showGeneralAlert = () => {
Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingAttachment'));
From 491fb1294d11651727e17c3abf765a58f2018e12 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:21:31 +0200
Subject: [PATCH 123/201] simplify style conditional expression
---
src/components/AttachmentPicker/index.native.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index a7ca787c4e39..151f1bec9868 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -326,7 +326,7 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
anchorPosition={styles.createMenuPosition}
onModalHide={onModalHide.current}
>
-
+
Date: Thu, 10 Aug 2023 15:26:47 +0200
Subject: [PATCH 124/201] replace withLocalize with useLocalize hook
---
src/components/AttachmentPicker/index.native.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 151f1bec9868..1f5c1db1dbd6 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -6,8 +6,6 @@ import RNFetchBlob from 'react-native-blob-util';
import {launchImageLibrary} from 'react-native-image-picker';
import {propTypes as basePropTypes, defaultProps} from './attachmentPickerPropTypes';
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
-import withLocalize, {withLocalizePropTypes} from '../withLocalize';
-import compose from '../../libs/compose';
import CONST from '../../CONST';
import * as FileUtils from '../../libs/fileDownload/FileUtils';
import * as Expensicons from '../Icon/Expensicons';
@@ -17,11 +15,11 @@ import Popover from '../Popover';
import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
+import useLocalize from '../../hooks/useLocalize';
const propTypes = {
...basePropTypes,
...windowDimensionsPropTypes,
- ...withLocalizePropTypes,
};
/**
@@ -85,10 +83,12 @@ const getDataForUpload = (fileData) => {
});
}
-function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
+function AttachmentPicker({ type, children, isSmallScreenWidth}) {
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
const keyboardListener = useRef();
+
+ const {translate} = useLocalize()
/**
* Inform the users when they need to grant camera access and guide them to settings
@@ -352,4 +352,4 @@ function AttachmentPicker({translate, type, children, isSmallScreenWidth}) {
AttachmentPicker.propTypes = propTypes;
AttachmentPicker.defaultProps = defaultProps;
-export default compose(withWindowDimensions, withLocalize)(AttachmentPicker);
+export default withWindowDimensions(AttachmentPicker);
From 05aad64c47f10fe76e9d9f211cbeb43068137a7a Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:27:42 +0200
Subject: [PATCH 125/201] simplify passing function as a prop
---
src/components/AttachmentPicker/index.native.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 1f5c1db1dbd6..19c4ac36228f 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -321,7 +321,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
return (
<>
close()}
+ onClose={close}
isVisible={isVisible}
anchorPosition={styles.createMenuPosition}
onModalHide={onModalHide.current}
From 29010871f010ee7e5611b74af2bdaa9dd1945942 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:31:49 +0200
Subject: [PATCH 126/201] wrap necessary functions with useCallback
---
.../AttachmentPicker/index.native.js | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 19c4ac36228f..97ff1eea419b 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -1,5 +1,5 @@
import _ from 'underscore';
-import React, {useEffect, useState, useRef} from 'react';
+import React, {useEffect, useState, useRef, useCallback} from 'react';
import {View, Alert, Linking} from 'react-native';
import RNDocumentPicker from 'react-native-document-picker';
import RNFetchBlob from 'react-native-blob-util';
@@ -114,9 +114,9 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
/**
* A generic handling when we don't know the exact reason for an error
*/
- const showGeneralAlert = () => {
+ const showGeneralAlert = useCallback(() => {
Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingAttachment'));
- }
+ }, [translate])
/**
* Common image picker handling
@@ -167,9 +167,9 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
/**
* An attachment error dialog when user selected malformed images
*/
- const showImageCorruptionAlert = () => {
+ const showImageCorruptionAlert = useCallback(() => {
Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
- }
+ }, [translate])
/**
* Launch the DocumentPicker. Results are in the same format as ImagePicker
@@ -209,7 +209,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
* @param {Array} attachments
* @returns {Promise}
*/
- const pickAttachment = (attachments = []) => {
+ const pickAttachment = useCallback((attachments = []) => {
if (attachments.length === 0) {
return;
}
@@ -229,7 +229,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
showGeneralAlert(error.message);
throw error;
});
- }
+ }, [showGeneralAlert, showImageCorruptionAlert])
/**
* Setup native attachment selection to start after this popover closes
@@ -237,7 +237,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
* @param {Object} item - an item from this.menuItemData
* @param {Function} item.pickAttachment
*/
- const selectItem = (item) => {
+ const selectItem = useCallback((item) => {
/* setTimeout delays execution to the frame after the modal closes
* without this on iOS closing the modal closes the gallery/camera as well */
onModalHide.current = () =>
@@ -252,9 +252,9 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
);
close();
- }
+ }, [pickAttachment])
- const attachKeyboardListener = () => {
+ const attachKeyboardListener = useCallback(() => {
const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
keyboardListener.current = KeyboardShortcut.subscribe(
shortcutConfig.shortcutKey,
@@ -269,7 +269,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
shortcutConfig.modifiers,
true,
);
- }
+ }, [focusedIndex, menuItemData, selectItem])
const removeKeyboardListener = () => {
if (!keyboardListener.current) {
@@ -306,8 +306,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
} else {
removeKeyboardListener();
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isVisible]);
+ }, [isVisible, attachKeyboardListener]);
/**
* Call the `children` renderProp with the interface defined in propTypes
From e2af866f5720131c18db1adbd5368f03fe5031b3 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:34:01 +0200
Subject: [PATCH 127/201] simplify showDocumentPicker function call
---
src/components/AttachmentPicker/index.native.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 97ff1eea419b..96ee4a5b4527 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -290,7 +290,7 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
{
icon: Expensicons.Paperclip,
textTranslationKey: 'attachmentPicker.chooseDocument',
- pickAttachment: () => showDocumentPicker(),
+ pickAttachment: showDocumentPicker,
},
]);
From bf143c9f8c16d95214833d4605baddba02453c0e Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:35:11 +0200
Subject: [PATCH 128/201] add displayName
---
src/components/AttachmentPicker/index.native.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 96ee4a5b4527..a903f125c43b 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -350,5 +350,6 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
AttachmentPicker.propTypes = propTypes;
AttachmentPicker.defaultProps = defaultProps;
+AttachmentPicker.displayName = 'AttachmentPicker';
export default withWindowDimensions(AttachmentPicker);
From e1a30e4119f0f547431d853aa99f0de1878b41bc Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:35:35 +0200
Subject: [PATCH 129/201] remove unnecessary comment
---
src/components/AttachmentPicker/index.native.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index a903f125c43b..ca0e9279c27a 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -162,8 +162,6 @@ function AttachmentPicker({ type, children, isSmallScreenWidth}) {
},
]);
- // const [result, setResult] = useState()
-
/**
* An attachment error dialog when user selected malformed images
*/
From fdd4db74e8c1df8cecdd39af28fb397cf28b9d6c Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:45:37 +0200
Subject: [PATCH 130/201] replace withWindowDimensions with useWindowDimensions
hook
---
src/components/AttachmentPicker/index.native.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index ca0e9279c27a..0c1dc1765bcb 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -5,7 +5,6 @@ import RNDocumentPicker from 'react-native-document-picker';
import RNFetchBlob from 'react-native-blob-util';
import {launchImageLibrary} from 'react-native-image-picker';
import {propTypes as basePropTypes, defaultProps} from './attachmentPickerPropTypes';
-import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
import CONST from '../../CONST';
import * as FileUtils from '../../libs/fileDownload/FileUtils';
import * as Expensicons from '../Icon/Expensicons';
@@ -16,10 +15,10 @@ import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
import useLocalize from '../../hooks/useLocalize';
+import useWindowDimensions from '../../hooks/useWindowDimensions';
const propTypes = {
...basePropTypes,
- ...windowDimensionsPropTypes,
};
/**
@@ -83,12 +82,13 @@ const getDataForUpload = (fileData) => {
});
}
-function AttachmentPicker({ type, children, isSmallScreenWidth}) {
+function AttachmentPicker({ type, children}) {
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
const keyboardListener = useRef();
const {translate} = useLocalize()
+ const {isSmallScreenWidth} = useWindowDimensions()
/**
* Inform the users when they need to grant camera access and guide them to settings
@@ -350,4 +350,4 @@ AttachmentPicker.propTypes = propTypes;
AttachmentPicker.defaultProps = defaultProps;
AttachmentPicker.displayName = 'AttachmentPicker';
-export default withWindowDimensions(AttachmentPicker);
+export default AttachmentPicker;
From 98ae4a5cabab86dbd11a7c968106696579345b83 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:47:40 +0200
Subject: [PATCH 131/201] move useState to the top
---
src/components/AttachmentPicker/index.native.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 0c1dc1765bcb..bd39e83ea3eb 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -83,6 +83,9 @@ const getDataForUpload = (fileData) => {
}
function AttachmentPicker({ type, children}) {
+ const [isVisible, setIsVisible] = useState(false);
+ const [focusedIndex, setFocusedIndex] = useState(-1);
+
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
const keyboardListener = useRef();
@@ -147,8 +150,6 @@ function AttachmentPicker({ type, children}) {
});
})
- const [isVisible, setIsVisible] = useState(false);
- const [focusedIndex, setFocusedIndex] = useState(-1);
const [menuItemData, setMenuItemData] = useState([
{
icon: Expensicons.Camera,
From 845470ffc6277483595253e09eb660053f5e667f Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Thu, 10 Aug 2023 15:57:00 +0200
Subject: [PATCH 132/201] add explaination to eslint disable rule
---
src/components/AttachmentPicker/index.native.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index bd39e83ea3eb..41317b78a7e3 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -296,7 +296,7 @@ function AttachmentPicker({ type, children}) {
return () => {
removeKeyboardListener();
};
- // eslint-disable-next-line react-hooks/exhaustive-deps
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- we only want this effect to run on initial render
}, []);
useEffect(() => {
From cc36b2afd5beea64e29f2c0cd1317623eb93ddda Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Fri, 11 Aug 2023 08:40:17 +0200
Subject: [PATCH 133/201] convert menuItemData to useState
---
.../AttachmentPicker/index.native.js | 178 ++++++++++--------
1 file changed, 95 insertions(+), 83 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 41317b78a7e3..492c6d4e23c2 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -1,5 +1,5 @@
import _ from 'underscore';
-import React, {useEffect, useState, useRef, useCallback} from 'react';
+import React, {useEffect, useState, useRef, useCallback, useMemo} from 'react';
import {View, Alert, Linking} from 'react-native';
import RNDocumentPicker from 'react-native-document-picker';
import RNFetchBlob from 'react-native-blob-util';
@@ -44,7 +44,7 @@ const getImagePickerOptions = (type) => {
mediaType,
...imagePickerOptions,
};
-}
+};
/**
* See https://github.com/rnmods/react-native-document-picker#options for DocumentPicker configuration options
@@ -80,23 +80,23 @@ const getDataForUpload = (fileData) => {
fileResult.size = stats.size;
return fileResult;
});
-}
+};
-function AttachmentPicker({ type, children}) {
+function AttachmentPicker({type, children}) {
const [isVisible, setIsVisible] = useState(false);
const [focusedIndex, setFocusedIndex] = useState(-1);
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
const keyboardListener = useRef();
-
- const {translate} = useLocalize()
- const {isSmallScreenWidth} = useWindowDimensions()
+
+ const {translate} = useLocalize();
+ const {isSmallScreenWidth} = useWindowDimensions();
/**
* Inform the users when they need to grant camera access and guide them to settings
*/
- const showPermissionsAlert = () => {
+ const showPermissionsAlert = useCallback(() => {
Alert.alert(
translate('attachmentPicker.cameraPermissionRequired'),
translate('attachmentPicker.expensifyDoesntHaveAccessToCamera'),
@@ -112,14 +112,14 @@ function AttachmentPicker({ type, children}) {
],
{cancelable: false},
);
- }
+ }, [translate]);
/**
* A generic handling when we don't know the exact reason for an error
*/
const showGeneralAlert = useCallback(() => {
Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingAttachment'));
- }, [translate])
+ }, [translate]);
/**
* Common image picker handling
@@ -127,7 +127,8 @@ function AttachmentPicker({ type, children}) {
* @param {function} imagePickerFunc - RNImagePicker.launchCamera or RNImagePicker.launchImageLibrary
* @returns {Promise}
*/
- const showImagePicker = (imagePickerFunc) => new Promise((resolve, reject) => {
+ const showImagePicker = useCallback((imagePickerFunc) =>
+ new Promise((resolve, reject) => {
imagePickerFunc(getImagePickerOptions(type), (response) => {
if (response.didCancel) {
// When the user cancelled resolve with no attachment
@@ -148,41 +149,54 @@ function AttachmentPicker({ type, children}) {
return resolve(response.assets);
});
- })
-
- const [menuItemData, setMenuItemData] = useState([
- {
- icon: Expensicons.Camera,
- textTranslationKey: 'attachmentPicker.takePhoto',
- pickAttachment: () => showImagePicker(launchCamera),
- },
- {
- icon: Expensicons.Gallery,
- textTranslationKey: 'attachmentPicker.chooseFromGallery',
- pickAttachment: () => showImagePicker(launchImageLibrary),
- },
- ]);
-
- /**
- * An attachment error dialog when user selected malformed images
- */
- const showImageCorruptionAlert = useCallback(() => {
- Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
- }, [translate])
+ }), [showGeneralAlert, showPermissionsAlert, type]);
/**
* Launch the DocumentPicker. Results are in the same format as ImagePicker
*
* @returns {Promise}
*/
- const showDocumentPicker = () => RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
+ const showDocumentPicker = useCallback(() =>
+ RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
if (RNDocumentPicker.isCancel(error)) {
return;
}
showGeneralAlert(error.message);
throw error;
- })
+ }), [showGeneralAlert]);
+
+ const menuItemData = useMemo(() => {
+ const data = [
+ {
+ icon: Expensicons.Camera,
+ textTranslationKey: 'attachmentPicker.takePhoto',
+ pickAttachment: () => showImagePicker(launchCamera),
+ },
+ {
+ icon: Expensicons.Gallery,
+ textTranslationKey: 'attachmentPicker.chooseFromGallery',
+ pickAttachment: () => showImagePicker(launchImageLibrary),
+ },
+ ];
+
+ if (type !== CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
+ data.push({
+ icon: Expensicons.Paperclip,
+ textTranslationKey: 'attachmentPicker.chooseDocument',
+ pickAttachment: showDocumentPicker,
+ });
+ }
+
+ return data;
+ }, [showDocumentPicker, showImagePicker, type]);
+
+ /**
+ * An attachment error dialog when user selected malformed images
+ */
+ const showImageCorruptionAlert = useCallback(() => {
+ Alert.alert(translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingCorruptedImage'));
+ }, [translate]);
/**
* Opens the attachment modal
@@ -192,14 +206,14 @@ function AttachmentPicker({ type, children}) {
const open = (onPickedHandler) => {
completeAttachmentSelection.current = onPickedHandler;
setIsVisible(true);
- }
+ };
/**
* Closes the attachment modal
*/
const close = () => {
setIsVisible(false);
- }
+ };
/**
* Handles the image/document picker result and
@@ -208,27 +222,30 @@ function AttachmentPicker({ type, children}) {
* @param {Array} attachments
* @returns {Promise}
*/
- const pickAttachment = useCallback((attachments = []) => {
- if (attachments.length === 0) {
- return;
- }
+ const pickAttachment = useCallback(
+ (attachments = []) => {
+ if (attachments.length === 0) {
+ return;
+ }
- const fileData = _.first(attachments);
+ const fileData = _.first(attachments);
- if (fileData.width === -1 || fileData.height === -1) {
- showImageCorruptionAlert();
- return;
- }
+ if (fileData.width === -1 || fileData.height === -1) {
+ showImageCorruptionAlert();
+ return;
+ }
- return getDataForUpload(fileData)
- .then((result) => {
- completeAttachmentSelection.current(result);
- })
- .catch((error) => {
- showGeneralAlert(error.message);
- throw error;
- });
- }, [showGeneralAlert, showImageCorruptionAlert])
+ return getDataForUpload(fileData)
+ .then((result) => {
+ completeAttachmentSelection.current(result);
+ })
+ .catch((error) => {
+ showGeneralAlert(error.message);
+ throw error;
+ });
+ },
+ [showGeneralAlert, showImageCorruptionAlert],
+ );
/**
* Setup native attachment selection to start after this popover closes
@@ -236,22 +253,25 @@ function AttachmentPicker({ type, children}) {
* @param {Object} item - an item from this.menuItemData
* @param {Function} item.pickAttachment
*/
- const selectItem = useCallback((item) => {
- /* setTimeout delays execution to the frame after the modal closes
- * without this on iOS closing the modal closes the gallery/camera as well */
- onModalHide.current = () =>
- setTimeout(
- () =>
- item
- .pickAttachment()
- .then(pickAttachment)
- .catch(console.error)
- .finally(() => delete onModalHide.current),
- 200,
- );
-
- close();
- }, [pickAttachment])
+ const selectItem = useCallback(
+ (item) => {
+ /* setTimeout delays execution to the frame after the modal closes
+ * without this on iOS closing the modal closes the gallery/camera as well */
+ onModalHide.current = () =>
+ setTimeout(
+ () =>
+ item
+ .pickAttachment()
+ .then(pickAttachment)
+ .catch(console.error)
+ .finally(() => delete onModalHide.current),
+ 200,
+ );
+
+ close();
+ },
+ [pickAttachment],
+ );
const attachKeyboardListener = useCallback(() => {
const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
@@ -268,14 +288,14 @@ function AttachmentPicker({ type, children}) {
shortcutConfig.modifiers,
true,
);
- }, [focusedIndex, menuItemData, selectItem])
+ }, [focusedIndex, menuItemData, selectItem]);
const removeKeyboardListener = () => {
if (!keyboardListener.current) {
return;
}
keyboardListener.current();
- }
+ };
useEffect(() => {
// When selecting an image on a native device, it would be redundant to have a second option for choosing a document,
@@ -284,15 +304,6 @@ function AttachmentPicker({ type, children}) {
return;
}
- setMenuItemData((oldMenuItemData) => [
- ...oldMenuItemData,
- {
- icon: Expensicons.Paperclip,
- textTranslationKey: 'attachmentPicker.chooseDocument',
- pickAttachment: showDocumentPicker,
- },
- ]);
-
return () => {
removeKeyboardListener();
};
@@ -312,9 +323,10 @@ function AttachmentPicker({ type, children}) {
*
* @returns {React.ReactNode}
*/
- const renderChildren = () => children({
+ const renderChildren = () =>
+ children({
openPicker: ({onPicked}) => open(onPicked),
- })
+ });
return (
<>
From 374b292a844d74cdd6d80253278a982d09fb6055 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Fri, 11 Aug 2023 12:03:42 +0200
Subject: [PATCH 134/201] replace empty return statement with Promise.resolve()
---
src/components/AttachmentPicker/index.native.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 492c6d4e23c2..3381d6486bd1 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -225,14 +225,14 @@ function AttachmentPicker({type, children}) {
const pickAttachment = useCallback(
(attachments = []) => {
if (attachments.length === 0) {
- return;
+ return Promise.resolve();
}
const fileData = _.first(attachments);
if (fileData.width === -1 || fileData.height === -1) {
showImageCorruptionAlert();
- return;
+ return Promise.resolve();
}
return getDataForUpload(fileData)
From f1089dfde0ca670e60132015afc827f592b74df2 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Fri, 11 Aug 2023 13:34:39 +0200
Subject: [PATCH 135/201] take advantage of useKeyboardShortcut hook
---
.../AttachmentPicker/index.native.js | 126 +++++++-----------
1 file changed, 50 insertions(+), 76 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 3381d6486bd1..11495f348a9c 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -1,5 +1,5 @@
import _ from 'underscore';
-import React, {useEffect, useState, useRef, useCallback, useMemo} from 'react';
+import React, {useState, useRef, useCallback, useMemo} from 'react';
import {View, Alert, Linking} from 'react-native';
import RNDocumentPicker from 'react-native-document-picker';
import RNFetchBlob from 'react-native-blob-util';
@@ -9,13 +9,13 @@ import CONST from '../../CONST';
import * as FileUtils from '../../libs/fileDownload/FileUtils';
import * as Expensicons from '../Icon/Expensicons';
import launchCamera from './launchCamera';
-import KeyboardShortcut from '../../libs/KeyboardShortcut';
import Popover from '../Popover';
import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
import useLocalize from '../../hooks/useLocalize';
import useWindowDimensions from '../../hooks/useWindowDimensions';
+import useKeyboardShortcut from '../../hooks/useKeyboardShortcut';
const propTypes = {
...basePropTypes,
@@ -88,7 +88,6 @@ function AttachmentPicker({type, children}) {
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
- const keyboardListener = useRef();
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();
@@ -127,44 +126,50 @@ function AttachmentPicker({type, children}) {
* @param {function} imagePickerFunc - RNImagePicker.launchCamera or RNImagePicker.launchImageLibrary
* @returns {Promise}
*/
- const showImagePicker = useCallback((imagePickerFunc) =>
- new Promise((resolve, reject) => {
- imagePickerFunc(getImagePickerOptions(type), (response) => {
- if (response.didCancel) {
- // When the user cancelled resolve with no attachment
- return resolve();
- }
- if (response.errorCode) {
- switch (response.errorCode) {
- case 'permission':
- showPermissionsAlert();
- return resolve();
- default:
- showGeneralAlert();
- break;
+ const showImagePicker = useCallback(
+ (imagePickerFunc) =>
+ new Promise((resolve, reject) => {
+ imagePickerFunc(getImagePickerOptions(type), (response) => {
+ if (response.didCancel) {
+ // When the user cancelled resolve with no attachment
+ return resolve();
+ }
+ if (response.errorCode) {
+ switch (response.errorCode) {
+ case 'permission':
+ showPermissionsAlert();
+ return resolve();
+ default:
+ showGeneralAlert();
+ break;
+ }
+
+ return reject(new Error(`Error during attachment selection: ${response.errorMessage}`));
}
- return reject(new Error(`Error during attachment selection: ${response.errorMessage}`));
- }
-
- return resolve(response.assets);
- });
- }), [showGeneralAlert, showPermissionsAlert, type]);
+ return resolve(response.assets);
+ });
+ }),
+ [showGeneralAlert, showPermissionsAlert, type],
+ );
/**
* Launch the DocumentPicker. Results are in the same format as ImagePicker
*
* @returns {Promise}
*/
- const showDocumentPicker = useCallback(() =>
- RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
- if (RNDocumentPicker.isCancel(error)) {
- return;
- }
+ const showDocumentPicker = useCallback(
+ () =>
+ RNDocumentPicker.pick(documentPickerOptions).catch((error) => {
+ if (RNDocumentPicker.isCancel(error)) {
+ return;
+ }
- showGeneralAlert(error.message);
- throw error;
- }), [showGeneralAlert]);
+ showGeneralAlert(error.message);
+ throw error;
+ }),
+ [showGeneralAlert],
+ );
const menuItemData = useMemo(() => {
const data = [
@@ -273,50 +278,19 @@ function AttachmentPicker({type, children}) {
[pickAttachment],
);
- const attachKeyboardListener = useCallback(() => {
- const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
- keyboardListener.current = KeyboardShortcut.subscribe(
- shortcutConfig.shortcutKey,
- () => {
- if (focusedIndex === -1) {
- return;
- }
- selectItem(menuItemData[focusedIndex]);
- setFocusedIndex(-1); // Reset the focusedIndex on selecting any menu
- },
- shortcutConfig.descriptionKey,
- shortcutConfig.modifiers,
- true,
- );
- }, [focusedIndex, menuItemData, selectItem]);
-
- const removeKeyboardListener = () => {
- if (!keyboardListener.current) {
- return;
- }
- keyboardListener.current();
- };
-
- useEffect(() => {
- // When selecting an image on a native device, it would be redundant to have a second option for choosing a document,
- // so it is excluded in this case.
- if (type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
- return;
- }
-
- return () => {
- removeKeyboardListener();
- };
- // eslint-disable-next-line react-hooks/exhaustive-deps -- we only want this effect to run on initial render
- }, []);
-
- useEffect(() => {
- if (isVisible) {
- attachKeyboardListener();
- } else {
- removeKeyboardListener();
- }
- }, [isVisible, attachKeyboardListener]);
+ useKeyboardShortcut(
+ CONST.KEYBOARD_SHORTCUTS.ENTER,
+ () => {
+ if (focusedIndex === -1) {
+ return;
+ }
+ selectItem(menuItemData[focusedIndex]);
+ setFocusedIndex(-1); // Reset the focusedIndex on selecting any menu
+ },
+ {
+ isActive: isVisible,
+ },
+ );
/**
* Call the `children` renderProp with the interface defined in propTypes
From 48922a7535b931a89825916169faa51e0ed774fc Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Fri, 11 Aug 2023 13:44:51 +0200
Subject: [PATCH 136/201] take advantage of useArrowKeyFocusManager hook
---
.../AttachmentPicker/index.native.js | 29 ++++++++-----------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 11495f348a9c..e07dd23d6f9f 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -12,10 +12,10 @@ import launchCamera from './launchCamera';
import Popover from '../Popover';
import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
-import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
import useLocalize from '../../hooks/useLocalize';
import useWindowDimensions from '../../hooks/useWindowDimensions';
import useKeyboardShortcut from '../../hooks/useKeyboardShortcut';
+import useArrowKeyFocusManager from '../../hooks/useArrowKeyFocusManager';
const propTypes = {
...basePropTypes,
@@ -84,7 +84,6 @@ const getDataForUpload = (fileData) => {
function AttachmentPicker({type, children}) {
const [isVisible, setIsVisible] = useState(false);
- const [focusedIndex, setFocusedIndex] = useState(-1);
const completeAttachmentSelection = useRef();
const onModalHide = useRef();
@@ -196,6 +195,8 @@ function AttachmentPicker({type, children}) {
return data;
}, [showDocumentPicker, showImagePicker, type]);
+ const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({initialFocusedIndex: -1, maxIndex: menuItemData.length - 1, isActive: isVisible});
+
/**
* An attachment error dialog when user selected malformed images
*/
@@ -311,21 +312,15 @@ function AttachmentPicker({type, children}) {
onModalHide={onModalHide.current}
>
- setFocusedIndex(index)}
- >
- {_.map(menuItemData, (item, menuIndex) => (
-
+ {_.map(menuItemData, (item, menuIndex) => (
+
{renderChildren()}
From 33c88fcd143927039fde3be62706e34435c9e6a9 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Fri, 18 Aug 2023 12:22:23 +0200
Subject: [PATCH 137/201] restore general comment
---
src/components/AttachmentPicker/index.native.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index e07dd23d6f9f..b2ed5c28edaa 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -82,6 +82,15 @@ const getDataForUpload = (fileData) => {
});
};
+
+/**
+ * This component renders a function as a child and
+ * returns a "show attachment picker" method that takes
+ * a callback. This is the ios/android implementation
+ * opening a modal with attachment options
+ * @param {propTypes} props
+ * @returns {JSX.Element}
+ */
function AttachmentPicker({type, children}) {
const [isVisible, setIsVisible] = useState(false);
From 782ae858504df880e10ea843ba9feedb86b83f33 Mon Sep 17 00:00:00 2001
From: Ana Margarida Silva
Date: Fri, 18 Aug 2023 12:00:49 +0100
Subject: [PATCH 138/201] feat: only grey out updated fields
---
src/components/ReportActionItem/MoneyRequestView.js | 10 +++++-----
src/libs/TransactionUtils.js | 7 ++++++-
src/libs/actions/IOU.js | 9 ++++++++-
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 17d219dce4fd..e992f16ba409 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -98,11 +98,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
style={[StyleUtils.getReportWelcomeBackgroundImageStyle(true)]}
/>
-
+
Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))}
/>
+
+
Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))}
/>
+
+
Date: Fri, 18 Aug 2023 13:20:50 +0100
Subject: [PATCH 139/201] Remove unused prop
---
src/components/MoneyRequestConfirmationList.js | 4 ++--
src/pages/iou/steps/MoneyRequestConfirmPage.js | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js
index 8c9e849b5e36..59da93aba935 100755
--- a/src/components/MoneyRequestConfirmationList.js
+++ b/src/components/MoneyRequestConfirmationList.js
@@ -59,7 +59,7 @@ const propTypes = {
iouType: PropTypes.string,
/** IOU date */
- iouDate: PropTypes.string,
+ iouCreated: PropTypes.string,
/** IOU merchant */
iouMerchant: PropTypes.string,
@@ -408,7 +408,7 @@ function MoneyRequestConfirmationList(props) {
<>
Navigation.navigate(ROUTES.getMoneyRequestCreatedRoute(props.iouType, props.reportID))}
diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js
index 3878aa6d340e..6b380ec3fa3e 100644
--- a/src/pages/iou/steps/MoneyRequestConfirmPage.js
+++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js
@@ -263,8 +263,7 @@ function MoneyRequestConfirmPage(props) {
policyID={props.report.policyID}
bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)}
iouMerchant={props.iou.merchant}
- iouModifiedMerchant={props.iou.modifiedMerchant}
- iouDate={props.iou.created}
+ iouCreated={props.iou.created}
/>
)}
From decaa94ef1c98d9fe2167092da0b1590fad389cf Mon Sep 17 00:00:00 2001
From: Pierre Michel
Date: Fri, 18 Aug 2023 06:25:56 -0600
Subject: [PATCH 140/201] Change the way we parse a date because it was
converting in wrong timezone date
Signed-off-by: Pierre Michel
---
src/libs/ReportUtils.js | 4 ++--
src/libs/TransactionUtils.js | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 77507164fe03..3b0c6fcf8ca9 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1,5 +1,5 @@
import _ from 'underscore';
-import {format} from 'date-fns';
+import {format, parseISO} from 'date-fns';
import Str from 'expensify-common/lib/str';
import lodashGet from 'lodash/get';
import lodashIntersection from 'lodash/intersection';
@@ -1344,7 +1344,7 @@ function getModifiedExpenseMessage(reportAction) {
const hasModifiedCreated = _.has(reportActionOriginalMessage, 'oldCreated') && _.has(reportActionOriginalMessage, 'created');
if (hasModifiedCreated) {
// Take only the YYYY-MM-DD value as the original date includes timestamp
- let formattedOldCreated = new Date(reportActionOriginalMessage.oldCreated);
+ let formattedOldCreated = parseISO(reportActionOriginalMessage.oldCreated);
formattedOldCreated = format(formattedOldCreated, CONST.DATE.FNS_FORMAT_STRING);
return `changed the request date to ${reportActionOriginalMessage.created} (previously ${formattedOldCreated})`;
}
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 90b6ca72bd4a..db19d6b5c195 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -1,5 +1,5 @@
import Onyx from 'react-native-onyx';
-import {format} from 'date-fns';
+import {format, parseISO} from 'date-fns';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import CONST from '../CONST';
@@ -7,6 +7,7 @@ import ONYXKEYS from '../ONYXKEYS';
import DateUtils from './DateUtils';
import * as NumberUtils from './NumberUtils';
+
let allTransactions = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION,
@@ -175,9 +176,11 @@ function getCurrency(transaction) {
*/
function getCreated(transaction) {
const created = lodashGet(transaction, 'modifiedCreated', '') || lodashGet(transaction, 'created', '');
- if (created) {
- return format(new Date(created), CONST.DATE.FNS_FORMAT_STRING);
+ const createdDate = parseISO(created);
+ if (createdDate) {
+ return format(createdDate, CONST.DATE.FNS_FORMAT_STRING);
}
+
return '';
}
From 62fe31047453ced28fe7fe53fdc2d16c5c77147a Mon Sep 17 00:00:00 2001
From: Pierre Michel
Date: Fri, 18 Aug 2023 06:41:42 -0600
Subject: [PATCH 141/201] After npm run prettier
Signed-off-by: Pierre Michel
---
src/libs/TransactionUtils.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index db19d6b5c195..b03d2bd41fa6 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -7,7 +7,6 @@ import ONYXKEYS from '../ONYXKEYS';
import DateUtils from './DateUtils';
import * as NumberUtils from './NumberUtils';
-
let allTransactions = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION,
@@ -176,7 +175,7 @@ function getCurrency(transaction) {
*/
function getCreated(transaction) {
const created = lodashGet(transaction, 'modifiedCreated', '') || lodashGet(transaction, 'created', '');
- const createdDate = parseISO(created);
+ const createdDate = parseISO(created);
if (createdDate) {
return format(createdDate, CONST.DATE.FNS_FORMAT_STRING);
}
From 74bbf44a51fef5126955e9905bb4190a85fab5b8 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 14:21:23 +0100
Subject: [PATCH 142/201] Add mechant and created to the build optimistic
transaction call
---
src/libs/TransactionUtils.js | 4 +++-
src/libs/actions/IOU.js | 17 ++++++++++++++---
src/pages/iou/MoneyRequestCreatedPage.js | 2 +-
src/pages/iou/steps/MoneyRequestConfirmPage.js | 4 +++-
tests/actions/IOUTest.js | 10 +++++-----
5 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index a4c0b1b554e6..b8a4fc70c19d 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -26,6 +26,7 @@ Onyx.connect({
* @param {String} currency
* @param {String} reportID
* @param {String} [comment]
+ * @param {String} [created]
* @param {String} [source]
* @param {String} [originalTransactionID]
* @param {String} [merchant]
@@ -38,6 +39,7 @@ function buildOptimisticTransaction(
currency,
reportID,
comment = '',
+ created = '',
source = '',
originalTransactionID = '',
merchant = CONST.REPORT.TYPE.IOU,
@@ -63,7 +65,7 @@ function buildOptimisticTransaction(
reportID,
comment: commentJSON,
merchant,
- created: DateUtils.getDBTime(),
+ created: created || DateUtils.getDBTime(),
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
receipt,
};
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 3baaedee585d..0ad6afd3950f 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -310,6 +310,8 @@ function buildOnyxDataForMoneyRequest(
* @param {String} comment
* @param {Number} amount
* @param {String} currency
+ * @param {String} created
+ * @param {String} merchant
* @param {Number} payeeAccountID
* @param {String} payeeEmail
* @param {Object} [receipt]
@@ -328,7 +330,7 @@ function buildOnyxDataForMoneyRequest(
* @returns {Object} data.onyxData.failureData
* @param {String} [existingTransactionID]
*/
-function getMoneyRequestInformation(report, participant, comment, amount, currency, payeeAccountID, payeeEmail, receipt = undefined, existingTransactionID = null) {
+function getMoneyRequestInformation(report, participant, comment, amount, currency, created, merchant, payeeAccountID, payeeEmail, receipt = undefined, existingTransactionID = null) {
const payerEmail = OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login);
const payerAccountID = Number(participant.accountID);
const isPolicyExpenseChat = participant.isPolicyExpenseChat;
@@ -383,9 +385,10 @@ function getMoneyRequestInformation(report, participant, comment, amount, curren
currency,
iouReport.reportID,
comment,
+ created,
'',
'',
- undefined,
+ merchant,
receiptObject,
existingTransactionID,
);
@@ -495,6 +498,8 @@ function createDistanceRequest(report, payeeEmail, payeeAccountID, participant,
comment,
0,
'USD',
+ created,
+ '',
payeeAccountID,
payeeEmail,
null,
@@ -526,19 +531,23 @@ function createDistanceRequest(report, payeeEmail, payeeAccountID, participant,
* @param {Object} report
* @param {Number} amount - always in the smallest unit of the currency
* @param {String} currency
+ * @param {String} created
+ * @param {String} merchant
* @param {String} payeeEmail
* @param {Number} payeeAccountID
* @param {Object} participant
* @param {String} comment
* @param {Object} [receipt]
*/
-function requestMoney(report, amount, currency, payeeEmail, payeeAccountID, participant, comment, receipt = undefined) {
+function requestMoney(report, amount, currency, created, merchant, payeeEmail, payeeAccountID, participant, comment, receipt = undefined) {
const {payerEmail, iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation(
report,
participant,
comment,
amount,
currency,
+ created,
+ merchant,
payeeAccountID,
payeeEmail,
receipt,
@@ -609,6 +618,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
comment,
'',
'',
+ '',
`${Localize.translateLocal('iou.splitBill')} ${Localize.translateLocal('common.with')} ${formattedParticipants} [${DateUtils.getDBTime().slice(0, 10)}]`,
);
@@ -782,6 +792,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
currency,
oneOnOneIOUReport.reportID,
comment,
+ '',
CONST.IOU.MONEY_REQUEST_TYPE.SPLIT,
splitTransaction.transactionID,
);
diff --git a/src/pages/iou/MoneyRequestCreatedPage.js b/src/pages/iou/MoneyRequestCreatedPage.js
index a582299d3128..e7827dc338fb 100644
--- a/src/pages/iou/MoneyRequestCreatedPage.js
+++ b/src/pages/iou/MoneyRequestCreatedPage.js
@@ -110,7 +110,7 @@ class MoneyRequestCreatedPage extends Component {
diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js
index 6b380ec3fa3e..c22a81cd7299 100644
--- a/src/pages/iou/steps/MoneyRequestConfirmPage.js
+++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js
@@ -134,6 +134,8 @@ function MoneyRequestConfirmPage(props) {
props.report,
props.iou.amount,
props.iou.currency,
+ props.iou.created,
+ props.iou.merchant,
props.currentUserPersonalDetails.login,
props.currentUserPersonalDetails.accountID,
selectedParticipants[0],
@@ -141,7 +143,7 @@ function MoneyRequestConfirmPage(props) {
receipt,
);
},
- [props.report, props.iou.amount, props.iou.currency, props.currentUserPersonalDetails.login, props.currentUserPersonalDetails.accountID],
+ [props.report, props.iou.amount, props.iou.currency, props.iou.created, props.iou.merchant, props.currentUserPersonalDetails.login, props.currentUserPersonalDetails.accountID],
);
const createTransaction = useCallback(
diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js
index 93648aa8ea74..ce43ce583c11 100644
--- a/tests/actions/IOUTest.js
+++ b/tests/actions/IOUTest.js
@@ -40,7 +40,7 @@ describe('actions/IOU', () => {
let iouAction;
let transactionID;
fetch.pause();
- IOU.requestMoney({}, amount, CONST.CURRENCY.USD, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
+ IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
return waitForPromisesToResolve()
.then(
() =>
@@ -205,7 +205,7 @@ describe('actions/IOU', () => {
}),
)
.then(() => {
- IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
+ IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
return waitForPromisesToResolve();
})
.then(
@@ -396,7 +396,7 @@ describe('actions/IOU', () => {
)
.then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransaction.transactionID}`, existingTransaction))
.then(() => {
- IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
+ IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
return waitForPromisesToResolve();
})
.then(
@@ -528,7 +528,7 @@ describe('actions/IOU', () => {
let iouAction;
let transactionID;
fetch.pause();
- IOU.requestMoney({}, amount, CONST.CURRENCY.USD, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
+ IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
return (
waitForPromisesToResolve()
.then(
@@ -1183,7 +1183,7 @@ describe('actions/IOU', () => {
let createIOUAction;
let payIOUAction;
let transaction;
- IOU.requestMoney({}, amount, CONST.CURRENCY.USD, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
+ IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
return waitForPromisesToResolve()
.then(
() =>
From 6ed654c0624ea4b0089e592ee76bec155541cc72 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 14:26:35 +0100
Subject: [PATCH 143/201] Pass the merchant and created to the api
---
src/libs/actions/IOU.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index 0ad6afd3950f..f16405cd9613 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -560,6 +560,8 @@ function requestMoney(report, amount, currency, created, merchant, payeeEmail, p
amount,
currency,
comment,
+ created,
+ merchant,
iouReportID: iouReport.reportID,
chatReportID: chatReport.reportID,
transactionID: transaction.transactionID,
From f8d6cab287e3e1e2d4db1585b8b4fda3a59b1c79 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 15:58:10 +0100
Subject: [PATCH 144/201] Update tests
---
src/libs/TransactionUtils.js | 2 +-
tests/actions/IOUTest.js | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index b8a4fc70c19d..b689b8e29a3f 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -64,7 +64,7 @@ function buildOptimisticTransaction(
currency,
reportID,
comment: commentJSON,
- merchant,
+ merchant: merchant || CONST.REPORT.TYPE.IOU,
created: created || DateUtils.getDBTime(),
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
receipt,
diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js
index ce43ce583c11..bf32c2ef8f9a 100644
--- a/tests/actions/IOUTest.js
+++ b/tests/actions/IOUTest.js
@@ -35,12 +35,13 @@ describe('actions/IOU', () => {
it('creates new chat if needed', () => {
const amount = 10000;
const comment = 'Giv money plz';
+ const merchant = 'KFC';
let iouReportID;
let createdAction;
let iouAction;
let transactionID;
fetch.pause();
- IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
+ IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment);
return waitForPromisesToResolve()
.then(
() =>
@@ -141,7 +142,7 @@ describe('actions/IOU', () => {
// The transactionID on the iou action should match the one from the transactions collection
expect(iouAction.originalMessage.IOUTransactionID).toBe(transactionID);
- expect(transaction.merchant).toBe(CONST.REPORT.TYPE.IOU);
+ expect(transaction.merchant).toBe(merchant);
resolve();
},
From 3105cf5dcecb0fa73593d63b9db7a52f51194ec1 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 16:20:58 +0100
Subject: [PATCH 145/201] Fix the lint
---
src/pages/iou/MoneyRequestCreatedPage.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/pages/iou/MoneyRequestCreatedPage.js b/src/pages/iou/MoneyRequestCreatedPage.js
index e7827dc338fb..e3586e315873 100644
--- a/src/pages/iou/MoneyRequestCreatedPage.js
+++ b/src/pages/iou/MoneyRequestCreatedPage.js
@@ -1,12 +1,10 @@
import React, {Component} from 'react';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
-import {format} from 'date-fns';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import ScreenWrapper from '../../components/ScreenWrapper';
-import CONST from '../../CONST';
import HeaderWithBackButton from '../../components/HeaderWithBackButton';
import Form from '../../components/Form';
import ONYXKEYS from '../../ONYXKEYS';
From ae5ab8d88812f68c42db031d2070eb323d37112e Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 16:36:09 +0100
Subject: [PATCH 146/201] Add the merchant to transaction header
---
.../ReportActionItem/MoneyRequestView.js | 14 +++++++++++++-
src/libs/ReportUtils.js | 1 +
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index c05cf14f2fc1..86c150f14b98 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -67,7 +67,13 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
const moneyRequestReport = parentReport;
const transaction = TransactionUtils.getLinkedTransaction(parentReportAction);
- const {created: transactionDate, amount: transactionAmount, currency: transactionCurrency, comment: transactionDescription} = ReportUtils.getTransactionDetails(transaction);
+ const {
+ created: transactionDate,
+ amount: transactionAmount,
+ currency: transactionCurrency,
+ comment: transactionDescription,
+ merchant: transactionMerchant,
+ } = ReportUtils.getTransactionDetails(transaction);
const formattedTransactionAmount = transactionAmount && transactionCurrency && CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency);
const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID);
@@ -121,6 +127,12 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
shouldShowRightIcon={canEdit}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))}
/>
+
{shouldShowHorizontalRule && }
);
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 77507164fe03..02c022e27816 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1242,6 +1242,7 @@ function getTransactionDetails(transaction) {
amount: TransactionUtils.getAmount(transaction, isExpenseReport(report)),
currency: TransactionUtils.getCurrency(transaction),
comment: TransactionUtils.getDescription(transaction),
+ merchant: TransactionUtils.getMerchant(transaction),
};
}
From 54cb2c41c5aa3661bb70551cb67bd447fc479237 Mon Sep 17 00:00:00 2001
From: Ana Margarida Silva
Date: Fri, 18 Aug 2023 16:42:06 +0100
Subject: [PATCH 147/201] fix: grey out when pendingAction is ADD
---
src/components/ReportActionItem/MoneyRequestView.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index e992f16ba409..fdaa558dfd0b 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -98,7 +98,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, polic
style={[StyleUtils.getReportWelcomeBackgroundImageStyle(true)]}
/>
-
+
Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))}
/>
-
+
Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))}
/>
-
+
Date: Fri, 18 Aug 2023 20:44:30 +0100
Subject: [PATCH 148/201] Refactoring the MoneyRequestDescriptionPage to
functional component
---
src/pages/iou/MoneyRequestDescriptionPage.js | 123 +++++++++----------
1 file changed, 60 insertions(+), 63 deletions(-)
diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js
index 07e4b295f85f..f5e0c431f322 100644
--- a/src/pages/iou/MoneyRequestDescriptionPage.js
+++ b/src/pages/iou/MoneyRequestDescriptionPage.js
@@ -1,4 +1,4 @@
-import React, {Component} from 'react';
+import React, {useEffect, useRef} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
@@ -17,6 +17,7 @@ import compose from '../../libs/compose';
import * as IOU from '../../libs/actions/IOU';
import optionPropTypes from '../../components/optionPropTypes';
import CONST from '../../CONST';
+import useLocalize from '../../hooks/useLocalize';
const propTypes = {
...withLocalizePropTypes,
@@ -29,6 +30,18 @@ const propTypes = {
comment: PropTypes.string,
participants: PropTypes.arrayOf(optionPropTypes),
}),
+
+ /** Route from navigation */
+ route: PropTypes.shape({
+ /** Params from the route */
+ params: PropTypes.shape({
+ /** Which field we are editing */
+ field: PropTypes.string,
+
+ /** reportID for the "transaction thread" */
+ threadReportID: PropTypes.string,
+ }),
+ }).isRequired,
};
const defaultProps = {
@@ -40,41 +53,26 @@ const defaultProps = {
},
};
-class MoneyRequestDescriptionPage extends Component {
- constructor(props) {
- super(props);
+function MoneyRequestDescriptionPage({iou, route}) {
+ const {translate} = useLocalize();
+ const inputRef = useRef(null);
+ const iouType = lodashGet(route, 'params.iouType', '');
+ const reportID = lodashGet(route, 'params.reportID', '');
- this.updateComment = this.updateComment.bind(this);
- this.navigateBack = this.navigateBack.bind(this);
- this.iouType = lodashGet(props.route, 'params.iouType', '');
- this.reportID = lodashGet(props.route, 'params.reportID', '');
- }
-
- componentDidMount() {
- const moneyRequestId = `${this.iouType}${this.reportID}`;
- const shouldReset = this.props.iou.id !== moneyRequestId;
+ useEffect(() => {
+ const moneyRequestId = `${iouType}${reportID}`;
+ const shouldReset = iou.id !== moneyRequestId;
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestId);
}
- if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || shouldReset) {
- Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
- }
- }
-
- // eslint-disable-next-line rulesdir/prefer-early-return
- componentDidUpdate(prevProps) {
- // ID in Onyx could change by initiating a new request in a separate browser tab or completing a request
- if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || prevProps.iou.id !== this.props.iou.id) {
- // The ID is cleared on completing a request. In that case, we will do nothing.
- if (this.props.iou.id) {
- Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
- }
+ if (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) {
+ Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true);
}
- }
+ }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID]);
- navigateBack() {
- Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(this.iouType, this.reportID));
+ function navigateBack() {
+ Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID));
}
/**
@@ -83,44 +81,43 @@ class MoneyRequestDescriptionPage extends Component {
* @param {Object} value
* @param {String} value.moneyRequestComment
*/
- updateComment(value) {
+ function updateComment(value) {
IOU.setMoneyRequestDescription(value.moneyRequestComment);
- this.navigateBack();
+ navigateBack();
}
- render() {
- return (
- this.descriptionInputRef && this.descriptionInputRef.focus()}
+ return (
+ inputRef && inputRef.focus()}
+ >
+ navigateBack()}
+ />
+
-
- );
- }
+
+ (inputRef.current = el)}
+ />
+
+
+
+ );
+
}
MoneyRequestDescriptionPage.propTypes = propTypes;
From 9128ab7d546ae1cf06b1bee1cef5621ea1912291 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 20:47:18 +0100
Subject: [PATCH 149/201] Remove use of withLocalize
---
src/pages/iou/MoneyRequestDescriptionPage.js | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js
index f5e0c431f322..4f53b2af4f65 100644
--- a/src/pages/iou/MoneyRequestDescriptionPage.js
+++ b/src/pages/iou/MoneyRequestDescriptionPage.js
@@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import TextInput from '../../components/TextInput';
-import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import ScreenWrapper from '../../components/ScreenWrapper';
import HeaderWithBackButton from '../../components/HeaderWithBackButton';
import Form from '../../components/Form';
@@ -13,15 +12,12 @@ import ONYXKEYS from '../../ONYXKEYS';
import styles from '../../styles/styles';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
-import compose from '../../libs/compose';
import * as IOU from '../../libs/actions/IOU';
import optionPropTypes from '../../components/optionPropTypes';
import CONST from '../../CONST';
import useLocalize from '../../hooks/useLocalize';
const propTypes = {
- ...withLocalizePropTypes,
-
/** Onyx Props */
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
@@ -123,9 +119,8 @@ function MoneyRequestDescriptionPage({iou, route}) {
MoneyRequestDescriptionPage.propTypes = propTypes;
MoneyRequestDescriptionPage.defaultProps = defaultProps;
-export default compose(
- withLocalize,
- withOnyx({
- iou: {key: ONYXKEYS.IOU},
- }),
-)(MoneyRequestDescriptionPage);
+export default withOnyx({
+ iou: {
+ key: ONYXKEYS.IOU
+ },
+})(MoneyRequestDescriptionPage);
From 0e06cc591be58e0d35873022d4e051ba77946716 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 20:53:05 +0100
Subject: [PATCH 150/201] Add missing property to the iou key
---
src/pages/iou/MoneyRequestDescriptionPage.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js
index 4f53b2af4f65..e23ce77fba46 100644
--- a/src/pages/iou/MoneyRequestDescriptionPage.js
+++ b/src/pages/iou/MoneyRequestDescriptionPage.js
@@ -25,6 +25,7 @@ const propTypes = {
amount: PropTypes.number,
comment: PropTypes.string,
participants: PropTypes.arrayOf(optionPropTypes),
+ receiptPath: PropTypes.string,
}),
/** Route from navigation */
@@ -46,6 +47,7 @@ const defaultProps = {
amount: 0,
comment: '',
participants: [],
+ receiptPath: '',
},
};
From 9e897dffd7c1cad0b99a1c0e7b4802fdc5cf5f8c Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 20:59:18 +0100
Subject: [PATCH 151/201] Refactor the MoneyRequestCreatedPage to functional
component
---
src/pages/iou/MoneyRequestCreatedPage.js | 124 +++++++++++------------
1 file changed, 58 insertions(+), 66 deletions(-)
diff --git a/src/pages/iou/MoneyRequestCreatedPage.js b/src/pages/iou/MoneyRequestCreatedPage.js
index e3586e315873..5a958264be3a 100644
--- a/src/pages/iou/MoneyRequestCreatedPage.js
+++ b/src/pages/iou/MoneyRequestCreatedPage.js
@@ -1,9 +1,8 @@
-import React, {Component} from 'react';
+import React, {useEffect} from 'react';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import _ from 'underscore';
import lodashGet from 'lodash/get';
-import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import ScreenWrapper from '../../components/ScreenWrapper';
import HeaderWithBackButton from '../../components/HeaderWithBackButton';
import Form from '../../components/Form';
@@ -11,14 +10,12 @@ import ONYXKEYS from '../../ONYXKEYS';
import styles from '../../styles/styles';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
-import compose from '../../libs/compose';
import * as IOU from '../../libs/actions/IOU';
import optionPropTypes from '../../components/optionPropTypes';
import NewDatePicker from '../../components/NewDatePicker';
+import useLocalize from '../../hooks/useLocalize';
const propTypes = {
- ...withLocalizePropTypes,
-
/** Onyx Props */
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
@@ -27,7 +24,20 @@ const propTypes = {
comment: PropTypes.string,
created: PropTypes.string,
participants: PropTypes.arrayOf(optionPropTypes),
+ receiptPath: PropTypes.string,
}),
+
+ /** Route from navigation */
+ route: PropTypes.shape({
+ /** Params from the route */
+ params: PropTypes.shape({
+ /** Which field we are editing */
+ field: PropTypes.string,
+
+ /** reportID for the "transaction thread" */
+ threadReportID: PropTypes.string,
+ }),
+ }).isRequired,
};
const defaultProps = {
@@ -37,44 +47,29 @@ const defaultProps = {
comment: '',
created: '',
participants: [],
+ receiptPath: '',
},
};
-class MoneyRequestCreatedPage extends Component {
- constructor(props) {
- super(props);
+function MoneyRequestCreatedPage({iou, route}) {
+ const {translate} = useLocalize();
+ const iouType = lodashGet(route, 'params.iouType', '');
+ const reportID = lodashGet(route, 'params.reportID', '');
- this.updateDate = this.updateDate.bind(this);
- this.navigateBack = this.navigateBack.bind(this);
- this.iouType = lodashGet(props.route, 'params.iouType', '');
- this.reportID = lodashGet(props.route, 'params.reportID', '');
- }
-
- componentDidMount() {
- const moneyRequestId = `${this.iouType}${this.reportID}`;
- const shouldReset = this.props.iou.id !== moneyRequestId;
+ useEffect(() => {
+ const moneyRequestId = `${iouType}${reportID}`;
+ const shouldReset = iou.id !== moneyRequestId;
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestId);
}
- if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || shouldReset) {
- Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
+ if (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) {
+ Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true);
}
- }
+ }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID]);
- // eslint-disable-next-line rulesdir/prefer-early-return
- componentDidUpdate(prevProps) {
- // ID in Onyx could change by initiating a new request in a separate browser tab or completing a request
- if (_.isEmpty(this.props.iou.participants) || (this.props.iou.amount === 0 && !this.props.iou.receiptPath) || prevProps.iou.id !== this.props.iou.id) {
- // The ID is cleared on completing a request. In that case, we will do nothing.
- if (this.props.iou.id) {
- Navigation.goBack(ROUTES.getMoneyRequestRoute(this.iouType, this.reportID), true);
- }
- }
- }
-
- navigateBack() {
- Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(this.iouType, this.reportID));
+ function navigateBack() {
+ Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID));
}
/**
@@ -83,46 +78,43 @@ class MoneyRequestCreatedPage extends Component {
* @param {Object} value
* @param {String} value.moneyRequestCreated
*/
- updateDate(value) {
+ function updateDate(value) {
IOU.setMoneyRequestCreated(value.moneyRequestCreated);
- this.navigateBack();
+ navigateBack();
}
- render() {
- return (
-
+ navigateBack()}
+ />
+
-
- );
- }
+
+
+ );
}
MoneyRequestCreatedPage.propTypes = propTypes;
MoneyRequestCreatedPage.defaultProps = defaultProps;
-export default compose(
- withLocalize,
- withOnyx({
- iou: {key: ONYXKEYS.IOU},
- }),
-)(MoneyRequestCreatedPage);
+export default withOnyx({
+ iou: {
+ key: ONYXKEYS.IOU
+ },
+})(MoneyRequestCreatedPage);
From ee0f400f97331d457e1fe83ffb59cc196aae0c3d Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 21:00:44 +0100
Subject: [PATCH 152/201] Fix style
---
src/pages/iou/MoneyRequestCreatedPage.js | 2 +-
src/pages/iou/MoneyRequestDescriptionPage.js | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/pages/iou/MoneyRequestCreatedPage.js b/src/pages/iou/MoneyRequestCreatedPage.js
index 5a958264be3a..c1fb0ca00b4f 100644
--- a/src/pages/iou/MoneyRequestCreatedPage.js
+++ b/src/pages/iou/MoneyRequestCreatedPage.js
@@ -115,6 +115,6 @@ MoneyRequestCreatedPage.defaultProps = defaultProps;
export default withOnyx({
iou: {
- key: ONYXKEYS.IOU
+ key: ONYXKEYS.IOU,
},
})(MoneyRequestCreatedPage);
diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js
index e23ce77fba46..17cfa139fe0d 100644
--- a/src/pages/iou/MoneyRequestDescriptionPage.js
+++ b/src/pages/iou/MoneyRequestDescriptionPage.js
@@ -115,7 +115,6 @@ function MoneyRequestDescriptionPage({iou, route}) {
);
-
}
MoneyRequestDescriptionPage.propTypes = propTypes;
@@ -123,6 +122,6 @@ MoneyRequestDescriptionPage.defaultProps = defaultProps;
export default withOnyx({
iou: {
- key: ONYXKEYS.IOU
+ key: ONYXKEYS.IOU,
},
})(MoneyRequestDescriptionPage);
From efd74c88271ded5170241de8d55d23a5cbf56f65 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 21:40:11 +0100
Subject: [PATCH 153/201] Change to Date instead of Created in component names
---
src/ONYXKEYS.js | 2 +-
src/ROUTES.js | 2 +-
.../Navigation/AppNavigator/ModalStackNavigators.js | 6 +++---
src/libs/Navigation/linkingConfig.js | 2 +-
src/pages/EditRequestCreatedPage.js | 2 +-
...eyRequestCreatedPage.js => MoneyRequestDatePage.js} | 10 +++++-----
6 files changed, 12 insertions(+), 12 deletions(-)
rename src/pages/iou/{MoneyRequestCreatedPage.js => MoneyRequestDatePage.js} (93%)
diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js
index 96e77347face..5a00c49db0a0 100755
--- a/src/ONYXKEYS.js
+++ b/src/ONYXKEYS.js
@@ -223,7 +223,7 @@ export default {
MONEY_REQUEST_DESCRIPTION_FORM: 'moneyRequestDescriptionForm',
MONEY_REQUEST_MERCHANT_FORM: 'moneyRequestMerchantForm',
MONEY_REQUEST_AMOUNT_FORM: 'moneyRequestAmountForm',
- MONEY_REQUEST_CREATED_FORM: 'moneyRequestCreatedForm',
+ MONEY_REQUEST_DATE_FORM: 'moneyRequestCreatedForm',
NEW_CONTACT_METHOD_FORM: 'newContactMethodForm',
PAYPAL_FORM: 'payPalForm',
WAYPOINT_FORM: 'waypointForm',
diff --git a/src/ROUTES.js b/src/ROUTES.js
index 207790e31d62..822e77fc5ba5 100644
--- a/src/ROUTES.js
+++ b/src/ROUTES.js
@@ -93,7 +93,7 @@ export default {
MONEY_REQUEST_AMOUNT: ':iouType/new/amount/:reportID?',
MONEY_REQUEST_PARTICIPANTS: ':iouType/new/participants/:reportID?',
MONEY_REQUEST_CONFIRMATION: ':iouType/new/confirmation/:reportID?',
- MONEY_REQUEST_CREATED: ':iouType/new/date/:reportID?',
+ MONEY_REQUEST_DATE: ':iouType/new/date/:reportID?',
MONEY_REQUEST_CURRENCY: ':iouType/new/currency/:reportID?',
MONEY_REQUEST_DESCRIPTION: ':iouType/new/description/:reportID?',
MONEY_REQUEST_MERCHANT: ':iouType/new/merchant/:reportID?',
diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
index 940569464229..8ee334d458c0 100644
--- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
+++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
@@ -71,10 +71,10 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator([
},
{
getComponent: () => {
- const MoneyRequestCreatedPage = require('../../../pages/iou/MoneyRequestCreatedPage').default;
- return MoneyRequestCreatedPage;
+ const MoneyRequestDatePage = require('../../../pages/iou/MoneyRequestDatePage').default;
+ return MoneyRequestDatePage;
},
- name: 'Money_Request_Created',
+ name: 'Money_Request_Date',
},
{
getComponent: () => {
diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js
index 3e7ed0b5fff4..a06f1004d566 100644
--- a/src/libs/Navigation/linkingConfig.js
+++ b/src/libs/Navigation/linkingConfig.js
@@ -323,7 +323,7 @@ export default {
Money_Request_Amount: ROUTES.MONEY_REQUEST_AMOUNT,
Money_Request_Participants: ROUTES.MONEY_REQUEST_PARTICIPANTS,
Money_Request_Confirmation: ROUTES.MONEY_REQUEST_CONFIRMATION,
- Money_Request_Created: ROUTES.MONEY_REQUEST_CREATED,
+ Money_Request_Date: ROUTES.MONEY_REQUEST_DATE,
Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY,
Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION,
Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT,
diff --git a/src/pages/EditRequestCreatedPage.js b/src/pages/EditRequestCreatedPage.js
index 4e4fce308e5b..79633c214486 100644
--- a/src/pages/EditRequestCreatedPage.js
+++ b/src/pages/EditRequestCreatedPage.js
@@ -31,7 +31,7 @@ function EditRequestCreatedPage({defaultCreated, onSubmit}) {
/>
+
+ );
}
MoneyRequestMerchantPage.propTypes = propTypes;
MoneyRequestMerchantPage.defaultProps = defaultProps;
-export default compose(
- withLocalize,
- withOnyx({
- iou: {key: ONYXKEYS.IOU},
- }),
-)(MoneyRequestMerchantPage);
+export default withOnyx({
+ iou: {
+ key: ONYXKEYS.IOU,
+ },
+})(MoneyRequestMerchantPage);
From ede0be7ff579d9cc6efca4d3be918acee22ec3a1 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Fri, 18 Aug 2023 21:44:51 +0100
Subject: [PATCH 155/201] Props clean up
---
src/pages/iou/MoneyRequestMerchantPage.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js
index 4daa161cab35..bec9bcb419f7 100644
--- a/src/pages/iou/MoneyRequestMerchantPage.js
+++ b/src/pages/iou/MoneyRequestMerchantPage.js
@@ -27,7 +27,20 @@ const propTypes = {
created: PropTypes.string,
merchant: PropTypes.string,
participants: PropTypes.arrayOf(optionPropTypes),
+ receiptPath: PropTypes.string,
}),
+
+ /** Route from navigation */
+ route: PropTypes.shape({
+ /** Params from the route */
+ params: PropTypes.shape({
+ /** Which field we are editing */
+ field: PropTypes.string,
+
+ /** reportID for the "transaction thread" */
+ threadReportID: PropTypes.string,
+ }),
+ }).isRequired,
};
const defaultProps = {
@@ -37,6 +50,7 @@ const defaultProps = {
comment: '',
merchant: '',
participants: [],
+ receiptPath: '',
},
};
From 55f563d9de95fd5a78b46ec1c43f2ee8eb588326 Mon Sep 17 00:00:00 2001
From: Anjana Mendiratta
Date: Sat, 19 Aug 2023 03:26:02 +0530
Subject: [PATCH 156/201] fix: do not show link on just BlockingView
Signed-off-by: Anjana Mendiratta
---
src/components/BlockingViews/BlockingView.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/BlockingViews/BlockingView.js b/src/components/BlockingViews/BlockingView.js
index 5610d30268b9..d02fa55a6434 100644
--- a/src/components/BlockingViews/BlockingView.js
+++ b/src/components/BlockingViews/BlockingView.js
@@ -42,7 +42,7 @@ const propTypes = {
const defaultProps = {
iconColor: themeColors.offline,
subtitle: '',
- shouldShowLink: true,
+ shouldShowLink: false,
link: 'notFound.goBackHome',
iconWidth: variables.iconSizeSuperLarge,
iconHeight: variables.iconSizeSuperLarge,
From 55a66a3e5d6b788dea7787019ef446020e91ee60 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Fri, 18 Aug 2023 19:25:50 -0400
Subject: [PATCH 157/201] Fix weird Android image upload issue
---
src/libs/fileDownload/FileUtils.js | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/libs/fileDownload/FileUtils.js b/src/libs/fileDownload/FileUtils.js
index 01c3f7fcb834..a98a33b2934f 100644
--- a/src/libs/fileDownload/FileUtils.js
+++ b/src/libs/fileDownload/FileUtils.js
@@ -1,4 +1,4 @@
-import {Alert, Linking} from 'react-native';
+import {Alert, Linking, Platform} from 'react-native';
import CONST from '../../CONST';
import * as Localize from '../Localize';
import DateUtils from '../DateUtils';
@@ -146,7 +146,10 @@ const readFileAsync = (path, fileName) =>
return fetch(path)
.then((res) => {
- if (!res.ok) {
+ // For some reason, fetch is "Unable to read uploaded file"
+ // on Android even though the blob is returned, so we'll ignore
+ // in that case
+ if (!res.ok && Platform.OS !== 'android') {
throw Error(res.statusText);
}
return res.blob();
From 8ad0fc4012603adfadae8384f9f4051cbeef31e2 Mon Sep 17 00:00:00 2001
From: Vit Horacek
Date: Sat, 19 Aug 2023 01:13:11 +0100
Subject: [PATCH 158/201] Disable changing date and merchant when creating
split bills
---
src/components/MoneyRequestConfirmationList.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js
index 59da93aba935..832be75c1317 100755
--- a/src/components/MoneyRequestConfirmationList.js
+++ b/src/components/MoneyRequestConfirmationList.js
@@ -126,6 +126,7 @@ function MoneyRequestConfirmationList(props) {
// A flag and a toggler for showing the rest of the form fields
const [showAllFields, toggleShowAllFields] = useReducer((state) => !state, false);
+ const isTypeRequest = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST;
/**
* Returns the participants with amount
@@ -407,20 +408,20 @@ function MoneyRequestConfirmationList(props) {
{showAllFields && (
<>
Navigation.navigate(ROUTES.getMoneyRequestCreatedRoute(props.iouType, props.reportID))}
- disabled={didConfirm || props.isReadOnly}
+ disabled={didConfirm || props.isReadOnly || !isTypeRequest}
/>
Navigation.navigate(ROUTES.getMoneyRequestMerchantRoute(props.iouType, props.reportID))}
- disabled={didConfirm || props.isReadOnly}
+ disabled={didConfirm || props.isReadOnly || !isTypeRequest}
/>
>
)}
From e057aca69952a3e241150a2740d906cee0e87c06 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Sat, 19 Aug 2023 00:21:16 -0400
Subject: [PATCH 159/201] Use optimistic transaction in updating report preview
---
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 0e83546ebdb7..c2c8c1c78b56 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -428,9 +428,9 @@ function getMoneyRequestInformation(report, participant, comment, amount, curren
let reportPreviewAction = isNewIOUReport ? null : ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID);
if (reportPreviewAction) {
- reportPreviewAction = ReportUtils.updateReportPreview(iouReport, reportPreviewAction, comment, existingTransaction);
+ reportPreviewAction = ReportUtils.updateReportPreview(iouReport, reportPreviewAction, comment, optimisticTransaction);
} else {
- reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, iouReport, comment, existingTransaction);
+ reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction);
}
// Add optimistic personal details for participant
From e3e20a264b9edd545517c1f28c9fec573feab2a9 Mon Sep 17 00:00:00 2001
From: tienifr
Date: Sat, 19 Aug 2023 17:14:41 +0700
Subject: [PATCH 160/201] fix: 23563 empty screen shows for a brief moment
---
src/pages/tasks/TaskAssigneeSelectorModal.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js
index 4803fc5b200e..37f9d8815324 100644
--- a/src/pages/tasks/TaskAssigneeSelectorModal.js
+++ b/src/pages/tasks/TaskAssigneeSelectorModal.js
@@ -76,6 +76,7 @@ function TaskAssigneeSelectorModal(props) {
const [filteredPersonalDetails, setFilteredPersonalDetails] = useState([]);
const [filteredUserToInvite, setFilteredUserToInvite] = useState(null);
const [filteredCurrentUserOption, setFilteredCurrentUserOption] = useState(null);
+ const [isLoading, setIsLoading] = React.useState(true);
const updateOptions = useCallback(() => {
const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getNewChatOptions(
@@ -94,7 +95,10 @@ function TaskAssigneeSelectorModal(props) {
setFilteredRecentReports(recentReports);
setFilteredPersonalDetails(personalDetails);
setFilteredCurrentUserOption(currentUserOption);
- }, [props, searchValue]);
+ if (isLoading) {
+ setIsLoading(false);
+ }
+ }, [props, searchValue, isLoading]);
useEffect(() => {
const debouncedSearch = _.debounce(updateOptions, 200);
@@ -195,7 +199,7 @@ function TaskAssigneeSelectorModal(props) {
onChangeText={onChangeText}
headerMessage={headerMessage}
showTitleTooltip
- shouldShowOptions={didScreenTransitionEnd}
+ shouldShowOptions={didScreenTransitionEnd && !isLoading}
textInputLabel={props.translate('optionsSelector.nameEmailOrPhoneNumber')}
safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle}
/>
From 486f8e9051b9ec946c39ea966a3a08b4d5c42eb0 Mon Sep 17 00:00:00 2001
From: John Schuster
Date: Sat, 19 Aug 2023 17:38:17 -0500
Subject: [PATCH 161/201] Update context.xml
Fixed the missing punctuation, and then opted to change the tone to be less robotic.
---
docs/context.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/context.xml b/docs/context.xml
index b38e1a5f9e8a..f62520153883 100644
--- a/docs/context.xml
+++ b/docs/context.xml
@@ -25,7 +25,7 @@
-
+
From bd84bb84ce3469c8a5704a362cd7779d254fba4d Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Sun, 20 Aug 2023 21:08:57 -0700
Subject: [PATCH 162/201] fix: pass width prop so that marker is displayed on
ios
---
src/components/DistanceRequest.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 383d7a9c1c28..71662f1a7017 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -97,6 +97,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
coordinate: [waypoint.lng, waypoint.lat],
markerComponent: () => (
From 9387d158b6ddc5e0f83c80c0626aee0a0360eb98 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Sun, 20 Aug 2023 21:40:06 -0700
Subject: [PATCH 163/201] chore: change test branch
---
package-lock.json | 31 +++++--------------------------
package.json | 2 +-
2 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index c11bb7cde369..e984d50aa348 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -104,7 +104,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
+ "react-native-x-maps": "github:Expensify/react-native-x-maps#test-hayata-fix-bounds-calculation",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
@@ -5597,16 +5597,6 @@
"gl-style-validate": "dist/gl-style-validate.mjs"
}
},
- "node_modules/@math.gl/web-mercator": {
- "version": "3.6.3",
- "resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.6.3.tgz",
- "integrity": "sha512-UVrkSOs02YLehKaehrxhAejYMurehIHPfFQvPFZmdJHglHOU4V2cCUApTVEwOksvCp161ypEqVp+9H6mGhTTcw==",
- "peer": true,
- "dependencies": {
- "@babel/runtime": "^7.12.0",
- "gl-matrix": "^3.4.0"
- }
- },
"node_modules/@mdx-js/mdx": {
"version": "1.6.22",
"dev": true,
@@ -43424,11 +43414,10 @@
}
},
"node_modules/react-native-x-maps": {
- "version": "1.0.6",
- "resolved": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#fe69c26a1a80c3b1f5ddeef389b5d1a179a94dfc",
+ "version": "1.0.7",
+ "resolved": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#6dbe84db037bae4dc43d146bd7ed112f09758c27",
"license": "MIT",
"peerDependencies": {
- "@math.gl/web-mercator": "^3.6.3",
"@rnmapbox/maps": "^10.0.11",
"mapbox-gl": "^2.15.0",
"react": "^18.2.0",
@@ -54160,16 +54149,6 @@
"sort-object": "^3.0.3"
}
},
- "@math.gl/web-mercator": {
- "version": "3.6.3",
- "resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.6.3.tgz",
- "integrity": "sha512-UVrkSOs02YLehKaehrxhAejYMurehIHPfFQvPFZmdJHglHOU4V2cCUApTVEwOksvCp161ypEqVp+9H6mGhTTcw==",
- "peer": true,
- "requires": {
- "@babel/runtime": "^7.12.0",
- "gl-matrix": "^3.4.0"
- }
- },
"@mdx-js/mdx": {
"version": "1.6.22",
"dev": true,
@@ -80237,8 +80216,8 @@
}
},
"react-native-x-maps": {
- "version": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#fe69c26a1a80c3b1f5ddeef389b5d1a179a94dfc",
- "from": "react-native-x-maps@github:Expensify/react-native-x-maps#hayata-test-new-version",
+ "version": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#6dbe84db037bae4dc43d146bd7ed112f09758c27",
+ "from": "react-native-x-maps@github:Expensify/react-native-x-maps#test-hayata-fix-bounds-calculation",
"requires": {}
},
"react-pdf": {
diff --git a/package.json b/package.json
index 865c7777f06f..475ff2b2ff14 100644
--- a/package.json
+++ b/package.json
@@ -144,7 +144,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
+ "react-native-x-maps": "github:Expensify/react-native-x-maps#test-hayata-fix-bounds-calculation",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
From 968434b3167bbbadc2223bc0c215f687884f4183 Mon Sep 17 00:00:00 2001
From: Julian Kobrynski
Date: Mon, 21 Aug 2023 08:27:57 +0200
Subject: [PATCH 164/201] run prettier
---
src/components/AttachmentPicker/index.native.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index b2ed5c28edaa..8ba7ae33606b 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -82,7 +82,6 @@ const getDataForUpload = (fileData) => {
});
};
-
/**
* This component renders a function as a child and
* returns a "show attachment picker" method that takes
From ffa7b085d95e3fd318eb3fda7f60bc84d91bec64 Mon Sep 17 00:00:00 2001
From: Pierre Michel
Date: Mon, 21 Aug 2023 05:53:50 -0600
Subject: [PATCH 165/201] Verify if the date is valid
Signed-off-by: Pierre Michel
---
src/libs/TransactionUtils.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index b03d2bd41fa6..df04bc2cbeef 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -1,5 +1,5 @@
import Onyx from 'react-native-onyx';
-import {format, parseISO} from 'date-fns';
+import {format, parseISO, isValid} from 'date-fns';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import CONST from '../CONST';
@@ -176,7 +176,7 @@ function getCurrency(transaction) {
function getCreated(transaction) {
const created = lodashGet(transaction, 'modifiedCreated', '') || lodashGet(transaction, 'created', '');
const createdDate = parseISO(created);
- if (createdDate) {
+ if (isValid(createdDate)) {
return format(createdDate, CONST.DATE.FNS_FORMAT_STRING);
}
From a1d3de32d5f0de2d545aad23f04901645559deb0 Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Mon, 21 Aug 2023 14:56:10 +0200
Subject: [PATCH 166/201] local timezone change
---
src/TIMEZONES.js | 420 ++++++++++++++++++
.../settings/Profile/TimezoneSelectPage.js | 3 +-
2 files changed, 422 insertions(+), 1 deletion(-)
create mode 100644 src/TIMEZONES.js
diff --git a/src/TIMEZONES.js b/src/TIMEZONES.js
new file mode 100644
index 000000000000..703c7453450f
--- /dev/null
+++ b/src/TIMEZONES.js
@@ -0,0 +1,420 @@
+export default [
+ 'Africa/Abidjan',
+ 'Africa/Accra',
+ 'Africa/Addis_Ababa',
+ 'Africa/Algiers',
+ 'Africa/Asmara',
+ 'Africa/Bamako',
+ 'Africa/Bangui',
+ 'Africa/Banjul',
+ 'Africa/Bissau',
+ 'Africa/Blantyre',
+ 'Africa/Brazzaville',
+ 'Africa/Bujumbura',
+ 'Africa/Cairo',
+ 'Africa/Casablanca',
+ 'Africa/Ceuta',
+ 'Africa/Conakry',
+ 'Africa/Dakar',
+ 'Africa/Dar_es_Salaam',
+ 'Africa/Djibouti',
+ 'Africa/Douala',
+ 'Africa/El_Aaiun',
+ 'Africa/Freetown',
+ 'Africa/Gaborone',
+ 'Africa/Harare',
+ 'Africa/Johannesburg',
+ 'Africa/Juba',
+ 'Africa/Kampala',
+ 'Africa/Khartoum',
+ 'Africa/Kigali',
+ 'Africa/Kinshasa',
+ 'Africa/Lagos',
+ 'Africa/Libreville',
+ 'Africa/Lome',
+ 'Africa/Luanda',
+ 'Africa/Lubumbashi',
+ 'Africa/Lusaka',
+ 'Africa/Malabo',
+ 'Africa/Maputo',
+ 'Africa/Maseru',
+ 'Africa/Mbabane',
+ 'Africa/Mogadishu',
+ 'Africa/Monrovia',
+ 'Africa/Nairobi',
+ 'Africa/Ndjamena',
+ 'Africa/Niamey',
+ 'Africa/Nouakchott',
+ 'Africa/Ouagadougou',
+ 'Africa/Porto-Novo',
+ 'Africa/Sao_Tome',
+ 'Africa/Tripoli',
+ 'Africa/Tunis',
+ 'Africa/Windhoek',
+ 'America/Adak',
+ 'America/Anchorage',
+ 'America/Anguilla',
+ 'America/Antigua',
+ 'America/Araguaina',
+ 'America/Argentina/Buenos_Aires',
+ 'America/Argentina/Catamarca',
+ 'America/Argentina/Cordoba',
+ 'America/Argentina/Jujuy',
+ 'America/Argentina/La_Rioja',
+ 'America/Argentina/Mendoza',
+ 'America/Argentina/Rio_Gallegos',
+ 'America/Argentina/Salta',
+ 'America/Argentina/San_Juan',
+ 'America/Argentina/San_Luis',
+ 'America/Argentina/Tucuman',
+ 'America/Argentina/Ushuaia',
+ 'America/Aruba',
+ 'America/Asuncion',
+ 'America/Atikokan',
+ 'America/Bahia',
+ 'America/Bahia_Banderas',
+ 'America/Barbados',
+ 'America/Belem',
+ 'America/Belize',
+ 'America/Blanc-Sablon',
+ 'America/Boa_Vista',
+ 'America/Bogota',
+ 'America/Boise',
+ 'America/Cambridge_Bay',
+ 'America/Campo_Grande',
+ 'America/Cancun',
+ 'America/Caracas',
+ 'America/Cayenne',
+ 'America/Cayman',
+ 'America/Chicago',
+ 'America/Chihuahua',
+ 'America/Ciudad_Juarez',
+ 'America/Costa_Rica',
+ 'America/Creston',
+ 'America/Cuiaba',
+ 'America/Curacao',
+ 'America/Danmarkshavn',
+ 'America/Dawson',
+ 'America/Dawson_Creek',
+ 'America/Denver',
+ 'America/Detroit',
+ 'America/Dominica',
+ 'America/Edmonton',
+ 'America/Eirunepe',
+ 'America/El_Salvador',
+ 'America/Fort_Nelson',
+ 'America/Fortaleza',
+ 'America/Glace_Bay',
+ 'America/Goose_Bay',
+ 'America/Grand_Turk',
+ 'America/Grenada',
+ 'America/Guadeloupe',
+ 'America/Guatemala',
+ 'America/Guayaquil',
+ 'America/Guyana',
+ 'America/Halifax',
+ 'America/Havana',
+ 'America/Hermosillo',
+ 'America/Indiana/Indianapolis',
+ 'America/Indiana/Knox',
+ 'America/Indiana/Marengo',
+ 'America/Indiana/Petersburg',
+ 'America/Indiana/Tell_City',
+ 'America/Indiana/Vevay',
+ 'America/Indiana/Vincennes',
+ 'America/Indiana/Winamac',
+ 'America/Inuvik',
+ 'America/Iqaluit',
+ 'America/Jamaica',
+ 'America/Juneau',
+ 'America/Kentucky/Louisville',
+ 'America/Kentucky/Monticello',
+ 'America/Kralendijk',
+ 'America/La_Paz',
+ 'America/Lima',
+ 'America/Los_Angeles',
+ 'America/Lower_Princes',
+ 'America/Maceio',
+ 'America/Managua',
+ 'America/Manaus',
+ 'America/Marigot',
+ 'America/Martinique',
+ 'America/Matamoros',
+ 'America/Mazatlan',
+ 'America/Menominee',
+ 'America/Merida',
+ 'America/Metlakatla',
+ 'America/Mexico_City',
+ 'America/Miquelon',
+ 'America/Moncton',
+ 'America/Monterrey',
+ 'America/Montevideo',
+ 'America/Montserrat',
+ 'America/Nassau',
+ 'America/New_York',
+ 'America/Nome',
+ 'America/Noronha',
+ 'America/North_Dakota/Beulah',
+ 'America/North_Dakota/Center',
+ 'America/North_Dakota/New_Salem',
+ 'America/Nuuk',
+ 'America/Ojinaga',
+ 'America/Panama',
+ 'America/Paramaribo',
+ 'America/Phoenix',
+ 'America/Port-au-Prince',
+ 'America/Port_of_Spain',
+ 'America/Porto_Velho',
+ 'America/Puerto_Rico',
+ 'America/Punta_Arenas',
+ 'America/Rankin_Inlet',
+ 'America/Recife',
+ 'America/Regina',
+ 'America/Resolute',
+ 'America/Rio_Branco',
+ 'America/Santarem',
+ 'America/Santiago',
+ 'America/Santo_Domingo',
+ 'America/Sao_Paulo',
+ 'America/Scoresbysund',
+ 'America/Sitka',
+ 'America/St_Barthelemy',
+ 'America/St_Johns',
+ 'America/St_Kitts',
+ 'America/St_Lucia',
+ 'America/St_Thomas',
+ 'America/St_Vincent',
+ 'America/Swift_Current',
+ 'America/Tegucigalpa',
+ 'America/Thule',
+ 'America/Tijuana',
+ 'America/Toronto',
+ 'America/Tortola',
+ 'America/Vancouver',
+ 'America/Whitehorse',
+ 'America/Winnipeg',
+ 'America/Yakutat',
+ 'Antarctica/Casey',
+ 'Antarctica/Davis',
+ 'Antarctica/DumontDUrville',
+ 'Antarctica/Macquarie',
+ 'Antarctica/Mawson',
+ 'Antarctica/McMurdo',
+ 'Antarctica/Palmer',
+ 'Antarctica/Rothera',
+ 'Antarctica/Syowa',
+ 'Antarctica/Troll',
+ 'Antarctica/Vostok',
+ 'Arctic/Longyearbyen',
+ 'Asia/Aden',
+ 'Asia/Almaty',
+ 'Asia/Amman',
+ 'Asia/Anadyr',
+ 'Asia/Aqtau',
+ 'Asia/Aqtobe',
+ 'Asia/Ashgabat',
+ 'Asia/Atyrau',
+ 'Asia/Baghdad',
+ 'Asia/Bahrain',
+ 'Asia/Baku',
+ 'Asia/Bangkok',
+ 'Asia/Barnaul',
+ 'Asia/Beirut',
+ 'Asia/Bishkek',
+ 'Asia/Brunei',
+ 'Asia/Chita',
+ 'Asia/Choibalsan',
+ 'Asia/Colombo',
+ 'Asia/Damascus',
+ 'Asia/Dhaka',
+ 'Asia/Dili',
+ 'Asia/Dubai',
+ 'Asia/Dushanbe',
+ 'Asia/Famagusta',
+ 'Asia/Gaza',
+ 'Asia/Hebron',
+ 'Asia/Ho_Chi_Minh',
+ 'Asia/Hong_Kong',
+ 'Asia/Hovd',
+ 'Asia/Irkutsk',
+ 'Asia/Jakarta',
+ 'Asia/Jayapura',
+ 'Asia/Jerusalem',
+ 'Asia/Kabul',
+ 'Asia/Kamchatka',
+ 'Asia/Karachi',
+ 'Asia/Kathmandu',
+ 'Asia/Khandyga',
+ 'Asia/Kolkata',
+ 'Asia/Krasnoyarsk',
+ 'Asia/Kuala_Lumpur',
+ 'Asia/Kuching',
+ 'Asia/Kuwait',
+ 'Asia/Macau',
+ 'Asia/Magadan',
+ 'Asia/Makassar',
+ 'Asia/Manila',
+ 'Asia/Muscat',
+ 'Asia/Nicosia',
+ 'Asia/Novokuznetsk',
+ 'Asia/Novosibirsk',
+ 'Asia/Omsk',
+ 'Asia/Oral',
+ 'Asia/Phnom_Penh',
+ 'Asia/Pontianak',
+ 'Asia/Pyongyang',
+ 'Asia/Qatar',
+ 'Asia/Qostanay',
+ 'Asia/Qyzylorda',
+ 'Asia/Riyadh',
+ 'Asia/Sakhalin',
+ 'Asia/Samarkand',
+ 'Asia/Seoul',
+ 'Asia/Shanghai',
+ 'Asia/Singapore',
+ 'Asia/Srednekolymsk',
+ 'Asia/Taipei',
+ 'Asia/Tashkent',
+ 'Asia/Tbilisi',
+ 'Asia/Tehran',
+ 'Asia/Thimphu',
+ 'Asia/Tokyo',
+ 'Asia/Tomsk',
+ 'Asia/Ulaanbaatar',
+ 'Asia/Urumqi',
+ 'Asia/Ust-Nera',
+ 'Asia/Vientiane',
+ 'Asia/Vladivostok',
+ 'Asia/Yakutsk',
+ 'Asia/Yangon',
+ 'Asia/Yekaterinburg',
+ 'Asia/Yerevan',
+ 'Atlantic/Azores',
+ 'Atlantic/Bermuda',
+ 'Atlantic/Canary',
+ 'Atlantic/Cape_Verde',
+ 'Atlantic/Faroe',
+ 'Atlantic/Madeira',
+ 'Atlantic/Reykjavik',
+ 'Atlantic/South_Georgia',
+ 'Atlantic/St_Helena',
+ 'Atlantic/Stanley',
+ 'Australia/Adelaide',
+ 'Australia/Brisbane',
+ 'Australia/Broken_Hill',
+ 'Australia/Darwin',
+ 'Australia/Eucla',
+ 'Australia/Hobart',
+ 'Australia/Lindeman',
+ 'Australia/Lord_Howe',
+ 'Australia/Melbourne',
+ 'Australia/Perth',
+ 'Australia/Sydney',
+ 'Europe/Amsterdam',
+ 'Europe/Andorra',
+ 'Europe/Astrakhan',
+ 'Europe/Athens',
+ 'Europe/Belgrade',
+ 'Europe/Berlin',
+ 'Europe/Bratislava',
+ 'Europe/Brussels',
+ 'Europe/Bucharest',
+ 'Europe/Budapest',
+ 'Europe/Busingen',
+ 'Europe/Chisinau',
+ 'Europe/Copenhagen',
+ 'Europe/Dublin',
+ 'Europe/Gibraltar',
+ 'Europe/Guernsey',
+ 'Europe/Helsinki',
+ 'Europe/Isle_of_Man',
+ 'Europe/Istanbul',
+ 'Europe/Jersey',
+ 'Europe/Kaliningrad',
+ 'Europe/Kirov',
+ 'Europe/Kyiv',
+ 'Europe/Lisbon',
+ 'Europe/Ljubljana',
+ 'Europe/London',
+ 'Europe/Luxembourg',
+ 'Europe/Madrid',
+ 'Europe/Malta',
+ 'Europe/Mariehamn',
+ 'Europe/Minsk',
+ 'Europe/Monaco',
+ 'Europe/Moscow',
+ 'Europe/Oslo',
+ 'Europe/Paris',
+ 'Europe/Podgorica',
+ 'Europe/Prague',
+ 'Europe/Riga',
+ 'Europe/Rome',
+ 'Europe/Samara',
+ 'Europe/San_Marino',
+ 'Europe/Sarajevo',
+ 'Europe/Saratov',
+ 'Europe/Simferopol',
+ 'Europe/Skopje',
+ 'Europe/Sofia',
+ 'Europe/Stockholm',
+ 'Europe/Tallinn',
+ 'Europe/Tirane',
+ 'Europe/Ulyanovsk',
+ 'Europe/Vaduz',
+ 'Europe/Vatican',
+ 'Europe/Vienna',
+ 'Europe/Vilnius',
+ 'Europe/Volgograd',
+ 'Europe/Warsaw',
+ 'Europe/Zagreb',
+ 'Europe/Zurich',
+ 'Indian/Antananarivo',
+ 'Indian/Chagos',
+ 'Indian/Christmas',
+ 'Indian/Cocos',
+ 'Indian/Comoro',
+ 'Indian/Kerguelen',
+ 'Indian/Mahe',
+ 'Indian/Maldives',
+ 'Indian/Mauritius',
+ 'Indian/Mayotte',
+ 'Indian/Reunion',
+ 'Pacific/Apia',
+ 'Pacific/Auckland',
+ 'Pacific/Bougainville',
+ 'Pacific/Chatham',
+ 'Pacific/Chuuk',
+ 'Pacific/Easter',
+ 'Pacific/Efate',
+ 'Pacific/Fakaofo',
+ 'Pacific/Fiji',
+ 'Pacific/Funafuti',
+ 'Pacific/Galapagos',
+ 'Pacific/Gambier',
+ 'Pacific/Guadalcanal',
+ 'Pacific/Guam',
+ 'Pacific/Honolulu',
+ 'Pacific/Kanton',
+ 'Pacific/Kiritimati',
+ 'Pacific/Kosrae',
+ 'Pacific/Kwajalein',
+ 'Pacific/Majuro',
+ 'Pacific/Marquesas',
+ 'Pacific/Midway',
+ 'Pacific/Nauru',
+ 'Pacific/Niue',
+ 'Pacific/Norfolk',
+ 'Pacific/Noumea',
+ 'Pacific/Pago_Pago',
+ 'Pacific/Palau',
+ 'Pacific/Pitcairn',
+ 'Pacific/Pohnpei',
+ 'Pacific/Port_Moresby',
+ 'Pacific/Rarotonga',
+ 'Pacific/Saipan',
+ 'Pacific/Tahiti',
+ 'Pacific/Tarawa',
+ 'Pacific/Tongatapu',
+ 'Pacific/Wake',
+ 'Pacific/Wallis',
+];
diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js
index 517abe3fb468..3dbb638251f3 100644
--- a/src/pages/settings/Profile/TimezoneSelectPage.js
+++ b/src/pages/settings/Profile/TimezoneSelectPage.js
@@ -5,6 +5,7 @@ import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes,
import ScreenWrapper from '../../../components/ScreenWrapper';
import HeaderWithBackButton from '../../../components/HeaderWithBackButton';
import CONST from '../../../CONST';
+import TIMEZONES from '../../../TIMEZONES';
import * as PersonalDetails from '../../../libs/actions/PersonalDetails';
import Navigation from '../../../libs/Navigation/Navigation';
import ROUTES from '../../../ROUTES';
@@ -36,7 +37,7 @@ function TimezoneSelectPage(props) {
const {translate} = useLocalize();
const timezone = useRef(getUserTimezone(props.currentUserPersonalDetails));
const allTimezones = useRef(
- _.chain(Intl.supportedValuesOf('timeZone'))
+ _.chain(TIMEZONES)
.filter((tz) => !tz.startsWith('Etc/GMT'))
.map((text) => ({
text,
From bd65aa2540331d49dd566b0618755f1952506df6 Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Mon, 21 Aug 2023 16:46:05 +0200
Subject: [PATCH 167/201] add a comment with a link
---
src/pages/settings/Profile/TimezoneSelectPage.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js
index 3dbb638251f3..a0c9e8d3ab45 100644
--- a/src/pages/settings/Profile/TimezoneSelectPage.js
+++ b/src/pages/settings/Profile/TimezoneSelectPage.js
@@ -33,6 +33,7 @@ const getKey = (text) => `${text}-${new Date().getTime()}`;
*/
const getUserTimezone = (currentUserPersonalDetails) => lodashGet(currentUserPersonalDetails, 'timezone', CONST.DEFAULT_TIME_ZONE);
+// All timezones were taken from: https://raw.githubusercontent.com/leon-do/Timezones/main/timezone.json
function TimezoneSelectPage(props) {
const {translate} = useLocalize();
const timezone = useRef(getUserTimezone(props.currentUserPersonalDetails));
From 9305d7500fd2b63fbd1fef6a00744561910b0759 Mon Sep 17 00:00:00 2001
From: Artem Makushov
Date: Mon, 21 Aug 2023 17:00:30 +0200
Subject: [PATCH 168/201] timezone link change
---
src/TIMEZONES.js | 1 +
src/pages/settings/Profile/TimezoneSelectPage.js | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/TIMEZONES.js b/src/TIMEZONES.js
index 703c7453450f..2a596b51e8b3 100644
--- a/src/TIMEZONES.js
+++ b/src/TIMEZONES.js
@@ -1,3 +1,4 @@
+// All timezones were taken from: https://raw.githubusercontent.com/leon-do/Timezones/main/timezone.json
export default [
'Africa/Abidjan',
'Africa/Accra',
diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js
index a0c9e8d3ab45..3dbb638251f3 100644
--- a/src/pages/settings/Profile/TimezoneSelectPage.js
+++ b/src/pages/settings/Profile/TimezoneSelectPage.js
@@ -33,7 +33,6 @@ const getKey = (text) => `${text}-${new Date().getTime()}`;
*/
const getUserTimezone = (currentUserPersonalDetails) => lodashGet(currentUserPersonalDetails, 'timezone', CONST.DEFAULT_TIME_ZONE);
-// All timezones were taken from: https://raw.githubusercontent.com/leon-do/Timezones/main/timezone.json
function TimezoneSelectPage(props) {
const {translate} = useLocalize();
const timezone = useRef(getUserTimezone(props.currentUserPersonalDetails));
From c7e472cded75066f5e38ea9a95ddba10e9b65d8f Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 08:56:25 -0700
Subject: [PATCH 169/201] chore(dep): bump package version
---
package-lock.json | 13 +++++++------
package.json | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index b385335a3d55..2391d7b45d13 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -107,7 +107,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "github:Expensify/react-native-x-maps#test-hayata-fix-bounds-calculation",
+ "react-native-x-maps": "^1.0.8",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
@@ -43447,9 +43447,9 @@
}
},
"node_modules/react-native-x-maps": {
- "version": "1.0.7",
- "resolved": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#6dbe84db037bae4dc43d146bd7ed112f09758c27",
- "license": "MIT",
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.8.tgz",
+ "integrity": "sha512-9JSm/6QvK7tKgNqloJ4rqlDCDvbAe0pJSn58aPvesA24pLK3lSm3CIGLT2sx7wHEgzQiXEtC0sM+Qa0p/z2xKw==",
"peerDependencies": {
"@rnmapbox/maps": "^10.0.11",
"mapbox-gl": "^2.15.0",
@@ -80288,8 +80288,9 @@
}
},
"react-native-x-maps": {
- "version": "git+ssh://git@github.com/Expensify/react-native-x-maps.git#6dbe84db037bae4dc43d146bd7ed112f09758c27",
- "from": "react-native-x-maps@github:Expensify/react-native-x-maps#test-hayata-fix-bounds-calculation",
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.8.tgz",
+ "integrity": "sha512-9JSm/6QvK7tKgNqloJ4rqlDCDvbAe0pJSn58aPvesA24pLK3lSm3CIGLT2sx7wHEgzQiXEtC0sM+Qa0p/z2xKw==",
"requires": {}
},
"react-pdf": {
diff --git a/package.json b/package.json
index ae07570ef6a8..2c0f6475f57e 100644
--- a/package.json
+++ b/package.json
@@ -147,7 +147,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "github:Expensify/react-native-x-maps#test-hayata-fix-bounds-calculation",
+ "react-native-x-maps": "1.0.8",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
From bc099f1441a0fc5ff23b96f45bc96235211559a2 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 08:58:06 -0700
Subject: [PATCH 170/201] chore(dep): run npm install
---
package-lock.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package-lock.json b/package-lock.json
index 2391d7b45d13..655c0c3d5ab3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -107,7 +107,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "^1.0.8",
+ "react-native-x-maps": "1.0.8",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
From b12644c6e6e64581141136023aef9118f9403330 Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Mon, 21 Aug 2023 12:08:21 -0400
Subject: [PATCH 171/201] Access transactionID safely in case of pay IOU
actions
---
.../AttachmentCarousel/extractAttachmentsFromReport.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js
index 61df1024a534..511c47119e23 100644
--- a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js
+++ b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js
@@ -5,6 +5,7 @@ import * as TransactionUtils from '../../../libs/TransactionUtils';
import * as ReceiptUtils from '../../../libs/ReceiptUtils';
import CONST from '../../../CONST';
import tryResolveUrlFromApiRoot from '../../../libs/tryResolveUrlFromApiRoot';
+import lodashGet from 'lodash/get';
/**
* Constructs the initial component state from report actions
@@ -43,7 +44,12 @@ function extractAttachmentsFromReport(report, reportActions) {
// We're handling receipts differently here because receipt images are not
// part of the report action message, the images are constructed client-side
if (ReportActionsUtils.isMoneyRequestAction(action)) {
- const transaction = TransactionUtils.getTransaction(action.originalMessage.IOUTransactionID);
+ const transactionID = lodashGet(action, ['originalMessage', 'IOUTransactionID']);
+ if (!transactionID) {
+ return;
+ }
+
+ const transaction = TransactionUtils.getTransaction(transactionID);
if (TransactionUtils.hasReceipt(transaction)) {
const {image} = ReceiptUtils.getThumbnailAndImageURIs(transaction.receipt.source, transaction.filename);
attachments.unshift({
From fec32bfa9d34b1b1993cbd21129ad1c4d855c42b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Mon, 21 Aug 2023 12:19:39 -0400
Subject: [PATCH 172/201] Fix lint
---
.../AttachmentCarousel/extractAttachmentsFromReport.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js
index 511c47119e23..b967d5ab0066 100644
--- a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js
+++ b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js
@@ -1,11 +1,11 @@
import {Parser as HtmlParser} from 'htmlparser2';
import _ from 'underscore';
+import lodashGet from 'lodash/get';
import * as ReportActionsUtils from '../../../libs/ReportActionsUtils';
import * as TransactionUtils from '../../../libs/TransactionUtils';
import * as ReceiptUtils from '../../../libs/ReceiptUtils';
import CONST from '../../../CONST';
import tryResolveUrlFromApiRoot from '../../../libs/tryResolveUrlFromApiRoot';
-import lodashGet from 'lodash/get';
/**
* Constructs the initial component state from report actions
From de09a89a988c8cd7ba4bd8d6453a3d60c85cb82b Mon Sep 17 00:00:00 2001
From: Andrew Li
Date: Mon, 21 Aug 2023 12:52:28 -0400
Subject: [PATCH 173/201] Fix lint
---
src/libs/TransactionUtils.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 0ebc3b219712..a995769eebe0 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -243,4 +243,4 @@ export {
getAllReportTransactions,
hasReceipt,
isReceiptBeingScanned,
-};
\ No newline at end of file
+};
From 42d5925b66b2631b5957d66b84f77c3128be5410 Mon Sep 17 00:00:00 2001
From: Carlos Martins
Date: Mon, 21 Aug 2023 11:46:18 -0600
Subject: [PATCH 174/201] fix style
---
src/components/ReportActionItem/MoneyRequestView.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 259cef1f25ad..622d02036dc0 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -26,7 +26,7 @@ import useWindowDimensions from '../../hooks/useWindowDimensions';
import transactionPropTypes from '../transactionPropTypes';
import Image from '../Image';
import ReportActionItemImage from './ReportActionItemImage';
-import * as TransactionUtils from '../../libs/TransactionUtils';
+import * as TransactionUtils from '../../libs/TransactionUtils';
import OfflineWithFeedback from '../OfflineWithFeedback';
const propTypes = {
From 7dab19b9d1c346592d9627734675499547ea0ce3 Mon Sep 17 00:00:00 2001
From: pradeepkumar
Date: Tue, 22 Aug 2023 00:03:47 +0530
Subject: [PATCH 175/201] crash bill
---
src/components/ReportActionItem/MoneyRequestAction.js | 2 +-
src/libs/TransactionUtils.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/ReportActionItem/MoneyRequestAction.js b/src/components/ReportActionItem/MoneyRequestAction.js
index da361b5540db..c8a18da2ac03 100644
--- a/src/components/ReportActionItem/MoneyRequestAction.js
+++ b/src/components/ReportActionItem/MoneyRequestAction.js
@@ -132,7 +132,7 @@ function MoneyRequestAction(props) {
props.action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD &&
props.network.isOffline
) {
- shouldShowPendingConversionMessage = IOUUtils.isIOUReportPendingCurrencyConversion(props.reportActions, props.iouReport);
+ shouldShowPendingConversionMessage = IOUUtils.isIOUReportPendingCurrencyConversion(props.iouReport);
}
return isDeletedParentAction ? (
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index a995769eebe0..86cf847b6e73 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -15,7 +15,7 @@ Onyx.connect({
if (!val) {
return;
}
- allTransactions = val;
+ allTransactions = _.pick(val, (val) => val);
},
});
From 70a454148e5db18ef381d947f0c35fea22cca29a Mon Sep 17 00:00:00 2001
From: pradeepkumar
Date: Tue, 22 Aug 2023 00:12:38 +0530
Subject: [PATCH 176/201] update property
---
src/libs/TransactionUtils.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index 86cf847b6e73..cc57827a12bb 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -15,7 +15,8 @@ Onyx.connect({
if (!val) {
return;
}
- allTransactions = _.pick(val, (val) => val);
+ allTransactions = _.pick(val, (transaction) => transaction);
+ console.log(allTransactions)
},
});
From e76eea0336d425db5139affbf60d8c1ec071ccc2 Mon Sep 17 00:00:00 2001
From: pradeepkumar
Date: Tue, 22 Aug 2023 00:13:01 +0530
Subject: [PATCH 177/201] crash bill
---
src/libs/TransactionUtils.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/libs/TransactionUtils.js b/src/libs/TransactionUtils.js
index cc57827a12bb..99fcc1844ad4 100644
--- a/src/libs/TransactionUtils.js
+++ b/src/libs/TransactionUtils.js
@@ -16,7 +16,6 @@ Onyx.connect({
return;
}
allTransactions = _.pick(val, (transaction) => transaction);
- console.log(allTransactions)
},
});
From ee977aa70c030c49d70af6d9d351a3ff2999c1f8 Mon Sep 17 00:00:00 2001
From: Ishpaul Singh
Date: Tue, 22 Aug 2023 00:25:08 +0530
Subject: [PATCH 178/201] fix room welcome message if user is admin
---
src/components/ReportWelcomeText.js | 18 ++++++++++++++++--
src/languages/en.js | 2 ++
src/libs/ReportUtils.js | 7 ++++---
.../home/report/ReportActionItemCreated.js | 5 ++++-
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js
index 3a177cbfb94b..118c966d34a8 100644
--- a/src/components/ReportWelcomeText.js
+++ b/src/components/ReportWelcomeText.js
@@ -10,6 +10,7 @@ import Text from './Text';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import compose from '../libs/compose';
import * as ReportUtils from '../libs/ReportUtils';
+import * as PolicyUtils from '../libs/PolicyUtils';
import * as OptionsListUtils from '../libs/OptionsListUtils';
import ONYXKEYS from '../ONYXKEYS';
import Navigation from '../libs/Navigation/Navigation';
@@ -33,6 +34,15 @@ const propTypes = {
/** The report currently being looked at */
report: reportPropTypes,
+ /** The policy object for the current route */
+ policy: PropTypes.shape({
+ /** The name of the policy */
+ name: PropTypes.string,
+
+ /** The URL for the policy avatar */
+ avatar: PropTypes.string,
+ }),
+
/* Onyx Props */
/** All of the personal details for everyone */
@@ -46,6 +56,7 @@ const propTypes = {
const defaultProps = {
report: {},
+ policy: {},
personalDetails: {},
betas: [],
};
@@ -62,8 +73,10 @@ function ReportWelcomeText(props) {
OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, props.personalDetails),
isMultipleParticipant,
);
- const roomWelcomeMessage = ReportUtils.getRoomWelcomeMessage(props.report);
+ const isUserPolicyAdmin = PolicyUtils.isPolicyAdmin(props.policy);
+ const roomWelcomeMessage = ReportUtils.getRoomWelcomeMessage(props.report, isUserPolicyAdmin);
const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(props.report, participantAccountIDs, props.betas);
+
return (
<>
@@ -90,7 +103,8 @@ function ReportWelcomeText(props) {
{isChatRoom && (
<>
{roomWelcomeMessage.phrase1}
- {!isAdminsOnlyPostingRoom && (
+ {/* for rooms in which only admins can post we dont need room name and phrase two */}
+ {(!isAdminsOnlyPostingRoom || isUserPolicyAdmin) && (
<>
`Collaboration among ${workspaceName} admins starts here! 🎉\nUse `,
beginningOfChatHistoryAdminRoomPartTwo: ' to chat about topics such as workspace configurations and more.',
beginningOfChatHistoryAdminOnlyPostingRoom: 'Only admins can send messages in this room.',
+ beginningOfChatHistoryAdminOnlyPostingRoomUserIsAdminPartOne: "You're an admin in this workspace. Use ",
+ beginningOfChatHistoryAdminOnlyPostingRoomUserIsAdminPartTwo: ' to announce important updates in this room.',
beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}) => `Collaboration between all ${workspaceName} members starts here! 🎉\nUse `,
beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}) => ` to chat about anything ${workspaceName} related.`,
beginningOfChatHistoryUserRoomPartOne: 'Collaboration starts here! 🎉\nUse this space to chat about anything ',
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 0b96c1d1120b..a9755486e156 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -760,10 +760,11 @@ function canDeleteReportAction(reportAction, reportID) {
/**
* Get welcome message based on room type
* @param {Object} report
+ * @param {Boolean} isUserPolicyAdmin
* @returns {Object}
*/
-function getRoomWelcomeMessage(report) {
+function getRoomWelcomeMessage(report, isUserPolicyAdmin) {
const welcomeMessage = {};
const workspaceName = getPolicyName(report);
@@ -776,7 +777,7 @@ function getRoomWelcomeMessage(report) {
} else if (isAdminRoom(report)) {
welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartOne', {workspaceName});
welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartTwo');
- } else if (isAdminsOnlyPostingRoom(report)) {
+ } else if (isAdminsOnlyPostingRoom(report) && !isUserPolicyAdmin) {
welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoom');
} else if (isAnnounceRoom(report)) {
welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartOne', {workspaceName});
@@ -800,7 +801,7 @@ function chatIncludesConcierge(report) {
}
/**
- * Returns true if there is any automated expensify account in accountIDs
+ * Returns true if there is any automated expensify account `in accountIDs
* @param {Array} accountIDs
* @returns {Boolean}
*/
diff --git a/src/pages/home/report/ReportActionItemCreated.js b/src/pages/home/report/ReportActionItemCreated.js
index b7716e22a851..4ae4fe81e4ac 100644
--- a/src/pages/home/report/ReportActionItemCreated.js
+++ b/src/pages/home/report/ReportActionItemCreated.js
@@ -89,7 +89,10 @@ function ReportActionItemCreated(props) {
/>
-
+
From d7aebbf100064ddac56eed82c83ebff1000e6c06 Mon Sep 17 00:00:00 2001
From: Ishpaul Singh
Date: Tue, 22 Aug 2023 00:34:28 +0530
Subject: [PATCH 179/201] remove unneccessary translation keys
---
src/languages/en.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/languages/en.js b/src/languages/en.js
index c09e5a0a91f3..902efeb156b9 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -311,8 +311,6 @@ export default {
beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}) => `Collaboration among ${workspaceName} admins starts here! 🎉\nUse `,
beginningOfChatHistoryAdminRoomPartTwo: ' to chat about topics such as workspace configurations and more.',
beginningOfChatHistoryAdminOnlyPostingRoom: 'Only admins can send messages in this room.',
- beginningOfChatHistoryAdminOnlyPostingRoomUserIsAdminPartOne: "You're an admin in this workspace. Use ",
- beginningOfChatHistoryAdminOnlyPostingRoomUserIsAdminPartTwo: ' to announce important updates in this room.',
beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}) => `Collaboration between all ${workspaceName} members starts here! 🎉\nUse `,
beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}) => ` to chat about anything ${workspaceName} related.`,
beginningOfChatHistoryUserRoomPartOne: 'Collaboration starts here! 🎉\nUse this space to chat about anything ',
From 5e03c42cf88b6bb144354fdfea4472cb0d8e7874 Mon Sep 17 00:00:00 2001
From: OSBotify
Date: Mon, 21 Aug 2023 19:53:18 +0000
Subject: [PATCH 180/201] Update version to 1.3.55-8
---
android/app/build.gradle | 4 ++--
ios/NewExpensify/Info.plist | 2 +-
ios/NewExpensifyTests/Info.plist | 2 +-
package-lock.json | 4 ++--
package.json | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 1b1330b47144..4c3f0c3825f0 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001035507
- versionName "1.3.55-7"
+ versionCode 1001035508
+ versionName "1.3.55-8"
}
flavorDimensions "default"
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index 391ea7062bee..3b8a20f90e79 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -40,7 +40,7 @@
CFBundleVersion
- 1.3.55.7
+ 1.3.55.8
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index 29d6f71e7e07..58d28cda5668 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.3.55.7
+ 1.3.55.8
diff --git a/package-lock.json b/package-lock.json
index 1ce9aee50531..e1f9a65ba009 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "1.3.55-7",
+ "version": "1.3.55-8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "1.3.55-7",
+ "version": "1.3.55-8",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index 252b45912502..88d0c5b8312f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.3.55-7",
+ "version": "1.3.55-8",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
From 441a76bf9c7a963427be6760b61a56cde82dd5a8 Mon Sep 17 00:00:00 2001
From: Ishpaul Singh
Date: Tue, 22 Aug 2023 02:07:00 +0530
Subject: [PATCH 181/201] fix: update hero text for all rooms
---
src/components/ReportWelcomeText.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js
index 118c966d34a8..9fc446df31e3 100644
--- a/src/components/ReportWelcomeText.js
+++ b/src/components/ReportWelcomeText.js
@@ -66,7 +66,6 @@ function ReportWelcomeText(props) {
const isChatRoom = ReportUtils.isChatRoom(props.report);
const isDefault = !(isChatRoom || isPolicyExpenseChat);
const isAdminsOnlyPostingRoom = ReportUtils.isAdminsOnlyPostingRoom(props.report);
- const isAnnounceRoom = ReportUtils.isAnnounceRoom(props.report);
const participantAccountIDs = lodashGet(props.report, 'participantAccountIDs', []);
const isMultipleParticipant = participantAccountIDs.length > 1;
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(
@@ -81,9 +80,7 @@ function ReportWelcomeText(props) {
<>
- {isAdminsOnlyPostingRoom || isAnnounceRoom
- ? props.translate('reportActionsView.welcomeToRoom', {roomName: ReportUtils.getReportName(props.report)})
- : props.translate('reportActionsView.sayHello')}
+ {isChatRoom ? props.translate('reportActionsView.welcomeToRoom', {roomName: ReportUtils.getReportName(props.report)}) : props.translate('reportActionsView.sayHello')}
From 5518086071e7f6f3b07c55eb75149458e20b494b Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 13:40:13 -0700
Subject: [PATCH 182/201] style: rename a variable
---
src/components/DistanceRequest.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 6a461d6f2d9a..e2c486801b81 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -80,7 +80,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
const numberOfWaypoints = _.size(waypoints);
const lastWaypointIndex = numberOfWaypoints - 1;
- const waypointsData = _.filter(
+ const waypointMarkers = _.filter(
_.map(waypoints, (waypoint, key) => {
if (waypoint.lng === undefined || waypoint.lat === undefined) {
return;
@@ -205,7 +205,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
zoom: DEFAULT_ZOOM_LEVEL,
}}
style={styles.mapView}
- waypoints={waypointsData}
+ waypoints={waypointMarkers}
/>
) : (
From 40eecdb61a851807bdb4808579237ad747823770 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 13:43:52 -0700
Subject: [PATCH 183/201] fix: check for null
---
src/components/DistanceRequest.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index e2c486801b81..f0fae054a9b0 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -82,7 +82,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
const waypointMarkers = _.filter(
_.map(waypoints, (waypoint, key) => {
- if (waypoint.lng === undefined || waypoint.lat === undefined) {
+ if (!waypoint || waypoint.lng === undefined || waypoint.lat === undefined) {
return;
}
From 00f6e4f2fbd040af91ad27aee851aa30d2326255 Mon Sep 17 00:00:00 2001
From: Sibtain Ali
Date: Tue, 22 Aug 2023 01:59:02 +0500
Subject: [PATCH 184/201] fix: revert changes for hover lost
---
.../home/report/ContextMenu/PopoverReportActionContextMenu.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
index 756b8da32d58..81858564b416 100644
--- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
+++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
@@ -165,8 +165,8 @@ class PopoverReportActionContextMenu extends React.Component {
vertical: nativeEvent.pageY - y,
},
popoverAnchorPosition: {
- horizontal: nativeEvent.pageX + CONST.MODAL.POPOVER_ANCHOR_SHIFT,
- vertical: nativeEvent.pageY - CONST.MODAL.POPOVER_ANCHOR_SHIFT,
+ horizontal: nativeEvent.pageX,
+ vertical: nativeEvent.pageY,
},
type,
reportID,
From 9ba77001903c244522ec7672a3004cec3b1a4c3a Mon Sep 17 00:00:00 2001
From: Sibtain Ali
Date: Tue, 22 Aug 2023 02:01:09 +0500
Subject: [PATCH 185/201] fix: revert const changes
---
src/CONST.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/CONST.js b/src/CONST.js
index 7f00cf32b3a7..4c19965837d9 100755
--- a/src/CONST.js
+++ b/src/CONST.js
@@ -611,7 +611,6 @@ const CONST = {
RIGHT: 'right',
},
POPOVER_MENU_PADDING: 8,
- POPOVER_ANCHOR_SHIFT: 2,
},
TIMING: {
CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action',
From a9b1cde48097686790e79aace1696b21f84c56f4 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 14:06:15 -0700
Subject: [PATCH 186/201] fix: change icon color
---
src/components/DistanceRequest.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index f0fae054a9b0..6ba8ebbf3d01 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -102,7 +102,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
),
};
From 9fa23b0f7d9753d79c580761bd10470fc7f0c3be Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 14:09:42 -0700
Subject: [PATCH 187/201] feat: use Expensify style in map
---
src/CONST.js | 1 +
src/components/DistanceRequest.js | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/CONST.js b/src/CONST.js
index e7d2fa6f4d03..0494fed3589c 100755
--- a/src/CONST.js
+++ b/src/CONST.js
@@ -2553,6 +2553,7 @@ const CONST = {
},
STATUS_TEXT_MAX_LENGTH: 100,
SF_COORDINATES: [-122.4194, 37.7749],
+ MAPBOX_STYLE_URL: 'mapbox://styles/expensify/cllcoiqds00cs01r80kp34tmq',
NAVIGATION: {
TYPE: {
FORCED_UP: 'FORCED_UP',
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 6ba8ebbf3d01..a3431ed8eccf 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -206,6 +206,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
}}
style={styles.mapView}
waypoints={waypointMarkers}
+ styleURL={CONST.MAPBOX_STYLE_URL}
/>
) : (
From e40c0443a9c4553360c7a53e4b691d11289f7e92 Mon Sep 17 00:00:00 2001
From: Marc Glasser
Date: Mon, 21 Aug 2023 11:10:44 -1000
Subject: [PATCH 188/201] Do not parse to reportActionID to int when building
comment linking url
---
src/pages/home/report/ContextMenu/ContextMenuActions.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js
index 898f5103eac5..98c9c01b28ff 100644
--- a/src/pages/home/report/ContextMenu/ContextMenuActions.js
+++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js
@@ -234,7 +234,7 @@ export default [
},
onPress: (closePopover, {reportAction, reportID}) => {
Environment.getEnvironmentURL().then((environmentURL) => {
- const reportActionID = parseInt(lodashGet(reportAction, 'reportActionID'), 10);
+ const reportActionID = lodashGet(reportAction, 'reportActionID');
Clipboard.setString(`${environmentURL}/r/${reportID}/${reportActionID}`);
});
hideContextMenu(true, ReportActionComposeFocusManager.focus);
From 31e0377c336e705810389fc16b31c1097db165c9 Mon Sep 17 00:00:00 2001
From: OSBotify
Date: Mon, 21 Aug 2023 21:40:35 +0000
Subject: [PATCH 189/201] Update version to 1.3.56-0
---
android/app/build.gradle | 4 ++--
ios/NewExpensify/Info.plist | 4 ++--
ios/NewExpensifyTests/Info.plist | 4 ++--
package-lock.json | 4 ++--
package.json | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 4c3f0c3825f0..9cfb91c4a8b1 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001035508
- versionName "1.3.55-8"
+ versionCode 1001035600
+ versionName "1.3.56-0"
}
flavorDimensions "default"
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index 3b8a20f90e79..3cfb7cb09e1f 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -19,7 +19,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.3.55
+ 1.3.56
CFBundleSignature
????
CFBundleURLTypes
@@ -40,7 +40,7 @@
CFBundleVersion
- 1.3.55.8
+ 1.3.56.0
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index 58d28cda5668..db62a31c6223 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -15,10 +15,10 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 1.3.55
+ 1.3.56
CFBundleSignature
????
CFBundleVersion
- 1.3.55.8
+ 1.3.56.0
diff --git a/package-lock.json b/package-lock.json
index e1f9a65ba009..4adf5740e99c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "1.3.55-8",
+ "version": "1.3.56-0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "1.3.55-8",
+ "version": "1.3.56-0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index 88d0c5b8312f..b68081c7f5e4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.3.55-8",
+ "version": "1.3.56-0",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
From 0c08d09ed0aaa9d85e1bee856a3b6de6c44e48f4 Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 15:12:26 -0700
Subject: [PATCH 190/201] chore(deps): update x-maps version
---
package-lock.json | 14 +++++++-------
package.json | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 655c0c3d5ab3..a5ca972bb42e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -107,7 +107,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "1.0.8",
+ "react-native-x-maps": "1.0.9",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
@@ -43447,9 +43447,9 @@
}
},
"node_modules/react-native-x-maps": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.8.tgz",
- "integrity": "sha512-9JSm/6QvK7tKgNqloJ4rqlDCDvbAe0pJSn58aPvesA24pLK3lSm3CIGLT2sx7wHEgzQiXEtC0sM+Qa0p/z2xKw==",
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.9.tgz",
+ "integrity": "sha512-EEb0BcAWwTnN18J2QL7WHbafV/NLaxtPKJbB0SYJp4KzGK1lRTT3Pl/LYodEUhLUbYk04Y0jcA8ifiImc7yn6A==",
"peerDependencies": {
"@rnmapbox/maps": "^10.0.11",
"mapbox-gl": "^2.15.0",
@@ -80288,9 +80288,9 @@
}
},
"react-native-x-maps": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.8.tgz",
- "integrity": "sha512-9JSm/6QvK7tKgNqloJ4rqlDCDvbAe0pJSn58aPvesA24pLK3lSm3CIGLT2sx7wHEgzQiXEtC0sM+Qa0p/z2xKw==",
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/react-native-x-maps/-/react-native-x-maps-1.0.9.tgz",
+ "integrity": "sha512-EEb0BcAWwTnN18J2QL7WHbafV/NLaxtPKJbB0SYJp4KzGK1lRTT3Pl/LYodEUhLUbYk04Y0jcA8ifiImc7yn6A==",
"requires": {}
},
"react-pdf": {
diff --git a/package.json b/package.json
index 2c0f6475f57e..bd9ff1d2b5a1 100644
--- a/package.json
+++ b/package.json
@@ -147,7 +147,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
- "react-native-x-maps": "1.0.8",
+ "react-native-x-maps": "^1.0.9",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
From f6212179e7a2e9e1a9c62f137dad3e48256442d7 Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 15:33:18 -0700
Subject: [PATCH 191/201] Consolidate mapbox SDK setup in with setupNode
---
.github/actions/composite/buildAndroidAPK/action.yml | 4 ----
.github/actions/composite/setupNode/action.yml | 4 ++++
.github/workflows/platformDeploy.yml | 6 ------
.github/workflows/testBuild.yml | 6 ------
4 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml
index 798df2eeaed3..819234df0bc3 100644
--- a/.github/actions/composite/buildAndroidAPK/action.yml
+++ b/.github/actions/composite/buildAndroidAPK/action.yml
@@ -11,10 +11,6 @@ runs:
steps:
- uses: Expensify/App/.github/actions/composite/setupNode@main
- - name: Setup credentails for Mapbox SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- shell: bash
-
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
ruby-version: '2.7'
diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml
index 6bdf500912c0..9e2be0f9aa16 100644
--- a/.github/actions/composite/setupNode/action.yml
+++ b/.github/actions/composite/setupNode/action.yml
@@ -24,6 +24,10 @@ runs:
path: desktop/node_modules
key: ${{ runner.os }}-desktop-node-modules-${{ hashFiles('desktop/package-lock.json') }}
+ - name: Configure MapBox credentials to install closed-source SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+ shell: bash
+
- name: Install root project node packages
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml
index 75dbc8a45e16..2587d30477ae 100644
--- a/.github/workflows/platformDeploy.yml
+++ b/.github/workflows/platformDeploy.yml
@@ -151,9 +151,6 @@ jobs:
ruby-version: '2.7'
bundler-cache: true
- - name: Setup credentails for Mapbox SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
-
- name: Install cocoapods
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
with:
@@ -244,9 +241,6 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- - name: Setup credentails for Mapbox SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
-
- name: Build web for production
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run build
diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml
index 16eac28e401a..728e2da0d474 100644
--- a/.github/workflows/testBuild.yml
+++ b/.github/workflows/testBuild.yml
@@ -103,9 +103,6 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- - name: Setup credentails for Mapbox SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
-
- name: Run Fastlane beta test
id: runFastlaneBetaTest
run: bundle exec fastlane android build_internal
@@ -151,9 +148,6 @@ jobs:
ruby-version: '2.7'
bundler-cache: true
- - name: Setup credentails for Mapbox SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
-
- name: Install cocoapods
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
with:
From b2416eb347644128feea876f22a1908afc58f30a Mon Sep 17 00:00:00 2001
From: Hayata Suenaga
Date: Mon, 21 Aug 2023 15:48:05 -0700
Subject: [PATCH 192/201] fix: hide link url
---
src/components/DistanceRequest.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index a3431ed8eccf..8f07c7c05ecf 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -214,6 +214,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
icon={Expensicons.EmptyStateRoutePending}
title={translate('distance.mapPending.title')}
subtitle={isOffline ? translate('distance.mapPending.subtitle') : translate('distance.mapPending.onlineSubtitle')}
+ shouldShowLink={false}
/>
)}
From e652d3c01d7475ba80f2f6a39c4c75d7835a4428 Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 16:14:24 -0700
Subject: [PATCH 193/201] Pass required secrets to setupNode
---
.github/actions/composite/buildAndroidAPK/action.yml | 5 +++++
.github/actions/composite/setupNode/action.yml | 7 ++++++-
.github/workflows/deployExpensifyHelp.yml | 8 +++++++-
.github/workflows/e2ePerformanceTests.yml | 2 ++
.github/workflows/lint.yml | 2 ++
.github/workflows/platformDeploy.yml | 10 ++++++++++
.github/workflows/reassurePerformanceTests.yml | 2 ++
.github/workflows/test.yml | 8 ++++++++
.github/workflows/testBuild.yml | 8 ++++++++
.github/workflows/typecheck.yml | 2 ++
.github/workflows/validateDocsRoutes.yml | 2 ++
.github/workflows/validateGithubActions.yml | 2 ++
.github/workflows/verifyPodfile.yml | 4 ++++
13 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml
index 819234df0bc3..9a5da13ba54f 100644
--- a/.github/actions/composite/buildAndroidAPK/action.yml
+++ b/.github/actions/composite/buildAndroidAPK/action.yml
@@ -5,11 +5,16 @@ inputs:
ARTIFACT_NAME:
description: The name of the workflow artifact where the APK should be uploaded
required: true
+ MAPBOX_SDK_DOWNLOAD_TOKEN:
+ description: Download token for the closed-source MapBox SDK.
+ required: true
runs:
using: composite
steps:
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ inputs.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml
index 9e2be0f9aa16..9d5141e367ea 100644
--- a/.github/actions/composite/setupNode/action.yml
+++ b/.github/actions/composite/setupNode/action.yml
@@ -1,6 +1,11 @@
name: Set up Node
description: Set up Node
+inputs:
+ MAPBOX_SDK_DOWNLOAD_TOKEN:
+ description: Download token for the closed-source MapBox SDK.
+ required: true
+
runs:
using: composite
steps:
@@ -25,7 +30,7 @@ runs:
key: ${{ runner.os }}-desktop-node-modules-${{ hashFiles('desktop/package-lock.json') }}
- name: Configure MapBox credentials to install closed-source SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+ run: ./scripts/setup-mapbox-sdk.sh ${{ inputs.MAPBOX_SDK_DOWNLOAD_TOKEN }}
shell: bash
- name: Install root project node packages
diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml
index cb4e0f956657..2fb606e4578c 100644
--- a/.github/workflows/deployExpensifyHelp.yml
+++ b/.github/workflows/deployExpensifyHelp.yml
@@ -28,23 +28,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+
- name: Setup NodeJS
uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- name: Setup Pages
uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382
+
- name: Create docs routes file
run: ./.github/scripts/createDocsRoutes.sh
+
- name: Build with Jekyll
uses: actions/jekyll-build-pages@0143c158f4fa0c5dcd99499a5d00859d79f70b0e
with:
source: ./docs/
destination: ./docs/_site
+
- name: Upload artifact
uses: actions/upload-pages-artifact@64bcae551a7b18bcb9a09042ddf1960979799187
with:
path: ./docs/_site
-
# Deployment job
deploy:
environment:
diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml
index fe364b376e3b..10d9862848a0 100644
--- a/.github/workflows/e2ePerformanceTests.yml
+++ b/.github/workflows/e2ePerformanceTests.yml
@@ -51,6 +51,7 @@ jobs:
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
with:
ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }}
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
buildDelta:
runs-on: ubuntu-latest-xl
@@ -116,6 +117,7 @@ jobs:
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
with:
ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }}
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
runTestsInAWS:
runs-on: ubuntu-latest
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 795271cab60a..0e7f85f1c37e 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -14,6 +14,8 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Lint JavaScript with ESLint
run: npm run lint
diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml
index 2587d30477ae..1aba28b5d9df 100644
--- a/.github/workflows/platformDeploy.yml
+++ b/.github/workflows/platformDeploy.yml
@@ -37,6 +37,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
@@ -108,6 +110,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Decrypt Developer ID Certificate
run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg
@@ -145,6 +149,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
@@ -231,6 +237,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Setup Cloudflare CLI
run: pip3 install cloudflare
@@ -358,6 +366,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Set version
run: echo "VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV"
diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml
index ab5e1d06e5a4..c36a5b8de781 100644
--- a/.github/workflows/reassurePerformanceTests.yml
+++ b/.github/workflows/reassurePerformanceTests.yml
@@ -15,6 +15,8 @@ jobs:
- name: Setup NodeJS
uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Run performance testing script
shell: bash
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index fe234bc8373c..58d042b66fc1 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,6 +21,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Get number of CPU cores
id: cpu-cores
@@ -42,7 +44,11 @@ jobs:
name: Storybook tests
steps:
- uses: actions/checkout@v3
+
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- name: Storybook run
run: npm run storybook -- --smoke-test --ci
@@ -54,6 +60,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Test CI git logic
run: tests/unit/CIGitLogicTest.sh
diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml
index 728e2da0d474..f78b0710f5bd 100644
--- a/.github/workflows/testBuild.yml
+++ b/.github/workflows/testBuild.yml
@@ -81,6 +81,8 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
@@ -139,6 +141,8 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Setup Xcode
run: sudo xcode-select -switch /Applications/Xcode_14.2.app
@@ -203,6 +207,8 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Decrypt Developer ID Certificate
run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg
@@ -244,6 +250,8 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Configure AWS Credentials
uses: Expensify/App/.github/actions/composite/configureAwsCredentials@main
diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml
index de433b2ae88a..36f4700a6c22 100644
--- a/.github/workflows/typecheck.yml
+++ b/.github/workflows/typecheck.yml
@@ -14,6 +14,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Type check with TypeScript
run: npm run typecheck
diff --git a/.github/workflows/validateDocsRoutes.yml b/.github/workflows/validateDocsRoutes.yml
index 717560e19f5f..8a0a1a17aab1 100644
--- a/.github/workflows/validateDocsRoutes.yml
+++ b/.github/workflows/validateDocsRoutes.yml
@@ -14,6 +14,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
# Verify that no new hubs were created without adding their metadata to _routes.yml
- name: Validate Docs Routes File
diff --git a/.github/workflows/validateGithubActions.yml b/.github/workflows/validateGithubActions.yml
index f496c5e4b27e..74a4224566f6 100644
--- a/.github/workflows/validateGithubActions.yml
+++ b/.github/workflows/validateGithubActions.yml
@@ -15,6 +15,8 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
# Rebuild all the actions on this branch and check for a diff. Fail if there is one,
# because that would be a sign that the PR author did not rebuild the Github Actions
diff --git a/.github/workflows/verifyPodfile.yml b/.github/workflows/verifyPodfile.yml
index 8b715a7047c4..94d85329d75e 100644
--- a/.github/workflows/verifyPodfile.yml
+++ b/.github/workflows/verifyPodfile.yml
@@ -15,5 +15,9 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
+
- uses: Expensify/App/.github/actions/composite/setupNode@main
+ with:
+ MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- run: ./.github/scripts/verifyPodfile.sh
From d387e1e092ef09bc6c3dcac47e849b2040162efe Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 16:31:50 -0700
Subject: [PATCH 194/201] Forward secrets to called workflows
---
.github/workflows/preDeploy.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml
index c9fb636238aa..3f162c807849 100644
--- a/.github/workflows/preDeploy.yml
+++ b/.github/workflows/preDeploy.yml
@@ -7,12 +7,15 @@ on:
jobs:
typecheck:
uses: Expensify/App/.github/workflows/typecheck.yml@main
+ secrets: inherit
lint:
uses: Expensify/App/.github/workflows/lint.yml@main
+ secrets: inherit
test:
uses: Expensify/App/.github/workflows/test.yml@main
+ secrets: inherit
confirmPassingBuild:
runs-on: ubuntu-latest
From 8f772eac93364b438d34bc549583dd051c8e5d4d Mon Sep 17 00:00:00 2001
From: OSBotify
Date: Mon, 21 Aug 2023 23:50:04 +0000
Subject: [PATCH 195/201] Update version to 1.3.56-1
---
android/app/build.gradle | 4 ++--
ios/NewExpensify/Info.plist | 2 +-
ios/NewExpensifyTests/Info.plist | 2 +-
package-lock.json | 4 ++--
package.json | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 9cfb91c4a8b1..2c6bb6855c87 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001035600
- versionName "1.3.56-0"
+ versionCode 1001035601
+ versionName "1.3.56-1"
}
flavorDimensions "default"
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index 3cfb7cb09e1f..71068da0688e 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -40,7 +40,7 @@
CFBundleVersion
- 1.3.56.0
+ 1.3.56.1
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index db62a31c6223..ce5acfc5710b 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.3.56.0
+ 1.3.56.1
diff --git a/package-lock.json b/package-lock.json
index 4adf5740e99c..4a02bf202b4f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "1.3.56-0",
+ "version": "1.3.56-1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "1.3.56-0",
+ "version": "1.3.56-1",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index b68081c7f5e4..790ec0dc202c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.3.56-0",
+ "version": "1.3.56-1",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
From 5d3c0a415b367c3f05ff98331c8ca3047e451cc2 Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 17:18:08 -0700
Subject: [PATCH 196/201] Add some notes about secrets in GitHub Actions
---
.github/workflows/README.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.github/workflows/README.md b/.github/workflows/README.md
index 84b611120a6d..a4a243c2590d 100644
--- a/.github/workflows/README.md
+++ b/.github/workflows/README.md
@@ -104,6 +104,11 @@ The GitHub workflows require a large list of secrets to deploy, notify and test
1. `APPLE_DEMO_PASSWORD` - Demo account password used for https://appstoreconnect.apple.com/
1. `BROWSERSTACK` - Used to access Browserstack's API
+### Important note about Secrets
+Secrets are available by default in most workflows. The exception to the rule is callable workflows. If a workflow is triggered by the `workflow_call` event, it will only have access to repo secrets if the workflow that called it passed in the secrets explicitly (for example, using `secrets: inherit`).
+
+Furthermore, secrets are not accessible in actions. If you need to access a secret in an action, you must declare it as an input and pass it in. GitHub _should_ still obfuscate the value of the secret in workflow run logs.
+
## Actions
All these _workflows_ are comprised of atomic _actions_. Most of the time, we can use pre-made and independently maintained actions to create powerful workflows that meet our needs. However, when we want to do something very specific or have a more complex or robust action in mind, we can create our own _actions_.
From 1160d3c55f20c384ffdb428de8bc7f0503cba603 Mon Sep 17 00:00:00 2001
From: OSBotify
Date: Tue, 22 Aug 2023 00:35:36 +0000
Subject: [PATCH 197/201] Update version to 1.3.56-2
---
android/app/build.gradle | 4 ++--
ios/NewExpensify/Info.plist | 2 +-
ios/NewExpensifyTests/Info.plist | 2 +-
package-lock.json | 4 ++--
package.json | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 2c6bb6855c87..9addf15d1800 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001035601
- versionName "1.3.56-1"
+ versionCode 1001035602
+ versionName "1.3.56-2"
}
flavorDimensions "default"
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index 71068da0688e..56345160a3d8 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -40,7 +40,7 @@
CFBundleVersion
- 1.3.56.1
+ 1.3.56.2
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index ce5acfc5710b..e3ef8610f95b 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.3.56.1
+ 1.3.56.2
diff --git a/package-lock.json b/package-lock.json
index 4a02bf202b4f..41a6ad6ad40b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "1.3.56-1",
+ "version": "1.3.56-2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "1.3.56-1",
+ "version": "1.3.56-2",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index 790ec0dc202c..ee0862f65394 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.3.56-1",
+ "version": "1.3.56-2",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
From ad31b0281439507fbfd4784b1cdcab2ca336ff6b Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 20:33:56 -0700
Subject: [PATCH 198/201] Remove setup-mapbox from setupNode
---
.github/actions/composite/buildAndroidAPK/action.yml | 2 --
.github/actions/composite/setupNode/action.yml | 9 ---------
.github/workflows/README.md | 2 +-
.github/workflows/deployExpensifyHelp.yml | 2 --
.github/workflows/lint.yml | 2 --
.github/workflows/platformDeploy.yml | 10 ----------
.github/workflows/reassurePerformanceTests.yml | 2 --
.github/workflows/test.yml | 6 ------
.github/workflows/testBuild.yml | 8 --------
.github/workflows/typecheck.yml | 2 --
.github/workflows/validateDocsRoutes.yml | 2 --
.github/workflows/validateGithubActions.yml | 2 --
.github/workflows/verifyPodfile.yml | 2 --
13 files changed, 1 insertion(+), 50 deletions(-)
diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml
index 9a5da13ba54f..7a3913ed47c9 100644
--- a/.github/actions/composite/buildAndroidAPK/action.yml
+++ b/.github/actions/composite/buildAndroidAPK/action.yml
@@ -13,8 +13,6 @@ runs:
using: composite
steps:
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ inputs.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml
index 9d5141e367ea..6bdf500912c0 100644
--- a/.github/actions/composite/setupNode/action.yml
+++ b/.github/actions/composite/setupNode/action.yml
@@ -1,11 +1,6 @@
name: Set up Node
description: Set up Node
-inputs:
- MAPBOX_SDK_DOWNLOAD_TOKEN:
- description: Download token for the closed-source MapBox SDK.
- required: true
-
runs:
using: composite
steps:
@@ -29,10 +24,6 @@ runs:
path: desktop/node_modules
key: ${{ runner.os }}-desktop-node-modules-${{ hashFiles('desktop/package-lock.json') }}
- - name: Configure MapBox credentials to install closed-source SDK
- run: ./scripts/setup-mapbox-sdk.sh ${{ inputs.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- shell: bash
-
- name: Install root project node packages
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
diff --git a/.github/workflows/README.md b/.github/workflows/README.md
index a4a243c2590d..e1b1696411b1 100644
--- a/.github/workflows/README.md
+++ b/.github/workflows/README.md
@@ -149,4 +149,4 @@ In order to bundle actions with their dependencies into a single Node.js executa
Do not try to use a relative path.
- Confusingly, paths in action metadata files (`action.yml`) _must_ use relative paths.
- You can't use any dynamic values or environment variables in a `uses` statement
-- In general, it is a best practice to minimize any side-effects of each action. Using atomic ("dumb") actions that have a clear and simple purpose will promote reuse and make it easier to understand the workflows that use them.
\ No newline at end of file
+- In general, it is a best practice to minimize any side-effects of each action. Using atomic ("dumb") actions that have a clear and simple purpose will promote reuse and make it easier to understand the workflows that use them.
diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml
index 2fb606e4578c..ca7345ef9462 100644
--- a/.github/workflows/deployExpensifyHelp.yml
+++ b/.github/workflows/deployExpensifyHelp.yml
@@ -31,8 +31,6 @@ jobs:
- name: Setup NodeJS
uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Setup Pages
uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 0e7f85f1c37e..795271cab60a 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -14,8 +14,6 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Lint JavaScript with ESLint
run: npm run lint
diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml
index 1aba28b5d9df..2587d30477ae 100644
--- a/.github/workflows/platformDeploy.yml
+++ b/.github/workflows/platformDeploy.yml
@@ -37,8 +37,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
@@ -110,8 +108,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Decrypt Developer ID Certificate
run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg
@@ -149,8 +145,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
@@ -237,8 +231,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Setup Cloudflare CLI
run: pip3 install cloudflare
@@ -366,8 +358,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Set version
run: echo "VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV"
diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml
index c36a5b8de781..ab5e1d06e5a4 100644
--- a/.github/workflows/reassurePerformanceTests.yml
+++ b/.github/workflows/reassurePerformanceTests.yml
@@ -15,8 +15,6 @@ jobs:
- name: Setup NodeJS
uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Run performance testing script
shell: bash
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 58d042b66fc1..e79a02281ae0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,8 +21,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Get number of CPU cores
id: cpu-cores
@@ -46,8 +44,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Storybook run
run: npm run storybook -- --smoke-test --ci
@@ -60,8 +56,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Test CI git logic
run: tests/unit/CIGitLogicTest.sh
diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml
index f78b0710f5bd..728e2da0d474 100644
--- a/.github/workflows/testBuild.yml
+++ b/.github/workflows/testBuild.yml
@@ -81,8 +81,6 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
with:
@@ -141,8 +139,6 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Setup Xcode
run: sudo xcode-select -switch /Applications/Xcode_14.2.app
@@ -207,8 +203,6 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Decrypt Developer ID Certificate
run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg
@@ -250,8 +244,6 @@ jobs:
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Configure AWS Credentials
uses: Expensify/App/.github/actions/composite/configureAwsCredentials@main
diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml
index 36f4700a6c22..de433b2ae88a 100644
--- a/.github/workflows/typecheck.yml
+++ b/.github/workflows/typecheck.yml
@@ -14,8 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- name: Type check with TypeScript
run: npm run typecheck
diff --git a/.github/workflows/validateDocsRoutes.yml b/.github/workflows/validateDocsRoutes.yml
index 8a0a1a17aab1..717560e19f5f 100644
--- a/.github/workflows/validateDocsRoutes.yml
+++ b/.github/workflows/validateDocsRoutes.yml
@@ -14,8 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
# Verify that no new hubs were created without adding their metadata to _routes.yml
- name: Validate Docs Routes File
diff --git a/.github/workflows/validateGithubActions.yml b/.github/workflows/validateGithubActions.yml
index 74a4224566f6..f496c5e4b27e 100644
--- a/.github/workflows/validateGithubActions.yml
+++ b/.github/workflows/validateGithubActions.yml
@@ -15,8 +15,6 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
# Rebuild all the actions on this branch and check for a diff. Fail if there is one,
# because that would be a sign that the PR author did not rebuild the Github Actions
diff --git a/.github/workflows/verifyPodfile.yml b/.github/workflows/verifyPodfile.yml
index 94d85329d75e..64188769f0bd 100644
--- a/.github/workflows/verifyPodfile.yml
+++ b/.github/workflows/verifyPodfile.yml
@@ -17,7 +17,5 @@ jobs:
- uses: actions/checkout@v3
- uses: Expensify/App/.github/actions/composite/setupNode@main
- with:
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
- run: ./.github/scripts/verifyPodfile.sh
From 35943954a11d748ff216342989202b4c370fca4e Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 20:35:00 -0700
Subject: [PATCH 199/201] Remove MAPBOX_SDK_DOWNLOAD_TOKEN secret from
buildAndroidAPK
---
.github/actions/composite/buildAndroidAPK/action.yml | 3 ---
.github/workflows/e2ePerformanceTests.yml | 2 --
2 files changed, 5 deletions(-)
diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml
index 7a3913ed47c9..819234df0bc3 100644
--- a/.github/actions/composite/buildAndroidAPK/action.yml
+++ b/.github/actions/composite/buildAndroidAPK/action.yml
@@ -5,9 +5,6 @@ inputs:
ARTIFACT_NAME:
description: The name of the workflow artifact where the APK should be uploaded
required: true
- MAPBOX_SDK_DOWNLOAD_TOKEN:
- description: Download token for the closed-source MapBox SDK.
- required: true
runs:
using: composite
diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml
index 10d9862848a0..fe364b376e3b 100644
--- a/.github/workflows/e2ePerformanceTests.yml
+++ b/.github/workflows/e2ePerformanceTests.yml
@@ -51,7 +51,6 @@ jobs:
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
with:
ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }}
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
buildDelta:
runs-on: ubuntu-latest-xl
@@ -117,7 +116,6 @@ jobs:
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
with:
ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }}
- MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
runTestsInAWS:
runs-on: ubuntu-latest
From d3d59be887f1770e8ca30de2374913495e597894 Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 20:42:35 -0700
Subject: [PATCH 200/201] Configure MapBox SDK before any iOS or Android native
builds
---
.github/workflows/e2ePerformanceTests.yml | 6 ++++++
.github/workflows/platformDeploy.yml | 6 ++++++
.github/workflows/testBuild.yml | 6 ++++++
3 files changed, 18 insertions(+)
diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml
index fe364b376e3b..d8f9cad138d9 100644
--- a/.github/workflows/e2ePerformanceTests.yml
+++ b/.github/workflows/e2ePerformanceTests.yml
@@ -46,6 +46,9 @@ jobs:
git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1
git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }}
+ - name: Configure MapBox SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- name: Build APK
if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }}
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
@@ -112,6 +115,9 @@ jobs:
- name: Checkout "delta ref"
run: git checkout ${{ steps.getDeltaRef.outputs.DELTA_REF }}
+ - name: Configure MapBox SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- name: Build APK
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
with:
diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml
index 2587d30477ae..84f8373ff247 100644
--- a/.github/workflows/platformDeploy.yml
+++ b/.github/workflows/platformDeploy.yml
@@ -36,6 +36,9 @@ jobs:
steps:
- uses: actions/checkout@v3
+ - name: Configure MapBox SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- uses: Expensify/App/.github/actions/composite/setupNode@main
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
@@ -144,6 +147,9 @@ jobs:
steps:
- uses: actions/checkout@v3
+ - name: Configure MapBox SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- uses: Expensify/App/.github/actions/composite/setupNode@main
- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml
index 728e2da0d474..402708ab7880 100644
--- a/.github/workflows/testBuild.yml
+++ b/.github/workflows/testBuild.yml
@@ -103,6 +103,9 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ - name: Configure MapBox SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- name: Run Fastlane beta test
id: runFastlaneBetaTest
run: bundle exec fastlane android build_internal
@@ -171,6 +174,9 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ - name: Configure MapBox SDK
+ run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
+
- name: Run Fastlane
run: bundle exec fastlane ios build_internal
env:
From b6021614927248acf7a5d535c952dddb32bb58c0 Mon Sep 17 00:00:00 2001
From: rory
Date: Mon, 21 Aug 2023 20:52:32 -0700
Subject: [PATCH 201/201] Remove unnecessary secrets: inherit
---
.github/workflows/preDeploy.yml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml
index 3f162c807849..c9fb636238aa 100644
--- a/.github/workflows/preDeploy.yml
+++ b/.github/workflows/preDeploy.yml
@@ -7,15 +7,12 @@ on:
jobs:
typecheck:
uses: Expensify/App/.github/workflows/typecheck.yml@main
- secrets: inherit
lint:
uses: Expensify/App/.github/workflows/lint.yml@main
- secrets: inherit
test:
uses: Expensify/App/.github/workflows/test.yml@main
- secrets: inherit
confirmPassingBuild:
runs-on: ubuntu-latest