Skip to content

Backport: defer CBPeripheralManager creation (no Bluetooth prompt at app launch) - #1

Open
sethforprivacy wants to merge 3 commits into
mainfrom
cw/lazy-peripheral-manager
Open

sethforprivacy wants to merge 3 commits into
mainfrom
cw/lazy-peripheral-manager

Conversation

@sethforprivacy

Copy link
Copy Markdown

Cherry-pick of upstream df0dd9d (Navideck#242) onto the commit Cake Wallet currently pins (6735c1b).

The peripheral plugin's initializer accessed peripheralManager.isAdvertising, which instantiates CBPeripheralManager during plugin registration, so iOS shows the Bluetooth permission prompt on every first app launch before the app has done anything Bluetooth related. With this backport the manager is created on first use of the peripheral API, matching the central side.

main already has this via Navideck#242; this branch exists so Cake Wallet can pin a commit compatible with its current universal_ble API without taking the 2.x rework yet. Cake Wallet pins it in cake-tech/cake_wallet#3631.

🤖 Generated with Claude Code

konstantinullrich and others added 3 commits July 16, 2026 17:38
…avideck#242)

* Defer CBPeripheralManager creation until peripheral APIs are used

* Refactor advertising state management in UniversalBlePeripheralPlugin

- Introduced completeStopIfNeeded() method to handle stopping logic more cleanly.
- Updated stopAdvertising() to ensure proper state transitions and callback invocations.
- Improved handling of peripheralManager's state during advertising stop process.

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Navideck Labs <130186950+navidecklabs@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit df0dd9d)
Conflict in UniversalBlePlugin.swift: this branch added the
`isBluetoothAuthorized()` iOS 13.1 availability guard where upstream added
`activateStateRestoration()`. Kept both, and applied the same `#available`
guard to upstream's new `hasBluetoothPermission` /
`availabilityStateFromAuthorization` so the Xcode
"'authorization' is only available in iOS 13.1 or newer" fix still holds.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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