-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[$250] We show wallet balance badge even for those who haven't enabled Expensify wallet #61248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Triggered auto assignment to @JmillsExpensify ( |
![]() 🚨 Edited by proposal-police: This proposal was edited at 2025-05-01 15:22:17 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.We show wallet balance badge even for those who haven't enabled Expensify wallet What is the root cause of that problem?We show the balance regardless of it beeing enabled or disabled App/src/pages/settings/Wallet/WalletPage/WalletPage.tsx Lines 493 to 502 in 61274d4
What changes do you think we should make in order to solve the problem?We should add condition to only show when the wallet is enabled App/src/pages/settings/Wallet/WalletPage/WalletPage.tsx Lines 493 to 502 in 61274d4
use condition {shouldShowLoadingSpinner ? (
<ActivityIndicator
color={theme.spinner}
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
style={[styles.mt7, styles.mb5]}
/>
) : hasActivatedWallet ? (
<OfflineWithFeedback
pendingAction={CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}
errors={walletTerms?.errors}
onClose={clearWalletTermsError}
errorRowStyles={[styles.ml10, styles.mr2]}
style={[styles.mt4, styles.mb2]}
>
<MenuItemWithTopDescription
description={translate('walletPage.balance')}
title={convertToDisplayString(userWallet?.currentBalance ?? 0)}
titleStyle={styles.textHeadlineH2}
interactive={false}
wrapperStyle={styles.sectionMenuItemTopDescription}
copyValue={convertToDisplayString(userWallet?.currentBalance ?? 0)}
/>
</OfflineWithFeedback>
) : null} Also we need to update the initial settings page to not show the balance until the card is in active state:
const hasActivatedWallet = ([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM] as string[]).includes(userWallet?.tierName ?? '');
badgeText={hasActivatedWallet ? item.badgeText ?? getWalletBalance(isPaymentItem) : undefined} What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?N/A What alternative solutions did you explore? (Optional)N/A ![]() |
ProposalPlease re-state the problem that we are trying to solve in this issue.We show wallet balance badge even for those who haven't enabled Expensify wallet What is the root cause of that problem?We always show the balance badge What changes do you think we should make in order to solve the problem?We should pass undefined to
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?None What alternative solutions did you explore? (Optional)N/A |
ProposalPlease re-state the problem that we are trying to solve in this issue.We show wallet balance badge even for those who haven't enabled Expensify wallet What is the root cause of that problem?The badge logic does not check the wallet’s activation status (tierName). It currently shows the balance if userWallet.currentBalance exists, even if the wallet is inactive.
What changes do you think we should make in order to solve the problem?Only display the wallet balance badge if the wallet is activated ( const getWalletBalance = (isPaymentItem: boolean): string | undefined => {
if (!isPaymentItem) {
return undefined;
}
const isWalletActivated = userWallet?.tierName === CONST.WALLET.TIER_NAME.GOLD || userWallet?.tierName === CONST.WALLET.TIER_NAME.PLATINUM;
return isWalletActivated ? convertToDisplayString(userWallet?.currentBalance) : undefined;
}; What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?N/A What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.We show wallet balance badge even for those users who haven't enabled Expensify wallet What is the root cause of that problem?we don't check whether the wallet is enabled or disabled for the user. We show the wallet balance when user has What changes do you think we should make in order to solve the problem?we are already calculating the wallet status at couple of places in the codebase. we should create a utility function named
Changes to be made in file: src/pages/settings/InitialSettingsPage.tsx const hasActivatedWallet = isWalletActivated(userWallet?.tierName);
<MenuItem
key={keyTitle}
wrapperStyle={styles.sectionMenuItem}
title={keyTitle}
icon={item.icon}
iconType={item.iconType}
disabled={isExecuting}
onPress={singleExecution(() => {
item.action();
})}
iconStyles={item.iconStyles}
badgeText={item.badgeText ?? getWalletBalance(hasActivatedWallet && isPaymentItem)}
getWalletBalance already returns undefined if we pass false to it.so this line will work perfectly fine for our usecase: getWalletBalance(hasActivatedWallet && isPaymentItem)
Other files where we are currently calculating the wallet status: App/src/components/KYCWall/BaseKYCWall.tsx Line 180 in a865bac
Changes that we need to make in these files: import {isWalletActivated} from '@libs/Wallet';
const hasActivatedWallet = isWalletActivated(userWallet?.tierName); What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?N/A What alternative solutions did you explore? (Optional)Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
@JmillsExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too... |
@JmillsExpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
Job added to Upwork: https://www.upwork.com/jobs/~021920822669207141133 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 ( |
will review in the morning |
Thanks for the proposals, everyone. I've checked the codes. Every user will have the wallet object by default. I think it makes sense to hide the balance only if they don't have an active wallet. Because of that, I'm aligned with @twilight2294 's proposal here, as he was the first one to propose the correct solution. ![]() 🎀 👀 🎀 |
Triggered auto assignment to @lakchote, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@hungvu193 The condition to show the |
Sorry, I don't get it. App/src/components/MenuItem.tsx Lines 872 to 877 in 64ff87f
|
Let's go with @twilight2294's proposal. I do agree with @hungvu193 that the double ternary is not ideal and should be addressed in the PR. |
📣 @twilight2294 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@hungvu193 We can address this at the time of PR review. App/src/pages/settings/InitialSettingsPage.tsx Lines 236 to 246 in 64ff87f
App/src/pages/settings/InitialSettingsPage.tsx Lines 379 to 397 in 64ff87f
|
PR ready for review @hungvu193 |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.1.38-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @joekaufmanexpensify
Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Expected Result:
You only see the badge for wallet balance in the wallet row if you've enabled your wallet.
Actual Result:
You see the badge for wallet balance, even if you haven't enabled your wallet.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Platforms Tested:
On which of our officially supported platforms was this issue tested:Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @lakchoteThe text was updated successfully, but these errors were encountered: