Skip to content

Commit

Permalink
Merge pull request #5472 from Expensify/OSBotify-cherry-pick-staging-…
Browse files Browse the repository at this point in the history
…5186
  • Loading branch information
OSBotify authored Sep 23, 2021
2 parents bbb9bf3 + 903486a commit f0cad1b
Show file tree
Hide file tree
Showing 7 changed files with 29 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 @@ -150,8 +150,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001010107
versionName "1.1.1-7"
versionCode 1001010108
versionName "1.1.1-8"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.1.7</string>
<string>1.1.1.8</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.1.1.7</string>
<string>1.1.1.8</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": "new.expensify",
"version": "1.1.1-7",
"version": "1.1.1-8",
"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
24 changes: 12 additions & 12 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function goToWithdrawalAccountSetupStep(stepID, achData) {

// When going back to the BankAccountStep from the Company Step, show the manual form instead of Plaid
if (newACHData.currentStep === CONST.BANK_ACCOUNT.STEP.COMPANY && stepID === CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT) {
newACHData.subStep = 'manual';
newACHData.subStep = CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL;
}

Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {achData: {...newACHData, ...achData, currentStep: stepID}});
Expand Down Expand Up @@ -613,6 +613,15 @@ function showBankAccountFormValidationError(error) {
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {error});
}

/**
* Set the current sub step in first step of adding withdrawal bank account
*
* @param {String} subStep - One of {CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL, CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID, null}
*/
function setBankAccountSubStep(subStep) {
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {achData: {subStep}});
}

/**
* Create or update the bank account in db with the updated data.
*
Expand Down Expand Up @@ -652,18 +661,8 @@ function setupWithdrawalAccount(data) {
}

API.BankAccount_SetupWithdrawal(newACHData)
/* eslint-disable arrow-body-style */
.then((response) => {
// Without this block, we can call merge again with the achData before this merge finishes, resulting in
// the original achData overwriting the data we're trying to set here. With this block, we ensure that the
// newACHData is set in Onyx before we call merge on the reimbursementAccount key again.
return Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {
loading: false,
achData: {...newACHData},
})
.then(() => Promise.resolve(response));
})
.then((response) => {
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {loading: false, achData: {...newACHData}});
const currentStep = newACHData.currentStep;
let achData = lodashGet(response, 'achData', {});
let error = lodashGet(achData, CONST.BANK_ACCOUNT.VERIFICATIONS.ERROR_MESSAGE);
Expand Down Expand Up @@ -816,5 +815,6 @@ export {
showBankAccountFormValidationError,
setBankAccountFormValidationErrors,
setWorkspaceIDForReimbursementAccount,
setBankAccountSubStep,
updateReimbursementAccountDraft,
};
26 changes: 11 additions & 15 deletions src/pages/ReimbursementAccount/BankAccountStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Text from '../../components/Text';
import ExpensiTextInput from '../../components/ExpensiTextInput';
import {
setBankAccountFormValidationErrors,
setBankAccountSubStep,
setupWithdrawalAccount,
showBankAccountErrorModal,
updateReimbursementAccountDraft,
Expand Down Expand Up @@ -48,7 +49,6 @@ class BankAccountStep extends React.Component {
this.addPlaidAccount = this.addPlaidAccount.bind(this);
this.state = {
// One of CONST.BANK_ACCOUNT.SETUP_TYPE
bankAccountAddMethod: props.achData.subStep || undefined,
hasAcceptedTerms: ReimbursementAccountUtils.getDefaultStateForField(props, 'acceptTerms', true),
routingNumber: ReimbursementAccountUtils.getDefaultStateForField(props, 'routingNumber'),
accountNumber: ReimbursementAccountUtils.getDefaultStateForField(props, 'accountNumber'),
Expand Down Expand Up @@ -163,15 +163,16 @@ class BankAccountStep extends React.Component {
// Disable bank account fields once they've been added in db so they can't be changed
const isFromPlaid = this.props.achData.setupType === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID;
const shouldDisableInputs = Boolean(this.props.achData.bankAccountID) || isFromPlaid;
const subStep = this.props.achData.subStep;
return (
<View style={[styles.flex1, styles.justifyContentBetween]}>
<HeaderWithCloseButton
title={this.props.translate('bankAccount.addBankAccount')}
onCloseButtonPress={Navigation.dismissModal}
onBackButtonPress={() => this.setState({bankAccountAddMethod: undefined})}
shouldShowBackButton={!_.isUndefined(this.state.bankAccountAddMethod)}
onBackButtonPress={() => setBankAccountSubStep(null)}
shouldShowBackButton={Boolean(subStep)}
/>
{!this.state.bankAccountAddMethod && (
{!subStep && (
<>
<View style={[styles.flex1]}>
<Text style={[styles.mh5, styles.mb5]}>
Expand All @@ -180,9 +181,7 @@ class BankAccountStep extends React.Component {
<MenuItem
icon={Bank}
title={this.props.translate('bankAccount.logIntoYourBank')}
onPress={() => {
this.setState({bankAccountAddMethod: CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID});
}}
onPress={() => setBankAccountSubStep(CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID)}
disabled={this.props.isPlaidDisabled}
shouldShowRightIcon
/>
Expand All @@ -194,9 +193,7 @@ class BankAccountStep extends React.Component {
<MenuItem
icon={Paycheck}
title={this.props.translate('bankAccount.connectManually')}
onPress={() => {
this.setState({bankAccountAddMethod: CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL});
}}
onPress={() => setBankAccountSubStep(CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL)}
shouldShowRightIcon
/>
<View style={[styles.m5, styles.flexRow, styles.justifyContentBetween]}>
Expand All @@ -218,16 +215,15 @@ class BankAccountStep extends React.Component {
</View>
</>
)}
{this.state.bankAccountAddMethod === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID && (
{subStep === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID && (
<AddPlaidBankAccount
text={this.props.translate('bankAccount.plaidBodyCopy')}
onSubmit={this.addPlaidAccount}
onExitPlaid={() => {
this.setState({bankAccountAddMethod: undefined});
}}
onExitPlaid={() => setBankAccountSubStep(null)}

/>
)}
{this.state.bankAccountAddMethod === CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL && (
{subStep === CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL && (
<ReimbursementAccountForm
onSubmit={this.addManualAccount}
>
Expand Down

0 comments on commit f0cad1b

Please sign in to comment.