mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-06-08 00:00:19 +08:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba105be55f | |||
| 92d26eab94 | |||
| ce6e412788 | |||
| 7243ed3960 | |||
| 264670211d | |||
| 847147a5fa | |||
| 4639bf9a94 | |||
| abb77e3e08 | |||
| 975f08b7b5 | |||
| 773722b767 | |||
| 447aa56e3c | |||
| 8d22798278 | |||
| 30297fb81d | |||
| ac777fca40 | |||
| 43b70a12b5 | |||
| ef28078815 | |||
| e304ce0e53 | |||
| 9e5f03f15d | |||
| 465d5519d0 | |||
| d683b9e5df | |||
| 2b2476e873 | |||
| 196adc8b2f | |||
| 363b41e075 | |||
| 2179699622 | |||
| e65406cc2f | |||
| ddb6d43ffa | |||
| 30ed33a046 | |||
| 3d0a12d40d | |||
| 6ca5beaf0b | |||
| 247efa656a |
+53
-10
@@ -1,3 +1,55 @@
|
||||
<a name="4.3.3"></a>
|
||||
## [4.3.3](https://github.com/ionic-team/ionic-native/compare/4.3.2...v4.3.3) (2017-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-maps:** HtmlInfoWindow should extend BaseClass [#2034](https://github.com/ionic-team/ionic-native/issues/2034) ([#2035](https://github.com/ionic-team/ionic-native/issues/2035)) ([ce6e412](https://github.com/ionic-team/ionic-native/commit/ce6e412))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.2"></a>
|
||||
## [4.3.2](https://github.com/ionic-team/ionic-native/compare/4.3.1...4.3.2) (2017-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-maps:** remove type from GoogleMapsEvent constant ([4639bf9](https://github.com/ionic-team/ionic-native/commit/4639bf9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **pro:** support corova-plugin-ionic v2.0.0 ([975f08b](https://github.com/ionic-team/ionic-native/commit/975f08b))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.1"></a>
|
||||
## [4.3.1](https://github.com/ionic-team/ionic-native/compare/v4.3.1...4.3.1) (2017-10-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **pro:** Add support for Ionic Pro by incorporating cordova-plugin-ionic ([465d551](https://github.com/ionic-team/ionic-native/commit/465d551))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.1"></a>
|
||||
## [4.3.1](https://github.com/ionic-team/ionic-native/compare/v4.3.0...v4.3.1) (2017-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **BLE:** make readRSSI() not static ([#2011](https://github.com/ionic-team/ionic-native/issues/2011)) ([363b41e](https://github.com/ionic-team/ionic-native/commit/363b41e))
|
||||
* **google-maps:** various fixed introduced in previous release ([#2024](https://github.com/ionic-team/ionic-native/issues/2024)) ([6ca5bea](https://github.com/ionic-team/ionic-native/commit/6ca5bea))
|
||||
* **onesignal:** fix property name ([#2019](https://github.com/ionic-team/ionic-native/issues/2019)) ([30ed33a](https://github.com/ionic-team/ionic-native/commit/30ed33a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **regula-document-reader:** separate initialization and scanning, add android ([#2013](https://github.com/ionic-team/ionic-native/issues/2013)) ([2179699](https://github.com/ionic-team/ionic-native/commit/2179699))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.0"></a>
|
||||
# [4.3.0](https://github.com/ionic-team/ionic-native/compare/v4.2.1...v4.3.0) (2017-09-27)
|
||||
|
||||
@@ -6,6 +58,7 @@
|
||||
|
||||
* **google-maps:** convert JS classes to Ionic Native ([#1956](https://github.com/ionic-team/ionic-native/issues/1956)) ([57af5c5](https://github.com/ionic-team/ionic-native/commit/57af5c5))
|
||||
* **google-maps:** fix icons property of MarkerClusterOptions ([#1937](https://github.com/ionic-team/ionic-native/issues/1937)) ([8004790](https://github.com/ionic-team/ionic-native/commit/8004790))
|
||||
* **google-maps:** fix issue when creating new instance of BaseArrayClass ([#1931](https://github.com/ionic-team/ionic-native/issues/1931)) ([957396b](https://github.com/ionic-team/ionic-native/commit/957396b))
|
||||
* **google-maps:** the zoom option is missing in the GoogleMapOptions class ([#1948](https://github.com/ionic-team/ionic-native/issues/1948)) ([ef898ef](https://github.com/ionic-team/ionic-native/commit/ef898ef))
|
||||
* **http:** fix plugin ref ([#1934](https://github.com/ionic-team/ionic-native/issues/1934)) ([3a1034e](https://github.com/ionic-team/ionic-native/commit/3a1034e))
|
||||
* **launch-navigator:** fix navigate method ([#1940](https://github.com/ionic-team/ionic-native/issues/1940)) ([a150d4d](https://github.com/ionic-team/ionic-native/commit/a150d4d))
|
||||
@@ -30,16 +83,6 @@
|
||||
|
||||
|
||||
|
||||
<a name="4.2.1"></a>
|
||||
## [4.2.1](https://github.com/ionic-team/ionic-native/compare/v4.2.0...v4.2.1) (2017-08-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-maps:** fix issue when creating new instance of BaseArrayClass ([#1931](https://github.com/ionic-team/ionic-native/issues/1931)) ([957396b](https://github.com/ionic-team/ionic-native/commit/957396b))
|
||||
|
||||
|
||||
|
||||
<a name="4.2.0"></a>
|
||||
# [4.2.0](https://github.com/ionic-team/ionic-native/compare/v4.1.0...v4.2.0) (2017-08-26)
|
||||
|
||||
|
||||
@@ -209,4 +209,13 @@ Example:
|
||||
someMethod(): Promise<any> {
|
||||
// anything here will only run if the plugin is available
|
||||
}
|
||||
```
|
||||
|
||||
#### CordovaFunctionOverride
|
||||
Wrap a stub function in a call to a Cordova plugin, checking if both Cordova and the required plugin are installed.
|
||||
|
||||
Example:
|
||||
```ts
|
||||
@CordovaFunctionOverride()
|
||||
someMethod(): Observable<any> { return; }
|
||||
```
|
||||
Generated
+7290
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.3",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@angular/compiler": "4.1.3",
|
||||
"@angular/compiler-cli": "4.1.3",
|
||||
"@angular/core": "4.1.3",
|
||||
"@angular/compiler": "4.4.4",
|
||||
"@angular/compiler-cli": "4.4.4",
|
||||
"@angular/core": "4.4.4",
|
||||
"@types/cordova": "0.0.34",
|
||||
"@types/jasmine": "^2.5.51",
|
||||
"@types/node": "^7.0.27",
|
||||
@@ -39,12 +39,12 @@
|
||||
"q": "1.5.0",
|
||||
"queue": "4.2.1",
|
||||
"rimraf": "2.6.1",
|
||||
"rxjs": "5.4.0",
|
||||
"rxjs": "5.4.3",
|
||||
"semver": "5.3.0",
|
||||
"tslint": "3.15.1",
|
||||
"tslint-ionic-rules": "0.0.8",
|
||||
"typescript": "2.3.3",
|
||||
"zone.js": "0.8.12"
|
||||
"typescript": "2.3.4",
|
||||
"zone.js": "0.8.18"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run test:watch",
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = currentVersion => {
|
||||
docTypes: ['class'],
|
||||
getOutputPath: doc => doc.originalModule.replace(config.pluginDir + '/', '')
|
||||
.replace('/plugins', '')
|
||||
.replace('/index', '/README.md')
|
||||
.replace(/\/index$/, '/README.md')
|
||||
}];
|
||||
|
||||
})
|
||||
|
||||
@@ -441,7 +441,7 @@ export class BLE extends IonicNativePlugin {
|
||||
*@returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static readRSSI(
|
||||
readRSSI(
|
||||
deviceId: string,
|
||||
): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Injectable } from '@angular/core';
|
||||
* getUrl() {
|
||||
* return this.url;
|
||||
* }
|
||||
* // DATABASES //
|
||||
* createDatabase(database_name:string) {
|
||||
* let url = this.getUrl();
|
||||
* url = url+database_name;
|
||||
@@ -34,7 +35,6 @@ import { Injectable } from '@angular/core';
|
||||
* return Observable.throw(error.json() || 'Couchbase Lite error');
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* deleteDatabase(database_name:string) {
|
||||
* let url = this.getUrl();
|
||||
* url = url+database_name;
|
||||
@@ -58,8 +58,6 @@ import { Injectable } from '@angular/core';
|
||||
* }
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -71,10 +71,10 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check permission to receive push notifications
|
||||
* @return {Promise<any>}
|
||||
* @return {Promise<{isEnabled: boolean}>}
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(): Promise<any> { return; }
|
||||
hasPermission(): Promise<{isEnabled: boolean}> { return; }
|
||||
|
||||
/**
|
||||
* Set icon badge number. Set to 0 to clear the badge.
|
||||
|
||||
@@ -153,6 +153,8 @@ export interface GeolocationOptions {
|
||||
plugin: 'cordova-plugin-geolocation',
|
||||
pluginRef: 'navigator.geolocation',
|
||||
repo: 'https://github.com/apache/cordova-plugin-geolocation',
|
||||
install: 'ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"',
|
||||
installVariables: ['GEOLOCATION_USAGE_DESCRIPTION'],
|
||||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -375,6 +375,7 @@ export interface PolygonOptions {
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
addHole?: Array<Array<ILatLng>>;
|
||||
clickable?: boolean;
|
||||
}
|
||||
|
||||
export interface PolylineOptions {
|
||||
@@ -384,6 +385,7 @@ export interface PolylineOptions {
|
||||
color?: string;
|
||||
width?: number;
|
||||
zIndex?: number;
|
||||
clickable?: boolean;
|
||||
}
|
||||
|
||||
export interface TileOverlayOptions {
|
||||
@@ -443,7 +445,7 @@ export class VisibleRegion implements ILatLngBounds {
|
||||
* @hidden
|
||||
* You can listen to these events where appropriate
|
||||
*/
|
||||
export const GoogleMapsEvent: { [eventName: string]: string; } = {
|
||||
export const GoogleMapsEvent = {
|
||||
MAP_READY: 'map_ready',
|
||||
MAP_LOADED: 'map_loaded',
|
||||
MAP_CLICK: 'map_click',
|
||||
@@ -517,7 +519,6 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
|
||||
* })
|
||||
* export class HomePage {
|
||||
* map: GoogleMap;
|
||||
* mapElement: HTMLElement;
|
||||
* constructor(private googleMaps: GoogleMaps) { }
|
||||
*
|
||||
* ionViewDidLoad() {
|
||||
@@ -525,7 +526,6 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
|
||||
* }
|
||||
*
|
||||
* loadMap() {
|
||||
* this.mapElement = document.getElementById('map');
|
||||
*
|
||||
* let mapOptions: GoogleMapOptions = {
|
||||
* camera: {
|
||||
@@ -538,7 +538,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* this.map = this.googleMaps.create(this.mapElement, mapOptions);
|
||||
* this.map = this.googleMaps.create('map_canvas', mapOptions);
|
||||
*
|
||||
* // Wait the MAP_READY before using any methods.
|
||||
* this.map.one(GoogleMapsEvent.MAP_READY)
|
||||
@@ -610,7 +610,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
|
||||
pluginRef: 'plugin.google.maps',
|
||||
plugin: 'cordova-plugin-googlemaps',
|
||||
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
|
||||
install: 'ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
|
||||
install: 'ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
|
||||
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@@ -623,9 +623,18 @@ export class GoogleMaps extends IonicNativePlugin {
|
||||
* @param options {any} Options
|
||||
* @return {GoogleMap}
|
||||
*/
|
||||
create(element: string | HTMLElement, options?: GoogleMapOptions): GoogleMap {
|
||||
let googleMap: GoogleMap = new GoogleMap(element, options);
|
||||
googleMap.set('_overlays', new BaseArrayClass());
|
||||
create(element: string | HTMLElement | GoogleMapOptions, options?: GoogleMapOptions): GoogleMap {
|
||||
if (element instanceof HTMLElement) {
|
||||
if (element.getAttribute('__pluginMapId')) {
|
||||
console.error('GoogleMaps', element.tagName + '[__pluginMapId=\'' + element.getAttribute('__pluginMapId') + '\'] has already map.');
|
||||
return;
|
||||
}
|
||||
} else if (typeof element === 'object') {
|
||||
options = <GoogleMapOptions>element;
|
||||
element = null;
|
||||
}
|
||||
let googleMap: GoogleMap = new GoogleMap(<HTMLElement>element, options);
|
||||
googleMap.set('_overlays', {});
|
||||
return googleMap;
|
||||
}
|
||||
|
||||
@@ -656,8 +665,21 @@ export class BaseClass {
|
||||
if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) {
|
||||
if (args[args.length - 1].type === 'Map') {
|
||||
args[args.length - 1] = this;
|
||||
} else if (this instanceof MarkerCluster) {
|
||||
let overlay: Marker = this.get(args[args.length - 1].getId());
|
||||
if (!overlay) {
|
||||
let markerJS: any = args[args.length - 1];
|
||||
let markerId: string = markerJS.getId();
|
||||
let markerCluster: MarkerCluster = <MarkerCluster>this;
|
||||
overlay = new Marker(markerCluster.getMap(), markerJS);
|
||||
this.get('_overlays')[markerId] = overlay;
|
||||
markerJS.one(markerJS.getId() + '_remove', () => {
|
||||
this.get('_overlays')[markerId] = null;
|
||||
});
|
||||
}
|
||||
args[args.length - 1] = overlay;
|
||||
} else {
|
||||
args[args.length - 1] = this._objectInstance.getMap().get(args[args.length - 1].getId());
|
||||
args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()];
|
||||
}
|
||||
}
|
||||
observer.next(args);
|
||||
@@ -677,8 +699,21 @@ export class BaseClass {
|
||||
if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) {
|
||||
if (args[args.length - 1].type === 'Map') {
|
||||
args[args.length - 1] = this;
|
||||
} else if (this instanceof MarkerCluster) {
|
||||
let overlay: Marker = this.get(args[args.length - 1].getId());
|
||||
if (!overlay) {
|
||||
let markerJS: any = args[args.length - 1];
|
||||
let markerId: string = markerJS.getId();
|
||||
let markerCluster: MarkerCluster = <MarkerCluster>this;
|
||||
overlay = new Marker(markerCluster.getMap(), markerJS);
|
||||
this.get('_overlays')[markerId] = overlay;
|
||||
markerJS.one(markerJS.getId() + '_remove', () => {
|
||||
this.get('_overlays')[markerId] = null;
|
||||
});
|
||||
}
|
||||
args[args.length - 1] = overlay;
|
||||
} else {
|
||||
args[args.length - 1] = this._objectInstance.getMap().get(args[args.length - 1].getId());
|
||||
args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()];
|
||||
}
|
||||
}
|
||||
resolve(args);
|
||||
@@ -723,8 +758,21 @@ export class BaseClass {
|
||||
if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) {
|
||||
if (args[args.length - 1].type === 'Map') {
|
||||
args[args.length - 1] = this;
|
||||
} else if (this instanceof MarkerCluster) {
|
||||
let overlay: Marker = this.get(args[args.length - 1].getId());
|
||||
if (!overlay) {
|
||||
let markerJS: any = args[args.length - 1];
|
||||
let markerId: string = markerJS.getId();
|
||||
let markerCluster: MarkerCluster = <MarkerCluster>this;
|
||||
overlay = new Marker(markerCluster.getMap(), markerJS);
|
||||
this.get('_overlays')[markerId] = overlay;
|
||||
markerJS.one(markerJS.getId() + '_remove', () => {
|
||||
this.get('_overlays')[markerId] = null;
|
||||
});
|
||||
}
|
||||
args[args.length - 1] = overlay;
|
||||
} else {
|
||||
args[args.length - 1] = this._objectInstance.getMap().get(args[args.length - 1].getId());
|
||||
args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()];
|
||||
}
|
||||
}
|
||||
observer.next(args);
|
||||
@@ -744,8 +792,21 @@ export class BaseClass {
|
||||
if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) {
|
||||
if (args[args.length - 1].type === 'Map') {
|
||||
args[args.length - 1] = this;
|
||||
} else if (this instanceof MarkerCluster) {
|
||||
let overlay: Marker = this.get(args[args.length - 1].getId());
|
||||
if (!overlay) {
|
||||
let markerJS: any = args[args.length - 1];
|
||||
let markerId: string = markerJS.getId();
|
||||
let markerCluster: MarkerCluster = <MarkerCluster>this;
|
||||
overlay = new Marker(markerCluster.getMap(), markerJS);
|
||||
this.get('_overlays')[markerId] = overlay;
|
||||
markerJS.one(markerJS.getId() + '_remove', () => {
|
||||
this.get('_overlays')[markerId] = null;
|
||||
});
|
||||
}
|
||||
args[args.length - 1] = overlay;
|
||||
} else {
|
||||
args[args.length - 1] = this._objectInstance.getMap().get(args[args.length - 1].getId());
|
||||
args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()];
|
||||
}
|
||||
}
|
||||
resolve(args);
|
||||
@@ -773,7 +834,7 @@ export class BaseClass {
|
||||
destroy(): void {
|
||||
let map: GoogleMap = this._objectInstance.getMap();
|
||||
if (map) {
|
||||
map.get('_overlays').set(this._objectInstance.getId(), undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this._objectInstance.getId()];
|
||||
}
|
||||
this._objectInstance.remove();
|
||||
}
|
||||
@@ -813,26 +874,65 @@ export class BaseArrayClass<T> extends BaseClass {
|
||||
* @param callback? {Function}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
forEach(fn: ((element: T, index?: number) => void) | ((element: T, callback: () => void) => void), callback?: () => void): void {}
|
||||
forEach(fn: (element: T, index?: number) => void): void {}
|
||||
|
||||
/**
|
||||
* Iterate over each element, calling the provided callback.
|
||||
* @param fn {Function}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@CordovaCheck()
|
||||
forEachAsync(fn: ((element: T, callback: () => void) => void)): Promise<void> {
|
||||
return new Promise<void>((resolve) => {
|
||||
this._objectInstance.forEach(fn, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over each element, then return a new value.
|
||||
* Then you can get the results of each callback.
|
||||
* @param fn {Function}
|
||||
* @param callback? {Function}
|
||||
* @return {Array<Object>} returns a new array with the results
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
map(fn: Function, callback?: ((element: T, index: number) => T) | ((element: T, callback: (newElement: T) => void) => void)): T[] { return; }
|
||||
map(fn: (element: T, index: number) => any): any[] { return; }
|
||||
|
||||
/**
|
||||
* Iterate over each element, calling the provided callback.
|
||||
* Then you can get the results of each callback.
|
||||
* @param fn {Function}
|
||||
* @param callback? {Function}
|
||||
* @return {Promise<any>} returns a new array with the results
|
||||
*/
|
||||
@CordovaCheck()
|
||||
mapAsync(fn: ((element: T, callback: (newElement: any) => void) => void)): Promise<any[]> {
|
||||
return new Promise<any[]>((resolve) => {
|
||||
this._objectInstance.map(fn, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The filter() method creates a new array with all elements that pass the test implemented by the provided function.
|
||||
* @param fn {Function}
|
||||
* @param callback? {Function}
|
||||
* @return {Array<Object>} returns a new array with the results
|
||||
* @return {Array<Object>} returns a new filtered array
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
filter(fn: Function, callback?: ((element: T, index: number) => T) | ((element: T, callback: (newElement: T) => void) => void)): T[] { return; }
|
||||
filter(fn: (element: T, index: number) => boolean): T[] { return; }
|
||||
|
||||
/**
|
||||
* The filterAsync() method creates a new array with all elements that pass the test implemented by the provided function.
|
||||
* @param fn {Function}
|
||||
* @param callback? {Function}
|
||||
* @return {Promise<any>} returns a new filtered array
|
||||
*/
|
||||
@CordovaCheck()
|
||||
filterAsync(fn: (element: T, callback: (result: boolean) => void) => void): Promise<T[]> {
|
||||
return new Promise<any[]>((resolve) => {
|
||||
this._objectInstance.filter(fn, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the underlying Array.
|
||||
@@ -1289,10 +1389,69 @@ export class GoogleMap extends BaseClass {
|
||||
constructor(element: string | HTMLElement, options?: GoogleMapOptions) {
|
||||
super();
|
||||
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) {
|
||||
if (typeof element === 'string') {
|
||||
element = document.getElementById(<string>element);
|
||||
if (element instanceof HTMLElement) {
|
||||
this._objectInstance = GoogleMaps.getPlugin().Map.getMap(element, options);
|
||||
} else if (typeof element === 'string') {
|
||||
let dummyObj: any = new (GoogleMaps.getPlugin().BaseClass)();
|
||||
this._objectInstance = dummyObj;
|
||||
let onListeners: any[] = [];
|
||||
let oneListeners: any[] = [];
|
||||
let _origAddEventListener: any = this._objectInstance.addEventListener;
|
||||
let _origAddEventListenerOnce: any = this._objectInstance.addEventListenerOnce;
|
||||
this._objectInstance.addEventListener = (eventName: string, fn: () => void) => {
|
||||
if (eventName === GoogleMapsEvent.MAP_READY) {
|
||||
_origAddEventListener.call(dummyObj, eventName, fn);
|
||||
} else {
|
||||
onListeners.push([dummyObj, fn]);
|
||||
}
|
||||
};
|
||||
this._objectInstance.on = this._objectInstance.addEventListener;
|
||||
|
||||
this._objectInstance.addEventListenerOnce = (eventName: string, fn: () => void) => {
|
||||
if (eventName === GoogleMapsEvent.MAP_READY) {
|
||||
_origAddEventListenerOnce.call(dummyObj, eventName, fn);
|
||||
} else {
|
||||
oneListeners.push([dummyObj, fn]);
|
||||
}
|
||||
};
|
||||
this._objectInstance.one = this._objectInstance.addEventListenerOnce;
|
||||
(new Promise<any>((resolve, reject) => {
|
||||
let count: number = 0;
|
||||
let timer: any = setInterval(() => {
|
||||
let target = document.querySelector('.show-page #' + element);
|
||||
if (target) {
|
||||
clearInterval(timer);
|
||||
resolve(target);
|
||||
} else {
|
||||
if (count++ < 20) {
|
||||
return;
|
||||
}
|
||||
clearInterval(timer);
|
||||
this._objectInstance.remove();
|
||||
console.error('Can not find the element [#' + element + ']');
|
||||
reject();
|
||||
}
|
||||
}, 100);
|
||||
}))
|
||||
.then((target: any) => {
|
||||
this._objectInstance = GoogleMaps.getPlugin().Map.getMap(target, options);
|
||||
this._objectInstance.one(GoogleMapsEvent.MAP_READY, () => {
|
||||
this.set('_overlays', {});
|
||||
onListeners.forEach((args) => {
|
||||
this.on.apply(this, args);
|
||||
});
|
||||
oneListeners.forEach((args) => {
|
||||
this.one.apply(this, args);
|
||||
});
|
||||
dummyObj.trigger(GoogleMapsEvent.MAP_READY);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this._objectInstance = null;
|
||||
});
|
||||
} else if (element === null && options) {
|
||||
this._objectInstance = GoogleMaps.getPlugin().Map.getMap(null, options);
|
||||
}
|
||||
this._objectInstance = GoogleMaps.getPlugin().Map.getMap(element, options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1300,8 +1459,14 @@ export class GoogleMap extends BaseClass {
|
||||
* Changes the map div
|
||||
* @param domNode
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setDiv(domNode?: HTMLElement): void { }
|
||||
@InstanceCheck()
|
||||
setDiv(domNode?: HTMLElement | string): void {
|
||||
if (typeof domNode === 'string') {
|
||||
this._objectInstance.setDiv(document.querySelector('.show-page #' + domNode));
|
||||
} else {
|
||||
this._objectInstance.setDiv(domNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map HTML element
|
||||
@@ -1457,9 +1622,12 @@ export class GoogleMap extends BaseClass {
|
||||
*/
|
||||
@CordovaInstance()
|
||||
remove(): Promise<any> {
|
||||
this.get('_overlays').forEach((overlayId: string) => this.set(overlayId, null));
|
||||
this.get('_overlays').empty();
|
||||
this.set('_overlays', undefined);
|
||||
if (this.get('_overlays')) {
|
||||
Object.keys(this.get('_overlays')).forEach((overlayId: string) => {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
delete this.get('_overlays')[overlayId];
|
||||
});
|
||||
}
|
||||
return new Promise<any>((resolve) => {
|
||||
this._objectInstance.remove(() => resolve());
|
||||
});
|
||||
@@ -1471,8 +1639,12 @@ export class GoogleMap extends BaseClass {
|
||||
*/
|
||||
@InstanceCheck()
|
||||
clear(): Promise<any> {
|
||||
this.get('_overlays').forEach((overlayId: string) => this.set(overlayId, null));
|
||||
this.get('_overlays').empty();
|
||||
if (this.get('_overlays')) {
|
||||
Object.keys(this.get('_overlays')).forEach((overlayId: string) => {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
delete this.get('_overlays')[overlayId];
|
||||
});
|
||||
}
|
||||
return new Promise<any>((resolve) => {
|
||||
this._objectInstance.clear(() => resolve());
|
||||
});
|
||||
@@ -1567,9 +1739,15 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<Marker>((resolve, reject) => {
|
||||
this._objectInstance.addMarker(options, (marker: any) => {
|
||||
if (marker) {
|
||||
let overlayId: string = marker.getId();
|
||||
const overlay: Marker = new Marker(this, marker);
|
||||
this.get('_overlays').push(marker.getId());
|
||||
this.set(marker.getId(), overlay);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
marker.one(overlayId + '_remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1583,9 +1761,16 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<MarkerCluster>((resolve, reject) => {
|
||||
this._objectInstance.addMarkerCluster(options, (markerCluster: any) => {
|
||||
if (markerCluster) {
|
||||
let overlayId = markerCluster.getId();
|
||||
const overlay = new MarkerCluster(this, markerCluster);
|
||||
this.get('_overlays').push(markerCluster.getId());
|
||||
this.set(markerCluster.getId(), overlay);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
markerCluster.one('remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
markerCluster.set('_overlays', new BaseArrayClass());
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1603,9 +1788,15 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<Circle>((resolve, reject) => {
|
||||
this._objectInstance.addCircle(options, (circle: any) => {
|
||||
if (circle) {
|
||||
let overlayId: string = circle.getId();
|
||||
const overlay = new Circle(this, circle);
|
||||
this.get('_overlays').push(circle.getId());
|
||||
this.set(circle.getId(), overlay);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
circle.one(overlayId + '_remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1623,10 +1814,16 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<Polygon>((resolve, reject) => {
|
||||
this._objectInstance.addPolygon(options, (polygon: any) => {
|
||||
if (polygon) {
|
||||
let overlayId: string = polygon.getId();
|
||||
const overlay = new Polygon(this, polygon);
|
||||
this.get('_overlays').push(polygon.getId());
|
||||
this.set(polygon.getId(), overlay);
|
||||
resolve(polygon);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
polygon.one(overlayId + '_remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -1643,9 +1840,15 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<Polyline>((resolve, reject) => {
|
||||
this._objectInstance.addPolyline(options, (polyline: any) => {
|
||||
if (polyline) {
|
||||
let overlayId: string = polyline.getId();
|
||||
const overlay = new Polyline(this, polyline);
|
||||
this.get('_overlays').push(polyline.getId());
|
||||
this.set(polyline.getId(), overlay);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
polyline.one(overlayId + '_remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1662,9 +1865,15 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<TileOverlay>((resolve, reject) => {
|
||||
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
|
||||
if (tileOverlay) {
|
||||
let overlayId: string = tileOverlay.getId();
|
||||
const overlay = new TileOverlay(this, tileOverlay);
|
||||
this.get('_overlays').push(tileOverlay.getId());
|
||||
this.set(tileOverlay.getId(), overlay);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
tileOverlay.one(overlayId + '_remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1681,9 +1890,15 @@ export class GoogleMap extends BaseClass {
|
||||
return new Promise<GroundOverlay>((resolve, reject) => {
|
||||
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
|
||||
if (groundOverlay) {
|
||||
let overlayId: string = groundOverlay.getId();
|
||||
const overlay = new GroundOverlay(this, groundOverlay);
|
||||
this.get('_overlays').push(groundOverlay.getId());
|
||||
this.set(groundOverlay.getId(), overlay);
|
||||
this.get('_overlays')[overlayId] = overlay;
|
||||
groundOverlay.one(overlayId + '_remove', () => {
|
||||
if (this.get('_overlays')) {
|
||||
this.get('_overlays')[overlayId] = null;
|
||||
overlay.destroy();
|
||||
}
|
||||
});
|
||||
resolve(overlay);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1720,6 +1935,7 @@ export class GoogleMap extends BaseClass {
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1836,7 +2052,7 @@ export class GroundOverlay extends BaseClass {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
remove(): void {
|
||||
this._objectInstance.getMap().get('_overlays').set(this.getId(), undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this.getId()];
|
||||
this._objectInstance.remove();
|
||||
this.destroy();
|
||||
}
|
||||
@@ -1851,18 +2067,11 @@ export class GroundOverlay extends BaseClass {
|
||||
pluginRef: 'plugin.google.maps.HtmlInfoWindow',
|
||||
repo: ''
|
||||
})
|
||||
export class HtmlInfoWindow<T> extends IonicNativePlugin {
|
||||
private _objectInstance: any;
|
||||
export class HtmlInfoWindow extends BaseClass {
|
||||
|
||||
constructor(initialData?: any) {
|
||||
constructor() {
|
||||
super();
|
||||
if (checkAvailability(HtmlInfoWindow.getPluginRef(), null, HtmlInfoWindow.getPluginName()) === true) {
|
||||
if (initialData instanceof GoogleMaps.getPlugin().HtmlInfoWindow) {
|
||||
this._objectInstance = initialData;
|
||||
} else {
|
||||
this._objectInstance = new (HtmlInfoWindow.getPlugin())();
|
||||
}
|
||||
}
|
||||
this._objectInstance = new (GoogleMaps.getPlugin().HtmlInfoWindow)();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1875,9 +2084,10 @@ export class HtmlInfoWindow<T> extends IonicNativePlugin {
|
||||
/**
|
||||
* Set your HTML contents.
|
||||
* @param content {any} String containing text or HTML element
|
||||
* @param cssOptions? {any} CSS styles for the container element of HTMLInfoWindow
|
||||
*/
|
||||
@CordovaInstance()
|
||||
setContent(content: string | Element): void {}
|
||||
setContent(content: string | Element, cssOptions?: any): void {}
|
||||
|
||||
/**
|
||||
* Open the htmlInfoWindow
|
||||
@@ -2020,7 +2230,7 @@ export class Marker extends BaseClass {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
remove(): void {
|
||||
this._objectInstance.getMap().get('_overlays').set(this.getId(), undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this.getId()];
|
||||
this._objectInstance.remove();
|
||||
this.destroy();
|
||||
}
|
||||
@@ -2141,7 +2351,8 @@ export class MarkerCluster extends BaseClass {
|
||||
|
||||
@InstanceCheck()
|
||||
remove(): void {
|
||||
this._objectInstance.getMap().get('_overlays').set(this.getId(), undefined);
|
||||
this._objectInstance.set('_overlays', undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this.getId()];
|
||||
this._objectInstance.remove();
|
||||
this.destroy();
|
||||
}
|
||||
@@ -2192,8 +2403,10 @@ export class Polygon extends BaseClass {
|
||||
* You can modify the points.
|
||||
* @return {BaseArrayClass<ILatLng>}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): BaseArrayClass<ILatLng> { return; }
|
||||
@CordovaCheck()
|
||||
getPoints(): BaseArrayClass<ILatLng> {
|
||||
return new BaseArrayClass<ILatLng>(this._objectInstance.getPoints());
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the polygon holes.
|
||||
@@ -2207,8 +2420,15 @@ export class Polygon extends BaseClass {
|
||||
* You can modify the holes.
|
||||
* @return {BaseArrayClass<ILatLng[]>}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getHoles(): BaseArrayClass<ILatLng[]> { return; }
|
||||
@CordovaCheck()
|
||||
getHoles(): BaseArrayClass<ILatLng[]> {
|
||||
let holes: ILatLng[][] = this._objectInstance.getPoints();
|
||||
let results: BaseArrayClass<ILatLng[]> = new BaseArrayClass<ILatLng[]>();
|
||||
holes.forEach((hole: ILatLng[]) => {
|
||||
results.push(hole);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the filling color (inner color)
|
||||
@@ -2284,7 +2504,7 @@ export class Polygon extends BaseClass {
|
||||
*/
|
||||
@InstanceCheck()
|
||||
remove(): void {
|
||||
this._objectInstance.getMap().get('_overlays').set(this.getId(), undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this.getId()];
|
||||
this._objectInstance.remove();
|
||||
this.destroy();
|
||||
}
|
||||
@@ -2353,9 +2573,12 @@ export class Polyline extends BaseClass {
|
||||
/**
|
||||
* Return an instance of the BaseArrayClass
|
||||
* You can modify the points.
|
||||
* @return {BaseArrayClass<ILatLng>}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): BaseArrayClass<ILatLng> { return; }
|
||||
@CordovaCheck()
|
||||
getPoints(): BaseArrayClass<ILatLng> {
|
||||
return new BaseArrayClass<ILatLng>(this._objectInstance.getPoints());
|
||||
}
|
||||
|
||||
/**
|
||||
* When true, edges of the polyline are interpreted as geodesic and will follow the curvature of the Earth.
|
||||
@@ -2445,7 +2668,7 @@ export class Polyline extends BaseClass {
|
||||
*/
|
||||
@InstanceCheck()
|
||||
remove(): void {
|
||||
this._objectInstance.getMap().get('_overlays').set(this.getId(), undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this.getId()];
|
||||
this._objectInstance.remove();
|
||||
this.destroy();
|
||||
}
|
||||
@@ -2544,7 +2767,7 @@ export class TileOverlay extends BaseClass {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
remove(): void {
|
||||
this._objectInstance.getMap().get('_overlays').set(this.getId(), undefined);
|
||||
delete this._objectInstance.getMap().get('_overlays')[this.getId()];
|
||||
this._objectInstance.remove();
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ export interface OSNotificationPayload {
|
||||
/**
|
||||
* URL to open when opening the notification.
|
||||
*/
|
||||
launchUrl?: string;
|
||||
launchURL?: string;
|
||||
/**
|
||||
* Sound resource to play when the notification is shown.
|
||||
*/
|
||||
@@ -301,7 +301,8 @@ export enum OSActionType {
|
||||
* The OneSignal plugin is an client implementation for using the [OneSignal](https://onesignal.com/) Service.
|
||||
* OneSignal is a simple implementation for delivering push notifications.
|
||||
*
|
||||
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
||||
* Please view the official [OneSignal Ionic SDK Installation](https://documentation.onesignal.com/docs/ionic-sdk-setup) guide
|
||||
* for more information.
|
||||
*
|
||||
* #### Icons
|
||||
* If you want to use generated icons with command `ionic cordova resources`:
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface PhotoViewerOptions {
|
||||
/**
|
||||
* Set to false to disable the share button (Android only). Default: true
|
||||
*/
|
||||
share?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Photo Viewer
|
||||
* @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image.
|
||||
@@ -29,8 +37,8 @@ export class PhotoViewer extends IonicNativePlugin {
|
||||
* Shows an image in full screen
|
||||
* @param url {string} URL or path to image
|
||||
* @param title {string}
|
||||
* @param options {any}
|
||||
* @param options {PhotoViewerOptions}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
show(url: string, title?: string, options?: {share?: boolean}): void { }
|
||||
show(url: string, title?: string, options?: PhotoViewerOptions): void { }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* Information about the currently running app
|
||||
*/
|
||||
export interface AppInfo {
|
||||
platform: string;
|
||||
platformVersion: string;
|
||||
version: string;
|
||||
bundleName: string;
|
||||
bundleVersion: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about the current live update
|
||||
*/
|
||||
export interface DeployInfo {
|
||||
deploy_uuid: string;
|
||||
channel: string;
|
||||
binary_version: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object for manually configuring deploy
|
||||
*/
|
||||
export interface DeployConfig {
|
||||
appId?: string;
|
||||
host?: string;
|
||||
channel?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class ProDeploy {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Re-initialize Deploy plugin with a new App ID and host. Not used in most cases.
|
||||
* @param config A valid Deploy config object
|
||||
*/
|
||||
@CordovaInstance()
|
||||
init(config: DeployConfig): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check a channel for an available update
|
||||
* @return {Promise<string>} Resolves with 'true' or 'false', or rejects with an error.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
observable: true
|
||||
})
|
||||
check(): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Download an available version
|
||||
* @return {Observable<any>} Updates with percent completion, or errors with a message.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
observable: true
|
||||
})
|
||||
download(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Unzip the latest downloaded version
|
||||
* @return {Observable<any>} Updates with percent completion, or errors with a message.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
extract(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Reload app with the deployed version
|
||||
*/
|
||||
@CordovaInstance()
|
||||
redirect(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get info about the version running on the device
|
||||
* @return {Promise<DeployInfo>} Information about the current version running on the app.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
info(): Promise<DeployInfo> { return; }
|
||||
|
||||
/**
|
||||
* List versions stored on the device
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getVersions(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete a version stored on the device by UUID
|
||||
* @param version A version UUID
|
||||
*/
|
||||
@CordovaInstance()
|
||||
deleteVersion(version: string): Promise<any> { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Pro
|
||||
* @description
|
||||
* This plugin enables Ionic Pro services like live updates and error monitoring
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Pro, AppInfo, DeployInfo } from '@ionic-native/pro';
|
||||
*
|
||||
*
|
||||
* constructor(private pro: Pro) { }
|
||||
*
|
||||
* // Get app info
|
||||
* this.pro.getAppInfo().then((res: AppInfo) => {
|
||||
* console.log(res)
|
||||
* })
|
||||
*
|
||||
* // Get live update info
|
||||
* this.pro.deploy.info().then((res: DeployInfo) => {
|
||||
* console.log(res)
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Pro',
|
||||
plugin: 'cordova-plugin-ionic',
|
||||
pluginRef: 'IonicCordova',
|
||||
repo: 'https://github.com/ionic-team/cordova-plugin-ionic',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic cordova plugin add cordova-plugin-ionic --save --variable APP_ID="XXXXXXXX" --variable CHANNEL_NAME="Channel"'
|
||||
})
|
||||
@Injectable()
|
||||
export class Pro extends IonicNativePlugin {
|
||||
/**
|
||||
* Ionic Pro Deploy .js API.
|
||||
*/
|
||||
deploy: ProDeploy = new ProDeploy(Pro.getPlugin().deploy);
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
enableCrashLogging(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
checkForPendingCrash(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
loadPendingCrash(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
forceCrash(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get information about the currently running app
|
||||
* @return {Promise<any>} Returns a promise that resolves with current app info
|
||||
*/
|
||||
@Cordova()
|
||||
getAppInfo(): Promise<AppInfo> { return; }
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
* import { RegulaDocumentReader } from '@ionic-native/regula-document-reader';
|
||||
*
|
||||
* let license; // read regula.license file
|
||||
* RegulaDocumentReader.scanDocument(license).then((result) => {
|
||||
* RegulaDocumentReader.initReader(license); // initialize reader
|
||||
* RegulaDocumentReader.scanDocument().then((result) => {
|
||||
* // read result
|
||||
* })
|
||||
* ```
|
||||
@@ -23,17 +24,23 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
plugin: 'cordova-plugin-documentreader',
|
||||
pluginRef: 'DocumentReader',
|
||||
repo: 'https://github.com/regulaforensics/cordova-plugin-documentreader.git',
|
||||
platforms: ['iOS'],
|
||||
platforms: ['iOS', 'Android'],
|
||||
install: 'ionic plugin add cordova-plugin-documentreader --variable CAMERA_USAGE_DESCRIPTION="To take photo"',
|
||||
})
|
||||
@Injectable()
|
||||
export class RegulaDocumentReader extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Run the scanner
|
||||
* Initialize the scanner
|
||||
* @param license {any} License data
|
||||
*/
|
||||
@Cordova()
|
||||
initReader(license: any): void {}
|
||||
|
||||
/**
|
||||
* Run the scanner
|
||||
* @return {Promise<string[]>} Returns a promise that resolves when results was got, and fails when not
|
||||
*/
|
||||
@Cordova()
|
||||
scanDocument(license: any): Promise<string[]> { return; }
|
||||
scanDocument(): Promise<string[]> { return; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user