Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Expensify/Expensify.cash into edited
Browse files Browse the repository at this point in the history
  • Loading branch information
parasharrajat committed Jun 8, 2021
2 parents ddeb44d + 350991b commit acf77af
Show file tree
Hide file tree
Showing 20 changed files with 205 additions and 118 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 1001006402
versionName "1.0.64-2"
versionCode 1001006500
versionName "1.0.65-0"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const mainWindow = (() => {
ipcMain.on(ELECTRON_EVENTS.REQUEST_VISIBILITY, (event) => {
// This is how synchronous messages work in Electron
// eslint-disable-next-line no-param-reassign
event.returnValue = browserWindow && browserWindow.isFocused();
event.returnValue = browserWindow && !browserWindow.isDestroyed() && browserWindow.isFocused();
});

// This allows the renderer process to bring the app
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.64</string>
<string>1.0.65</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.64.2</string>
<string>1.0.65.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.64</string>
<string>1.0.65</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.64.2</string>
<string>1.0.65.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.64-2",
"version": "1.0.65-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
30 changes: 6 additions & 24 deletions src/components/ReportActionItemIOUAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ReportActionItemIOUQuote from './ReportActionItemIOUQuote';
import ReportActionPropTypes from '../pages/home/report/ReportActionPropTypes';
import ReportActionItemIOUPreview from './ReportActionItemIOUPreview';
import Navigation from '../libs/Navigation/Navigation';
import compose from '../libs/compose';
import ROUTES from '../ROUTES';

const propTypes = {
Expand All @@ -25,25 +24,17 @@ const propTypes = {
/** The participants of this report */
participants: PropTypes.arrayOf(PropTypes.string),
}),

/** iouReport associated with this iouAction */
iouReport: PropTypes.shape({
/** Does the iouReport have an outstanding IOU? */
hasOutstandingIOU: PropTypes.bool,
}),
};

const defaultProps = {
chatReport: {
participants: [],
},
iouReport: {},
};

const ReportActionItemIOUAction = ({
action,
chatReportID,
iouReport,
isMostRecentIOUReportAction,
}) => {
const launchDetailsModal = () => {
Expand All @@ -56,9 +47,7 @@ const ReportActionItemIOUAction = ({
shouldShowViewDetailsLink={Boolean(action.originalMessage.IOUReportID)}
onViewDetailsPressed={launchDetailsModal}
/>
{isMostRecentIOUReportAction
&& iouReport.hasOutstandingIOU
&& Boolean(action.originalMessage.IOUReportID) && (
{isMostRecentIOUReportAction && Boolean(action.originalMessage.IOUReportID) && (
<ReportActionItemIOUPreview
iouReportID={action.originalMessage.IOUReportID}
chatReportID={chatReportID}
Expand All @@ -73,15 +62,8 @@ ReportActionItemIOUAction.propTypes = propTypes;
ReportActionItemIOUAction.defaultProps = defaultProps;
ReportActionItemIOUAction.displayName = 'ReportActionItemIOUAction';

export default compose(
withOnyx({
chatReport: {
key: ({chatReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`,
},
}),
withOnyx({
iouReport: {
key: ({chatReport}) => `${ONYXKEYS.COLLECTION.REPORT_IOUS}${chatReport.iouReportID}`,
},
}),
)(ReportActionItemIOUAction);
export default withOnyx({
chatReport: {
key: ({chatReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`,
},
})(ReportActionItemIOUAction);
13 changes: 12 additions & 1 deletion src/components/ReportActionItemIOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import withLocalize, {withLocalizePropTypes} from './withLocalize';
import {fetchIOUReportByID} from '../libs/actions/Report';
import themeColors from '../styles/themes/default';
import Icon from './Icon';
import CONST from '../CONST';
import {Checkmark} from './Icon/Expensicons';

const propTypes = {
Expand Down Expand Up @@ -82,6 +83,14 @@ const ReportActionItemIOUPreview = ({
onPayButtonPressed,
translate,
}) => {
// Usually the parent determines whether the IOU Preview is displayed. But as the iouReport total cannot be known
// until it is stored locally, we need to make this check within the Component after retrieving it. This allows us
// to handle the loading UI from within this Component instead of needing to declare it within each parent, which
// would duplicate and complicate the logic
if (iouReport.total === 0) {
return null;
}

const sessionEmail = lodashGet(session, 'email', null);
const managerEmail = iouReport.managerEmail || '';
const ownerEmail = iouReport.ownerEmail || '';
Expand Down Expand Up @@ -131,7 +140,9 @@ const ReportActionItemIOUPreview = ({
? translate('iou.owes', {manager: managerName, owner: ownerName})
: translate('iou.paid', {manager: managerName, owner: ownerName})}
</Text>
{(isCurrentUserManager && !shouldHidePayButton && (
{(isCurrentUserManager
&& !shouldHidePayButton
&& iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (
<TouchableOpacity
style={[styles.buttonSmall, styles.buttonSuccess, styles.mt4]}
onPress={onPayButtonPressed}
Expand Down
81 changes: 81 additions & 0 deletions src/components/TextInputFocusable/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React from 'react';
import {TextInput} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
import themeColors from '../../styles/themes/default';

/**
* On native layers we like to have the Text Input not focused so the user can read new chats without they keyboard in
* the way of the view
* On Android, the selection prop is required on the TextInput but this prop has issues on IOS
* https://github.com/facebook/react-native/issues/29063
*/

const propTypes = {
/** If the input should clear, it actually gets intercepted instead of .clear() */
shouldClear: PropTypes.bool,

/** A ref to forward to the text input */
forwardedRef: PropTypes.func,

/** When the input has cleared whoever owns this input should know about it */
onClear: PropTypes.func,

/** Set focus to this component the first time it renders.
* Override this in case you need to set focus on one field out of many, or when you want to disable autoFocus */
autoFocus: PropTypes.bool,

/** Prevent edits and interactions like focus for this input. */
isDisabled: PropTypes.bool,

};

const defaultProps = {
shouldClear: false,
onClear: () => {},
autoFocus: false,
isDisabled: false,
forwardedRef: null,
};

class TextInputFocusable extends React.Component {
componentDidMount() {
// This callback prop is used by the parent component using the constructor to
// get a ref to the inner textInput element e.g. if we do
// <constructor ref={el => this.textInput = el} /> this will not
// return a ref to the component, but rather the HTML element by default
if (this.props.forwardedRef && _.isFunction(this.props.forwardedRef)) {
this.props.forwardedRef(this.textInput);
}
}

componentDidUpdate(prevProps) {
if (!prevProps.shouldClear && this.props.shouldClear) {
this.textInput.clear();
this.props.onClear();
}
}

render() {
return (
<TextInput
placeholderTextColor={themeColors.placeholderText}
ref={el => this.textInput = el}
maxHeight={116}
rejectResponderTermination={false}
editable={!this.props.isDisabled}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...this.props}
/>
);
}
}

TextInputFocusable.displayName = 'TextInputFocusable';
TextInputFocusable.propTypes = propTypes;
TextInputFocusable.defaultProps = defaultProps;

export default React.forwardRef((props, ref) => (
/* eslint-disable-next-line react/jsx-props-no-spreading */
<TextInputFocusable {...props} forwardedRef={ref} />
));
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import themeColors from '../../styles/themes/default';
/**
* On native layers we like to have the Text Input not focused so the user can read new chats without they keyboard in
* the way of the view
* On Android, the selection prop is required on the TextInput but this prop has issues on IOS
* https://github.com/facebook/react-native/issues/29063
*/

const propTypes = {
Expand Down
8 changes: 5 additions & 3 deletions src/components/TextLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ const TextLink = (props) => {
const additionalStyles = _.isArray(props.style) ? props.style : [props.style];
return (
<Pressable
style={additionalStyles}
onPress={() => {
onPress={(e) => {
e.preventDefault();
openURLInNewTab(props.href);
}}
accessibilityRole="link"
href={props.href}
>
{({hovered, pressed}) => (
<Text style={[styles.link, (hovered || pressed) ? styles.linkHovered : undefined]}>
<Text style={[additionalStyles, styles.link, (hovered || pressed) ? styles.linkHovered : undefined]}>
{props.children}
</Text>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function getIOUReportsForNewTransaction(requestParams) {
/**
* Creates IOUSplit Transaction
* @param {Object} params
* @param {String} params.amount
* @param {Number} params.amount
* @param {String} params.comment
* @param {String} params.currency
* @param {String} params.debtorEmail
Expand All @@ -86,7 +86,7 @@ function createIOUTransaction(params) {
* @param {Object} params
* @param {Array} params.splits
* @param {String} params.comment
* @param {String} params.amount
* @param {Number} params.amount
* @param {String} params.currency
*/
function createIOUSplit(params) {
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class ReportActionCompose extends React.Component {
* @param {String} newComment
*/
updateComment(newComment) {
this.textInput.setNativeProps({text: newComment});
this.setState({
isCommentEmpty: newComment.length === 0,
});
Expand Down
25 changes: 23 additions & 2 deletions src/pages/home/report/ReportActionContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ReportActionContextMenu extends React.Component {
this.confirmDeleteAndHideModal = this.confirmDeleteAndHideModal.bind(this);
this.hideDeleteConfirmModal = this.hideDeleteConfirmModal.bind(this);
this.getActionText = this.getActionText.bind(this);
this.hidePopover = this.hidePopover.bind(this);

// A list of all the context actions in this menu.
this.contextActions = [
Expand All @@ -86,6 +87,7 @@ class ReportActionContextMenu extends React.Component {
} else {
Clipboard.setString(html);
}
this.hidePopover(true);
},
},

Expand All @@ -104,6 +106,7 @@ class ReportActionContextMenu extends React.Component {
onPress: () => {
updateLastReadActionID(this.props.reportID, this.props.reportAction.sequenceNumber);
setNewMarkerPosition(this.props.reportID, this.props.reportAction.sequenceNumber);
this.hidePopover(true);
},
},

Expand All @@ -112,7 +115,7 @@ class ReportActionContextMenu extends React.Component {
icon: Pencil,
shouldShow: () => canEditReportAction(this.props.reportAction),
onPress: () => {
this.props.hidePopover();
this.hidePopover();
saveReportActionDraft(
this.props.reportID,
this.props.reportAction.reportActionID,
Expand All @@ -124,7 +127,9 @@ class ReportActionContextMenu extends React.Component {
text: this.props.translate('reportActionContextMenu.deleteComment'),
icon: Trashcan,
shouldShow: () => canEditReportAction(this.props.reportAction),
onPress: () => this.setState({isDeleteCommentConfirmModalVisible: true}),
onPress: () => {
this.setState({isDeleteCommentConfirmModalVisible: true});
},
},
];

Expand All @@ -148,10 +153,26 @@ class ReportActionContextMenu extends React.Component {
confirmDeleteAndHideModal() {
deleteReportComment(this.props.reportID, this.props.reportAction);
this.setState({isDeleteCommentConfirmModalVisible: false});
this.hidePopover();
}

hideDeleteConfirmModal() {
this.setState({isDeleteCommentConfirmModalVisible: false});
this.hidePopover();
}

/**
* Hides the popover menu with an optional delay
*
* @param {Boolean} shouldDelay whether the menu should close after a delay
* @memberof ReportActionContextMenu
*/
hidePopover(shouldDelay) {
if (!shouldDelay) {
this.props.hidePopover();
return;
}
setTimeout(this.props.hidePopover, 800);
}

render() {
Expand Down
14 changes: 6 additions & 8 deletions src/pages/iou/IOUDetailsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,12 @@ class IOUDetailsModal extends Component {
{reportIsLoading ? <ActivityIndicator color={themeColors.text} /> : (
<View style={[styles.flex1, styles.justifyContentBetween]}>
<ScrollView contentContainerStyle={styles.iouDetailsContainer}>
{(this.props.iouReport.hasOutstandingIOU) && (
<ReportActionItemIOUPreview
iou={this.props.iouReport}
chatReportID={Number(this.props.route.params.chatReportID)}
iouReportID={Number(this.props.route.params.iouReportID)}
shouldHidePayButton
/>
)}
<ReportActionItemIOUPreview
iou={this.props.iouReport}
chatReportID={Number(this.props.route.params.chatReportID)}
iouReportID={Number(this.props.route.params.iouReportID)}
shouldHidePayButton
/>
<IOUTransactions
chatReportID={Number(this.props.route.params.chatReportID)}
iouReportID={Number(this.props.route.params.iouReportID)}
Expand Down
Loading

0 comments on commit acf77af

Please sign in to comment.