From 5d2a24b7e84b2b73899027c29bb09c874f166b85 Mon Sep 17 00:00:00 2001 From: OSBotify <76178356+OSBotify@users.noreply.github.com> Date: Wed, 17 May 2023 09:54:44 -0400 Subject: [PATCH 1/2] Merge pull request #19120 from Expensify/version-BUILD-DC3301C1-4BCA-4A9D-BDF0-81F706473E70 Update version to 1.3.15-4 on main (cherry picked from commit 02fff92ee5484d8699f3d6768fad324585177398) --- 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 8ea78e7305eb..bdebf6b1d808 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -106,8 +106,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001031503 - versionName "1.3.15-3" + versionCode 1001031504 + versionName "1.3.15-4" } splits { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index b4fcd5b54d35..1f4776747a50 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 1.3.15.3 + 1.3.15.4 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 3b59083fe517..1810dcb24c06 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.15.3 + 1.3.15.4 diff --git a/package-lock.json b/package-lock.json index 309b307a979d..d07b889eb123 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.15-3", + "version": "1.3.15-4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.15-3", + "version": "1.3.15-4", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 14d422c794cd..8e87cc27f499 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.15-3", + "version": "1.3.15-4", "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 242466d86c237c5b917c5e0cc01b84e1e95e7cc2 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 17 May 2023 07:44:33 -0600 Subject: [PATCH 2/2] Merge pull request #18695 from Expensify/marcaaron-isMoneyRequestThreadReport Show transaction amount & description in report header for "transaction thread" (cherry picked from commit b061397ba49db0f19a0c3beabbdfb1794b2312df) --- src/components/MoneyRequestHeader.js | 57 ++++++++++++++++++++++++---- src/libs/DateUtils.js | 14 +++++++ src/pages/home/ReportScreen.js | 7 +++- 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js index ac7908677d68..7e1685a4e8c8 100644 --- a/src/components/MoneyRequestHeader.js +++ b/src/components/MoneyRequestHeader.js @@ -2,6 +2,7 @@ import React from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; +import {withOnyx} from 'react-native-onyx'; import HeaderWithCloseButton from './HeaderWithCloseButton'; import iouReportPropTypes from '../pages/iouReportPropTypes'; import withLocalize, {withLocalizePropTypes} from './withLocalize'; @@ -19,11 +20,17 @@ import Navigation from '../libs/Navigation/Navigation'; import ROUTES from '../ROUTES'; import Icon from './Icon'; import * as CurrencyUtils from '../libs/CurrencyUtils'; +import MenuItemWithTopDescription from './MenuItemWithTopDescription'; +import DateUtils from '../libs/DateUtils'; +import ONYXKEYS from '../ONYXKEYS'; const propTypes = { /** The report currently being looked at */ report: iouReportPropTypes.isRequired, + /** The expense report or iou report (only will have a value if this is a transaction thread) */ + parentReport: iouReportPropTypes, + /** The policies which the user has access to and which the report could be tied to */ policies: PropTypes.shape({ /** Name of the policy */ @@ -41,16 +48,27 @@ const propTypes = { const defaultProps = { isSingleTransactionView: false, + parentReport: {}, }; const MoneyRequestHeader = (props) => { + // These are only used for the single transaction view and not "money requests" + const transactionAmount = lodashGet(props.parentReportAction, ['originalMessage', 'amount']); + const transactionCurrency = lodashGet(props.parentReportAction, ['originalMessage', 'currency']); + const transactionDescription = lodashGet(props.parentReportAction, ['originalMessage', 'comment']); + const formattedTransactionAmount = transactionAmount && transactionCurrency && CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency); + const transactionDate = lodashGet(props.parentReportAction, ['created']); + const formattedTransactionDate = DateUtils.getDateStringFromISOTimestamp(transactionDate); + const formattedAmount = CurrencyUtils.convertToDisplayString(ReportUtils.getMoneyRequestTotal(props.report), props.report.currency); - const isSettled = ReportUtils.isSettled(props.report.reportID); - const isExpenseReport = ReportUtils.isExpenseReport(props.report); - const payeeName = isExpenseReport ? ReportUtils.getPolicyName(props.report, props.policies) : ReportUtils.getDisplayNameForParticipant(props.report.managerEmail); + + const moneyRequestReport = props.isSingleTransactionView ? props.parentReport : props.report; + const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID); + const isExpenseReport = ReportUtils.isExpenseReport(moneyRequestReport); + const payeeName = isExpenseReport ? ReportUtils.getPolicyName(moneyRequestReport, props.policies) : ReportUtils.getDisplayNameForParticipant(moneyRequestReport.managerEmail); const payeeAvatar = isExpenseReport - ? ReportUtils.getWorkspaceAvatar(props.report) - : ReportUtils.getAvatar(lodashGet(props.personalDetails, [props.report.managerEmail, 'avatar']), props.report.managerEmail); + ? ReportUtils.getWorkspaceAvatar(moneyRequestReport) + : ReportUtils.getAvatar(lodashGet(props.personalDetails, [moneyRequestReport.managerEmail, 'avatar']), moneyRequestReport.managerEmail); return ( { }, ]} threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton} - report={props.report} + report={moneyRequestReport} policies={props.policies} personalDetails={props.personalDetails} shouldShowCloseButton={false} @@ -111,6 +129,23 @@ const MoneyRequestHeader = (props) => { + {props.isSingleTransactionView && ( + <> + + + + + )} ); }; @@ -119,4 +154,12 @@ MoneyRequestHeader.displayName = 'MoneyRequestHeader'; MoneyRequestHeader.propTypes = propTypes; MoneyRequestHeader.defaultProps = defaultProps; -export default compose(withWindowDimensions, withLocalize)(MoneyRequestHeader); +export default compose( + withWindowDimensions, + withLocalize, + withOnyx({ + parentReport: { + key: (props) => `${ONYXKEYS.COLLECTION.REPORT}${props.report.parentReportID}`, + }, + }), +)(MoneyRequestHeader); diff --git a/src/libs/DateUtils.js b/src/libs/DateUtils.js index 74a18a653ad8..7196a8f0a89e 100644 --- a/src/libs/DateUtils.js +++ b/src/libs/DateUtils.js @@ -192,6 +192,19 @@ function subtractMillisecondsFromDateTime(dateTime, milliseconds) { return getDBTime(newTimestamp); } +/** + * @param {string} isoTimestamp example: 2023-05-16 05:34:14.388 + * @returns {string} example: 2023-05-16 + */ +function getDateStringFromISOTimestamp(isoTimestamp) { + if (!isoTimestamp) { + return ''; + } + + const [dateString] = isoTimestamp.split(' '); + return dateString; +} + /** * @namespace DateUtils */ @@ -206,6 +219,7 @@ const DateUtils = { getMicroseconds, getDBTime, subtractMillisecondsFromDateTime, + getDateStringFromISOTimestamp, }; export default DateUtils; diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 5541f91a2575..680b3d9dd3d3 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -244,7 +244,8 @@ class ReportScreen extends React.Component { // the moment the ReportScreen becomes unfrozen we want to start the animation of the placeholder skeleton content // (which is shown, until all the actual views of the ReportScreen have been rendered) const shouldAnimate = !shouldFreeze; - + const parentReportAction = ReportActionsUtils.getParentReportAction(this.props.report); + const isSingleTransactionView = ReportActionsUtils.isTransactionThread(parentReportAction); return ( - {ReportUtils.isMoneyRequestReport(this.props.report) ? ( + {ReportUtils.isMoneyRequestReport(this.props.report) || isSingleTransactionView ? ( ) : (