Skip to content

Commit

Permalink
Merge pull request #238 from Hengyu/hengyu
Browse files Browse the repository at this point in the history
Adapt to new method for getting authorization of bluetooth
  • Loading branch information
ivanvorobei committed Jun 6, 2021
2 parents 81a317a + 043a4c8 commit 275d4f8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/SPPermissionsBluetooth/SPBluetoothPermission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ public class SPBluetoothPermission: SPPermissions.Permission {
open var usageDescriptionKey: String? { "NSBluetoothAlwaysUsageDescription" }

public override var status: SPPermissions.PermissionStatus {
if #available(iOS 13.0, tvOS 13, *) {
if #available(iOS 13.1, tvOS 13.1, *) {
switch CBCentralManager.authorization {
case .allowedAlways: return .authorized
case .notDetermined: return .notDetermined
case .restricted: return .denied
case .denied: return .denied
@unknown default: return .denied
}
} else if #available(iOS 13.0, tvOS 13.0, *) {
switch CBCentralManager().authorization {
case .allowedAlways: return .authorized
case .notDetermined: return .notDetermined
Expand Down

0 comments on commit 275d4f8

Please sign in to comment.