Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

fix: wrong rejection when using always option on enableLocationRequest() #191

Merged
merged 3 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions demo/app/main-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function enableLocationTap() {
geolocation.isEnabled().then(function (isEnabled) {
if (!isEnabled) {
geolocation.enableLocationRequest(false, true).then(function () {
console.log("allowed location usage");
}, function (e) {
console.log("Error: " + (e.message || e));
});
Expand Down
14 changes: 1 addition & 13 deletions src/geolocation.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,10 @@ class LocationListenerImpl extends NSObject implements CLLocationManagerDelegate
break;

case CLAuthorizationStatus.kCLAuthorizationStatusAuthorizedAlways:
if (this.authorizeAlways && this._resolve) {
LocationMonitor.stopLocationMonitoring(this.id);
this._resolve();
} else if (this._reject) {
LocationMonitor.stopLocationMonitoring(this.id);
this._reject(new Error("Authorization Denied."));
}
break;

case CLAuthorizationStatus.kCLAuthorizationStatusAuthorizedWhenInUse:
if (!this.authorizeAlways && this._resolve) {
if (this._resolve) {
LocationMonitor.stopLocationMonitoring(this.id);
this._resolve();
} else if (this._reject) {
LocationMonitor.stopLocationMonitoring(this.id);
this._reject(new Error("Authorization Denied."));
}
break;

Expand Down