Repository navigation
feat (dashpay): update "about me" / contact request details dialog - #1486
Conversation
…chUserFragment.kt
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR introduces a new Compose-based bottom sheet for DashPay user profiles, migrating the interaction flow from activity results to Fragment Result API. It adds supporting UI components (ProfileAvatar with zoom-crop transformation, ContactRequestPaneCompose), state management (ViewModel with notification filtering and credit checks), and updates multiple screens to use the new sheet. Resources and documentation are extended accordingly. ChangesDashPay User Bottom Sheet Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (4)
wallet/src/de/schildbach/wallet/ui/SearchUserFragment.kt (1)
284-285: 💤 Low valueDrop the commented-out legacy launch.
The previous
startActivityForResult(DashPayUserActivity...)lines are left commented just above the new bottom-sheet call. Now that the migration is in place, this is just noise and will rot.♻️ Proposed cleanup
override fun onItemClicked(view: View, usernameSearchResult: UsernameSearchResult) { - // startActivityForResult(DashPayUserActivity.createIntent(requireContext(), usernameSearchResult), - // DashPayUserActivity.REQUEST_CODE_DEFAULT) - DashPayUserBottomSheet.newInstance(usernameSearchResult).show(requireActivity()) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wallet/src/de/schildbach/wallet/ui/SearchUserFragment.kt` around lines 284 - 285, Remove the dead commented legacy launch lines and associated artifacts: delete the two commented lines that call startActivityForResult(DashPayUserActivity.createIntent(requireContext(), usernameSearchResult), DashPayUserActivity.REQUEST_CODE_DEFAULT) so only the new bottom-sheet flow remains; ensure no other references to REQUEST_CODE_DEFAULT or the old startActivityForResult invocation remain in SearchUserFragment.kt (especially around the code handling usernameSearchResult) to avoid rot and leftover noise.wallet/src/de/schildbach/wallet/ui/dashpay/ContactsFragment.kt (1)
405-410: ⚡ Quick winRemove the now-unreachable
onActivityResulthandler.After this migration, neither
onItemClickedbranch startsDashPayUserActivityviastartActivityForResult, so theDashPayUserActivity.REQUEST_CODE_DEFAULT/RESULT_CODE_CHANGEDpath here is dead code. The new Fragment Result listener at lines 101-108 already handles refreshes viasearchContacts(). Leaving the override invites confusion about which result path is active.If nothing else in this fragment starts an activity for result, you can drop the entire override (and the now-unused
android.content.Intentimport).♻️ Proposed cleanup
- override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (requestCode == DashPayUserActivity.REQUEST_CODE_DEFAULT && resultCode == DashPayUserActivity.RESULT_CODE_CHANGED) { - searchContacts() - } - } -🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wallet/src/de/schildbach/wallet/ui/dashpay/ContactsFragment.kt` around lines 405 - 410, Remove the now-dead onActivityResult override and related unused imports: delete the override of onActivityResult that checks DashPayUserActivity.REQUEST_CODE_DEFAULT and DashPayUserActivity.RESULT_CODE_CHANGED and calls searchContacts(), since no code calls startActivityForResult anymore and the Fragment Result listener already invokes searchContacts(); also remove the now-unused android.content.Intent import to clean up warnings and avoid confusion between result-handling mechanisms.wallet/src/de/schildbach/wallet/ui/compose_views/ProfileAvatarCompose.kt (1)
62-63: 💤 Low valueConsider removing or gating the per-composition log statement.
Line 63 logs on every recomposition, which can generate excessive log spam in production. Consider removing it or wrapping it in a debug flag if this is intended for development only.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wallet/src/de/schildbach/wallet/ui/compose_views/ProfileAvatarCompose.kt` around lines 62 - 63, The Log.d call that prints "compose for $username url=..." on every recomposition (using LOG_TAG, username, avatarUrl) is noisy; remove the statement or guard it behind a development-only flag (e.g., BuildConfig.DEBUG or a boolean debug/logging flag) so it only runs in debug builds or when explicitly enabled, and ensure any retained logging uses a conditional check around the Log.d invocation rather than executing unconditionally during ProfileAvatarCompose recompositions.common/src/main/java/org/dash/wallet/common/ui/avatar/ProfilePictureZoomTransformation.kt (1)
36-46: ⚡ Quick winUse Kotlin's
roundToInt()instead of Java'sMath.round().Lines 37-38 and 43-44 use
Math.round(), which is Java-style. Kotlin's idiomatic approach is to call.roundToInt()directly on Float expressions.♻️ Proposed refactor
override suspend fun transform(input: Bitmap, size: Size): Bitmap { - val cropWidth = Math.round(input.width * (zoomedRect.right - zoomedRect.left)) - val cropHeight = Math.round(input.height * (zoomedRect.bottom - zoomedRect.top)) + val cropWidth = (input.width * (zoomedRect.right - zoomedRect.left)).roundToInt() + val cropHeight = (input.height * (zoomedRect.bottom - zoomedRect.top)).roundToInt() if (cropWidth <= 0 || cropHeight <= 0) return input val zoomX = TARGET / cropWidth val zoomY = TARGET / cropHeight val matrix = Matrix().apply { setScale(zoomX, zoomY) } - val x = Math.round(zoomedRect.left * input.width) - val y = Math.round(zoomedRect.top * input.height) + val x = (zoomedRect.left * input.width).roundToInt() + val y = (zoomedRect.top * input.height).roundToInt() return Bitmap.createBitmap(input, x, y, cropWidth, cropHeight, matrix, true) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@common/src/main/java/org/dash/wallet/common/ui/avatar/ProfilePictureZoomTransformation.kt` around lines 36 - 46, The transform function uses Java's Math.round; replace those calls with Kotlin's .roundToInt() on the Float expressions: compute cropWidth = (input.width * (zoomedRect.right - zoomedRect.left)).roundToInt(), cropHeight = (input.height * (zoomedRect.bottom - zoomedRect.top)).roundToInt(), and compute x and y as (zoomedRect.left * input.width).roundToInt() and (zoomedRect.top * input.height).roundToInt(); keep the rest of the logic (matrix scale, TARGET, Bitmap.createBitmap) unchanged and add kotlin.math.roundToInt import if the IDE/compiler requires it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/agents/DEVELOPMENT-PATTERNS.md:
- Around line 773-775: Fenced code blocks in the markdown are missing language
identifiers; update the block that shows the filename "EnterAmount.kt" to use
```text and change the Kotlin snippet fence to ```kotlin so markdownlint MD040
is satisfied; specifically update the blocks that contain the filename line
referencing EnterAmount.kt and the Kotlin snippet that includes symbols like
FeatureDetailsDialog and FeatureDetailsView (also apply the same fix to the
other occurrence around the block that contains those same symbols).
In
`@common/src/main/java/org/dash/wallet/common/ui/avatar/ProfilePictureZoomTransformation.kt`:
- Line 45: The transform method in ProfilePictureZoomTransformation currently
calls Bitmap.createBitmap(...) with computed x, y, cropWidth, cropHeight that
may be out of bounds; add validation before the Bitmap.createBitmap call:
compute x/y/width/height as now, then clamp x to [0, bitmap.width-1], y to [0,
bitmap.height-1], clamp cropWidth to at least 1 and at most bitmap.width - x,
and clamp cropHeight to at least 1 and at most bitmap.height - y; if after
clamping cropWidth or cropHeight is <= 0 (or x/y are invalid), return the
original input bitmap instead of calling Bitmap.createBitmap to avoid
IllegalArgumentException. Ensure this change is applied inside the
transform(...) method and references the same local variables used for the
Bitmap.createBitmap(...) call.
In `@common/src/main/java/org/dash/wallet/common/ui/components/Grapper.kt`:
- Around line 38-52: Rename the source file from Grapper.kt to Grabber.kt so the
filename matches the primary public composable function Grabber; update any
build/include lists or imports that reference the old filename if present,
ensuring the Kotlin file name exactly matches the Grabber declaration to follow
convention and avoid confusion.
In `@wallet/src/de/schildbach/wallet/ui/dashpay/user/DashPayUserBottomSheet.kt`:
- Around line 147-151: notifyContactChange() is currently invoked
unconditionally before async credit-check/send flows causing KEY_CHANGED=true
even on errors/cancel; move the call into the code paths inside
handleCreditCheckAndSend/checkCreditsAndSend where sendContactRequest() (or the
branch that actually performs the mutation) succeeds so the contact-change
result is emitted only after a real mutation completes (do the same for the
other occurrences around lines 168-170 and 172-209), and remove the pre-flight
notifyContactChange() call at the start of the onSendOrAcceptClick handler.
- Line 153: The Ignore button is wired to a no-op in DashPayUserBottomSheet
(onIgnoreClick = { /* not yet implemented */ }) while RequestReceivedCard still
renders it interactive; either implement the ignore flow or hide/disable the
control. Fix by changing DashPayUserBottomSheet to stop passing a stub lambda
(pass null or an explicit disabled flag) and update RequestReceivedCard to check
that value (e.g., onIgnoreClick == null or isIgnoreEnabled == false) and then
hide or render the Ignore button as disabled; apply the same change for the
second occurrence mentioned (lines 375-427) so no interactive no-op remains.
- Around line 663-667: The code is passing milliseconds as seconds to
DateUtils.getRelativeTimeSpanString by dividing item.getDate() by 1000; change
the call in DashPayUserBottomSheet (the block using
DateUtils.getRelativeTimeSpanString and item.getDate()) to pass item.getDate()
directly (remove the "/ 1000") so the first parameter is milliseconds as
required and matches the other usage in this file.
---
Nitpick comments:
In
`@common/src/main/java/org/dash/wallet/common/ui/avatar/ProfilePictureZoomTransformation.kt`:
- Around line 36-46: The transform function uses Java's Math.round; replace
those calls with Kotlin's .roundToInt() on the Float expressions: compute
cropWidth = (input.width * (zoomedRect.right - zoomedRect.left)).roundToInt(),
cropHeight = (input.height * (zoomedRect.bottom - zoomedRect.top)).roundToInt(),
and compute x and y as (zoomedRect.left * input.width).roundToInt() and
(zoomedRect.top * input.height).roundToInt(); keep the rest of the logic (matrix
scale, TARGET, Bitmap.createBitmap) unchanged and add kotlin.math.roundToInt
import if the IDE/compiler requires it.
In `@wallet/src/de/schildbach/wallet/ui/compose_views/ProfileAvatarCompose.kt`:
- Around line 62-63: The Log.d call that prints "compose for $username url=..."
on every recomposition (using LOG_TAG, username, avatarUrl) is noisy; remove the
statement or guard it behind a development-only flag (e.g., BuildConfig.DEBUG or
a boolean debug/logging flag) so it only runs in debug builds or when explicitly
enabled, and ensure any retained logging uses a conditional check around the
Log.d invocation rather than executing unconditionally during
ProfileAvatarCompose recompositions.
In `@wallet/src/de/schildbach/wallet/ui/dashpay/ContactsFragment.kt`:
- Around line 405-410: Remove the now-dead onActivityResult override and related
unused imports: delete the override of onActivityResult that checks
DashPayUserActivity.REQUEST_CODE_DEFAULT and
DashPayUserActivity.RESULT_CODE_CHANGED and calls searchContacts(), since no
code calls startActivityForResult anymore and the Fragment Result listener
already invokes searchContacts(); also remove the now-unused
android.content.Intent import to clean up warnings and avoid confusion between
result-handling mechanisms.
In `@wallet/src/de/schildbach/wallet/ui/SearchUserFragment.kt`:
- Around line 284-285: Remove the dead commented legacy launch lines and
associated artifacts: delete the two commented lines that call
startActivityForResult(DashPayUserActivity.createIntent(requireContext(),
usernameSearchResult), DashPayUserActivity.REQUEST_CODE_DEFAULT) so only the new
bottom-sheet flow remains; ensure no other references to REQUEST_CODE_DEFAULT or
the old startActivityForResult invocation remain in SearchUserFragment.kt
(especially around the code handling usernameSearchResult) to avoid rot and
leftover noise.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cbdb4bde-2b52-4bf3-8206-d1066c9ae283
📒 Files selected for processing (18)
.claude/agents/DEVELOPMENT-PATTERNS.md.claude/agents/figma-to-compose.mdcommon/src/main/java/org/dash/wallet/common/ui/avatar/ProfilePictureZoomTransformation.ktcommon/src/main/java/org/dash/wallet/common/ui/components/DashButton.ktcommon/src/main/java/org/dash/wallet/common/ui/components/Grapper.ktcommon/src/main/java/org/dash/wallet/common/ui/components/MyTheme.ktcommon/src/main/java/org/dash/wallet/common/ui/dialogs/ComposeBottomSheet.ktcommon/src/main/res/layout/dialog_compose_sheet.xmlwallet/build.gradlewallet/res/drawable/ic_notification_contact_received.xmlwallet/res/drawable/ic_notification_contact_sent.xmlwallet/res/values/strings-dashpay.xmlwallet/src/de/schildbach/wallet/ui/SearchUserFragment.ktwallet/src/de/schildbach/wallet/ui/compose_views/ProfileAvatarCompose.ktwallet/src/de/schildbach/wallet/ui/dashpay/ContactsFragment.ktwallet/src/de/schildbach/wallet/ui/dashpay/user/DashPayUserBottomSheet.ktwallet/src/de/schildbach/wallet/ui/dashpay/user/DashPayUserBottomSheetViewModel.ktwallet/src/de/schildbach/wallet/ui/dashpay/widget/ContactRequestPaneCompose.kt
| onSendOrAcceptClick = { | ||
| notifyContactChange() | ||
| lifecycleScope.launch { | ||
| handleCreditCheckAndSend(viewModel) | ||
| } |
There was a problem hiding this comment.
Emit contact-change result only after an actual mutation.
notifyContactChange() is called before checkCreditsAndSend() completes, so Line 148 can report KEY_CHANGED=true even when no request is sent (error/cancel path). Move the result emission into the branches where sendContactRequest() is actually executed.
Suggested fix
DashPayUserContent(
state = state,
onCloseClick = { dismiss() },
onSendOrAcceptClick = {
- notifyContactChange()
lifecycleScope.launch {
- handleCreditCheckAndSend(viewModel)
+ handleCreditCheckAndSend(viewModel)
}
},
@@
DashPayUserBottomSheetViewModel.CreditCheckOutcome.ShowWarningEmpty,
DashPayUserBottomSheetViewModel.CreditCheckOutcome.ShowWarningLow -> {
@@
if (answer == true) {
SendCoinsActivity.startBuyCredits(activity)
} else if (!isEmpty) {
viewModel.sendContactRequest()
+ notifyContactChange()
}
viewModel.resetCreditCheck()
}
DashPayUserBottomSheetViewModel.CreditCheckOutcome.Proceed -> {
viewModel.sendContactRequest()
+ notifyContactChange()
viewModel.resetCreditCheck()
}
}
}Also applies to: 168-170, 172-209
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wallet/src/de/schildbach/wallet/ui/dashpay/user/DashPayUserBottomSheet.kt`
around lines 147 - 151, notifyContactChange() is currently invoked
unconditionally before async credit-check/send flows causing KEY_CHANGED=true
even on errors/cancel; move the call into the code paths inside
handleCreditCheckAndSend/checkCreditsAndSend where sendContactRequest() (or the
branch that actually performs the mutation) succeeds so the contact-change
result is emitted only after a real mutation completes (do the same for the
other occurrences around lines 168-170 and 172-209), and remove the pre-flight
notifyContactChange() call at the start of the onSendOrAcceptClick handler.
Calling Activity.finish() immediately after DashPayUserBottomSheet.show() raced with launchWhenResumed in the sheet's show path, risking an IllegalStateException or a silently dropped fragment commit. Post the finish() so the fragment transaction lands first. Also remove now-unused DashPayUserActivity/Intent imports and commented-out startActivity calls left behind by the bottom-sheet migration. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt`:
- Around line 153-156: The code currently calls finish() immediately after
DashPayUserBottomSheet.newInstance(...).show(this) in TransactionResultActivity
which can tear down the FragmentManager; remove the posted finish() calls and
instead finish the host only when the bottom sheet is dismissed. Concretely:
delete the binding.root.post { finish() } lines around the
DashPayUserBottomSheet.newInstance(...).show(this) calls in
TransactionResultActivity and implement a dismissal-based flow—either have
DashPayUserBottomSheet (the BottomSheetDialogFragment) call back to the activity
via an interface/callback when its onDismiss(...) runs, or have
TransactionResultActivity register a FragmentResultListener or observe the
sheet’s dismiss event and call finish() there (invoke activity.finish() from the
sheet’s onDismiss or the registered listener).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2b8dae03-b568-4403-a6e9-c72510b13bd8
📒 Files selected for processing (8)
wallet/src/de/schildbach/wallet/ui/dashpay/NotificationsFragment.ktwallet/src/de/schildbach/wallet/ui/dashpay/user/DashPayUserBottomSheet.ktwallet/src/de/schildbach/wallet/ui/invite/InviteDetailsFragment.ktwallet/src/de/schildbach/wallet/ui/main/WalletTransactionsFragment.ktwallet/src/de/schildbach/wallet/ui/transactions/ChangeTaxCategoryExplainerDialogFragment.ktwallet/src/de/schildbach/wallet/ui/transactions/TransactionDetailsDialogFragment.ktwallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.ktwallet/src/de/schildbach/wallet/ui/transactions/TransactionResultViewBinder.kt
…ivity The bottom sheet is shown on TransactionResultActivity's own FragmentManager, so finishing the activity right after show() tore the sheet down with it - clicking the contact icon just closed the payment window and revealed the main screen. Icon click: drop the finish() entirely; dismissing the sheet returns to the transaction result screen. Close button with contact data: defer finish() until the sheet is dismissed via FragmentLifecycleCallbacks, mirroring the old finish() + DashPayUserActivity flow. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt`:
- Around line 295-311: The current FragmentManager.FragmentLifecycleCallbacks
implementation uses onFragmentDestroyed to call finish(), which also runs during
configuration changes; change the logic to only finish the activity when the
sheet is genuinely dismissed by moving the finish trigger out of
onFragmentDestroyed and into a dismissal-specific callback: listen for the
DashPayUserBottomSheet's dismissal (use the sheet's onDismiss /
setOnDismissListener or fragment result API from DashPayUserBottomSheet) or
register a FragmentResultListener and call finish() there instead of in
onFragmentDestroyed; update the registration/unregistration accordingly (remove
the onFragmentDestroyed-based unregister) and ensure
DashPayUserBottomSheet.newInstance(userData!!) shows the sheet without tying
activity teardown to fragment destruction.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6bb183f3-709a-4a48-b619-6a031ec0869f
📒 Files selected for processing (1)
wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt
Grapper.kt was a byte-for-byte duplicate of Grabber.kt declaring the same Grabber composable, causing conflicting overloads and overload resolution ambiguity errors in the common module build. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist:
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation