feat(ui): migrate seed input flow to Swift bridge and align watch build version#770
feat(ui): migrate seed input flow to Swift bridge and align watch build version#770romchornyi wants to merge 5 commits into
Conversation
📝 WalkthroughWalkthroughSeed phrase recovery UI migrates from Objective-C UITextView to SwiftUI via a new Swift controller that bridges SwiftUI behavior to ObjC delegates. DWRecoverContentView now hosts and forwards to the controller; project files, bridging header, and build flags updated to include the new Swift sources and diagnostic flag. ChangesSeed Phrase Recovery Refactoring
Sequence Diagram(s)sequenceDiagram
participant ViewController as DWRecoverViewController
participant ContentView as DWRecoverContentView
participant Controller as RecoverSeedPhraseInputController
participant State as RecoverSeedPhraseInputState
participant SwiftUI as RecoverSeedPhraseInputView
participant Delegate as Recovery Delegate
ViewController->>ContentView: attachToParentViewController(self)
ContentView->>Controller: init(delegate: self)
Controller->>State: initialize state
ContentView->>Controller: addChild(viewController)
Controller->>SwiftUI: UIHostingController presents view
Note over SwiftUI,Controller: User enters seed phrase
SwiftUI->>State: phrase binding updated
State->>Controller: onPhraseChange callback
Controller->>ContentView: phraseDidChange(phrase:)
ContentView->>Delegate: phraseDidChange(phrase:)
Note over SwiftUI,Controller: User submits phrase
SwiftUI->>Controller: onSubmit callback
Controller->>Controller: continueAction()
alt Invalid word count
Controller->>ContentView: showIncorrectWord(word:)
ContentView->>Delegate: showIncorrectWord(word:)
else Bad recovery phrase
Controller->>ContentView: badRecoveryPhrase()
ContentView->>Delegate: badRecoveryPhrase()
else Wipe not allowed
Controller->>ContentView: wipeNotAllowed()
ContentView->>Delegate: wipeNotAllowed()
else Recover success
Controller->>ContentView: didRecoverWalletWith(info:)
ContentView->>Delegate: didRecoverWalletWith(info:)
end
Delegate->>ViewController: handle outcome
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@DashWallet/Sources/UI/Setup/RecoverWallet/Views/DWRecoverContentView.m`:
- Around line 55-59: The child view controller's view (hostView created from
inputController.viewController.view) is being added to self before the view
controller containment calls; move the call that adds hostView as a subview and
sets its translatesAutoresizingMaskIntoConstraints/backgroundColor and
constraints so it happens after you call addChildViewController: on
inputController.viewController but before you call
didMoveToParentViewController:; ensure addChildViewController: is called on the
parent (self) with inputController.viewController, then addSubview:hostView and
activate constraints, then call didMoveToParentViewController: to complete
containment.
In
`@DashWallet/Sources/UI/Setup/RecoverWallet/Views/RecoverSeedPhraseInputController.swift`:
- Around line 137-140: Replace the hard-coded raw-value constant by comparing
the model action directly to the Objective-C enum case: remove private let
recoverActionRawValue and change checks like model.action.rawValue ==
recoverActionRawValue in RecoverSeedPhraseInputController to compare
model.action (or its value) against DWRecoverAction_Recover; alternatively add a
boolean on DWRecoverModel (e.g., isRecoverAction) and use that in the routing
logic to avoid relying on enum ordering.
In `@WatchApp` Extension/Info.plist:
- Line 24: The Info.plist currently hardcodes CFBundleVersion as "12"; change
that string to use the Xcode build variable (e.g., replace the literal with
$(CURRENT_PROJECT_VERSION) or $(MARKETING_VERSION) as appropriate for your
versioning policy) so the WatchApp Extension inherits the iOS app's project
version automatically; ensure the WatchApp Extension target's
CURRENT_PROJECT_VERSION (or MARKETING_VERSION) build setting is configured to
match the main iOS app so the plist value stays in sync and you no longer need
to edit CFBundleVersion by hand.
In `@WatchApp/Info.plist`:
- Line 24: The CFBundleVersion in WatchApp/Info.plist was hardcoded to "12";
revert it to use the build variable by replacing the literal with
$(CURRENT_PROJECT_VERSION) so the WatchApp target inherits the project's build
number automatically; ensure the WatchApp target's CURRENT_PROJECT_VERSION is
set in Xcode project settings and keep CFBundleShortVersionString using
$(MARKETING_VERSION) if applicable to maintain parity with the iOS app.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 44cd4f2f-994b-4505-b404-4f6f7217c2b9
📒 Files selected for processing (9)
DashWallet.xcodeproj/project.pbxprojDashWallet/Sources/UI/Setup/RecoverWallet/DWRecoverViewController.mDashWallet/Sources/UI/Setup/RecoverWallet/Views/DWRecoverContentView.hDashWallet/Sources/UI/Setup/RecoverWallet/Views/DWRecoverContentView.mDashWallet/Sources/UI/Setup/RecoverWallet/Views/RecoverSeedPhraseInputController.swiftDashWallet/Sources/UI/Setup/RecoverWallet/Views/RecoverSeedPhraseInputView.swiftDashWallet/dashwallet-Bridging-Header.hWatchApp Extension/Info.plistWatchApp/Info.plist
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@DashWallet.xcodeproj/project.pbxproj`:
- Line 10839: The SWIFT_ACTIVE_COMPILATION_CONDITIONS entry currently enables
SEED_INPUT_DIAGNOSTICS in non-debug builds; remove SEED_INPUT_DIAGNOSTICS from
any build configurations that do not include DEBUG so diagnostic code isn't
shipped. Locate the SWIFT_ACTIVE_COMPILATION_CONDITIONS assignments (e.g., the
line containing "PIGGYCARDS_ENABLED SEED_INPUT_DIAGNOSTICS") and ensure
SEED_INPUT_DIAGNOSTICS is only present in debug configurations (where DEBUG is
defined), leaving release/distribution configurations without that flag; also
update the other identical occurrence noted in the diff so both spots are fixed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: efcb6ee3-de5a-4c82-80fa-411c324a2de9
📒 Files selected for processing (1)
DashWallet.xcodeproj/project.pbxproj
| PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash; | ||
| PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| SWIFT_ACTIVE_COMPILATION_CONDITIONS = PIGGYCARDS_ENABLED; | ||
| SWIFT_ACTIVE_COMPILATION_CONDITIONS = "PIGGYCARDS_ENABLED SEED_INPUT_DIAGNOSTICS"; |
There was a problem hiding this comment.
Do not enable SEED_INPUT_DIAGNOSTICS in non-debug build configurations.
These configs omit DEBUG but still compile diagnostics code. For seed-entry flows, that can unintentionally ship diagnostic behavior into distribution builds.
Suggested fix
- SWIFT_ACTIVE_COMPILATION_CONDITIONS = "PIGGYCARDS_ENABLED SEED_INPUT_DIAGNOSTICS";
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "PIGGYCARDS_ENABLED";Also applies to: 11823-11823
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@DashWallet.xcodeproj/project.pbxproj` at line 10839, The
SWIFT_ACTIVE_COMPILATION_CONDITIONS entry currently enables
SEED_INPUT_DIAGNOSTICS in non-debug builds; remove SEED_INPUT_DIAGNOSTICS from
any build configurations that do not include DEBUG so diagnostic code isn't
shipped. Locate the SWIFT_ACTIVE_COMPILATION_CONDITIONS assignments (e.g., the
line containing "PIGGYCARDS_ENABLED SEED_INPUT_DIAGNOSTICS") and ensure
SEED_INPUT_DIAGNOSTICS is only present in debug configurations (where DEBUG is
defined), leaving release/distribution configurations without that flag; also
update the other identical occurrence noted in the diff so both spots are fixed.
Issue being fixed or feature implemented
This PR finalizes the Recover Wallet seed-entry migration path by moving seed phrase decision logic from Objective-C container code into Swift-side controller logic, while preserving the existing Objective-C public API and delegate contract.
What was done?
How Has This Been Tested?
Manual code-path verification by review against legacy behavior requirements:
Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes
Chores