Skip to content

fix: issue 289 #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2025
Merged

fix: issue 289 #290

merged 4 commits into from
Apr 24, 2025

Conversation

r1b2ns
Copy link
Collaborator

@r1b2ns r1b2ns commented Apr 24, 2025

Description

Fix issue 289

Notes to the reviewers

This PR includes a small refactor that extracts the WalletSyncScriptInspector and WalletFullScanScriptInspector classes into separate files, and both have now been converted into actors.

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature
  • UI changes tested on small, medium, and large devices to ensure layout consistency

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@r1b2ns r1b2ns changed the title Fix/issue 289 fix: issue 289 Apr 24, 2025
@reez reez requested a review from Copilot April 24, 2025 13:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issue 289 by refactoring the wallet sync and full scan inspectors into separate files and converting them into actors. It also removes duplicate progress update functions from several view models in favor of concise closure-based implementations.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
BDKSwiftExampleWallet/View Model/WalletViewModel.swift Implements closure-based progress update and removes unused update functions.
BDKSwiftExampleWallet/View Model/Settings/SettingsViewModel.swift Replaces the old updateProgressFullScan function with a closure for updating progress.
BDKSwiftExampleWallet/View Model/Activity/ActivityListViewModel.swift Introduces a closure-based updateProgress and removes the redundant function implementation.
BDKSwiftExampleWallet/Actor/WalletSyncScriptInspector.swift Moves sync inspector logic into an actor; note the use of a synchronous sleep call in an actor context.
BDKSwiftExampleWallet/Actor/WalletFullScanScriptInspector.swift Moves full scan inspector logic into an actor using closure-based progress updates.
Files not reviewed (1)
  • BDKSwiftExampleWallet.xcodeproj/project.pbxproj: Language not supported

@reez
Copy link
Collaborator

reez commented Apr 24, 2025

Nice! Feel free to add me as reviewer when this is ready for review (just want to make sure I don't start reviewing before you're ready)

@r1b2ns
Copy link
Collaborator Author

r1b2ns commented Apr 24, 2025

Hi @reez, I believe I don’t have the necessary permissions to add reviewers to PRs.

Could you please take a look at it?

@reez
Copy link
Collaborator

reez commented Apr 24, 2025

yeah my bad, take a look to see if you got an invite/access

@r1b2ns r1b2ns requested a review from reez April 24, 2025 15:37
@r1b2ns
Copy link
Collaborator Author

r1b2ns commented Apr 24, 2025

I received and accepted!! thk @reez

@reez
Copy link
Collaborator

reez commented Apr 24, 2025

What do you think about https://github.com/bitcoindevkit/BDKSwiftExampleWallet/pull/290/files#r2058436583 comment from Copilot?

Otherwise tested and everything works great!

@r1b2ns
Copy link
Collaborator Author

r1b2ns commented Apr 24, 2025

I’ll take care of it! One way to solve this is by using Task.sleep inside a Task, because we can’t make inspect function async to use Task.sleep directly.

I just tested this solution and works perfectly.
What do you think?

@reez
Copy link
Collaborator

reez commented Apr 24, 2025

I’ll take care of it! One way to solve this is by using Task.sleep inside a Task, because we can’t make inspect function async to use Task.sleep directly.

I just tested this solution and works perfectly. What do you think?

Love it, perfect solution.

And by the way the reason I had to sleep there was more of a UI/UX reason, on WalletView the visual progress of the scripts being inspected went too fast visually if people were new users, so just letting you know since its a bit unclear possibly exactly why I'm sleeping there

@reez reez merged commit 9d7f3c5 into bitcoindevkit:main Apr 24, 2025
1 check passed
@r1b2ns r1b2ns deleted the fix/issue-289 branch April 24, 2025 18:11
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