diff --git a/Source/Supporting Files/Utilities.swift b/Source/Supporting Files/Utilities.swift index 6dc00e5..a69ce88 100644 --- a/Source/Supporting Files/Utilities.swift +++ b/Source/Supporting Files/Utilities.swift @@ -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 diff --git a/Source/Types/Bluetooth.swift b/Source/Types/Bluetooth.swift index bf9f065..7812dbf 100644 --- a/Source/Types/Bluetooth.swift +++ b/Source/Types/Bluetooth.swift @@ -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 } } @@ -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 }