Skip to content
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

Improve how we persist the last manually disconnected device #51

Merged
merged 25 commits into from
Nov 10, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Oct 28, 2024

Improve how we persist the last manually disconnected device

♻️ Current situation & Problem

The feature that prevents the last known device from getting reconnected currently doesn't work properly. This PR fixes that to ensure that the last manually disconnected device won't be automatically connected again.

With fully enabling Swift 6, we discovered that SwiftUI assumes that mutations are executed on the MainActor. Therefore, this PR needed to restructures how mutations are notified using Observation and all mutations are now shadowed on the MainActor for improved compatibility with SwiftUI.

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@PSchmiedmayer PSchmiedmayer added the enhancement New feature or request label Oct 28, 2024
@Supereg Supereg requested a review from PSchmiedmayer October 30, 2024 17:00
@Supereg Supereg marked this pull request as ready for review October 30, 2024 17:00
Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

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

Very cool; thank you!

I will take a look at the runner issues that we have in place as noted on Slack.

@Supereg Supereg mentioned this pull request Nov 6, 2024
1 task
Copy link

codecov bot commented Nov 9, 2024

Codecov Report

Attention: Patch coverage is 92.78351% with 14 lines in your changes missing coverage. Please review.

Project coverage is 80.63%. Comparing base (8ee8ba9) to head (ffe6d0b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...uetooth/Model/ManagedAtomicMainActorBuffered.swift 85.37% 6 Missing ⚠️
...etooth/CoreBluetooth/Model/PeripheralStorage.swift 85.00% 3 Missing ⚠️
...rtySupport/CharacteristicPeripheralInjection.swift 0.00% 3 Missing ⚠️
...etooth/CoreBluetooth/Model/MainActorBuffered.swift 96.93% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
- Coverage   80.92%   80.63%   -0.29%     
==========================================
  Files         108      111       +3     
  Lines        5958     6053      +95     
==========================================
+ Hits         4821     4880      +59     
- Misses       1137     1173      +36     
Files with missing lines Coverage Δ
Sources/SpeziBluetooth/Bluetooth.swift 87.02% <100.00%> (-1.52%) ⬇️
...peziBluetooth/CoreBluetooth/BluetoothManager.swift 82.05% <100.00%> (-0.29%) ⬇️
.../CoreBluetooth/Model/BluetoothManagerStorage.swift 95.33% <100.00%> (+0.14%) ⬆️
...uetooth/CoreBluetooth/Model/DiscoverySession.swift 88.84% <100.00%> (+0.05%) ⬆️
...tooth/CoreBluetooth/Model/GATTCharacteristic.swift 70.74% <100.00%> (-3.51%) ⬇️
...eziBluetooth/Model/Properties/Characteristic.swift 90.33% <100.00%> (-0.58%) ⬇️
...rces/SpeziBluetooth/Model/Properties/Service.swift 80.96% <100.00%> (ø)
...Model/PropertySupport/CharacteristicAccessor.swift 59.36% <ø> (+0.54%) ⬆️
...el/PropertySupport/DeviceStateTestInjections.swift 92.46% <100.00%> (-0.40%) ⬇️
...Modifier/ConnectedDevicesEnvironmentModifier.swift 100.00% <100.00%> (ø)
... and 5 more

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 977cc67...ffe6d0b. Read the comment docs.

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

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

@Supereg Finally found the time at the runner issues and fixed them; all builds are passing now 🚀

.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
@Supereg Supereg merged commit 4d64dfa into main Nov 10, 2024
9 checks passed
@Supereg Supereg deleted the fix/auto-connect-disconnect branch November 10, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants