Skip to content

Commit

Permalink
Merge pull request #3132 from Expensify/main
Browse files Browse the repository at this point in the history
  • Loading branch information
OSBotify authored May 25, 2021
2 parents a5f9d38 + 7980fe0 commit ebaf800
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 85 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001005206
versionName "1.0.52-6"
versionCode 1001005300
versionName "1.0.53-0"
}
splits {
abi {
Expand Down
4 changes: 2 additions & 2 deletions ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.52</string>
<string>1.0.53</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.52.6</string>
<string>1.0.53.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/ExpensifyCashTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.52</string>
<string>1.0.53</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.52.6</string>
<string>1.0.53.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion 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": "expensify.cash",
"version": "1.0.52-6",
"version": "1.0.53-0",
"author": "Expensify, Inc.",
"homepage": "https://expensify.cash",
"description": "Expensify.cash is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
5 changes: 0 additions & 5 deletions src/pages/iou/IOUDetailsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import ScreenWrapper from '../../components/ScreenWrapper';
import {payIOUReport} from '../../libs/actions/IOU';
import {fetchIOUReportByID} from '../../libs/actions/Report';
import ReportActionItemIOUPreview from '../../components/ReportActionItemIOUPreview';
import iouTransactionPropTypes from './iouTransactionPropTypes';
import IOUTransactions from './IOUTransactions';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import compose from '../../libs/compose';
Expand Down Expand Up @@ -53,9 +52,6 @@ const propTypes = {
/** Owner is the person who is owed money */
ownerEmail: PropTypes.string,

/** The IOU transactions */
transactions: PropTypes.arrayOf(PropTypes.shape(iouTransactionPropTypes)),

/** Does the report have an outstanding IOU that needs to be paid? */
hasOutstandingIOU: PropTypes.bool,
}).isRequired,
Expand Down Expand Up @@ -116,7 +112,6 @@ class IOUDetailsModal extends Component {
<IOUTransactions
chatReportID={Number(this.props.route.params.chatReportID)}
iouReportID={Number(this.props.route.params.iouReportID)}
transactions={this.props.iouReport.transactions}
hasOutstandingIOU={this.props.iouReport.hasOutstandingIOU}
/>
</ScrollView>
Expand Down
75 changes: 21 additions & 54 deletions src/pages/iou/IOUTransactions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, {Component} from 'react';
import React from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import PropTypes from 'prop-types';
import styles from '../../styles/styles';
import ONYXKEYS from '../../ONYXKEYS';
import ReportActionPropTypes from '../home/report/ReportActionPropTypes';
import iouTransactionPropTypes from './iouTransactionPropTypes';
import ReportTransaction from '../../components/ReportTransaction';

const propTypes = {
Expand All @@ -18,65 +17,33 @@ const propTypes = {

/** ReportID for the associated IOU report */
iouReportID: PropTypes.number.isRequired,

/** Transactions for this IOU report */
transactions: PropTypes.arrayOf(PropTypes.shape(iouTransactionPropTypes)),
};

const defaultProps = {
reportActions: {},
transactions: [],
};

class IOUTransactions extends Component {
constructor(props) {
super(props);

this.getActionForTransaction = this.getActionForTransaction.bind(this);
}

/**
* Given a transaction from an IOU Report, returns the chatReport action with a matching transactionID. Unless
* something has gone wrong with our storing logic, there should always exist an action for each transaction.
*
* @param {Object} transaction
* @returns {Object} action
*/
getActionForTransaction(transaction) {
const matchedAction = _.find(this.props.reportActions, (action) => {
// iouReport.transaction.transactionID is returned as a String, but the originalMessage value is Number
if (action && action.originalMessage && action.originalMessage.IOUTransactionID
&& action.originalMessage.IOUTransactionID.toString() === transaction.transactionID) {
return action;
const IOUTransactions = ({
reportActions,
chatReportID,
iouReportID,
}) => (
<View style={[styles.mt3]}>
{_.map(reportActions, (reportAction) => {
if (reportAction.actionName === 'IOU'
&& reportAction.originalMessage.IOUReportID === iouReportID) {
return (
<ReportTransaction
chatReportID={chatReportID}
iouReportID={iouReportID}
action={reportAction}
key={reportAction.sequenceNumber}
/>
);
}
return false;
});
if (!matchedAction) {
throw new Error(`Unable to locate a matching report action for transaction ${transaction.transactionID}!`);
}

return matchedAction;
}

render() {
return (
<View style={[styles.mt3]}>
{/* For each IOU transaction, get the matching report action */}
{_.map(this.props.transactions, (transaction) => {
const action = this.getActionForTransaction(transaction);
return (
<ReportTransaction
chatReportID={this.props.chatReportID}
iouReportID={this.props.iouReportID}
action={action}
key={action.originalMessage.IOUTransactionID}
/>
);
})}
</View>
);
}
}
})}
</View>
);

IOUTransactions.defaultProps = defaultProps;
IOUTransactions.propTypes = propTypes;
Expand Down
18 changes: 0 additions & 18 deletions src/pages/iou/iouTransactionPropTypes.js

This file was deleted.

0 comments on commit ebaf800

Please sign in to comment.