fix(dashpay): defer contact auth until preview closes - #994
Conversation
📝 WalkthroughWalkthrough
ChangesContact preview actions
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AddContactScreen
participant PreviewSheet
participant performPendingPreviewAction
participant ContactRequestFlow
AddContactScreen->>PreviewSheet: Queue send or accept action
PreviewSheet->>AddContactScreen: Complete dismissal
AddContactScreen->>performPendingPreviewAction: Dispatch pending action
performPendingPreviewAction->>ContactRequestFlow: Revalidate current state
ContactRequestFlow-->>AddContactScreen: Send or accept, or report invalid state
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/AddContactScreen.swift (1)
81-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the explicit
nilinitializer.SwiftLint reports
implicit_optional_initializationon Line 81. Optional stored properties initialize tonilby default.Proposed fix
- `@State` private var pendingPreviewAction: PendingPreviewAction? = nil + `@State` private var pendingPreviewAction: PendingPreviewAction?As per coding guidelines, “Use SwiftFormat and SwiftLint conventions.”
🤖 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/Sources/UI/DashPay/Contacts/SwiftUI/AddContactScreen.swift` at line 81, Remove the explicit nil initializer from the pendingPreviewAction state property declaration, relying on Swift’s default optional initialization while preserving its existing optional type and behavior.Sources: Coding guidelines, Linters/SAST tools
🤖 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.
Nitpick comments:
In `@DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/AddContactScreen.swift`:
- Line 81: Remove the explicit nil initializer from the pendingPreviewAction
state property declaration, relying on Swift’s default optional initialization
while preserving its existing optional type and behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f53b18db-43ef-4b07-a647-eb05bc7b317f
📒 Files selected for processing (1)
DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/AddContactScreen.swift
|
Revalidating after dismissal is the right call — but two of its outcomes are silent. In It's a narrow window, but it's exactly the window this PR opens up: the action is now dispatched after the dismissal, so a relationship change during that transition lands in these branches rather than being impossible as before.
|
Summary
Root cause
The contact preview started authentication and dismissed itself in the same tap. Depending on SwiftUI scroll/focus and keyboard timing, the PIN modal could be attached to the disappearing preview controller, briefly appear, then be removed and reported as Authentication failed before any PIN digits were entered.
Verification
xcodebuild -workspace DashWallet.xcworkspace -scheme dashpay -configuration Debug -destination generic/platform=iOS Simulator CODE_SIGNING_ALLOWED=NO EXCLUDED_ARCHS=x86_64 ONLY_ACTIVE_ARCH=YES buildgit diff --checkSummary by CodeRabbit