Auto reconnect#41
Merged
Merged
Conversation
Missing iOS 17+ functionality so needs refactored still
Contributor
There was a problem hiding this comment.
Pull request overview
Implements FR-1.2 / FR-1.3.1 by adding a two-tier auto-reconnect system (OS daemon auto-reconnect where available, plus a library-managed exponential-backoff “ladder”), exposing reconnection progress via the existing connection-state stream, and updating tests + docs + Demo UI to make reconnection behavior observable.
Changes:
- Added
ReconnectPolicytoReliaBLEConfigand plumbed it into the process-wideBluetoothActorinitialization. - Expanded
ConnectionStatewith.reconnecting(source:attempt:nextRetryAt:)and introducedReconnectSourceto distinguish OS vs library retry. - Implemented reconnect scheduling/cancellation in
BluetoothActor, added mock-driven reconnection tests, and updated DocC + Demo settings/detail UI to reflect the new behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/ReliaBLETests/ReliaBLEManagerTests.swift | Adds a reconnection test suite + helpers; adjusts Mock manager setup to avoid unintended reconnects in unrelated tests. |
| Sources/ReliaBLE/ReliaBLEManager.swift | Adds connect(to:autoReconnect:) and forwards ReconnectPolicy into actor initialization. |
| Sources/ReliaBLE/ReliaBLEConfig.swift | Introduces ReconnectPolicy and a new reconnectPolicy config field with defaults. |
| Sources/ReliaBLE/Models/PeripheralError.swift | Updates DocC references to the new connect(to:autoReconnect:) API. |
| Sources/ReliaBLE/Models/Peripheral.swift | Updates DocC references to the new connect(to:autoReconnect:) API. |
| Sources/ReliaBLE/Models/ConnectionState.swift | Adds .reconnecting state + ReconnectSource for OS vs library reconnect reporting. |
| Sources/ReliaBLE/Documentation.docc/Topics/Concurrency.md | Updates public API list to include connect(to:autoReconnect:). |
| Sources/ReliaBLE/Documentation.docc/GettingStarted.md | Documents the two-tier reconnect model, .reconnecting semantics, and config tuning. |
| Sources/ReliaBLE/BluetoothActor.swift | Implements reconnect intent tracking, backoff scheduling, cancellation, and test-only injection hooks. |
| prompt-exports/oracle-review-2026-07-05-184401-new-chat-bd21ef-3cd5.md | Adds an exported review note (non-code artifact). |
| docs/reviews/auto-reconnect-backoff-plan-critique-2026-07-05.md | Adds a critique document for the reconnect plan (non-code artifact). |
| docs/plans/auto-reconnect-backoff-2026-07-05.md | Adds the reconnect implementation plan document (non-code artifact). |
| Demo/ReliaBLE Demo/ReliaBLE Demo/Settings/SettingsView.swift | Adds UI controls (AppStorage-backed) for tuning reconnect policy in the Demo. |
| Demo/ReliaBLE Demo/ReliaBLE Demo/ReliaBLE_DemoApp.swift | Loads ReconnectPolicy from UserDefaults and injects into ReliaBLEConfig. |
| Demo/ReliaBLE Demo/ReliaBLE Demo/Central/CentralView.swift | Surfaces .reconnecting (system vs library) and shows countdown to next retry in device detail. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37 -- FR-1.2: Automatic reconnection with exponential backoff