Skip to content

feat: allow user to set the sync start date - #1453

Merged
HashEngineering merged 19 commits into
masterfrom
feat/sync-start-date
Jan 19, 2026
Merged

HashEngineering merged 19 commits into
masterfrom
feat/sync-start-date

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Jan 7, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

Summary by CodeRabbit

  • New Features

    • Optional wallet creation date selection during seed restore and rescan flows
    • Wallet creation date info bottom sheet
  • UI/UX Improvements

    • Enhanced modal dialog options (alignment, padding, optional content)
    • New drawable resources for rounded and outlined buttons
    • Date picker integrated into restore flows with clear/info actions
  • Configuration Updates

    • Block explorer URLs normalized (removed explicit ports)
    • Updated testnet checkpoint data
  • Removed Features

    • Removed intermediary seed-restore dialog and related failure dialog flows

✏️ Tip: You can customize this high-level summary in your review settings.

@HashEngineering HashEngineering self-assigned this Jan 7, 2026
@coderabbitai

coderabbitai Bot commented Jan 7, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds wallet creation date storage and UI, converts seed restoration to suspend-based flows, integrates date pickers for restore/rescan dialogs, removes a legacy seed-restore dialog, updates block-explorer endpoints, and adds related UI resources and strings.

Changes

Cohort / File(s) Summary
Creation Date Config
common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt, common/src/main/java/org/dash/wallet/common/util/Constants.kt
Add WALLET_CREATION_DATE preference key, getWalletCreationDate()/setWalletCreationDate() suspend APIs, and EARLIEST_HD_SEED_CREATION_TIME constant (1427610960L).
Factory & Restore APIs
wallet/src/de/schildbach/wallet/service/WalletFactory.kt, wallet/test/de/schildbach/wallet/util/services/WalletFactoryTest.kt
Make restoreFromSeed() suspend and accept optional creationTimeSeconds; DashWalletFactory now requires BlockchainServiceConfig; tests updated with mock config and coroutines.
Restore ViewModel
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt
Add selectedCreationDate LiveData, helpers to set/clear it; convert restoreWalletFromSeed to suspend fun returning Boolean and pass creation time to factory.
Restore Activity & Layout
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt, wallet/res/layout/activity_recover_wallet_from_seed.xml
Add date picker setup, selection/clear UI and info dialog integration; enforce min/max dates; wire selected date into restore flow and UI.
Rescan Dialog & Settings
wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt, wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt, wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
New RescanBlockchainDialogFragment Compose dialog with date picker and confirm callback; SettingsViewModel receives BlockchainServiceConfig and exposes suspend getters/setters; SettingsFragment uses dialog and coroutine-driven reset flow.
Removed Legacy UI & Failure Paths
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedDialogFragment.java, wallet/src/de/schildbach/wallet/ui/OnboardingActivity.kt, wallet/src/de/schildbach/wallet/ui/OnboardingViewModel.kt, wallet/src/de/schildbach/wallet/ui/RestoreWalletFromFileViewModel.kt, wallet/src/de/schildbach/wallet/ui/backup/RestoreFromFileActivity.kt, wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt
Delete legacy seed-restore dialog fragment and remove showRestoreWalletFailureAction-based failure dialogs and related observers; remove several seed-restore helper methods.
Compose Info Dialog
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt
New bottom sheet compose component createWalletCreationDateInfoDialog() and content for wallet creation date info.
Modal Dialog API
common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt
Expanded ModalDialog signature: defaulted textBlocks, textAlign, optional moreInfoButton, defaulted buttons, optional content, and horizontalPadding; updated rendering.
Block Explorer URLs
wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java, wallet/devnet/res/values/values.xml, wallet/staging/res/values/values.xml
Remove explicit :3002 port from Insight API URLs across environments.
UI Resources & Strings
wallet/res/drawable/button_outlined_background.xml, wallet/res/drawable/rounded_background_light.xml, wallet/res/values/strings.xml
Add outlined button and rounded background drawables; add 13 strings for creation date UI and rescan dialog.
Checkpoints Data
wallet/assets/checkpoints-testnet.txt
Updated initial checkpoint index and appended many new checkpoint entries.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Activity as RestoreWalletFromSeedActivity
    participant ViewModel as RestoreWalletFromSeedViewModel
    participant Factory as DashWalletFactory
    participant Config as BlockchainServiceConfig

    User->>Activity: Open restore screen / pick date
    Activity->>ViewModel: setWalletCreationDate(timeInMillis)
    User->>Activity: Enter seed and tap Restore
    Activity->>ViewModel: restoreWalletFromSeed(words)
    ViewModel->>Factory: restoreFromSeed(params, words, creationTimeSeconds)
    Factory->>Factory: Create wallet (uses earliest HD seed time)
    alt creationTimeSeconds provided
      Factory->>Config: setWalletCreationDate(creationTimeSeconds)
      Config->>Config: persist creation date
    end
    Factory-->>ViewModel: return success/failure
    ViewModel-->>Activity: return Boolean (success)
    Activity->>Activity: proceed to PIN setup on success
Loading
sequenceDiagram
    actor User
    participant Settings as SettingsFragment
    participant Dialog as RescanBlockchainDialogFragment
    participant ViewModel as SettingsViewModel
    participant Service as BlockchainService

    User->>Settings: Initiate blockchain rescan
    Settings->>ViewModel: getWalletCreationDate()
    ViewModel-->>Settings: return creation date (or null)
    Settings->>Dialog: show(activity, creationDate, onConfirm)
    Dialog->>User: present date picker / confirm
    User->>Dialog: Confirm with selectedDate
    Dialog-->>Settings: onConfirm(true, selectedDate)
    Settings->>ViewModel: setWalletCreationDate(selectedDate)
    Settings->>Service: reset blockchain (with optional date)
    Settings->>Settings: navigate to MainActivity
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped in code to add a date,
Seeds remembered from an earlier state,
Suspend now hums, dialogs refreshed and bright,
Old fragments vanished, new pickers take flight,
A tiny rabbit cheers the restore's new fate.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.51% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main feature: allowing users to set the wallet sync start date. It is concise, specific, and clearly reflects the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Fix all issues with AI agents
In @common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt:
- Around line 59-66: The getWalletCreationDate() validation is inverted: it
currently returns creationDate only when creationDate <=
Constants.EARLIEST_HD_SEED_CREATION_TIME, which rejects valid dates; change the
comparison in getWalletCreationDate() to require creationDate >=
Constants.EARLIEST_HD_SEED_CREATION_TIME (keeping the null check and returned
value logic using WALLET_CREATION_DATE and
Constants.EARLIEST_HD_SEED_CREATION_TIME).

In @common/src/main/java/org/dash/wallet/common/ui/components/MyTheme.kt:
- Around line 201-206: Replace the non-standard FontWeight(650) with the
standard bold weight for consistency: update the TextStyle definitions (e.g.,
HeadlineLargeBold and the other bold headline styles that currently use
FontWeight(650)) to use FontWeight(700) or FontWeight.Bold instead of
FontWeight(650); ensure each bold headline TextStyle (the ones around the
current HeadlineLargeBold, and the similar bold variants at the other two
locations) is changed to the standard 700 weight.
- Line 135: Rename the mis-typed object Typeography to Typography in MyTheme.kt
and update all call sites to reference Typography (e.g., usages in
FeatureTopText.kt and DashModelDialog.kt); this is a public API rename so update
imports/usages, any references in XML or string templates, and run a
project-wide refactor/compile to catch and fix remaining references.

In @wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt:
- Around line 68-77: The fragment's lateinit callback onConfirm can crash after
recreation; change the declaration in RescanBlockchainDialogFragment from
"lateinit var onConfirm: (Boolean, Long?) -> Unit" to a nullable property like
"var onConfirm: ((Boolean, Long?) -> Unit)? = null" (or assign a no-op default)
and update any invocation sites to use a safe call (onConfirm?.invoke(...));
also persist/restore initialCreationDate via onSaveInstanceState and restore it
in onCreate/onViewStateRestored so the date survives configuration changes.

In @wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:
- Around line 205-208: In setWalletCreationDate, avoid the force unwrap of
walletApplication.wallet; check walletApplication.wallet for null (or use a
safe-call) before mutating keyChainSeed.creationTimeSeconds and calling
blockchainServiceConfig.setWalletCreationDate(creationDate); if wallet is null,
return early (or no-op) so you don’t risk an NPE while preserving the existing
blockchainServiceConfig persistence call when a wallet exists.

In @wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt:
- Line 207: The code concatenates a hardcoded " ✓" to
getString(R.string.restore_wallet_select_date) which breaks i18n; update the UI
assignment for binding.selectDateButton.text to use a localized string resource
(either a new string like restore_wallet_select_date_selected or a
placeholder-style resource) and fetch it via getString(...) so the checkmark is
part of the translatable text rather than concatenated at runtime.

In @wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt:
- Line 194: The call to RescanBlockchainDialogFragment().show(...) is
force-unwrapping walletApplication.wallet
(walletApplication.wallet!!.keyChainSeed.creationTimeSeconds) which can throw an
NPE; update resetBlockchain (or the method containing that line in
SettingsFragment) to first null-check walletApplication.wallet and its
keyChainSeed/creationTimeSeconds and handle the null case (e.g., return early,
show an error/toast, or disable the dialog) before invoking
RescanBlockchainDialogFragment.show so the code never dereferences a null
wallet.
🧹 Nitpick comments (9)
common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt (1)

44-54: Consider consolidating button visibility logic.

The button visibility requires both showButton=true AND buttonLabel!=null, which could be confusing. Consider either:

  • Making buttonLabel required when showButton=true via documentation
  • Simplifying to just check buttonLabel != null and removing the showButton flag

This would prevent scenarios where showButton=true but nothing renders because buttonLabel is null.

common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt (2)

88-100: Remove commented-out code.

Line 91 contains commented-out code referencing iconBackgroundColor. Since this parameter appears to have been removed from the implementation, clean up this comment.


138-143: Remove commented-out padding code.

Line 141 contains commented-out padding code. Either remove it entirely or document why it was disabled if this is intentional for the design update.

wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (2)

46-48: Unused dialog parameter in content lambda.

The dialog parameter is passed but never used. Since this dialog has no buttons that need to dismiss it programmatically, consider using _ to indicate it's intentionally unused.

Suggested fix
-        content = { dialog ->
+        content = { _ ->
             WalletCreationDateInfoContent()
         }

55-58: Remove commented-out code.

Line 57 contains commented-out code. Either remove it or apply it if the background is needed.

Suggested fix
     Column(
         modifier = Modifier
             .fillMaxWidth()
-            //.background(MyTheme.Colors.backgroundSecondary)
             .padding(top = 60.dp) // Space for drag indicator and close button
     ) {
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt (1)

53-53: Consider using StateFlow instead of LiveData for new code.

Per the documented development patterns, asynchronously updated fields should use StateFlow rather than LiveData. However, given the existing codebase conventions, this can be addressed in a follow-up refactor.

wallet/src/de/schildbach/wallet/service/WalletFactory.kt (1)

299-300: Remove empty finally block.

The empty finally block serves no purpose and can be removed for cleaner code.

Proposed fix
             checkWalletValid(wallet, params)
             blockchainServiceConfig.setWalletCreationDate(seedCreationTime)
             wallet
-        } finally {
-        }
+        }
     }
.claude/agents/DEVELOPMENT-PATTERNS.md (1)

444-520: Consider adding blank lines around tables for markdown compatibility.

Static analysis suggests adding blank lines around tables (MD058). This is a minor formatting issue that improves compatibility with some markdown renderers.

wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt (1)

526-539: Minor inconsistency: wallet.isEncrypted() vs wallet.isEncrypted.

Line 531 uses wallet.isEncrypted() (method call syntax) while line 505 uses wallet.isEncrypted (property access syntax). Consider using consistent property access throughout for idiomatic Kotlin style.

♻️ Suggested fix
-            if (wallet.isEncrypted()) {
+            if (wallet.isEncrypted) {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e7b9f4 and 8f02d24.

📒 Files selected for processing (28)
  • .claude/agents/DEVELOPMENT-PATTERNS.md
  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
  • common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt
  • common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt
  • common/src/main/java/org/dash/wallet/common/ui/components/MyTheme.kt
  • common/src/main/java/org/dash/wallet/common/util/Constants.kt
  • wallet/assets/checkpoints-testnet.txt
  • wallet/devnet/res/values/values.xml
  • wallet/res/drawable/button_outlined_background.xml
  • wallet/res/drawable/rounded_background_light.xml
  • wallet/res/layout/activity_recover_wallet_from_seed.xml
  • wallet/res/values/strings.xml
  • wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java
  • wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.kt
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
  • wallet/src/de/schildbach/wallet/ui/OnboardingActivity.kt
  • wallet/src/de/schildbach/wallet/ui/OnboardingViewModel.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromFileViewModel.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedDialogFragment.java
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt
  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
  • wallet/src/de/schildbach/wallet/ui/backup/RestoreFromFileActivity.kt
  • wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt
  • wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt
  • wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt
  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
  • wallet/staging/res/values/values.xml
💤 Files with no reviewable changes (5)
  • wallet/src/de/schildbach/wallet/ui/backup/RestoreFromFileActivity.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromFileViewModel.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedDialogFragment.java
  • wallet/src/de/schildbach/wallet/ui/OnboardingViewModel.kt
  • wallet/src/de/schildbach/wallet/ui/OnboardingActivity.kt
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1417
File: features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/MerchantDao.kt:0-0
Timestamp: 2025-08-08T16:48:49.964Z
Learning: In PR dashpay/dash-wallet#1417, HashEngineering chose to defer adding Room indexes for gift_card_providers (provider, denominationsType, merchantId) to a follow-up PR; do not block the current PR on this optimization. Files: features/exploredash/.../data/explore/MerchantDao.kt and features/exploredash/.../data/dashspend/GiftCardProvider.kt.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-09-23T05:19:47.861Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1428
File: wallet/src/de/schildbach/wallet/ui/dashpay/PlatformRepo.kt:1065-1068
Timestamp: 2025-09-23T05:19:47.861Z
Learning: The Dash wallet app doesn't use non-encrypted wallets, so getWalletEncryptionKey() will never return null in practice. Defensive null-safe programming with ?.let is appropriate for methods like getIdentityFromPublicKeyId() in PlatformRepo.kt.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt
  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
  • wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt
📚 Learning: 2025-09-05T06:16:12.649Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:134-145
Timestamp: 2025-09-05T06:16:12.649Z
Learning: The dash-wallet project has a minimum SDK version of 24, so API availability checks for methods introduced in API 23 or earlier are not needed.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-05-07T14:18:11.161Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1389
File: features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/SearchFragment.kt:45-46
Timestamp: 2025-05-07T14:18:11.161Z
Learning: In the ExploreViewModel of the dash-wallet application, `appliedFilters` is a StateFlow (not LiveData), so Flow operators like `distinctUntilChangedBy` can be used with it.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In the Dash Wallet app, DashPayConfig methods like isTransactionMetadataInfoShown() already use withContext(Dispatchers.IO) internally, so wrapping these calls with another withContext(Dispatchers.IO) in ViewModels is redundant.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt
  • common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In Dash Wallet, DataStore operations (like those in DashPayConfig through BaseConfig) already handle background threading internally. Adding another layer of withContext(Dispatchers.IO) around these calls in ViewModels is redundant because the Jetpack DataStore API automatically dispatches its operations to a background thread.

Applied to files:

  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
📚 Learning: 2025-09-05T06:47:44.508Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.

Applied to files:

  • .claude/agents/DEVELOPMENT-PATTERNS.md
📚 Learning: 2025-04-16T17:07:27.359Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1377
File: wallet/src/de/schildbach/wallet/service/platform/PlatformService.kt:0-0
Timestamp: 2025-04-16T17:07:27.359Z
Learning: For PlatformService in the Dash Wallet, the implementation should avoid throwing exceptions when Constants.SUPPORTS_PLATFORM is false. The platform should only be initialized when SUPPORTS_PLATFORM is true, and initialization should be done lazily to defer Platform creation until needed.

Applied to files:

  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-05-12T09:15:56.594Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1391
File: integrations/coinbase/src/main/java/org/dash/wallet/integrations/coinbase/ui/convert_currency/ConvertViewFragment.kt:134-155
Timestamp: 2025-05-12T09:15:56.594Z
Learning: The SegmentedPicker composable in Dash Wallet has a safety check for empty options, returning early if options.isEmpty() is true.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
🧬 Code graph analysis (6)
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (1)
common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt (1)
  • FeatureTopText (43-119)
common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt (2)
wallet/src/de/schildbach/wallet/service/TestingSPVBlockStore.kt (1)
  • get (59-73)
common/src/main/java/org/dash/wallet/common/data/BaseConfig.kt (1)
  • set (82-86)
wallet/src/de/schildbach/wallet/service/WalletFactory.kt (1)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt (1)
  • restoreWalletFromSeed (88-102)
wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt (3)
common/src/main/java/org/dash/wallet/common/ui/components/ComposeHostFrameLayout.kt (1)
  • setContent (18-24)
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (1)
  • createWalletCreationDateInfoDialog (42-50)
common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt (1)
  • ModalDialog (49-229)
wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java (1)
wallet/src/de/schildbach/wallet/Constants.java (1)
  • Constants (48-340)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (2)
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (1)
  • createWalletCreationDateInfoDialog (42-50)
wallet/src/de/schildbach/wallet/database/entity/DashPayProfile.kt (1)
  • getString (60-62)
🪛 LanguageTool
.claude/agents/DEVELOPMENT-PATTERNS.md

[style] ~228-~228: This is not the usual sequence for adjectives that have no special emphasis.
Context: ...atureItemNumber (Internal Component) A blue circular badge with white number text, used for ...

(EN_ADJ_ORDER)

🪛 markdownlint-cli2 (0.18.1)
.claude/agents/DEVELOPMENT-PATTERNS.md

445-445: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


458-458: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


474-474: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


490-490: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


506-506: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: check
🔇 Additional comments (24)
wallet/devnet/res/values/values.xml (1)

22-22: Verify the devnet block explorer endpoint is still functional.

The removal of port :3002 from the block explorer URL appears intentional (part of a refactoring commit to remove obsolete code), but the change means the connection will use the default HTTPS port 443 instead. Confirm that the Insight service for devnet is accessible at https://insight.ouzo.networks.dash.org/insight without the explicit port specification.

wallet/staging/res/values/values.xml (1)

22-22: Remove this concern — the URL change is correct.

The testnet block explorer service does not run on port 3002. Testing confirms the new URL without the port (defaulting to HTTPS port 443) is accessible and returns HTTP 200, while the old URL with :3002 fails to connect. This change fixes the block explorer URL, not breaks it.

wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java (1)

342-344: No issues found. The protocol difference (HTTPS for production/testnet, HTTP for devnet) is an intentional design choice appropriate for each environment. The devnet name extraction using substring("devnet-".length()) is consistent with the pattern used elsewhere in Constants.java. The endpoints are infrastructure dependencies that function as designed.

wallet/assets/checkpoints-testnet.txt (1)

3-2395: Checkpoint header matches data rows — no action required

Declared checkpoint count (2392) equals the number of data rows; file format is consistent.

wallet/res/drawable/rounded_background_light.xml (1)

1-23: LGTM!

The drawable resource is well-structured and follows Android XML conventions. The design parameters (8dp radius, 1dp stroke) align with the design system updates mentioned in this PR.

common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt (1)

80-117: Button styling looks correct but verify small icon size is intentional.

The button icons and text are sized at 13.dp/13.sp, which is quite small. Ensure this matches the design specifications, particularly for accessibility on smaller or lower-DPI screens.

common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt (1)

50-61: Verify custom content doesn't conflict with other dialog elements.

The new content parameter allows injecting arbitrary composables between the text blocks and buttons. Ensure there's guidance for users about:

  • Proper spacing/padding expectations
  • Interaction with limitationItems layout
  • Maximum height constraints to avoid dialog overflow
common/src/main/java/org/dash/wallet/common/ui/components/MyTheme.kt (1)

135-549: Comprehensive typography system added successfully.

The typography system is well-structured with clear naming conventions and proper coverage of all size/weight combinations. The deprecated aliases provide good backward compatibility.

wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.kt (1)

1403-1403: Change correctly prioritizes serviceConfig.getWalletCreationDate() with proper fallback.

The implementation properly handles timestamp units (both are in seconds), includes synchronization between wallet and serviceConfig sources (verified in SettingsViewModel.kt:206-207), and the single usage site at this location correctly applies the new fallback pattern. No additional changes needed.

common/src/main/java/org/dash/wallet/common/util/Constants.kt (1)

30-30: LGTM!

The constant is well-named and provides a clear earliest boundary for HD seed creation times (March 29, 2015). This aligns with the PR's goal of allowing users to set wallet sync start dates.

wallet/res/drawable/button_outlined_background.xml (1)

18-33: LGTM!

Standard selector drawable with appropriate pressed and default states for an outlined button style. The 8dp corner radius and 1dp stroke provide consistent styling.

wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt (1)

195-213: Verify the order of wallet creation date update and blockchain reset.

The creation date is saved via viewModel.setWalletCreationDate(it) (line 204) before calling walletApplication.resetBlockchain() (line 206). Please confirm this order is correct, as the blockchain reset might need the updated creation date to be already persisted.

wallet/res/layout/activity_recover_wallet_from_seed.xml (2)

43-97: LGTM!

The date picker UI section is well-structured with:

  • Clear label and info icon for user guidance
  • Outlined button for date selection with calendar icon
  • Hidden selected date display that can be revealed when a date is chosen
  • Appropriate margins and padding for consistency

Accessibility is considered with the contentDescription on the info icon (line 62).


108-108: LGTM!

The constraint update correctly references the new selected_date_display view, maintaining proper layout flow.

wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt (1)

88-102: Wallet restoration flow looks correct.

The suspend function properly passes the creation time to walletFactory.restoreFromSeed() and returns a boolean success indicator. The flow handles both success and failure cases appropriately.

wallet/src/de/schildbach/wallet/service/WalletFactory.kt (1)

275-298: Wallet restoration with creation time looks well-implemented.

The implementation correctly:

  • Falls back to EARLIEST_HD_SEED_CREATION_TIME when no creation time is provided
  • Constructs the DeterministicSeed with the appropriate timestamp
  • Persists the wallet creation date to BlockchainServiceConfig
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (2)

167-198: Date picker implementation looks correct.

The date picker properly:

  • Constrains dates between EARLIEST_HD_SEED_CREATION_TIME and current time
  • Initializes to today's date
  • Converts selected date to milliseconds and passes to ViewModel

225-235: Restoration flow correctly gates PIN setup on success.

The updated flow only proceeds to SetPinActivity when restoreWalletFromSeed returns true, preventing navigation on failure.

.claude/agents/DEVELOPMENT-PATTERNS.md (1)

1-50: Excellent development patterns documentation.

This comprehensive guide covering MVVM architecture, Compose UI patterns, component mappings, and typography will significantly help maintain consistency across the codebase.

wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt (2)

125-129: Good use of DisposableEffect for date picker cleanup.

Properly dismissing the DatePickerDialog when the composable is disposed (e.g., when the screen locks) prevents window leaks.


112-262: Well-structured RescanBlockchainDialog composable.

The dialog correctly:

  • Manages selected date state with remember
  • Provides date picker with proper constraints
  • Shows clear button only when a date is selected
  • Uses ModalDialog with appropriate content layout
wallet/res/values/strings.xml (2)

206-212: LGTM! Well-crafted user-facing strings.

The wallet creation date strings are clear and informative. The explanation in restore_wallet_creation_date_info effectively communicates the benefit of selecting a creation date, and wallet_creation_date_info_description provides a helpful warning about selecting a date that's too recent.


288-293: LGTM! Rescan blockchain dialog strings are consistent with the restore flow.

The strings follow the established naming convention and provide clear guidance for the rescan feature.

wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt (1)

501-524: LGTM! Good refactoring to reduce API surface and improve type safety.

The visibility change from open to private is appropriate since these methods are internal implementation details. The non-null ImmutableList<ChildNumber> parameter type is safer and aligns with the call site at line 173 using Constants.BIP44_PATH. The switch to property access syntax (wallet.isEncrypted, supportFragmentManager) is idiomatic Kotlin.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In @common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt:
- Around line 68-70: The setter setWalletCreationDate currently persists any
Long but the getter (getWalletCreationDate) rejects dates before
EARLIEST_HD_SEED_CREATION_TIME; update setWalletCreationDate to validate the
input: ensure the provided date is >= EARLIEST_HD_SEED_CREATION_TIME (and
optionally <= System.currentTimeMillis()) before calling
set(WALLET_CREATION_DATE, date); if invalid, either throw an
IllegalArgumentException or return without persisting and log a clear error
message so invalid dates cannot be stored.

In @wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt:
- Line 207: Replace the misuse of R.string.fiat_balance_with_currency and the
hardcoded "✓" by adding a dedicated localized string resource (e.g.,
restore_wallet_select_date_selected with placeholder like "%1$s ✓") and use it
when setting binding.selectDateButton.text; update the call to getString to use
R.string.restore_wallet_select_date_selected and pass
getString(R.string.restore_wallet_select_date) as the argument so the checkmark
comes from the localized format rather than a hardcoded symbol.
- Around line 167-198: The date value from showDatePickerDialog is currently
passed in milliseconds to viewModel.setWalletCreationDate but the rest of the
code (observeSelectedDate and BlockchainServiceConfig.getWalletCreationDate)
expects/validates seconds (Constants.EARLIEST_HD_SEED_CREATION_TIME is in
seconds); convert the selectedDateInMillis to seconds before calling
viewModel.setWalletCreationDate (e.g. divide by 1000L) so stored values are
seconds-consistent across observeSelectedDate and
BlockchainServiceConfig.getWalletCreationDate, and ensure any other
callers/readers of the wallet creation date treat it as seconds.
- Around line 225-235: The code currently does nothing when
viewModel.restoreWalletFromSeed(words) returns false; update the
RestoreWalletFromSeedActivity to show user-facing error feedback (e.g.,
Toast.makeText or a Snackbar) when restoreWalletFromSeed(words) is false, and
add the string resource key restore_wallet_from_seed_failed (with an appropriate
message) to resources; keep the existing startActivityForResult call to
SetPinActivity when the call returns true and only display the error UI and do
not proceed when it returns false.
🧹 Nitpick comments (2)
common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt (1)

99-105: Prefer Typography style over inline text styling for consistency.

The button label uses inline fontSize and lineHeight values instead of a predefined TextStyle from MyTheme.Typography. For consistency with the heading (line 64) and body text (line 73), consider using a Typography style.

The inline values fontSize = 13.sp, lineHeight = 18.sp match MyTheme.Caption or could use MyTheme.Typography.LabelLarge (14sp/20sp) for better alignment with the new Typography system.

♻️ Proposed refactor
                    Text(
                        text = buttonLabel,
-                       fontSize = 13.sp,
-                       lineHeight = 18.sp,
+                       style = MyTheme.Caption,
                        color = MyTheme.Colors.dashBlue,
                        textAlign = TextAlign.Center
                    )
wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt (1)

105-110: Consider persisting initialCreationDate across configuration changes.

The show() method sets initialCreationDate but doesn't persist it in savedInstanceState. If the fragment is recreated (e.g., screen rotation), the initial date will be lost and the user will need to re-select it.

While the DisposableEffect (lines 125-129) properly dismisses any active date picker, persisting the date would provide a smoother user experience.

♻️ Optional enhancement

Add state persistence:

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    initialCreationDate = savedInstanceState?.getLong("initialCreationDate")?.takeIf { it != 0L }
}

override fun onSaveInstanceState(outState: Bundle) {
    super.onSaveInstanceState(outState)
    initialCreationDate?.let { outState.putLong("initialCreationDate", it) }
}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f02d24 and 4dd3820.

📒 Files selected for processing (5)
  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
  • common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt
  • common/src/main/java/org/dash/wallet/common/ui/components/MyTheme.kt
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
  • wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-09-23T05:19:47.861Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1428
File: wallet/src/de/schildbach/wallet/ui/dashpay/PlatformRepo.kt:1065-1068
Timestamp: 2025-09-23T05:19:47.861Z
Learning: The Dash wallet app doesn't use non-encrypted wallets, so getWalletEncryptionKey() will never return null in practice. Defensive null-safe programming with ?.let is appropriate for methods like getIdentityFromPublicKeyId() in PlatformRepo.kt.

Applied to files:

  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In Dash Wallet, DataStore operations (like those in DashPayConfig through BaseConfig) already handle background threading internally. Adding another layer of withContext(Dispatchers.IO) around these calls in ViewModels is redundant because the Jetpack DataStore API automatically dispatches its operations to a background thread.

Applied to files:

  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
📚 Learning: 2025-05-12T09:15:56.594Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1391
File: integrations/coinbase/src/main/java/org/dash/wallet/integrations/coinbase/ui/convert_currency/ConvertViewFragment.kt:134-155
Timestamp: 2025-05-12T09:15:56.594Z
Learning: The SegmentedPicker composable in Dash Wallet has a safety check for empty options, returning early if options.isEmpty() is true.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
  • wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt
🧬 Code graph analysis (3)
common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt (1)
common/src/main/java/org/dash/wallet/common/data/BaseConfig.kt (1)
  • set (82-86)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (2)
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (1)
  • createWalletCreationDateInfoDialog (42-50)
wallet/src/de/schildbach/wallet/database/entity/DashPayProfile.kt (1)
  • getString (60-62)
wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt (3)
common/src/main/java/org/dash/wallet/common/ui/components/ComposeHostFrameLayout.kt (1)
  • setContent (18-24)
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (1)
  • createWalletCreationDateInfoDialog (42-50)
common/src/main/java/org/dash/wallet/common/ui/components/DashModelDialog.kt (1)
  • ModalDialog (49-229)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (6)
common/src/main/java/org/dash/wallet/common/ui/components/MyTheme.kt (1)

135-549: Typography system implementation looks solid.

The comprehensive Typography object provides good coverage of text styles across Display, Headline, Title, Body, and Label categories. The deprecated aliases ensure backward compatibility during migration.

Note: Past review comments have already flagged the typo in the object name and the non-standard FontWeight(650) usage in the Headline Bold styles.

common/src/main/java/org/dash/wallet/common/ui/components/FeatureTopText.kt (1)

43-54: Well-structured component with good composability.

The function signature provides sensible defaults and clear parameter names. The conditional rendering logic for text and button is clean, and the use of safe calls (onButtonClick?.invoke()) properly handles nullable callbacks.

Also applies to: 55-78, 80-98, 106-119

wallet/src/de/schildbach/wallet/ui/more/RescanBlockchainDialogFragment.kt (3)

68-70: Nullable callback addresses configuration change crash risk.

The onConfirm callback is now nullable, which addresses the crash risk identified in past review comments when the fragment is recreated during configuration changes.


112-161: Solid date picker implementation with proper constraints.

The composable correctly manages state with remember and properly constrains the date picker using EARLIEST_HD_SEED_CREATION_TIME as the minimum date. The DisposableEffect (lines 125-129) ensures the date picker is dismissed when the dialog is disposed, preventing leaks.


163-261: Clean dialog UI with proper conditional rendering.

The dialog layout is well-structured with:

  • Clear labeling and info icon for the date field
  • Conditional rendering of the clear button only when a date is selected (line 236)
  • Proper visual hierarchy and spacing
  • Standard cancel/confirm button pattern
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (1)

168-168: No inconsistency issue exists—both Constants files define EARLIEST_HD_SEED_CREATION_TIME with identical values.

de.schildbach.wallet.Constants.EARLIEST_HD_SEED_CREATION_TIME and org.dash.wallet.common.util.Constants.EARLIEST_HD_SEED_CREATION_TIME both equal 1427610960L. Date validation will remain consistent across the wallet restoration and configuration subsystems.

Likely an incorrect or invalid review comment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt:
- Around line 200-213: In observeSelectedDate(), replace the misuse of
R.string.fiat_balance_with_currency and the hardcoded "✓" when setting
binding.selectDateButton.text: add a dedicated localized string resource (e.g.,
restore_wallet_select_date_selected with a placeholder for the label and
checkmark) and change the assignment in observeSelectedDate() to call
getString(R.string.restore_wallet_select_date_selected,
getString(R.string.restore_wallet_select_date)) so the checkmark is provided by
the string resource rather than hardcoded.
🧹 Nitpick comments (1)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (1)

156-165: Consider adding visual affordance for the clear action.

The tap-to-clear behavior on selectedDateDisplay isn't discoverable—users typically expect a clear/X button. Consider adding a small clear icon or tooltip, or alternatively show a confirmation before clearing.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4dd3820 and 06892ff.

📒 Files selected for processing (1)
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-05-12T09:15:56.594Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1391
File: integrations/coinbase/src/main/java/org/dash/wallet/integrations/coinbase/ui/convert_currency/ConvertViewFragment.kt:134-155
Timestamp: 2025-05-12T09:15:56.594Z
Learning: The SegmentedPicker composable in Dash Wallet has a safety check for empty options, returning early if options.isEmpty() is true.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
🧬 Code graph analysis (1)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (1)
wallet/src/de/schildbach/wallet/ui/compose_views/WalletCreationDateInfoDialog.kt (1)
  • createWalletCreationDateInfoDialog (42-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (2)

145-154: LGTM!

Clean separation of date picker setup into dedicated methods, and proper integration of the info dialog via createWalletCreationDateInfoDialog().


225-237: Error feedback now provided—minor improvement opportunity.

Good addition of error handling when restoreWalletFromSeed() returns false. Consider using a more descriptive, dedicated error message instead of the generic R.string.error placeholder for better user experience.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (1)

42-45: Redundant explicit imports.

Lines 44-45 explicitly import Calendar and Date, but these are already covered by the wildcard import on line 43 (java.util.*). Consider removing the redundant explicit imports.

♻️ Suggested cleanup
 import java.text.SimpleDateFormat
 import java.util.*
-import java.util.Calendar
-import java.util.Date
 import javax.inject.Inject
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06892ff and 337c51a.

📒 Files selected for processing (1)
  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-05-12T09:15:56.594Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1391
File: integrations/coinbase/src/main/java/org/dash/wallet/integrations/coinbase/ui/convert_currency/ConvertViewFragment.kt:134-155
Timestamp: 2025-05-12T09:15:56.594Z
Learning: The SegmentedPicker composable in Dash Wallet has a safety check for empty options, returning early if options.isEmpty() is true.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (4)

145-154: LGTM!

The date picker setup and info dialog integration are cleanly organized with appropriate separation of concerns.


156-165: LGTM!

The date picker setup is clean. The click-to-clear behavior on the date display provides intuitive UX.


224-236: Error handling for failed restoration now in place.

The addition of the error dialog on restoration failure (lines 234-236) addresses the previous concern about silent failures. Users now receive feedback when the operation fails.


177-189: Verify consistent time unit handling between Activity and ViewModel.

Line 184 passes selectedCalendar.time.time (milliseconds) to setWalletCreationDate(), while observeSelectedDate() at line 200 treats the observed value as seconds (multiplying by 1000L). The commit message mentions fixing a ms/s bug—please confirm the ViewModel properly converts milliseconds to seconds on storage.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
build.gradle (1)

72-88: Scope "Central Portal Snapshots" to avoid unintended snapshot resolution and nondeterministic builds.

The snapshot dependency org.dashj:dashj-core:21.1.14-SNAPSHOT is actively used in wallet/build.gradle. With two unscoped snapshot repositories (s01.oss.sonatype.org and central.sonatype.com), Gradle will resolve the dependency from whichever repo appears first and contains the artifact. This creates non-deterministic builds if both repos host the same version and makes it impossible to control which source is authoritative.

The commented-out content { includeModule(...) } block indicates intent to scope this, but leaving it incomplete keeps the risk active. Uncomment and implement this filter to restrict Central Portal Snapshots to only the dependencies that require it.

Proposed tightening (Groovy DSL)
 allprojects {
     repositories {
         google()
         mavenLocal()
         mavenCentral()
         maven { url 'https://jitpack.io' }
         maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
         maven {
             name 'Central Portal Snapshots'
             url 'https://central.sonatype.com/repository/maven-snapshots/'

-            // Only search this repository for the specific dependency
-//            content {
-//                includeModule("<the snapshot's groupId>", "<the snapshot's artifactId>")
-//            }
+            // Only search this repository for the specific dependency
+            content {
+                includeModule('org.dashj', 'dashj-core')
+            }
         }
     }
 }

Also evaluate whether both snapshot repositories are necessary, or if s01.oss.sonatype.org can be removed once Central Portal Snapshots is properly scoped.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 337c51a and 35b6ad1.

📒 Files selected for processing (1)
  • build.gradle
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: check

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt (1)

68-70: Consider validating input in the setter for consistency.

The getter filters out dates <= EARLIEST_HD_SEED_CREATION_TIME, but the setter accepts any value. This could lead to scenarios where a caller stores an invalid date that silently returns null on retrieval.

🔧 Optional: Add validation to reject invalid dates early
 suspend fun setWalletCreationDate(date: Long) {
+    require(date > Constants.EARLIEST_HD_SEED_CREATION_TIME) {
+        "Wallet creation date must be after EARLIEST_HD_SEED_CREATION_TIME"
+    }
     set(WALLET_CREATION_DATE, date)
 }
wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt (1)

193-194: Use the injected walletApplication instead of casting from Activity.

The class already has @Inject lateinit var walletApplication: WalletApplication at line 77. Retrieving it again via requireActivity().application as WalletApplication is redundant.

♻️ Use the injected instance
 private fun resetBlockchain() {
     viewLifecycleOwner.lifecycleScope.launch {
-        val walletApplication = requireActivity().application as WalletApplication
-        val configuration = walletApplication.configuration
+        val configuration = walletApplication.configuration
         val creationDateFromSettings = viewModel.getWalletCreationDate()
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35b6ad1 and b677ed5.

📒 Files selected for processing (3)
  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1450
File: docs/security/FALLBACK_TESTING_GUIDE.md:408-428
Timestamp: 2026-01-12T20:56:34.250Z
Learning: HashEngineering prefers to place testing utilities like FallbackTestingUtils in debug-only source sets rather than using ProGuard rules to strip them from release builds. This ensures test code is never compiled into production builds by the build system itself.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-09-23T05:19:47.861Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1428
File: wallet/src/de/schildbach/wallet/ui/dashpay/PlatformRepo.kt:1065-1068
Timestamp: 2025-09-23T05:19:47.861Z
Learning: The Dash wallet app doesn't use non-encrypted wallets, so getWalletEncryptionKey() will never return null in practice. Defensive null-safe programming with ?.let is appropriate for methods like getIdentityFromPublicKeyId() in PlatformRepo.kt.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
📚 Learning: 2025-08-08T13:29:37.702Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1419
File: wallet/src/de/schildbach/wallet/payments/SendCoinsTaskRunner.kt:312-331
Timestamp: 2025-08-08T13:29:37.702Z
Learning: Dash Wallet: For network presence checks, if a transaction is not in the wallet, we generally won’t have broadcast peer data (likely 0) and chain-locks only arrive after the block containing the transaction; thus fallback confidence checks on the local transaction often remain false. It’s safe but usually non-effective to include them; primary detection should rely on the wallet-known transaction.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-05-12T09:14:36.656Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1391
File: wallet/src/de/schildbach/wallet/ui/payments/PaymentsFragment.kt:111-119
Timestamp: 2025-05-12T09:14:36.656Z
Learning: In the dashpay/dash-wallet project, explicitly unregistering ViewPager2 callbacks is not considered critical since memory leaks haven't been observed in practice with the memory profiler.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-08-25T14:48:39.247Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-09-05T06:47:44.508Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-08-08T16:48:49.964Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1417
File: features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/MerchantDao.kt:0-0
Timestamp: 2025-08-08T16:48:49.964Z
Learning: In PR dashpay/dash-wallet#1417, HashEngineering chose to defer adding Room indexes for gift_card_providers (provider, denominationsType, merchantId) to a follow-up PR; do not block the current PR on this optimization. Files: features/exploredash/.../data/explore/MerchantDao.kt and features/exploredash/.../data/dashspend/GiftCardProvider.kt.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-09-05T06:00:25.088Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In the Dash Wallet app, DashPayConfig methods like isTransactionMetadataInfoShown() already use withContext(Dispatchers.IO) internally, so wrapping these calls with another withContext(Dispatchers.IO) in ViewModels is redundant.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-08-25T15:00:20.777Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In Dash Wallet, DataStore operations (like those in DashPayConfig through BaseConfig) already handle background threading internally. Adding another layer of withContext(Dispatchers.IO) around these calls in ViewModels is redundant because the Jetpack DataStore API automatically dispatches its operations to a background thread.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
  • common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt
📚 Learning: 2025-09-24T22:07:25.689Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1429
File: features/exploredash/src/main/res/values/strings-explore-dash.xml:239-239
Timestamp: 2025-09-24T22:07:25.689Z
Learning: The Dash wallet app has custom link handling for the "contact:" URL scheme in GiftCardDetailsDialog.kt. When a link with "contact:" is clicked, a custom LinkMovementMethod intercepts it and calls contactSupport() instead of trying to open it as a standard web link. This allows for consistent support contact behavior across different services (CTX, PiggyCards, etc.) rather than using mailto: links.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
common/src/main/java/org/dash/wallet/common/data/BlockchainServiceConfig.kt (2)

52-52: LGTM!

The new preference key for wallet creation date is properly defined using longPreferencesKey.


59-66: LGTM!

The getter correctly validates the stored creation date against EARLIEST_HD_SEED_CREATION_TIME and returns null for invalid or missing values. Based on learnings, DataStore operations handle background threading internally, so no additional dispatchers are needed.

wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt (2)

61-61: No action needed. The import of java.time.Instant is properly supported via core library desugaring enabled in the wallet module, which allows usage on minSdk 24+.

Likely an incorrect or invalid review comment.


196-215: Code is correct — creationDate is consistently in epoch seconds.

The RescanBlockchainDialogFragment converts the DatePicker's millisecond value to seconds (selectedCalendar.timeInMillis / 1000L) before passing it to the callback. The subsequent use in SettingsFragment with Instant.ofEpochSecond(creationDate) and passage to viewModel.setWalletCreationDate(it) are all consistent with this expectation, as the ViewModel stores the value as creationTimeSeconds. No changes needed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @wallet/src/de/schildbach/wallet/service/WalletFactory.kt:
- Around line 298-301: The code checks creationTimeSeconds but mistakenly writes
seedCreationTime into the config; change the call to
blockchainServiceConfig.setWalletCreationDate(...) to pass creationTimeSeconds
(not seedCreationTime). Locate the block that uses creationTimeSeconds?.let {
... } and replace the stored value with the received creationTimeSeconds (ensure
any expected units match the config API before saving).
🧹 Nitpick comments (1)
wallet/src/de/schildbach/wallet/service/WalletFactory.kt (1)

275-284: Clarify the distinction between seed creation time and wallet creation date.

The code uses EARLIEST_HD_SEED_CREATION_TIME for the DeterministicSeed (line 282-283) while the user-provided creationTimeSeconds is meant for the config. Consider adding a brief comment explaining this design choice — the wallet internally uses the earliest possible time for key derivation, while the config stores the user-selected date for blockchain sync optimization.

This aligns with the commit message "don't save the UI date in the wallet."

📝 Suggested documentation
         return try {
-            // The wallet creation time should always be the oldest possible time
+            // The wallet internally uses the earliest possible time for key derivation to ensure
+            // all historical transactions are found. The user-selected creationTimeSeconds is stored
+            // separately in BlockchainServiceConfig for sync optimization purposes only.
             val seedCreationTime = Constants.EARLIEST_HD_SEED_CREATION_TIME
             val seed = DeterministicSeed(words, null, "", seedCreationTime)
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b677ed5 and fc9f2d7.

📒 Files selected for processing (2)
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1450
File: docs/security/FALLBACK_TESTING_GUIDE.md:408-428
Timestamp: 2026-01-12T20:56:41.213Z
Learning: HashEngineering prefers to place testing utilities like FallbackTestingUtils in debug-only source sets rather than using ProGuard rules to strip them from release builds. This ensures test code is never compiled into production builds by the build system itself.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-09-23T05:19:47.861Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1428
File: wallet/src/de/schildbach/wallet/ui/dashpay/PlatformRepo.kt:1065-1068
Timestamp: 2025-09-23T05:19:47.861Z
Learning: The Dash wallet app doesn't use non-encrypted wallets, so getWalletEncryptionKey() will never return null in practice. Defensive null-safe programming with ?.let is appropriate for methods like getIdentityFromPublicKeyId() in PlatformRepo.kt.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In the Dash Wallet app, DashPayConfig methods like isTransactionMetadataInfoShown() already use withContext(Dispatchers.IO) internally, so wrapping these calls with another withContext(Dispatchers.IO) in ViewModels is redundant.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-04-19T07:01:17.535Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1362
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:107-115
Timestamp: 2025-04-19T07:01:17.535Z
Learning: In Dash Wallet, DataStore operations (like those in DashPayConfig through BaseConfig) already handle background threading internally. Adding another layer of withContext(Dispatchers.IO) around these calls in ViewModels is redundant because the Jetpack DataStore API automatically dispatches its operations to a background thread.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-08-08T16:48:49.964Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1417
File: features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/MerchantDao.kt:0-0
Timestamp: 2025-08-08T16:48:49.964Z
Learning: In PR dashpay/dash-wallet#1417, HashEngineering chose to defer adding Room indexes for gift_card_providers (provider, denominationsType, merchantId) to a follow-up PR; do not block the current PR on this optimization. Files: features/exploredash/.../data/explore/MerchantDao.kt and features/exploredash/.../data/dashspend/GiftCardProvider.kt.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-08-25T14:48:39.247Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-09-05T06:47:44.508Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-09-05T06:00:25.088Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-05-12T09:14:36.656Z
Learnt from: Syn-McJ
Repo: dashpay/dash-wallet PR: 1391
File: wallet/src/de/schildbach/wallet/ui/payments/PaymentsFragment.kt:111-119
Timestamp: 2025-05-12T09:14:36.656Z
Learning: In the dashpay/dash-wallet project, explicitly unregistering ViewPager2 callbacks is not considered critical since memory leaks haven't been observed in practice with the memory profiler.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-08-25T15:00:20.777Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-09-24T22:07:25.689Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1429
File: features/exploredash/src/main/res/values/strings-explore-dash.xml:239-239
Timestamp: 2025-09-24T22:07:25.689Z
Learning: The Dash wallet app has custom link handling for the "contact:" URL scheme in GiftCardDetailsDialog.kt. When a link with "contact:" is clicked, a custom LinkMovementMethod intercepts it and calls contactSupport() instead of trying to open it as a standard web link. This allows for consistent support contact behavior across different services (CTX, PiggyCards, etc.) rather than using mailto: links.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
📚 Learning: 2025-09-05T06:16:12.649Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:134-145
Timestamp: 2025-09-05T06:16:12.649Z
Learning: The dash-wallet project has a minimum SDK version of 24, so API availability checks for methods introduced in API 23 or earlier are not needed.

Applied to files:

  • wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-04-16T17:07:27.359Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1377
File: wallet/src/de/schildbach/wallet/service/platform/PlatformService.kt:0-0
Timestamp: 2025-04-16T17:07:27.359Z
Learning: For PlatformService in the Dash Wallet, the implementation should avoid throwing exceptions when Constants.SUPPORTS_PLATFORM is false. The platform should only be initialized when SUPPORTS_PLATFORM is true, and initialization should be done lazily to defer Platform creation until needed.

Applied to files:

  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
🧬 Code graph analysis (1)
wallet/src/de/schildbach/wallet/service/WalletFactory.kt (1)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt (1)
  • restoreWalletFromSeed (88-102)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (5)
wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt (2)

42-42: LGTM: BlockchainServiceConfig dependency injection.

The new dependency is correctly injected via Hilt constructor injection, following the existing pattern for other config dependencies in this ViewModel.

Also applies to: 75-75


205-210: LGTM: Wallet creation date accessors.

The new suspend functions correctly delegate to blockchainServiceConfig. Based on learnings, DataStore operations in this codebase already handle background threading internally, so no additional withContext(Dispatchers.IO) wrapping is needed.

wallet/src/de/schildbach/wallet/service/WalletFactory.kt (3)

59-62: LGTM: Interface updated to suspend function with optional creation time.

The interface change correctly adds the suspend modifier and optional creationTimeSeconds parameter, aligning with the asynchronous restoration flow.


72-75: LGTM: BlockchainServiceConfig dependency added.

Constructor correctly accepts the new dependency for persisting wallet creation date.


123-125: Verify: creationTimeSeconds parameter is correctly propagated.

The override correctly delegates to restoreWalletFromSeed with all parameters. However, ensure the fix for storing creationTimeSeconds (not seedCreationTime) is applied in the private implementation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @wallet/src/de/schildbach/wallet/service/WalletFactory.kt:
- Around line 59-62: The test calling the suspend function restoreFromSeed is
missing a coroutine context; modify the failing test in WalletFactoryTest (the
test at the location that invokes restoreFromSeed) to run inside a coroutine
builder such as kotlinx.coroutines.test.runTest { ... } or
kotlinx.coroutines.runBlocking { ... }, moving the restoreFromSeed(...)
invocation into that lambda and importing the chosen builder so the suspend call
executes correctly.
🧹 Nitpick comments (1)
wallet/src/de/schildbach/wallet/service/WalletFactory.kt (1)

275-305: Remove empty finally block and consider error handling.

The try-finally with an empty finally clause serves no purpose and should be cleaned up.

Additionally, blockchainServiceConfig.setWalletCreationDate(it) is called after wallet creation but before returning. If the caller fails to persist the wallet, the creation date will already be stored, potentially causing inconsistent state. Consider whether this side effect should be moved to the caller or handled atomically.

♻️ Suggested cleanup
     private suspend fun restoreWalletFromSeed(
         words: List<String>,
         params: NetworkParameters,
         creationTimeSeconds: Long? = null
     ): Wallet {
-        return try {
-            // The wallet creation time should always be the oldest possible time
-            val seedCreationTime = Constants.EARLIEST_HD_SEED_CREATION_TIME
-            val seed = DeterministicSeed(words, null, "", seedCreationTime)
-            val group = KeyChainGroup.builder(params)
-                .fromSeed(seed, Script.ScriptType.P2PKH)
-                .addChain(
-                    DeterministicKeyChain.builder()
-                        .seed(seed)
-                        .accountPath(Constants.BIP44_PATH)
-                        .build()
-                )
-                .build()
-            val wallet = WalletEx(params, group)
-            // add extensions
-            addMissingExtensions(wallet)
-
-            checkWalletValid(wallet, params)
-            // set the creation date here
-            creationTimeSeconds?.let {
-                blockchainServiceConfig.setWalletCreationDate(it)
-            }
-            wallet
-        } finally {
-        }
+        // The wallet creation time should always be the oldest possible time
+        val seedCreationTime = Constants.EARLIEST_HD_SEED_CREATION_TIME
+        val seed = DeterministicSeed(words, null, "", seedCreationTime)
+        val group = KeyChainGroup.builder(params)
+            .fromSeed(seed, Script.ScriptType.P2PKH)
+            .addChain(
+                DeterministicKeyChain.builder()
+                    .seed(seed)
+                    .accountPath(Constants.BIP44_PATH)
+                    .build()
+            )
+            .build()
+        val wallet = WalletEx(params, group)
+        // add extensions
+        addMissingExtensions(wallet)
+
+        checkWalletValid(wallet, params)
+        // set the creation date here
+        creationTimeSeconds?.let {
+            blockchainServiceConfig.setWalletCreationDate(it)
+        }
+        return wallet
     }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc9f2d7 and 6b58a5c.

📒 Files selected for processing (1)
  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsScreen.kt:122-151
Timestamp: 2025-09-05T06:47:44.508Z
Learning: HashEngineering prefers to defer UI edge case fixes like the CoinJoin finishing state display issue (showing "Finishing ...%" when mode is OFF but status is FINISHING) to later PRs when the main focus is on redesigning the settings screen.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: common/src/main/java/org/dash/wallet/common/util/Constants.kt:68-69
Timestamp: 2025-08-25T15:00:20.777Z
Learning: HashEngineering prefers to keep HTTP logging enabled in release mode (using log.info instead of gating with BuildConfig.DEBUG) to debug production errors, even though this may leak URLs in production logs. This is a deliberate trade-off for debugging purposes in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1410
File: wallet/src/de/schildbach/wallet/data/InvitationLinkData.kt:79-84
Timestamp: 2025-07-12T07:12:04.769Z
Learning: HashEngineering prefers to handle defensive validation improvements for URI parsing in follow-up PRs rather than including them in the current PR when the main focus is on replacing Firebase with AppsFlyer.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1450
File: docs/security/FALLBACK_TESTING_GUIDE.md:408-428
Timestamp: 2026-01-12T20:56:41.213Z
Learning: HashEngineering prefers to place testing utilities like FallbackTestingUtils in debug-only source sets rather than using ProGuard rules to strip them from release builds. This ensures test code is never compiled into production builds by the build system itself.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1423
File: wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt:418-446
Timestamp: 2025-08-25T14:48:39.247Z
Learning: HashEngineering prefers to refactor and reuse topup code for balance validation logic improvements in DashPay activities like EditProfileActivity, rather than implementing individual fixes in the current PR.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1422
File: wallet/src/de/schildbach/wallet/data/PaymentIntent.java:476-481
Timestamp: 2025-08-25T15:04:18.461Z
Learning: HashEngineering prefers to keep payeeUsername and payeeUserId in PaymentIntent.toString() logs unredacted for debugging purposes, prioritizing troubleshooting capability over PII protection concerns in the Dash wallet project.
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt:94-101
Timestamp: 2025-09-05T06:00:25.088Z
Learning: HashEngineering prefers to fix the DashButton alpha dimming issue (using explicit disabled colors instead of overall alpha) in a follow-up PR rather than including it in the current settings screen redesign PR.
📚 Learning: 2025-09-23T05:19:47.861Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1428
File: wallet/src/de/schildbach/wallet/ui/dashpay/PlatformRepo.kt:1065-1068
Timestamp: 2025-09-23T05:19:47.861Z
Learning: The Dash wallet app doesn't use non-encrypted wallets, so getWalletEncryptionKey() will never return null in practice. Defensive null-safe programming with ?.let is appropriate for methods like getIdentityFromPublicKeyId() in PlatformRepo.kt.

Applied to files:

  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-04-16T17:07:27.359Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1377
File: wallet/src/de/schildbach/wallet/service/platform/PlatformService.kt:0-0
Timestamp: 2025-04-16T17:07:27.359Z
Learning: For PlatformService in the Dash Wallet, the implementation should avoid throwing exceptions when Constants.SUPPORTS_PLATFORM is false. The platform should only be initialized when SUPPORTS_PLATFORM is true, and initialization should be done lazily to defer Platform creation until needed.

Applied to files:

  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
📚 Learning: 2025-09-05T06:16:12.649Z
Learnt from: HashEngineering
Repo: dashpay/dash-wallet PR: 1425
File: wallet/src/de/schildbach/wallet/ui/more/SettingsViewModel.kt:134-145
Timestamp: 2025-09-05T06:16:12.649Z
Learning: The dash-wallet project has a minimum SDK version of 24, so API availability checks for methods introduced in API 23 or earlier are not needed.

Applied to files:

  • wallet/src/de/schildbach/wallet/service/WalletFactory.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
wallet/src/de/schildbach/wallet/service/WalletFactory.kt (3)

72-75: LGTM!

Constructor injection of BlockchainServiceConfig follows the established DI pattern with Hilt.


123-125: LGTM!

Clean delegation to the private implementation method.


281-301: Good design: separating seed time from user-provided creation date.

The approach of using EARLIEST_HD_SEED_CREATION_TIME for the seed while storing the user-provided creationTimeSeconds in blockchainServiceConfig is correct. This ensures:

  1. Full blockchain scanning coverage from the earliest HD wallet time
  2. User's date preference is persisted separately for sync/UI purposes

This aligns with the PR objective to "not save the UI date in the wallet."

@@ -0,0 +1,159 @@
/*
* Copyright 2025 Dash Core Group.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to use 2025?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will update our date for new files to 2026 for now on

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@wallet/src/de/schildbach/wallet/ui/SettingsFragment.kt`:
- Around line 190-214: The rescan flow in resetBlockchain() currently passes a
null creationDate from RescanBlockchainDialogFragment into
viewModel.setWalletCreationDate(null), which causes the wallet to be reset to
EARLIEST_HD_SEED_CREATION_TIME instead of preserving the existing date; change
the logic so that when the dialog returns creationDate == null (user cleared the
date) you do not overwrite the stored creation date — either call
viewModel.setWalletCreationDate(creationDateFromSettings) or skip calling
setWalletCreationDate entirely, and preserve the existing value from
viewModel.getWalletCreationDate(); update resetBlockchain() to use the saved
creationDateFromSettings when creationDate is null so the user's intent to
"leave unchanged" is honored.
🧹 Nitpick comments (2)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt (1)

20-20: Encapsulate selectedCreationDate to prevent external writes bypassing unit conversion.

Public MutableLiveData could allow callers to set raw values and skip setWalletCreationDate(). Prefer a private mutable backing field with a public LiveData view to enforce the conversion logic.

♻️ Proposed refactor
-import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
@@
-    val selectedCreationDate = MutableLiveData<Long?>() // timestamp in seconds, null = not selected
+    private val _selectedCreationDate = MutableLiveData<Long?>() // timestamp in seconds, null = not selected
+    val selectedCreationDate: LiveData<Long?> get() = _selectedCreationDate
@@
-        selectedCreationDate.value = timeInMillis?.let { it / 1000 } // convert to seconds
+        _selectedCreationDate.value = timeInMillis?.let { it / 1000 } // convert to seconds
@@
-        selectedCreationDate.value = null
+        _selectedCreationDate.value = null

Also applies to: 59-59, 172-178

wallet/res/values/strings.xml (1)

288-293: Consider richer copy (or reuse existing description) for date info.
rescan_blockchain_date_info_description currently reads like a placeholder. Reusing the detailed creation-date explanation would be more helpful and consistent.

♻️ Suggested reuse to avoid placeholder copy
-    <string name="rescan_blockchain_date_info_description">Information about wallet creation date</string>
+    <string name="rescan_blockchain_date_info_description">@string/wallet_creation_date_info_description</string>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt`:
- Around line 191-205: The restoreWalletFromSeed function's call to isSeedValid
can throw MnemonicException so the else branch is unreachable; update
restoreWalletFromSeed to catch MnemonicException (around isSeedValid or the
validation+normalize step) and return false when caught, optionally logging the
exception, so the function reliably returns a boolean for invalid seeds;
reference restoreWalletFromSeed, isSeedValid, MnemonicException, normalize and
walletFactory.restoreFromSeed when making the change.
♻️ Duplicate comments (1)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (1)

199-210: Use a dedicated localized string for the selected-date label.

The current label reuses a currency-format string and hardcodes a "✓", which breaks i18n. Please switch to a dedicated string resource (e.g., restore_wallet_select_date_selected).

♻️ Suggested change
-                binding.selectDateButton.text = getString(R.string.fiat_balance_with_currency, getString(R.string.restore_wallet_select_date), "✓")
+                binding.selectDateButton.text = getString(
+                    R.string.restore_wallet_select_date_selected,
+                    getString(R.string.restore_wallet_select_date)
+                )
🧹 Nitpick comments (2)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedActivity.kt (1)

167-188: Initialize the date picker with the current selection.

Reopening the picker always starts at today, which is confusing after a user has already selected a date. Consider initializing the dialog with the existing selected date (if any).

♻️ Suggested change
-        // Set initial date to today
-        val calendar = Calendar.getInstance()
+        // Set initial date to selected date (fallback to today)
+        val calendar = Calendar.getInstance()
+        viewModel.selectedCreationDate.value?.let { seconds ->
+            calendar.timeInMillis = seconds * 1000L
+        }
         val year = calendar.get(Calendar.YEAR)
         val month = calendar.get(Calendar.MONTH)
         val day = calendar.get(Calendar.DAY_OF_MONTH)
wallet/src/de/schildbach/wallet/ui/RestoreWalletFromSeedViewModel.kt (1)

20-20: Encapsulate MutableLiveData behind a private backing field.

Public MutableLiveData allows external mutation; prefer a private backing property and expose LiveData instead. This keeps state mutation inside the ViewModel.

♻️ Proposed refactor
-import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
@@
-    val selectedCreationDate = MutableLiveData<Long?>() // timestamp in seconds, null = not selected
+    private val _selectedCreationDate = MutableLiveData<Long?>() // timestamp in seconds, null = not selected
+    val selectedCreationDate: LiveData<Long?> get() = _selectedCreationDate
@@
     fun setWalletCreationDate(timeInMillis: Long?) {
-        selectedCreationDate.value = timeInMillis?.let { it / 1000 } // convert to seconds
+        _selectedCreationDate.value = timeInMillis?.let { it / 1000 } // convert to seconds
     }
@@
     fun clearWalletCreationDate() {
-        selectedCreationDate.value = null
+        _selectedCreationDate.value = null
     }

Also applies to: 59-60, 172-178

@HashEngineering
HashEngineering merged commit eddb65b into master Jan 19, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jan 20, 2026
1 of 3 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Apr 16, 2026
3 tasks
@HashEngineering
HashEngineering deleted the feat/sync-start-date branch April 20, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants