Skip to content

Commit

Permalink
Merge pull request #5141 from Expensify/amal-workspace-card-open
Browse files Browse the repository at this point in the history
Automatically open bank setup modal if user has incomplete bank setup
  • Loading branch information
Chris Kosuke Tseng authored Sep 10, 2021
2 parents 3f5f90d + 1a5477f commit 6cdfd4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/workspace/WorkspaceCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,19 @@ const WorkspaceCardPage = ({
const isNotAutoProvisioned = !user.isUsingExpensifyCard
&& lodashGet(reimbursementAccount, 'achData.state', '') === BankAccount.STATE.OPEN;
let buttonText;

const openBankSetupModal = () => {
setWorkspaceIDForReimbursementAccount(route.params.policyID);
Navigation.navigate(ROUTES.getBankAccountRoute());
};

if (user.isFromPublicDomain) {
buttonText = translate('workspace.card.addEmail');
} else if (user.isUsingExpensifyCard) {
buttonText = translate('workspace.card.manageCards');
} else if (isVerifying || isPending || isNotAutoProvisioned) {
buttonText = translate('workspace.card.finishSetup');
openBankSetupModal();
} else {
buttonText = translate('workspace.card.getStarted');
}
Expand All @@ -106,8 +113,7 @@ const WorkspaceCardPage = ({
} else if (user.isUsingExpensifyCard) {
openSignedInLink(CONST.MANAGE_CARDS_URL);
} else {
setWorkspaceIDForReimbursementAccount(route.params.policyID);
Navigation.navigate(ROUTES.getBankAccountRoute());
openBankSetupModal();
}
};

Expand Down

0 comments on commit 6cdfd4b

Please sign in to comment.