Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Supporting Files/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct Defaults {
static var requestedBluetooth: Bool

@UserDefault("permission.statusBluetooth", defaultValue: nil)
static var statusBluetooth: PermissionStatus?
static var statusBluetooth: String?

@UserDefault("permission.stateBluetoothManagerDetermined", defaultValue: false)
static var stateBluetoothManagerDetermined: Bool
Expand Down
4 changes: 2 additions & 2 deletions Source/Types/Bluetooth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension Permission {
case .unauthorized: return .denied
case .poweredOn: return .authorized
case .resetting, .unknown:
return Defaults.statusBluetooth ?? .notDetermined
return PermissionStatus(string: Defaults.statusBluetooth) ?? .notDetermined
@unknown default: return .notDetermined
}
}
Expand All @@ -62,7 +62,7 @@ extension Permission {
extension Permission: CBPeripheralManagerDelegate {
public func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
Defaults.stateBluetoothManagerDetermined = true
Defaults.statusBluetooth = statusBluetooth
Defaults.statusBluetooth = statusBluetooth.rawValue

guard Defaults.requestedBluetooth else { return }

Expand Down