|
@@ -32,15 +32,28 @@
|
32
|
32
|
return resolve(RNPermissionStatusNotAvailable);
|
33
|
33
|
}
|
34
|
34
|
|
35
|
|
- switch ([CBPeripheralManager authorizationStatus]) {
|
36
|
|
- case CBPeripheralManagerAuthorizationStatusNotDetermined:
|
37
|
|
- return resolve(RNPermissionStatusNotDetermined);
|
38
|
|
- case CBPeripheralManagerAuthorizationStatusRestricted:
|
39
|
|
- return resolve(RNPermissionStatusRestricted);
|
40
|
|
- case CBPeripheralManagerAuthorizationStatusDenied:
|
41
|
|
- return resolve(RNPermissionStatusDenied);
|
42
|
|
- case CBPeripheralManagerAuthorizationStatusAuthorized:
|
43
|
|
- return resolve(RNPermissionStatusAuthorized);
|
|
35
|
+ if (@available(iOS 13.0, *)) {
|
|
36
|
+ switch ([[CBManager new] authorization]) {
|
|
37
|
+ case CBManagerAuthorizationNotDetermined:
|
|
38
|
+ return resolve(RNPermissionStatusNotDetermined);
|
|
39
|
+ case CBManagerAuthorizationRestricted:
|
|
40
|
+ return resolve(RNPermissionStatusRestricted);
|
|
41
|
+ case CBManagerAuthorizationDenied:
|
|
42
|
+ return resolve(RNPermissionStatusDenied);
|
|
43
|
+ case CBManagerAuthorizationAllowedAlways:
|
|
44
|
+ return resolve(RNPermissionStatusAuthorized);
|
|
45
|
+ }
|
|
46
|
+ } else {
|
|
47
|
+ switch ([CBPeripheralManager authorizationStatus]) {
|
|
48
|
+ case CBPeripheralManagerAuthorizationStatusNotDetermined:
|
|
49
|
+ return resolve(RNPermissionStatusNotDetermined);
|
|
50
|
+ case CBPeripheralManagerAuthorizationStatusRestricted:
|
|
51
|
+ return resolve(RNPermissionStatusRestricted);
|
|
52
|
+ case CBPeripheralManagerAuthorizationStatusDenied:
|
|
53
|
+ return resolve(RNPermissionStatusDenied);
|
|
54
|
+ case CBPeripheralManagerAuthorizationStatusAuthorized:
|
|
55
|
+ return resolve(RNPermissionStatusAuthorized);
|
|
56
|
+ }
|
44
|
57
|
}
|
45
|
58
|
#endif
|
46
|
59
|
}
|
|
@@ -62,12 +75,10 @@
|
62
|
75
|
}
|
63
|
76
|
|
64
|
77
|
- (void)peripheralManagerDidUpdateState:(nonnull CBPeripheralManager *)peripheral {
|
65
|
|
- int state = peripheral.state;
|
66
|
|
-
|
67
|
78
|
[_peripheralManager stopAdvertising];
|
68
|
79
|
_peripheralManager = nil;
|
69
|
80
|
|
70
|
|
- switch (state) {
|
|
81
|
+ switch (peripheral.state) {
|
71
|
82
|
case CBManagerStatePoweredOff:
|
72
|
83
|
case CBManagerStateResetting:
|
73
|
84
|
case CBManagerStateUnsupported:
|