fix(ibeacon): undefined locationManager (#3505)

Change some cordova.plugins calls to window.cordova.plugins to
prevent 'Cannot read property 'locationManager' of undefined'
This commit is contained in:
Stefanic 2020-08-14 17:31:03 +02:00 committed by GitHub
parent 44f86f3ce5
commit 1ffad79320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,7 +293,7 @@ export class IBeacon extends IonicNativePlugin {
*/
@CordovaCheck({ sync: true })
Delegate(): IBeaconDelegate {
const delegate = new cordova.plugins.locationManager.Delegate();
const delegate = new window.cordova.plugins.locationManager.Delegate();
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
@ -358,7 +358,7 @@ export class IBeacon extends IonicNativePlugin {
});
};
cordova.plugins.locationManager.setDelegate(delegate);
window.cordova.plugins.locationManager.setDelegate(delegate);
return delegate;
}
@ -382,7 +382,7 @@ export class IBeacon extends IonicNativePlugin {
minor?: number,
notifyEntryStateOnDisplay?: boolean
): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
return new window.cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
}
/**