-
Notifications
You must be signed in to change notification settings - Fork 2
fix: hide monetary values in activity detail #752
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
Conversation
| onCopy: (String) -> Unit, | ||
| feeRates: FeeRates? = null, | ||
| ) { | ||
| val settings = settingsViewModel ?: return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLAUDE.md Violation: Parent-Child Composable Pattern
The ActivityDetailContent composable is a private child composable but is accessing settingsViewModel directly instead of receiving state as a parameter from its parent.
CLAUDE.md Rule:
"ALWAYS split screen composables into parent accepting viewmodel + inner private child accepting state and callbacks
Content()"
Current pattern:
// ActivityDetailContent (private child)
val settings = settingsViewModel ?: return
val hideBalance by settings.hideBalance.collectAsStateWithLifecycle()Expected pattern:
The parent ActivityDetailScreen should access the ViewModel and pass state down:
// In ActivityDetailScreen (parent)
val settings = settingsViewModel ?: return
val hideBalance by settings.hideBalance.collectAsStateWithLifecycle()
ActivityDetailContent(
// ... other params
hideBalance = hideBalance
)
// In ActivityDetailContent (private child)
@Composable
private fun ActivityDetailContent(
// ... other params
hideBalance: Boolean
) {
// Use hideBalance directly
}Reference: See SendConfirmScreen.kt for a correct implementation of this pattern:
bitkit-android/app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt
Lines 105 to 165 in e09ac4c
| val settings = settingsViewModel ?: return | |
| val isPinEnabled by settings.isPinEnabled.collectAsStateWithLifecycle() | |
| val pinForPayments by settings.isPinForPaymentsEnabled.collectAsStateWithLifecycle() | |
| val isBiometricEnabled by settings.isBiometricEnabled.collectAsStateWithLifecycle() | |
| val isBiometrySupported = rememberBiometricAuthSupported() | |
| // Handle result from PinCheckScreen | |
| LaunchedEffect(savedStateHandle) { | |
| savedStateHandle.getStateFlow<Boolean?>(PIN_CHECK_RESULT_KEY, null) | |
| .filterNotNull() | |
| .collect { isSuccess -> | |
| isLoading = isSuccess | |
| savedStateHandle.remove<Boolean>(PIN_CHECK_RESULT_KEY) | |
| } | |
| } | |
| // Confirm with pin or bio if required | |
| LaunchedEffect(uiState.shouldConfirmPay) { | |
| if (!uiState.shouldConfirmPay) return@LaunchedEffect | |
| if (isPinEnabled && pinForPayments) { | |
| currentOnEvent(SendEvent.ClearPayConfirmation) | |
| if (isBiometricEnabled && isBiometrySupported) { | |
| showBiometrics = true | |
| } else { | |
| onNavigateToPin() | |
| } | |
| } else { | |
| currentOnEvent(SendEvent.PayConfirmed) | |
| } | |
| } | |
| Content( | |
| uiState = uiState, | |
| isNodeRunning = isNodeRunning, | |
| isLoading = isLoading, | |
| showBiometrics = showBiometrics, | |
| canGoBack = canGoBack, | |
| onBack = onBack, | |
| onEvent = onEvent, | |
| onClickAddTag = onClickAddTag, | |
| onClickTag = onClickTag, | |
| onSwipeToConfirm = { | |
| scope.launch { | |
| isLoading = true | |
| delay(300) | |
| onEvent(SendEvent.SwipeToPay) | |
| } | |
| }, | |
| onBiometricsSuccess = { | |
| isLoading = true | |
| showBiometrics = false | |
| onEvent(SendEvent.PayConfirmed) | |
| }, | |
| onBiometricsFailure = { | |
| isLoading = false | |
| showBiometrics = false | |
| onNavigateToPin() | |
| }, | |
| ) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, it even gives examples now 🥹🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can address after
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude's comments do seem relevant, otherwise LGTM 🥂
Fixes #732
This PR fixes monetary values not being hidden on the activity detail page when the user has enabled balance hiding.
Description
When users swipe to hide their balance, values are hidden throughout the app (home page, confetti sheet, activity list) but the individual activity detail page still displayed bitcoin and fiat amounts. This PR:
Preview
Screen_recording_20260129_131012.webm
Screen_recording_20260129_131210.webm
QA Notes
1. Activity detail with hidden balance
• • • • • • • • •• • • • •• • • • •(if applicable)2. Swipe to toggle on activity detail
3. Regression - Balance visible