|
|
|
|
22
|
if (![CLLocationManager locationServicesEnabled]) {
|
22
|
if (![CLLocationManager locationServicesEnabled]) {
|
23
|
return resolve(RNPermissionStatusNotAvailable);
|
23
|
return resolve(RNPermissionStatusNotAvailable);
|
24
|
}
|
24
|
}
|
25
|
-
|
|
|
|
|
25
|
+
|
26
|
switch ([CLLocationManager authorizationStatus]) {
|
26
|
switch ([CLLocationManager authorizationStatus]) {
|
27
|
case kCLAuthorizationStatusNotDetermined:
|
27
|
case kCLAuthorizationStatusNotDetermined:
|
28
|
return resolve(RNPermissionStatusNotDetermined);
|
28
|
return resolve(RNPermissionStatusNotDetermined);
|
|
|
|
|
39
|
- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
|
39
|
- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
|
40
|
withResolver:(void (^)(RNPermissionStatus status))resolve
|
40
|
withResolver:(void (^)(RNPermissionStatus status))resolve
|
41
|
withRejecter:(void (^)(NSError *error))reject {
|
41
|
withRejecter:(void (^)(NSError *error))reject {
|
42
|
- if ([CLLocationManager locationServicesEnabled] != kCLAuthorizationStatusNotDetermined) {
|
|
|
|
|
42
|
+ CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
|
|
43
|
+
|
|
|
44
|
+ if (status != kCLAuthorizationStatusNotDetermined) {
|
43
|
return [self checkWithResolver:resolve withRejecter:reject];
|
45
|
return [self checkWithResolver:resolve withRejecter:reject];
|
44
|
}
|
46
|
}
|
45
|
-
|
|
|
|
|
47
|
+
|
46
|
_resolve = resolve;
|
48
|
_resolve = resolve;
|
47
|
_reject = reject;
|
49
|
_reject = reject;
|
48
|
-
|
|
|
|
|
50
|
+
|
49
|
_locationManager = [CLLocationManager new];
|
51
|
_locationManager = [CLLocationManager new];
|
50
|
[_locationManager setDelegate:self];
|
52
|
[_locationManager setDelegate:self];
|
51
|
[_locationManager requestWhenInUseAuthorization];
|
53
|
[_locationManager requestWhenInUseAuthorization];
|
|
|
|
|
56
|
_initialChangeEventFired = true;
|
58
|
_initialChangeEventFired = true;
|
57
|
} else {
|
59
|
} else {
|
58
|
[self checkWithResolver:_resolve withRejecter:_reject];
|
60
|
[self checkWithResolver:_resolve withRejecter:_reject];
|
59
|
-
|
|
|
|
|
61
|
+
|
60
|
[_locationManager setDelegate:nil];
|
62
|
[_locationManager setDelegate:nil];
|
61
|
_locationManager = nil;
|
63
|
_locationManager = nil;
|
62
|
}
|
64
|
}
|