Skip to content

fix(swift-sdk): example app ask if the spv is running directly instead of using the sync state#3821

Merged
ZocoLini merged 1 commit into
v3.1-devfrom
fix/stop-spv-example-app
Jun 10, 2026
Merged

fix(swift-sdk): example app ask if the spv is running directly instead of using the sync state#3821
ZocoLini merged 1 commit into
v3.1-devfrom
fix/stop-spv-example-app

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Before the arquitectural change the example app was checking if the spv client was running using the sync progress state, in this PR we are replacing that logic with directly calls to the exposed spv client methods that correctly return if the spv client is running or not

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Refactor
    • SPV running status handling was redesigned and is now exposed as a stable read-only indicator.
    • The UI now reads this indicator to drive Start/Pause and Clear button enabled/disabled states, improving reliability of those controls.
    • SPV polling was adjusted to update the indicator only when the running state changes, reducing unnecessary UI updates.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38af956a-4df4-4ddd-91ad-62e192786b7c

📥 Commits

Reviewing files that changed from the base of the PR and between c59d12b and 77ced90.

📒 Files selected for processing (2)
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManager.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerSPV.swift
💤 Files with no reviewable changes (2)
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManager.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerSPV.swift

📝 Walkthrough

Walkthrough

Adds a published spvIsRunning property to PlatformWalletManager, updates the SPV polling loop to refresh it, removes the enum-level isRunning property, and changes the example app view to observe the new manager-published state.

Changes

SPV Running State Indicator

Layer / File(s) Summary
SPV running state property and polling update
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManager.swift
PlatformWalletManager introduces @Published public private(set) var spvIsRunning: Bool and extends the SPV polling loop to call isSpvRunning() and update spvIsRunning when the value changes.
Enum property cleanup
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerSPV.swift
Removes the public isRunning computed property from PlatformSpvSyncState; the enum ends after its final case.
View update for new state source
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/CoreContentView.swift
CoreContentView now reads isSpvRunning from walletManager.spvIsRunning instead of walletManager.spvProgress.overallState.isRunning.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • shumkov
  • QuantumExplorer
  • thepastaclaw

Poem

🐰 A tiny hop through manager fields,
I publish truths the UI yields,
The poller asks and then replies,
Buttons wake under clearer skies,
Hooray — SPV's running, carrot-wise! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: moving from sync state inspection to direct SPV running checks in the example app.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/stop-spv-example-app

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.

@ZocoLini ZocoLini requested a review from bezibalazs June 9, 2026 10:06
@thepastaclaw

thepastaclaw commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit c59d12b)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

Small, focused change replacing a derived isRunning enum property with a directly-polled @published Bool from the SPV FFI. The convergent concern is that removing the public PlatformSpvSyncState.isRunning is technically source-breaking for downstream SDK consumers, though the new spvIsRunning property cleanly replaces it. Treated as a suggestion rather than blocking given the swift-sdk's active-development status and trivial migration path.

🟡 1 suggestion(s) | 💬 1 nitpick(s)

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerSPV.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerSPV.swift:5-11: Removing public PlatformSpvSyncState.isRunning is source-breaking
  `PlatformSpvSyncState.isRunning` was a public computed property on a public enum in `SwiftDashSDK`. Downstream apps reading `progress.overallState.isRunning` will fail to compile after this PR. The PR title isn't marked breaking and the breaking-change checkbox is unchecked, but the deletion silently changes the public surface. Either mark the PR breaking, or retain the property with a `@available(*, deprecated, message: "Use PlatformWalletManager.spvIsRunning")` annotation pointing to the new source of truth. Note the new signal (FFI `spv_is_running`) is semantically different from the old (derived from progress state: only `waitingForConnections`/`syncing` returned true), so silently keeping a no-op shim is not equivalent — deprecation with redirect is the right shape.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "0f0be9e3e230fa6fd622481b8867b9c76fd7bb3756058ab7c047d1ac308d8dd2"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

@ZocoLini ZocoLini force-pushed the fix/stop-spv-example-app branch from c59d12b to 77ced90 Compare June 10, 2026 10:29
@ZocoLini ZocoLini merged commit ba94110 into v3.1-dev Jun 10, 2026
17 checks passed
@ZocoLini ZocoLini deleted the fix/stop-spv-example-app branch June 10, 2026 11:35
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.

3 participants