Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed Sep 3, 2023
2 parents ac08f33 + 2fbe81d commit 4304851
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 33 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001036201
versionName "1.3.62-1"
versionCode 1001036202
versionName "1.3.62-2"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.62.1</string>
<string>1.3.62.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.62.1</string>
<string>1.3.62.2</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.62-1",
"version": "1.3.62-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.",
Expand Down
1 change: 0 additions & 1 deletion src/components/DistanceRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken})
success
style={[styles.w100, styles.mb4, styles.ph4, styles.flexShrink0]}
onPress={() => IOU.navigateToNextPage(iou, iouType, reportID, report)}
pressOnEnter
isDisabled={_.keys(validatedWaypoints).length < 2}
text={translate('common.next')}
/>
Expand Down
11 changes: 10 additions & 1 deletion src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ function MoneyRequestConfirmationList(props) {
return [...selectedParticipants, OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(payeePersonalDetails)];
}, [selectedParticipants, props.hasMultipleParticipants, payeePersonalDetails]);

const distanceMerchant = useMemo(() => DistanceRequestUtils.getDistanceMerchant(distance, unit, rate, currency, translate), [distance, unit, rate, currency, translate]);

useEffect(() => {
if (!props.isDistanceRequest) {
return;
}
IOU.setMoneyRequestMerchant(distanceMerchant);
}, [distanceMerchant, props.isDistanceRequest]);

/**
* @param {Object} option
*/
Expand Down Expand Up @@ -457,7 +466,7 @@ function MoneyRequestConfirmationList(props) {
{props.isDistanceRequest ? (
<MenuItemWithTopDescription
shouldShowRightIcon={!props.isReadOnly && isTypeRequest}
title={DistanceRequestUtils.getDistanceMerchant(distance, unit, rate, currency, translate)}
title={distanceMerchant}
description={translate('common.distance')}
style={[styles.moneyRequestMenuItem, styles.mb2]}
titleStyle={styles.flex1}
Expand Down
6 changes: 5 additions & 1 deletion src/components/TabSelector/TabSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ function TabSelector({state, navigation, onTabPress, position}) {
const isFocused = index === state.index;

const onPress = () => {
if (isFocused) {
return;
}

const event = navigation.emit({
type: 'tabPress',
target: route.key,
canPreventDefault: true,
});

if (!isFocused && !event.defaultPrevented) {
if (!event.defaultPrevented) {
// The `merge: true` option makes sure that the params inside the tab screen are preserved
navigation.navigate({name: route.name, merge: true});
}
Expand Down
35 changes: 19 additions & 16 deletions src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@ function getCreated(transaction) {
return '';
}

/*
* @param {Object} transaction
* @param {Object} transaction.comment
* @param {String} transaction.comment.type
* @param {Object} [transaction.comment.customUnit]
* @param {String} [transaction.comment.customUnit.name]
* @returns {Boolean}
*/
function isDistanceRequest(transaction) {
const type = lodashGet(transaction, 'comment.type');
const customUnitName = lodashGet(transaction, 'comment.customUnit.name');
return type === CONST.TRANSACTION.TYPE.CUSTOM_UNIT && customUnitName === CONST.CUSTOM_UNITS.NAME_DISTANCE;
}

function isReceiptBeingScanned(transaction) {
return _.contains([CONST.IOU.RECEIPT_STATE.SCANREADY, CONST.IOU.RECEIPT_STATE.SCANNING], transaction.receipt.state);
}
Expand All @@ -248,7 +262,7 @@ function isReceiptBeingScanned(transaction) {
* @returns {Boolean}
*/
function hasMissingSmartscanFields(transaction) {
return hasReceipt(transaction) && !isReceiptBeingScanned(transaction) && !areModifiedFieldsPopulated(transaction);
return hasReceipt(transaction) && !isDistanceRequest(transaction) && !isReceiptBeingScanned(transaction) && !areModifiedFieldsPopulated(transaction);
}

/**
Expand All @@ -264,7 +278,10 @@ function getLinkedTransaction(reportAction = {}) {
}

function getAllReportTransactions(reportID) {
return _.filter(allTransactions, (transaction) => transaction.reportID === reportID);
// `reportID` from the `/CreateDistanceRequest` endpoint return's number instead of string for created `transaction`.
// For reference, https://github.com/Expensify/App/pull/26536#issuecomment-1703573277.
// We will update this in a follow-up Issue. According to this comment: https://github.com/Expensify/App/pull/26536#issuecomment-1703591019.
return _.filter(allTransactions, (transaction) => `${transaction.reportID}` === `${reportID}`);
}

/**
Expand Down Expand Up @@ -308,20 +325,6 @@ function getValidWaypoints(waypoints, reArrangeIndexes = false) {
return validWaypoints;
}

/*
* @param {Object} transaction
* @param {Object} transaction.comment
* @param {String} transaction.comment.type
* @param {Object} [transaction.comment.customUnit]
* @param {String} [transaction.comment.customUnit.name]
* @returns {Boolean}
*/
function isDistanceRequest(transaction) {
const type = lodashGet(transaction, 'comment.type');
const customUnitName = lodashGet(transaction, 'comment.customUnit.name');
return type === CONST.TRANSACTION.TYPE.CUSTOM_UNIT && customUnitName === CONST.CUSTOM_UNITS.NAME_DISTANCE;
}

export {
buildOptimisticTransaction,
getUpdatedTransaction,
Expand Down
11 changes: 7 additions & 4 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,19 @@ function getMoneyRequestInformation(
* @param {String} comment
* @param {String} created
* @param {String} [transactionID]
* @param {Number} amount
* @param {String} currency
* @param {String} merchant
*/
function createDistanceRequest(report, participant, comment, created, transactionID) {
function createDistanceRequest(report, participant, comment, created, transactionID, amount, currency, merchant) {
const {iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation(
report,
participant,
comment,
0,
'USD',
amount,
currency,
created,
'',
merchant,
null,
null,
null,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function IOUCurrencySelection(props) {
if (_.isEmpty(backTo) || props.navigation.getState().routes.length === 1) {
Navigation.goBack();
} else {
Navigation.goBack(`${props.route.params.backTo}?currency=${option.currencyCode}`, true);
Navigation.navigate(`${props.route.params.backTo}?currency=${option.currencyCode}`);
}
},
[props.route, props.navigation],
Expand Down
13 changes: 11 additions & 2 deletions src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,18 @@ function MoneyRequestConfirmPage(props) {
*/
const createDistanceRequest = useCallback(
(selectedParticipants, trimmedComment) => {
IOU.createDistanceRequest(props.report, selectedParticipants[0], trimmedComment, props.iou.created, props.iou.transactionID);
IOU.createDistanceRequest(
props.report,
selectedParticipants[0],
trimmedComment,
props.iou.created,
props.iou.transactionID,
props.iou.amount,
props.iou.currency,
props.iou.merchant,
);
},
[props.report, props.iou.created, props.iou.transactionID],
[props.report, props.iou.created, props.iou.transactionID, props.iou.amount, props.iou.currency, props.iou.merchant],
);

const createTransaction = useCallback(
Expand Down

0 comments on commit 4304851

Please sign in to comment.