From 27bb3a269a34f60fd20cbf224e20278e62c820de Mon Sep 17 00:00:00 2001 From: OSBotify <76178356+OSBotify@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:31:16 -0700 Subject: [PATCH 1/2] Merge pull request #5470 from Expensify/version-BUILD-ce65a8d4d3fc51550d4d1f79e36d748dadc62214 (cherry picked from commit 17e1e73b93b7ae9f938bf5647a926b66ac3dd54f) --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 30f2d4fd20ba..6691e5f4c05e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 65fd3a6e423e..df6a67ed20e4 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -31,7 +31,7 @@ CFBundleVersion - 1.1.1.7 + 1.1.1.8 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index d4934e6da5f7..43162f27008c 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.1.1.7 + 1.1.1.8 diff --git a/package-lock.json b/package-lock.json index 778da9bb78d6..89776cbd574f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.1-7", + "version": "1.1.1-8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 24fe47831411..7c34dbf55b12 100644 --- a/package.json +++ b/package.json @@ -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.", From 903486a8f4182a8ee81a9ccd8a5f8cd08080a919 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Thu, 23 Sep 2021 11:28:54 -1000 Subject: [PATCH 2/2] Merge pull request #5186 from Expensify/aldo_fix-wrong-substep-after-error Return to the correct sub step in VBA flow after error in adding Bank Account manually (cherry picked from commit b05a7a782196ddf5758bea6f068b4f536879692c) --- src/libs/actions/BankAccounts.js | 24 ++++++++--------- .../ReimbursementAccount/BankAccountStep.js | 26 ++++++++----------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index 37e32c27ba23..f3dd96da68ff 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -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}}); @@ -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. * @@ -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); @@ -816,5 +815,6 @@ export { showBankAccountFormValidationError, setBankAccountFormValidationErrors, setWorkspaceIDForReimbursementAccount, + setBankAccountSubStep, updateReimbursementAccountDraft, }; diff --git a/src/pages/ReimbursementAccount/BankAccountStep.js b/src/pages/ReimbursementAccount/BankAccountStep.js index 9db7b5b27ffc..70e2896bb8c4 100644 --- a/src/pages/ReimbursementAccount/BankAccountStep.js +++ b/src/pages/ReimbursementAccount/BankAccountStep.js @@ -21,6 +21,7 @@ import Text from '../../components/Text'; import ExpensiTextInput from '../../components/ExpensiTextInput'; import { setBankAccountFormValidationErrors, + setBankAccountSubStep, setupWithdrawalAccount, showBankAccountErrorModal, updateReimbursementAccountDraft, @@ -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'), @@ -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 ( this.setState({bankAccountAddMethod: undefined})} - shouldShowBackButton={!_.isUndefined(this.state.bankAccountAddMethod)} + onBackButtonPress={() => setBankAccountSubStep(null)} + shouldShowBackButton={Boolean(subStep)} /> - {!this.state.bankAccountAddMethod && ( + {!subStep && ( <> @@ -180,9 +181,7 @@ class BankAccountStep extends React.Component { { - this.setState({bankAccountAddMethod: CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID}); - }} + onPress={() => setBankAccountSubStep(CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID)} disabled={this.props.isPlaidDisabled} shouldShowRightIcon /> @@ -194,9 +193,7 @@ class BankAccountStep extends React.Component { { - this.setState({bankAccountAddMethod: CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL}); - }} + onPress={() => setBankAccountSubStep(CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL)} shouldShowRightIcon /> @@ -218,16 +215,15 @@ class BankAccountStep extends React.Component { )} - {this.state.bankAccountAddMethod === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID && ( + {subStep === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID && ( { - this.setState({bankAccountAddMethod: undefined}); - }} + onExitPlaid={() => setBankAccountSubStep(null)} + /> )} - {this.state.bankAccountAddMethod === CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL && ( + {subStep === CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL && (