mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
Revert "chore(package): bump dependencies and lint rules"
This reverts commit 21ad4734fa.
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
Cordova,
|
||||
CordovaCheck,
|
||||
IonicNativePlugin,
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare const cordova: any;
|
||||
@@ -34,11 +29,7 @@ export interface Beacon {
|
||||
* ProximityFar
|
||||
* ProximityUnknown
|
||||
*/
|
||||
proximity:
|
||||
| 'ProximityImmediate'
|
||||
| 'ProximityNear'
|
||||
| 'ProximityFar'
|
||||
| 'ProximityUnknown';
|
||||
proximity: 'ProximityImmediate' | 'ProximityNear' | 'ProximityFar' | 'ProximityUnknown';
|
||||
|
||||
/**
|
||||
* Transmission Power of the beacon. A constant emitted by the beacon which indicates what's the expected RSSI at a distance of 1 meter to the beacon.
|
||||
@@ -55,6 +46,7 @@ export interface Beacon {
|
||||
* The accuracy of the ranging.
|
||||
*/
|
||||
accuracy: number;
|
||||
|
||||
}
|
||||
|
||||
export interface BeaconRegion {
|
||||
@@ -112,6 +104,7 @@ export interface CircularRegion {
|
||||
export type Region = BeaconRegion | CircularRegion;
|
||||
|
||||
export interface IBeaconPluginResult {
|
||||
|
||||
/**
|
||||
* The name of the delegate function that produced the PluginResult object.
|
||||
*/
|
||||
@@ -294,6 +287,7 @@ export interface IBeaconDelegate {
|
||||
})
|
||||
@Injectable()
|
||||
export class IBeacon extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Instances of this class are delegates between the {@link LocationManager} and
|
||||
* the code that consumes the messages generated on in the native layer.
|
||||
@@ -304,79 +298,85 @@ export class IBeacon extends IonicNativePlugin {
|
||||
Delegate(): IBeaconDelegate {
|
||||
let delegate = new cordova.plugins.locationManager.Delegate();
|
||||
|
||||
delegate.didChangeAuthorizationStatus = (
|
||||
pluginResult?: IBeaconPluginResult
|
||||
) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.didChangeAuthorizationStatus = cb);
|
||||
});
|
||||
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.didChangeAuthorizationStatus = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.didDetermineStateForRegion = (
|
||||
pluginResult?: IBeaconPluginResult
|
||||
) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.didDetermineStateForRegion = cb);
|
||||
});
|
||||
delegate.didDetermineStateForRegion = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.didDetermineStateForRegion = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.didEnterRegion = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.didEnterRegion = cb);
|
||||
});
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.didEnterRegion = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.didExitRegion = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.didExitRegion = cb);
|
||||
});
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.didExitRegion = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.didRangeBeaconsInRegion = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.didRangeBeaconsInRegion = cb);
|
||||
});
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.didRangeBeaconsInRegion = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.didStartMonitoringForRegion = (
|
||||
pluginResult?: IBeaconPluginResult
|
||||
) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.didStartMonitoringForRegion = cb);
|
||||
});
|
||||
delegate.didStartMonitoringForRegion = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.didStartMonitoringForRegion = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.monitoringDidFailForRegionWithError = (
|
||||
pluginResult?: IBeaconPluginResult
|
||||
) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.monitoringDidFailForRegionWithError = cb);
|
||||
});
|
||||
delegate.monitoringDidFailForRegionWithError = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.monitoringDidFailForRegionWithError = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.peripheralManagerDidStartAdvertising = (
|
||||
pluginResult?: IBeaconPluginResult
|
||||
) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.peripheralManagerDidStartAdvertising = cb);
|
||||
});
|
||||
delegate.peripheralManagerDidStartAdvertising = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.peripheralManagerDidStartAdvertising = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
delegate.peripheralManagerDidUpdateState = (
|
||||
pluginResult?: IBeaconPluginResult
|
||||
) => {
|
||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||
const cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return (delegate.peripheralManagerDidUpdateState = cb);
|
||||
});
|
||||
delegate.peripheralManagerDidUpdateState = (pluginResult?: IBeaconPluginResult) => {
|
||||
return new Observable<IBeaconPluginResult>(
|
||||
(observer: any) => {
|
||||
let cb = (data: IBeaconPluginResult) => observer.next(data);
|
||||
return delegate.peripheralManagerDidUpdateState = cb;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
cordova.plugins.locationManager.setDelegate(delegate);
|
||||
@@ -396,29 +396,15 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* @returns {BeaconRegion} Returns the BeaconRegion that was created
|
||||
*/
|
||||
@CordovaCheck({ sync: true })
|
||||
BeaconRegion(
|
||||
identifer: string,
|
||||
uuid: string,
|
||||
major?: number,
|
||||
minor?: number,
|
||||
notifyEntryStateOnDisplay?: boolean
|
||||
): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(
|
||||
identifer,
|
||||
uuid,
|
||||
major,
|
||||
minor,
|
||||
notifyEntryStateOnDisplay
|
||||
);
|
||||
BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {IBeaconDelegate} Returns the IBeaconDelegate
|
||||
*/
|
||||
@Cordova()
|
||||
getDelegate(): IBeaconDelegate {
|
||||
return;
|
||||
}
|
||||
getDelegate(): IBeaconDelegate { return; }
|
||||
|
||||
/**
|
||||
* @param {IBeaconDelegate} delegate An instance of a delegate to register with the native layer.
|
||||
@@ -426,9 +412,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* @returns {IBeaconDelegate} Returns the IBeaconDelegate
|
||||
*/
|
||||
@Cordova()
|
||||
setDelegate(delegate: IBeaconDelegate): IBeaconDelegate {
|
||||
return;
|
||||
}
|
||||
setDelegate(delegate: IBeaconDelegate): IBeaconDelegate { return; }
|
||||
|
||||
/**
|
||||
* Signals the native layer that the client side is ready to consume messages.
|
||||
@@ -451,9 +435,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the request and started to send events.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
onDomDelegateReady(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
onDomDelegateReady(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Determines if bluetooth is switched on, according to the native layer.
|
||||
@@ -461,9 +443,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* indicating whether bluetooth is active.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
isBluetoothEnabled(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Enables Bluetooth using the native Layer. (ANDROID ONLY)
|
||||
@@ -472,9 +452,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
enableBluetooth(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
enableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Disables Bluetooth using the native Layer. (ANDROID ONLY)
|
||||
@@ -483,9 +461,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
disableBluetooth(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
disableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring the specified region.
|
||||
@@ -505,9 +481,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
startMonitoringForRegion(region: BeaconRegion): Promise<string> {
|
||||
return;
|
||||
}
|
||||
startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring the specified region. It is valid to call
|
||||
@@ -524,9 +498,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
stopMonitoringForRegion(region: BeaconRegion): Promise<void> {
|
||||
return;
|
||||
}
|
||||
stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Request state the for specified region. When result is ready
|
||||
@@ -542,9 +514,8 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
requestStateForRegion(region: Region): Promise<void> {
|
||||
return;
|
||||
}
|
||||
requestStateForRegion(region: Region): Promise<void> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Start ranging the specified beacon region.
|
||||
@@ -561,9 +532,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> {
|
||||
return;
|
||||
}
|
||||
startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging the specified region. It is valid to call
|
||||
@@ -580,9 +549,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> {
|
||||
return;
|
||||
}
|
||||
stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Queries the native layer to determine the current authorization in effect.
|
||||
@@ -591,9 +558,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* requested authorization status.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getAuthorizationStatus(): Promise<IBeaconPluginResult> {
|
||||
return;
|
||||
}
|
||||
getAuthorizationStatus(): Promise<IBeaconPluginResult> { return; }
|
||||
|
||||
/**
|
||||
* For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
|
||||
@@ -605,9 +570,8 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* @returns {Promise<void>} Returns a promise that is resolved when the request dialog is shown.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
requestWhenInUseAuthorization(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* See the documentation of {@code requestWhenInUseAuthorization} for further details.
|
||||
@@ -616,9 +580,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* shows the request dialog.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
requestAlwaysAuthorization(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
requestAlwaysAuthorization(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -626,9 +588,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* of {Region} instances that are being monitored by the native layer.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getMonitoredRegions(): Promise<Region[]> {
|
||||
return;
|
||||
}
|
||||
getMonitoredRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -636,9 +596,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* of {Region} instances that are being ranged by the native layer.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getRangedRegions(): Promise<Region[]> {
|
||||
return;
|
||||
}
|
||||
getRangedRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
* Determines if ranging is available or not, according to the native layer.
|
||||
@@ -646,9 +604,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* indicating whether ranging is available or not.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
isRangingAvailable(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
isRangingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Determines if region type is supported or not, according to the native layer.
|
||||
@@ -660,9 +616,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* indicating whether the region type is supported or not.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
isMonitoringAvailableForClass(region: Region): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Start advertising the specified region.
|
||||
@@ -682,9 +636,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the advertising request.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
startAdvertising(region: Region, measuredPower?: number): Promise<void> {
|
||||
return;
|
||||
}
|
||||
startAdvertising(region: Region, measuredPower?: number): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Stop advertising as a beacon.
|
||||
@@ -695,9 +647,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer acknowledged the dispatch of the request to stop advertising.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
stopAdvertising(region: Region): Promise<void> {
|
||||
return;
|
||||
}
|
||||
stopAdvertising(region: Region): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Determines if advertising is available or not, according to the native layer.
|
||||
@@ -705,9 +655,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* indicating whether advertising is available or not.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
isAdvertisingAvailable(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
isAdvertisingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Determines if advertising is currently active, according to the native layer.
|
||||
@@ -715,9 +663,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* indicating whether advertising is active.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
isAdvertising(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
isAdvertising(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Disables debug logging in the native layer. Use this method if you want
|
||||
@@ -727,9 +673,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
disableDebugLogs(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
disableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Enables the posting of debug notifications in the native layer. Use this method if you want
|
||||
@@ -740,9 +684,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer has set the flag to enabled.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
enableDebugNotifications(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
enableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Disables the posting of debug notifications in the native layer. Use this method if you want
|
||||
@@ -752,9 +694,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer has set the flag to disabled.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
disableDebugNotifications(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
disableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Enables debug logging in the native layer. Use this method if you want
|
||||
@@ -764,9 +704,7 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
enableDebugLogs(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
enableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Appends the provided [message] to the device logs.
|
||||
@@ -779,7 +717,6 @@ export class IBeacon extends IonicNativePlugin {
|
||||
* is expected to be equivalent to the one provided in the original call.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
appendToDeviceLog(message: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
appendToDeviceLog(message: string): Promise<void> { return; }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user