Skip to content

Commit

Permalink
Merge branch 'main' into fix/scroll-to-picker-regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Pader committed Jan 23, 2023
2 parents 27f5fea + fd5e781 commit 165af16
Show file tree
Hide file tree
Showing 50 changed files with 917 additions and 913 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001025701
versionName "1.2.57-1"
versionCode 1001025703
versionName "1.2.57-3"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.57.1</string>
<string>1.2.57.3</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.2.57.1</string>
<string>1.2.57.3</string>
</dict>
</plist>
32 changes: 16 additions & 16 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.2.57-1",
"version": "1.2.57-3",
"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 Expand Up @@ -79,7 +79,7 @@
"metro-config": "^0.71.3",
"moment": "^2.29.4",
"moment-timezone": "^0.5.31",
"onfido-sdk-ui": "^10.3.0",
"onfido-sdk-ui": "10.3.0",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"pusher-js": "^7.0.6",
Expand All @@ -100,7 +100,7 @@
"react-native-image-picker": "^4.10.2",
"react-native-image-size": "git+https://github.com/Expensify/react-native-image-size#6b5ab5110dc3ed554f8eafbc38d7d87c17147972",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.35",
"react-native-onyx": "1.0.36",
"react-native-pdf": "^6.6.2",
"react-native-performance": "^4.0.0",
"react-native-permissions": "^3.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ const CONST = {
DECIMAL_PAD: 'decimal-pad',
VISIBLE_PASSWORD: 'visible-password',
EMAIL_ADDRESS: 'email-address',
ASCII_CAPABLE: 'ascii-capable',
},

ATTACHMENT_SOURCE_ATTRIBUTE: 'data-expensify-source',
Expand Down
3 changes: 3 additions & 0 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export default {
// Plaid data (access tokens, bank accounts ...)
PLAID_DATA: 'plaidData',

// If we disabled Plaid because of too many attempts
IS_PLAID_DISABLED: 'isPlaidDisabled',

// Token needed to initialize Plaid link
PLAID_LINK_TOKEN: 'plaidLinkToken',

Expand Down
2 changes: 0 additions & 2 deletions src/components/AddPaymentMethodMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import withWindowDimensions from './withWindowDimensions';
import Permissions from '../libs/Permissions';
import PopoverMenu from './PopoverMenu';
import paypalMeDataPropTypes from './paypalMeDataPropTypes';
import * as BankAccounts from '../libs/actions/BankAccounts';

const propTypes = {
isVisible: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -50,7 +49,6 @@ const AddPaymentMethodMenu = props => (
text: props.translate('common.bankAccount'),
icon: Expensicons.Bank,
onSelected: () => {
BankAccounts.clearPlaid();
props.onItemSelected(CONST.PAYMENT_METHODS.BANK_ACCOUNT);
},
},
Expand Down
34 changes: 13 additions & 21 deletions src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
View,
} from 'react-native';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import Log from '../libs/Log';
import PlaidLink from './PlaidLink';
import * as BankAccounts from '../libs/actions/BankAccounts';
Expand All @@ -16,15 +16,15 @@ import themeColors from '../styles/themes/default';
import compose from '../libs/compose';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import Picker from './Picker';
import plaidDataPropTypes from '../pages/ReimbursementAccount/plaidDataPropTypes';
import {plaidDataPropTypes} from '../pages/ReimbursementAccount/plaidDataPropTypes';
import Text from './Text';
import getBankIcon from './Icon/BankIcons';
import Icon from './Icon';
import FullPageOfflineBlockingView from './BlockingViews/FullPageOfflineBlockingView';

const propTypes = {
/** Contains plaid data */
plaidData: plaidDataPropTypes,
plaidData: plaidDataPropTypes.isRequired,

/** Selected account ID from the Picker associated with the end of the Plaid flow */
selectedPlaidAccountID: PropTypes.string,
Expand Down Expand Up @@ -57,14 +57,6 @@ const propTypes = {
};

const defaultProps = {
plaidData: {
bankName: '',
plaidAccessToken: '',
bankAccounts: [],
isLoading: false,
error: '',
errors: {},
},
selectedPlaidAccountID: '',
plaidLinkToken: '',
onExitPlaid: () => {},
Expand All @@ -85,7 +77,9 @@ class AddPlaidBankAccount extends React.Component {

componentDidMount() {
// If we're coming from Plaid OAuth flow then we need to reuse the existing plaidLinkToken
if ((this.props.receivedRedirectURI && this.props.plaidLinkOAuthToken) || !_.isEmpty(this.props.plaidData)) {
if ((this.props.receivedRedirectURI && this.props.plaidLinkOAuthToken)
|| !_.isEmpty(lodashGet(this.props.plaidData, 'bankAccounts'))
|| !_.isEmpty(lodashGet(this.props.plaidData, 'errors'))) {
return;
}

Expand All @@ -106,20 +100,22 @@ class AddPlaidBankAccount extends React.Component {
}

render() {
const plaidBankAccounts = lodashGet(this.props.plaidData, 'bankAccounts', []);
const plaidBankAccounts = lodashGet(this.props.plaidData, 'bankAccounts') || [];
const token = this.getPlaidLinkToken();
const options = _.map(plaidBankAccounts, account => ({
value: account.plaidAccountID,
label: `${account.addressName} ${account.mask}`,
}));
const {icon, iconSize} = getBankIcon();
const plaidDataErrorMessage = !_.isEmpty(this.props.plaidData.errors) ? _.chain(this.props.plaidData.errors).values().first().value() : this.props.plaidData.error;
const plaidErrors = lodashGet(this.props.plaidData, 'errors');
const plaidDataErrorMessage = !_.isEmpty(plaidErrors) ? _.chain(plaidErrors).values().first().value() : '';
const bankName = lodashGet(this.props.plaidData, 'bankName');

// Plaid Link view
if (!plaidBankAccounts.length) {
return (
<FullPageOfflineBlockingView>
{this.props.plaidData.isLoading && (
{lodashGet(this.props.plaidData, 'isLoading') && (
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>
<ActivityIndicator color={themeColors.spinner} size="large" />
</View>
Expand All @@ -129,13 +125,12 @@ class AddPlaidBankAccount extends React.Component {
{plaidDataErrorMessage}
</Text>
)}
{Boolean(token) && (
{Boolean(token) && !bankName && (
<PlaidLink
token={token}
onSuccess={({publicToken, metadata}) => {
Log.info('[PlaidLink] Success!');
BankAccounts.openPlaidBankAccountSelector(publicToken, metadata.institution.name, this.props.allowDebit);
BankAccounts.updatePlaidData({institution: metadata.institution});
}}
onError={(error) => {
Log.hmmm('[PlaidLink] Error: ', error.message);
Expand Down Expand Up @@ -163,7 +158,7 @@ class AddPlaidBankAccount extends React.Component {
height={iconSize}
width={iconSize}
/>
<Text style={[styles.ml3, styles.textStrong]}>{this.props.plaidData.bankName}</Text>
<Text style={[styles.ml3, styles.textStrong]}>{bankName}</Text>
</View>
<View style={[styles.mb5]}>
<Picker
Expand All @@ -188,9 +183,6 @@ AddPlaidBankAccount.defaultProps = defaultProps;
export default compose(
withLocalize,
withOnyx({
plaidData: {
key: ONYXKEYS.PLAID_DATA,
},
plaidLinkToken: {
key: ONYXKEYS.PLAID_LINK_TOKEN,
initWithStoredValues: false,
Expand Down
14 changes: 7 additions & 7 deletions src/components/ButtonWithMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ButtonWithMenu extends PureComponent {
super(props);

this.state = {
selectedItem: props.options[0],
selectedItemIndex: 0,
isMenuVisible: false,
};
}
Expand All @@ -53,15 +53,15 @@ class ButtonWithMenu extends PureComponent {
}

render() {
const selectedItemText = this.state.selectedItem.text;
const selectedItem = this.props.options[this.state.selectedItemIndex];
return (
<View>
{this.props.options.length > 1 ? (
<ButtonWithDropdown
buttonText={selectedItemText}
buttonText={selectedItem.text}
isLoading={this.props.isLoading}
isDisabled={this.props.isDisabled}
onButtonPress={event => this.props.onPress(event, this.state.selectedItem.value)}
onButtonPress={event => this.props.onPress(event, selectedItem.value)}
onDropdownPress={() => {
this.setMenuVisibility(true);
}}
Expand All @@ -72,7 +72,7 @@ class ButtonWithMenu extends PureComponent {
isDisabled={this.props.isDisabled}
style={[styles.w100]}
isLoading={this.props.isLoading}
text={selectedItemText}
text={selectedItem.text}
onPress={event => this.props.onPress(event, this.props.options[0].value)}
pressOnEnter
/>
Expand All @@ -84,10 +84,10 @@ class ButtonWithMenu extends PureComponent {
onItemSelected={() => this.setMenuVisibility(false)}
anchorPosition={styles.createMenuPositionRightSidepane}
headerText={this.props.menuHeaderText}
menuItems={_.map(this.props.options, item => ({
menuItems={_.map(this.props.options, (item, index) => ({
...item,
onSelected: () => {
this.setState({selectedItem: item});
this.setState({selectedItemIndex: index});
},
}))}
/>
Expand Down
3 changes: 2 additions & 1 deletion src/components/DatePicker/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class DatePicker extends React.Component {
* @param {Event} event
*/
showPicker(event) {
this.initialValue = this.state.selectedDate;

// Opens the popover only after the keyboard is hidden to avoid a "blinking" effect where the keyboard was on iOS
// See https://github.com/Expensify/App/issues/14084 for more context
if (!this.props.isKeyboardShown) {
Expand All @@ -50,7 +52,6 @@ class DatePicker extends React.Component {
listener.remove();
});
Keyboard.dismiss();
this.initialValue = this.state.selectedDate;
event.preventDefault();
}

Expand Down
Loading

0 comments on commit 165af16

Please sign in to comment.