@@ -78,7 +78,6 @@ class LocationListenerImpl extends NSObject implements CLLocationManagerDelegate
78
78
}
79
79
80
80
private _handleAuthorizationChange ( status : CLAuthorizationStatus ) {
81
-
82
81
// the permisssion listener doesn't resolve
83
82
if ( this . _onPermissionChange ) {
84
83
this . _onPermissionChange ( status ) ;
@@ -181,13 +180,14 @@ export function getCurrentLocation(options?: Options): Promise<Location> {
181
180
reject ( new Error ( 'There is no last known location!' ) ) ;
182
181
}
183
182
} else {
184
- let timerId : number ;
183
+ let timerId : any ;
185
184
let locListener : any ;
186
185
let initLocation : Location ;
187
186
188
187
const stopTimerAndMonitor = function ( locListenerId ) {
189
- if ( timerId !== undefined ) {
188
+ if ( typeof timerId === 'number' ) {
190
189
clearTimeout ( timerId ) ;
190
+ timerId = null ;
191
191
}
192
192
193
193
LocationMonitor . stopLocationMonitoring ( locListenerId ) ;
@@ -287,8 +287,7 @@ export function enableLocationRequest(always?: boolean, openSettingsIfLocationHa
287
287
return ;
288
288
} else {
289
289
const status = getIOSLocationManagerStatus ( ) ;
290
- if ( ( status === CLAuthorizationStatus . kCLAuthorizationStatusDenied && openSettingsIfLocationHasBeenDenied ) ||
291
- ( ! _systemDialogWillShow ( always , status ) && openSettingsIfLocationHasBeenDenied ) ) {
290
+ if ( ( status === CLAuthorizationStatus . kCLAuthorizationStatusDenied && openSettingsIfLocationHasBeenDenied ) || ( ! _systemDialogWillShow ( always , status ) && openSettingsIfLocationHasBeenDenied ) ) {
292
291
// now open the Settings so the user can toggle the Location permission
293
292
UIApplication . sharedApplication . openURL ( NSURL . URLWithString ( UIApplicationOpenSettingsURLString ) ) ;
294
293
reject ( ) ;
@@ -312,7 +311,7 @@ export function enableLocationRequest(always?: boolean, openSettingsIfLocationHa
312
311
313
312
function _systemDialogWillShow ( always : boolean , status : CLAuthorizationStatus ) : boolean {
314
313
// the system dialog for "always" permission will not show if we requested it previously and currently have "when use" permission
315
- return ! ( status === CLAuthorizationStatus . kCLAuthorizationStatusAuthorizedWhenInUse && always && ApplicationSettings . getBoolean ( 'hasRequestedAlwaysAuthorization' , false ) )
314
+ return ! ( status === CLAuthorizationStatus . kCLAuthorizationStatusAuthorizedWhenInUse && always && ApplicationSettings . getBoolean ( 'hasRequestedAlwaysAuthorization' , false ) ) ;
316
315
}
317
316
318
317
function _isEnabled ( always ?: boolean ) : boolean {
0 commit comments