Compare commits

...

27 Commits

Author SHA1 Message Date
Raman Rasliuk a2d33963b1 feat(http): use a different plugin source with better features (#1921) 2017-08-26 03:57:23 -04:00
Leonardo Ruhland 332f9aefe5 docs(safariview): usage fix (#1923)
The show method returns a Observable, not a Promise.
2017-08-26 03:55:06 -04:00
Heather Lemieux 4942b88873 docs(google-maps): update docs (#1833)
Since the new googlemaps plugin uses the native code, you need to wait for the platform to be ready before loading the map.
2017-08-26 03:53:57 -04:00
frank10gm 39ec5158a0 fix(google-maps): add missing debug option (#1832)
added debug option to TileOverlayOptions.
2017-08-26 03:51:39 -04:00
Masashi Katsumata c11aec33a7 feat(google-maps): update plugin and fix a few issues (#1834)
* Update index.ts

* Update index.ts

* Add missing features, and bug fix of methods

* update: classname must be in pascal case

* remove: duplicated class definition

* export encode and spherical static classes

* Add comma

* Fix Encoding and Spherical

* Add convenience methods

* Fix decorators for Encoding and Spherical

* Update: getMap() methods return the instance of the wrapper plugin

* Update: getMap() methods return the instance of the wrapper plugin

* Remove `@CordovaInstance` decorators from getMap()

* Update: GoogleMapOptions (all fields are not optional).

* Follow up:  version `2.0.0-beta2-20170719-2226` of cordova-plugin-googlemaps

* Fix: tslint error

* Fix: tslint error

* No more isAvailable() method.

* Bug fix: description is incorrect

* Bug fix: example code was wrong.

* Bug fix: HtmlInfoWindow does not work
https://github.com/ionic-team/ionic-native/pull/1815#issuecomment-318909795

* Bug fix: HtmlInfoWindow does not work

* Bug fix: HtmlInfoWindow does not work

* Bug fix: HtmlInfoWindow does not work

* Bug fix: HtmlInfoWindow does not work

* It seems the ionViewDidLoad() is enough delayed after platform.ready()

* Bug fix: map.setDiv()

* Bug fix: HtmlInfoWindow does not work

* Bug fix: BaseArrayClass definition is incorrect

* Bug fix: BaseArrayClass constructor is wrong

* Bug fix: Geocoder class does not work

* Bug fix: LatLngBounds constructor is wrong

* update: noNotify option is not declared

* Bug fix: Geocoder.geocode() returns array of GeocoderResult

* Update: clarify acceptable parameters of BaseArrayClass

* Add: AnimateCameraOption.padding is missing

* Revert: BaseClass.empty() method does not have the noNotify option

* Add `destruct` option to the CordovaOption.

- This allows BaseClass.on() is able to pass multiple retuned values from the cordova plugin side to the event lister.

* A semicolon is mixing

* update: event names

* Update: BaseClass.addEventListener(), addEventListenerOnce(), on(), and one()

* Add: destruct option for otherPromise
Change: inside event names (must use the version 2.0.0-beta3-20170808-1950 or higher)

* Build for working group

* Bug fix: map.getCameraTarget() definition is incorrect

* Bug fix: The definition of VisibleRegion interface is incorrect

* Fix: LatLng, LatLngBounds, and PolylineOptions classes
Update: map.getVisibleRegion()

Add: VisibleRegion class

* Bug fix: the definition of map.clear() method is incorrect

* Fix: map.fromLatLngToPoint()

* Ignore the dist directory on the master branch

* Remove the dist folder on the master branch

* fixes and tweaks

* use union types for CameraPosition

fixes issue mentioned on slack by @wf9a5m75

* fix types

* update AnimateCameraOptions interface

* remove AnimateCameraOptions interface

* add MarkerCluster class
2017-08-26 03:37:40 -04:00
Keepertje 21045ea535 fix(ms-adal): make userId optional (#1894)
The docs say User Identifier is optional but the method does not reflect it.
2017-08-23 19:55:46 -04:00
Rohin Mohanadas 955c450483 docs(): update supported platforms (#1879)
Removing browser from the list of supported platforms.
2017-08-23 19:55:05 -04:00
Ibby Hadeed 00c0707dad fix(geofence): remove duplicate onTransitionReceived method 2017-08-23 19:54:11 -04:00
Ibby Hadeed 79f88d6a02 Merge branch 'master' of github.com:ionic-team/ionic-native 2017-08-23 19:47:05 -04:00
Yasin Simsek ce5966bf10 feat(local-notifications): add un method to unsubscribe from events (#1871) 2017-08-23 19:46:58 -04:00
Ibby Hadeed fb8dbe5fc0 Merge branch 'master' of github.com:ionic-team/ionic-native 2017-08-23 19:42:51 -04:00
martinhanke cde87e2113 feat(paypal): add payeeEmail for third party merchants (#1864) 2017-08-23 19:42:47 -04:00
Fatih Kızmaz 262e18f409 fix(native-spinner): update pluginRef (#1859)
Wrong pluginRef causes errors:
Native: tried calling SpinnerDialog.show, but the SpinnerDialog plugin is not installed.
Install the SpinnerDialog plugin: 'ionic cordova plugin add cordova-plugin-native-spinner'

Fix pluginRef to work properly.
2017-08-23 19:41:03 -04:00
Davor Peic 39ef066875 docs(cardio): update docs (#1858)
Added iOS10 permission message and corrected requireCVV use
2017-08-23 19:40:14 -04:00
Chris 35d317f7f3 docs(): add missing import (#1853)
BackgroundGeolocationResponse was not declared in classes to import from @ionic-native/background-geolocation
2017-08-23 19:39:29 -04:00
Tom Sundstrom 5505e5f064 docs(): adjust log messages in photo library example callbacks (#1851)
* Move error message to the error callback

* Log a debug message in complete callback
2017-08-23 19:39:04 -04:00
Ibby Hadeed e6b0250d97 refactor 2017-08-23 19:38:30 -04:00
Mario Mol aa4c3b3787 feat(push): add Browser Push notification support (#1848)
* Browser Push interface with options to use push notification with browsers , as a proxy to phonegap-plush-plugin

* making both properties optional
2017-08-23 19:38:04 -04:00
foysal 57bbcdebfb docs(nfc): update usage doc of the nfc plugin (#1846)
* docs(nfc): update usage doc of the nfc plugin

show an example of how the event listeners work with observable subscription and implement an nfc share within the event listener.

* docs(AndroidPermissions): requestPermissions->requestPermission
2017-08-23 19:37:31 -04:00
Josh McRae 85825c7b91 fix(fingerprint-aio): add missing FingerprintOptions properties (#1845)
* docs(fingerprint-aio): add missing FingerprintOptions properties

* fix(fingerprint-aio): fix circle lint error
2017-08-23 19:37:04 -04:00
Josh Miles 1acade4883 fix(serial): add missing options for the open method (#1844) 2017-08-23 19:36:41 -04:00
Sebastian Baar 7c1b409542 fix(native-geocoder): update NativeGeocoderReverse result (#1840)
* feat(nativegeocoder): add NativeGeocoder plugin

* add district

* update NativeGeocoderReverseResult & refactor code

* delete plugins

* delete index.ts
2017-08-23 19:35:51 -04:00
Ibby Hadeed fe02c84fd9 clean up 2017-08-23 19:34:55 -04:00
Moamen Mostafa a2cc1870b4 feat(keychain-touch-id): add KeychainTouchId plugin (#1837) 2017-08-23 19:33:12 -04:00
Ibby Hadeed 1c6a3a3bc5 update package-lock 2017-08-23 19:31:23 -04:00
Robert Coie 0c097ba2be fix(sqlite): add optional key parameter to SQLiteDatabaseConfig to support sqlcipher-adapter (#1917) 2017-08-23 19:21:57 -04:00
Animesh Kumar 0dd507ff03 docs(): fix typo (#1914)
corrected `to` to `two` on line number 14
2017-08-23 19:21:25 -04:00
26 changed files with 3313 additions and 1430 deletions
+1 -1
View File
@@ -3,5 +3,5 @@ node_modules/
.idea
.tmp
aot/
dist/
scripts/ionic-native-bower
dist/
+2503 -1069
View File
File diff suppressed because it is too large Load Diff
+39 -1
View File
@@ -2,6 +2,7 @@ import 'core-js';
import { Plugin, Cordova, CordovaProperty, CordovaCheck, CordovaInstance, InstanceProperty } from './decorators';
import { IonicNativePlugin } from './ionic-native-plugin';
import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin';
import { Observable } from 'rxjs/Observable';
declare const window: any;
@@ -47,6 +48,17 @@ class TestPlugin extends IonicNativePlugin {
return new TestObject(TestPlugin.getPlugin().create());
}
@Cordova({
destruct: true
})
destructPromise(): Promise<any> { return; }
@Cordova({
destruct: true,
observable: true
})
destructObservable(): Observable<any> { return; }
}
function definePlugin() {
@@ -59,7 +71,9 @@ function definePlugin() {
this.ping = (success: Function, error: Function) => success('pong');
this.name = 'John Smith';
return this;
}
},
destructPromise: (success: Function) => success('hello', 'world'),
destructObservable: (success: Function) => success('hello', 'world')
};
}
@@ -177,6 +191,30 @@ describe('Regular Decorators', () => {
});
describe('CordovaOptions', () => {
describe('destruct', () => {
it('should destruct values returned by a Promise', (done) => {
plugin.destructPromise()
.then((args: any[]) => {
expect(args).toEqual(['hello', 'world']);
done();
});
});
it('should destruct values returned by an Observable', (done) => {
plugin.destructObservable()
.subscribe((args: any[]) => {
expect(args).toEqual(['hello', 'world']);
done();
});
});
});
});
});
describe('Instance Decorators', () => {
+2 -1
View File
@@ -37,6 +37,7 @@ export interface PluginConfig {
}
export interface CordovaOptions {
destruct?: boolean;
/**
* Set to true if the wrapped method is a sync function
*/
@@ -252,7 +253,7 @@ export function Cordova(opts: CordovaOptions = {}) {
*
* Wrap an instance method
*/
export function CordovaInstance(opts: any = {}) {
export function CordovaInstance(opts: CordovaOptions = {}) {
return (target: Object, methodName: string) => {
return {
value: function(...args: any[]) {
+44 -6
View File
@@ -136,7 +136,11 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
if (opts.destruct) {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
} else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
}
rej = reject;
});
// Angular throws an error on unhandled rejection, but in this case we have already printed
@@ -166,7 +170,14 @@ function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts:
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return new Observable(observer => {
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
let pluginResult;
if (opts.destruct) {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
} else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
observer.complete();
@@ -266,7 +277,14 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
} else if (opts.observable) {
return new Observable(observer => {
let pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
let pluginResult;
if (opts.destruct) {
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
} else {
pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
@@ -287,9 +305,13 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
});
} else if (opts.otherPromise) {
return getPromise((resolve: Function, reject: Function) => {
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
let result;
if (opts.destruct) {
result = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
} else {
result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
}
if (result && !!result.then) {
result.then(resolve, reject);
} else {
@@ -298,8 +320,24 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
});
} else {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
if (opts.destruct) {
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
} else {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
}
rej = reject;
});
// Angular throws an error on unhandled rejection, but in this case we have already printed
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error
if (pluginResult && pluginResult.error) {
p.catch(() => { });
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject));
}
};
@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
*
* this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
* success => console.log('Permission granted'),
* err => this.androidPermissions.requestPermissions(this.androidPermissions.PERMISSION.CAMERA)
* err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
* );
*
* this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);
@@ -264,7 +264,7 @@ export interface BackgroundGeolocationConfig {
* BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
*
* ```typescript
* import { BackgroundGeolocation, BackgroundGeolocationConfig } from '@ionic-native/background-geolocation';
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
*
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
*
+6 -1
View File
@@ -133,6 +133,11 @@ export interface CardIOResponse {
* @name Card IO
* @description
* @usage
* Note: For use with iOS 10 + When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the <your app name>Info.plist file. Add the following lines in the main <dict> element.
* ```xml
*<key>NSCameraUsageDescription</key>
*<string>To scan credit cards.</string>
*```
* ```typescript
* import { CardIO } from '@ionic-native/card-io';
*
@@ -147,7 +152,7 @@ export interface CardIOResponse {
* if(res){
* let options = {
* requireExpiry: true,
* requireCCV: false,
* requireCVV: false,
* requirePostalCode: false
* };
* CardIO.scan(options);
+1 -1
View File
@@ -32,7 +32,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
plugin: 'cordova-clipboard',
pluginRef: 'cordova.plugins.clipboard',
repo: 'https://github.com/ihadeed/cordova-clipboard',
platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8']
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class Clipboard extends IonicNativePlugin {
@@ -17,6 +17,16 @@ export interface FingerprintOptions {
* Disable 'use backup' option. Only for android (optional)
*/
disableBackup?: boolean;
/**
* Title of fallback button. Only for iOS
*/
localizedFallbackTitle?: string;
/**
* Description in authentication dialogue. Only for iOS
*/
localizedReason?: string;
}
/**
@@ -36,7 +46,9 @@ export interface FingerprintOptions {
* this.faio.show({
* clientId: 'Fingerprint-Demo',
* clientSecret: 'password', //Only necessary for Android
* disableBackup:true //Only for Android(optional)
* disableBackup:true, //Only for Android(optional)
* localizedFallbackTitle: 'Use Pin', //Only for iOS
* localizedReason: 'Please authenticate' //Only for iOS
* })
* .then((result: any) => console.log(result))
* .catch((error: any) => console.log(error));
+2 -16
View File
@@ -85,7 +85,7 @@ declare const window: any;
@Injectable()
export class Geofence extends IonicNativePlugin {
public TransitionType = {
TransitionType = {
ENTER: 1,
EXIT: 2,
BOTH: 3
@@ -96,7 +96,7 @@ export class Geofence extends IonicNativePlugin {
* @return {Observable<any>}
*/
@CordovaFunctionOverride()
onTrasitionReceived(): Observable<any> { return; };
onTransitionReceived(): Observable<any> { return; };
/**
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
@@ -139,20 +139,6 @@ export class Geofence extends IonicNativePlugin {
@Cordova()
getWatched(): Promise<string> { return; };
/**
* Called when a geofence is crossed in the direction specified by `TransitType`.
*
* @returns {Observable<any>}
*/
onTransitionReceived(): Observable<any> {
return new Observable<any>((observer) => {
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
return () => window.geofence.onTransitionReceived = () => { };
});
}
/**
* Called when the user clicks a geofence notification. iOS and Android only.
*
+444 -292
View File
@@ -1,64 +1,161 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaInstance, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/observable/fromEvent';
export type MapType = 'MAP_TYPE_NORMAL' | 'MAP_TYPE_ROADMAP' | 'MAP_TYPE_SATELLITE' | 'MAP_TYPE_HYBRID' | 'MAP_TYPE_TERRAIN' | 'MAP_TYPE_NONE';
/**
* @hidden
*/
export class LatLng implements ILatLng {
lat: number;
lng: number;
constructor(lat: number, lng: number) {
this.lat = lat;
this.lng = lng;
}
equals(other: ILatLng): boolean {
return this.lat === other.lat && this.lng === other.lng;
}
toString(): string {
return this.lat + ',' + this.lng;
}
toUrlValue(precision?: number): string {
precision = precision || 6;
return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
}
}
export interface ILatLngBounds {
northeast: ILatLng;
southwest: ILatLng;
}
/**
* @hidden
*/
export class LatLngBounds implements ILatLngBounds {
private _objectInstance: any;
@InstanceProperty northeast: ILatLng;
@InstanceProperty southwest: ILatLng;
@InstanceProperty type: string;
constructor(points?: ILatLng[]) {
this._objectInstance = new (GoogleMaps.getPlugin()).LatLngBounds(points);
}
/**
* Converts to string
* @return {string}
*/
@CordovaInstance({ sync: true })
toString(): string { return; }
/**
* Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box.
* @param precision {number}
* @return {string}
*/
@CordovaInstance({ sync: true })
toUrlValue(precision?: number): string { return; }
/**
* Extends this bounds to contain the given point.
* @param LatLng {ILatLng}
*/
@CordovaInstance({ sync: true })
extend(LatLng: ILatLng): void {}
/**
* Returns true if the given lat/lng is in this bounds.
* @param LatLng {ILatLng}
*/
@CordovaInstance({ sync: true })
contains(LatLng: ILatLng): boolean { return; }
/**
* Computes the center of this LatLngBounds
* @return {LatLng}
*/
@CordovaInstance({ sync: true })
getCenter(): LatLng { return; }
}
export interface GoogleMapOptions {
mapType?: MapType;
controls?: {
/**
* Turns the compass on or off.
*/
compass?: boolean;
/**
* Turns the myLocation picker on or off. If turns on this button, the application displays a permission dialog to obtain the geolocation data.
*/
myLocationButton?: boolean;
/**
* Turns the indoor picker on or off.
*/
indoorPicker?: boolean;
/**
* Turns the map toolbar on or off. This option is for Android only.
*/
mapToolbar?: boolean
mapToolbar?: boolean;
};
gestures?: {
scroll?: boolean;
tilt?: boolean;
zoom?: boolean;
rotate?: boolean;
};
/**
* Map styles
* @ref https://developers.google.com/maps/documentation/javascript/style-reference
*/
styles?: any[];
/**
* Initial camera position
*/
camera?: CameraPosition;
camera?: CameraPosition<any>;
preferences?: {
/**
* Minimum and maximum zoom levels for zooming gestures.
*/
zoom?: {
minZoom?: number;
maxZoom?: number;
},
};
/**
* Paddings of controls.
*/
padding?: {
left?: number,
top?: number,
bottom?: number,
right?: number
},
left?: number;
top?: number;
bottom?: number;
right?: number;
};
/**
* Turns the 3D buildings layer on or off.
*/
@@ -66,34 +163,11 @@ export interface GoogleMapOptions {
};
}
export interface AnimateCameraOptions {
/**
* Center position of the camera target.
*/
target?: ILatLng | Array<ILatLng> | LatLngBounds;
/**
* View angle of camera from 0 to 90
*/
tilt?: number;
/**
* Zoom level from 0 to 20
*/
zoom?: number;
/**
* Heading from 0 to 359
*/
bearing?: number;
/**
* Duration of camera animation in milli seconds
*/
duration?: number;
}
export interface CameraPosition {
export interface CameraPosition<T> {
/**
* The center location of the camera view.
*/
target?: ILatLng | LatLngBounds | ILatLng[];
target?: T;
/**
* View angle
*/
@@ -110,6 +184,10 @@ export interface CameraPosition {
* The duration of animation in milliseconds
*/
duration?: number;
/**
* Camera padding in pixel
*/
padding?: number;
}
export interface CircleOptions {
@@ -260,6 +338,23 @@ export interface MarkerOptions {
disableAutoPan?: boolean;
}
export interface MarkerClusterIcon {
min: number;
max: number;
url: string;
anchor: {
x: number;
y: number;
};
}
export interface MarkerClusterOptions {
maxZoomLevel?: number;
boundsDraw?: boolean;
markers: MarkerOptions[];
icons: MarkerClusterIcon[];
}
export interface MyLocation {
latLng?: LatLng;
elapsedRealtimeNanos?: any;
@@ -284,7 +379,7 @@ export interface PolygonOptions {
fillColor?: string;
visible?: boolean;
zIndex?: number;
addHole?: Array<LatLng>;
addHole?: Array<Array<LatLng>>;
}
export interface PolylineOptions {
@@ -302,11 +397,51 @@ export interface TileOverlayOptions {
zIndex?: number;
tileSize?: number;
opacity?: number;
debug?: boolean;
}
export interface VisibleRegion {
northeast?: any;
southwest?: any;
/**
* @hidden
*/
export class VisibleRegion implements ILatLngBounds {
private _objectInstance: any;
@InstanceProperty northeast: ILatLng;
@InstanceProperty southwest: ILatLng;
@InstanceProperty farLeft: ILatLng;
@InstanceProperty farRight: ILatLng;
@InstanceProperty nearLeft: ILatLng;
@InstanceProperty nearRight: ILatLng;
@InstanceProperty type: string;
constructor(southwest: LatLngBounds, northeast: LatLngBounds, farLeft: ILatLng, farRight: ILatLng, nearLeft: ILatLng, nearRight: ILatLng) {
this._objectInstance = new (GoogleMaps.getPlugin()).VisibleRegion(southwest, northeast, farLeft, farRight, nearLeft, nearRight);
}
/**
* Converts to string
* @return {string}
*/
@CordovaInstance({ sync: true })
toString(): string { return; }
/**
* Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box.
* @param precision {number}
* @return {string}
*/
@CordovaInstance({ sync: true })
toUrlValue(precision?: number): string { return; }
/**
* Returns true if the given lat/lng is in this bounds.
* @param LatLng {ILatLng}
*/
@CordovaInstance({ sync: true })
contains(LatLng: ILatLng): boolean { return; }
}
/**
@@ -315,6 +450,7 @@ export interface VisibleRegion {
*/
export const GoogleMapsEvent: { [eventName: string]: string; } = {
MAP_READY: 'map_ready',
MAP_LOADED: 'map_loaded',
MAP_CLICK: 'map_click',
MAP_LONG_CLICK: 'map_long_click',
MY_LOCATION_BUTTON_CLICK: 'my_location_button_click',
@@ -323,18 +459,23 @@ export const GoogleMapsEvent: { [eventName: string]: string; } = {
CAMERA_MOVE_START: 'camera_move_start',
CAMERA_MOVE: 'camera_move',
CAMERA_MOVE_END: 'camera_move_end',
OVERLAY_CLICK: 'overlay_click',
POLYGON_CLICK: 'polygon_click',
POLYLINE_CLICK: 'polyline_click',
CIRCLE_CLICK: 'circle_click',
GROUND_OVERLAY_CLICK: 'ground_overlay_click',
GROUND_OVERLAY_CLICK: 'groundoverlay_click',
INFO_CLICK: 'info_click',
INFO_LONG_CLICK: 'info_long_click',
INFO_CLOSE: 'info_close',
INFO_OPEN: 'info_open',
CLUSTER_CLICK: 'cluster_click',
MARKER_CLICK: 'marker_click',
MARKER_DRAG: 'marker_drag',
MARKER_DRAG_START: 'marker_drag_start',
MARKER_DRAG_END: 'marker_drag_end'
MARKER_DRAG_END: 'marker_drag_end',
MAP_DRAG: 'map_drag',
MAP_DRAG_START: 'map_drag_start',
MAP_DRAG_END: 'map_drag_end'
};
/**
@@ -368,67 +509,72 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
* GoogleMaps,
* GoogleMap,
* GoogleMapsEvent,
* LatLng,
* GoogleMapOptions,
* CameraPosition,
* MarkerOptions,
* Marker
* } from '@ionic-native/google-maps';
* import { Component } from "@angular/core/";
*
* export class MapPage {
* constructor(private googleMaps: GoogleMaps) {}
* @Component({
* selector: 'page-home',
* templateUrl: 'home.html'
* })
* export class HomePage {
* map: GoogleMap;
* mapElement: HTMLElement;
* constructor(private googleMaps: GoogleMaps) { }
* // Load the map when the platform is ready
* this.platform.ready().then(() => {
* this.loadMap();
* });
*
* // Load map only after view is initialized
* ngAfterViewInit() {
* this.loadMap();
* ionViewDidLoad() {
* this.loadMap();
* }
*
* loadMap() {
* this.mapElement = document.getElementById('map');
*
* let mapOptions: GoogleMapOptions = {
* camera: {
* target: {
* lat: 43.0741904,
* lng: -89.3809802
* },
* zoom: 18,
* tilt: 30
* }
* };
*
* this.map = this.googleMaps.create(this.mapElement, mapOptions);
*
* // Wait the MAP_READY before using any methods.
* this.map.one(GoogleMapsEvent.MAP_READY)
* .then(() => {
* console.log('Map is ready!');
*
* // Now you can use all methods safely.
* this.map.addMarker({
* title: 'Ionic',
* icon: 'blue',
* animation: 'DROP',
* position: {
* lat: 43.0741904,
* lng: -89.3809802
* }
* })
* .then(marker => {
* marker.on(GoogleMapsEvent.MARKER_CLICK)
* .subscribe(() => {
* alert('clicked');
* });
* });
*
* });
* }
* }
*
* loadMap() {
* // make sure to create following structure in your view.html file
* // and add a height (for example 100%) to it, else the map won't be visible
* // <ion-content>
* // <div #map id="map" style="height:100%;"></div>
* // </ion-content>
*
* // create a new map by passing HTMLElement
* let element: HTMLElement = document.getElementById('map');
*
* let map: GoogleMap = this.googleMaps.create(element);
*
* // listen to MAP_READY event
* // You must wait for this event to fire before adding something to the map or modifying it in anyway
* map.one(GoogleMapsEvent.MAP_READY).then(
* () => {
* console.log('Map is ready!');
* // Now you can add elements to the map like the marker
* }
* );
*
* // create CameraPosition
* let position: CameraPosition = {
* target: {
* lat: 43.0741904,
* lng: -89.3809802
* },
* zoom: 18,
* tilt: 30
* };
*
* // move the map's camera to position
* map.moveCamera(position);
*
* // create new marker
* let markerOptions: MarkerOptions = {
* position: ionic,
* title: 'Ionic'
* };
*
* const marker: Marker = map.addMarker(markerOptions)
* .then((marker: Marker) => {
* marker.showInfoWindow();
* });
* }
*
* }
* ```
* @classes
* GoogleMap
@@ -442,6 +588,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
* LatLng
* LatLngBounds
* Marker
* MarkerCluster
* Polygon
* Polyline
* Spherical
@@ -450,7 +597,6 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
* BaseArrayClass
* @interfaces
* GoogleMapOptions
* AnimateCameraOptions
* CameraPosition
* CircleOptions
* GeocoderRequest
@@ -459,6 +605,8 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = {
* ILatLng
* MarkerIcon
* MarkerOptions
* MarkerClusterIcon
* MarkerClusterOptions
* MyLocation
* MyLocationOptions
* PolygonOptions
@@ -530,6 +678,99 @@ export class GoogleMaps extends IonicNativePlugin {
}
/**
* @hidden
* https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseClass/README.md
*/
@Plugin({
plugin: 'cordova-plugin-googlemaps',
pluginName: 'GoogleMaps',
pluginRef: 'plugin.google.maps.BaseClass',
repo: ''
})
export class BaseClass {
protected _objectInstance: any;
/**
* Adds an event listener.
*
* @return {Observable<any>}
*/
@CordovaInstance({
destruct: true,
observable: true,
clearFunction: 'removeEventListener',
clearWithArgs: true
})
addEventListener(eventName: string): Observable<any> { return; }
/**
* Adds an event listener that works once.
*
* @return {Promise<any>}
*/
@CordovaInstance({ destruct: true })
addListenerOnce(eventName: string): Promise<any> { return; }
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any, noNotify?: boolean): void { }
/**
* Bind a key to another object
* @param key {string}
* @param target {any}
* @param targetKey? {string}
* @param noNotify? {boolean}
*/
@CordovaInstance({ sync: true })
bindTo(key: string, target: any, targetKey?: string, noNotify?: boolean): void { }
/**
* Listen to a map event.
*
* @return {Observable<any>}
*/
@CordovaInstance({
observable: true,
destruct: true,
clearFunction: 'off',
clearWithArgs: true
})
on(eventName: string): Observable<any> { return; }
/**
* Listen to a map event only once.
*
* @return {Promise<any>}
*/
@CordovaInstance({ destruct: true })
one(eventName: string): Promise<any> { return; };
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
/**
* Dispatch event.
*/
@CordovaInstance({ sync: true })
trigger(eventName: string, ...parameters: any[]): void {}
}
/**
* @hidden
* https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseArrayClass/README.md
@@ -540,29 +781,17 @@ export class GoogleMaps extends IonicNativePlugin {
pluginRef: 'plugin.google.maps.BaseArrayClass',
repo: ''
})
export class BaseArrayClass<T> extends IonicNativePlugin {
private _objectInstance: any;
export class BaseArrayClass<T> extends BaseClass {
constructor(initialData: T[]) {
constructor(initialData?: T[] | any) {
super();
if (checkAvailability(BaseArrayClass.getPluginRef(), null, BaseArrayClass.getPluginName()) === true) {
this._objectInstance = new (BaseArrayClass.getPlugin())(initialData);
if (initialData instanceof GoogleMaps.getPlugin().BaseArrayClass) {
this._objectInstance = initialData;
} else {
this._objectInstance = GoogleMaps.getPlugin().BaseArrayClass(initialData);
}
}
/**
* Add an event listener
* @param event {string} name of the event. Can be `insert_at`, `remove_at`, `set_at`, or `finish`.
* @return {Observable<any>} returns an Observable
*/
@InstanceCheck({ observable: true })
on(event: 'insert_at' | 'remove_at' | 'set_at' | 'finish') {
return new Observable<any>((observer: Observer<any>) => {
this._objectInstance.on(event, observer.next.bind(observer));
return () => this._objectInstance.off(event, observer.next.bind(observer));
});
}
/**
* Removes all elements from the array.
* @param noNotify? {boolean} Set true to prevent remove_at events.
@@ -683,91 +912,6 @@ export class BaseArrayClass<T> extends IonicNativePlugin {
setAt(index: number, element: T, noNotify?: boolean): void {}
}
/**
* @hidden
* https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseClass/README.md
*/
export class BaseClass {
protected _objectInstance: any;
/**
* Adds an event listener.
*
* @return {Observable<any>}
*/
@InstanceCheck()
addEventListener(eventName: string): Observable<any> {
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
* Adds an event listener that works once.
*
* @return {Promise<any>}
*/
@InstanceCheck()
addListenerOnce(eventName: string): Promise<any> {
return new Promise<any>(resolve => this._objectInstance.addListenerOnce(eventName, resolve));
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Bind a key to another object
* @param key {string}
* @param target {any}
* @param targetKey? {string}
* @param noNotify? {boolean}
*/
@CordovaInstance({ sync: true })
bindTo(key: string, target: any, targetKey: string, noNotify: boolean): void { }
/**
* Listen to a map event.
*
* @return {Observable<any>}
*/
@InstanceCheck({ observable: true })
on(eventName: string): Observable<any> {
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
* Listen to a map event only once.
*
* @return {Promise<any>}
*/
@InstanceCheck()
one(eventName: string): Promise<any> {
return new Promise<any>(resolve => this._objectInstance.one(eventName, resolve));
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
/**
* Dispatch event.
*/
@CordovaInstance({ sync: true })
trigger(eventName: string, ...parameters: any[]): void {}
}
/**
* @hidden
* https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Circle/README.md
@@ -954,10 +1098,46 @@ export class Geocoder {
/**
* Converts position to address and vice versa
* @param {GeocoderRequest} request Request object with either an address or a position
* @return {Promise<GeocoderResult | BaseArrayClass<GeocoderResult>>}
* @return {Promise<GeocoderResult[] | BaseArrayClass<GeocoderResult>>}
*/
@Cordova()
geocode(request: GeocoderRequest): Promise<GeocoderResult | BaseArrayClass<GeocoderResult>> { return; }
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | BaseArrayClass<GeocoderResult>> {
if (request.address instanceof Array || Array.isArray(request.address) ||
request.position instanceof Array || Array.isArray(request.position)) {
// -------------------------
// Geocoder.geocode({
// address: [
// "Kyoto, Japan",
// "Tokyo, Japan"
// ]
// })
// -------------------------
return new Promise<BaseArrayClass<GeocoderResult>>((resolve, reject) => {
GoogleMaps.getPlugin().Geocoder.geocode(request, (mvcArray: any) => {
if (mvcArray) {
resolve(new BaseArrayClass(mvcArray));
} else {
reject();
}
});
});
} else {
// -------------------------
// Geocoder.geocode({
// address: "Kyoto, Japan"
// })
// -------------------------
return new Promise<GeocoderResult[]>((resolve, reject) => {
GoogleMaps.getPlugin().Geocoder.geocode(request, (results: GeocoderResult[]) => {
if (results) {
resolve(results);
} else {
reject();
}
});
});
}
}
}
/**
@@ -1094,7 +1274,7 @@ export class GoogleMap extends BaseClass {
* @param domNode
*/
@CordovaInstance({ sync: true })
setDiv(domNode: HTMLElement): void { }
setDiv(domNode?: HTMLElement): void { }
/**
* Returns the map HTML element
@@ -1115,7 +1295,7 @@ export class GoogleMap extends BaseClass {
* @return {Promise<any>}
*/
@CordovaInstance()
animateCamera(animateCameraOptions: AnimateCameraOptions): Promise<any> { return; }
animateCamera(cameraPosition: CameraPosition<any>): Promise<any> { return; }
/**
* Zooming in the camera with animation
@@ -1136,7 +1316,7 @@ export class GoogleMap extends BaseClass {
* @return {Promise<any>}
*/
@CordovaInstance()
moveCamera(cameraPosition: CameraPosition): Promise<any> { return; }
moveCamera(cameraPosition: CameraPosition<any>): Promise<any> { return; }
/**
* Zooming in the camera without animation
@@ -1157,14 +1337,14 @@ export class GoogleMap extends BaseClass {
* @return {CameraPosition}
*/
@CordovaInstance({ sync: true })
getCameraPosition(): CameraPosition { return; }
getCameraPosition(): CameraPosition<ILatLng> { return; }
/**
* Get the current camera target position
* @return {Promise<CameraPosition>}
*/
@CordovaInstance()
getCameraTarget(): Promise<CameraPosition> { return; }
@CordovaInstance({ sync: true })
getCameraTarget(): ILatLng { return; }
/**
* Get the current camera zoom level
@@ -1254,7 +1434,7 @@ export class GoogleMap extends BaseClass {
* Remove all overlays, such as marker
* @return {Promise<any>}
*/
@CordovaInstance({ sync: true })
@CordovaInstance()
clear(): Promise<any> { return; }
/**
@@ -1262,7 +1442,7 @@ export class GoogleMap extends BaseClass {
* @return {Promise<any>}
*/
@CordovaInstance()
fromLatLngToPoint(latLng: ILatLng): Promise<any> { return; }
fromLatLngToPoint(latLng: ILatLng): Promise<any[]> { return; }
/**
* Convert the unit from the pixels from the left/top to the LatLng
@@ -1354,6 +1534,19 @@ export class GoogleMap extends BaseClass {
});
}
@InstanceCheck()
addMarkerCluster(options: MarkerClusterOptions): Promise<MarkerCluster | any> {
return new Promise<MarkerCluster>((resolve, reject) => {
this._objectInstance.addMarkerCluster(options, (markerCluster: any) => {
if (markerCluster) {
resolve(new MarkerCluster(this, markerCluster));
} else {
reject();
}
});
});
}
/**
* Adds a circle
* @return {Promise<Circle | any>}
@@ -1580,13 +1773,20 @@ export class GroundOverlay extends BaseClass {
/**
* @hidden
*/
export class HtmlInfoWindow extends BaseClass {
@Plugin({
plugin: 'cordova-plugin-googlemaps',
pluginName: 'GoogleMaps',
pluginRef: 'plugin.google.maps.HtmlInfoWindow',
repo: ''
})
export class HtmlInfoWindow<T> extends IonicNativePlugin {
private _objectInstance: any;
constructor() {
super();
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) {
this._objectInstance = new (GoogleMaps.getPlugin()).HtmlInfoWindow();
}
super();
if (checkAvailability(HtmlInfoWindow.getPluginRef(), null, HtmlInfoWindow.getPluginName()) === true) {
this._objectInstance = new (HtmlInfoWindow.getPlugin())();
}
}
/**
@@ -1618,85 +1818,6 @@ export class HtmlInfoWindow extends BaseClass {
}
/**
* @hidden
*/
export class LatLng implements ILatLng {
lat: number;
lng: number;
constructor(lat: number, lng: number) {
this.lat = lat;
this.lng = lng;
}
equals(other: ILatLng): boolean {
return this.lat === other.lat && this.lng === other.lng;
}
toString(): string {
return this.lat + ',' + this.lng;
}
toUrlValue(precision?: number): string {
precision = precision || 6;
return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
}
}
/**
* @hidden
*/
export class LatLngBounds {
private _objectInstance: any;
@InstanceProperty northeast: LatLng;
@InstanceProperty southwest: LatLng;
@InstanceProperty type: string;
constructor(southwestOrArrayOfLatLng: LatLng | LatLng[], northeast?: LatLng) {
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
this._objectInstance = new (GoogleMaps.getPlugin()).LatLngBounds(args);
}
/**
* Converts to string
* @return {string}
*/
@CordovaInstance({ sync: true })
toString(): string { return; }
/**
* Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box.
* @param precision {number}
* @return {string}
*/
@CordovaInstance({ sync: true })
toUrlValue(precision?: number): string { return; }
/**
* Extends this bounds to contain the given point.
* @param LatLng {ILatLng}
*/
@CordovaInstance({ sync: true })
extend(LatLng: ILatLng): void {}
/**
* Returns true if the given lat/lng is in this bounds.
* @param LatLng {ILatLng}
*/
@CordovaInstance({ sync: true })
contains(LatLng: ILatLng): boolean { return; }
/**
* Computes the center of this LatLngBounds
* @return {LatLng}
*/
@CordovaInstance({ sync: true })
getCenter(): LatLng { return; }
}
/**
* @hidden
@@ -1711,6 +1832,13 @@ export class Marker extends BaseClass {
this._objectInstance = _objectInstance;
}
/**
* Return the ID of instance.
* @return {string}
*/
@CordovaInstance({ sync: true })
getId(): number { return; }
/**
* Return the map instance.
* @return {GoogleMap}
@@ -1906,6 +2034,30 @@ export class Marker extends BaseClass {
}
/**
* @hidden
*/
export class MarkerCluster extends BaseClass {
private _map: GoogleMap;
constructor(_map: GoogleMap, _objectInstance: any) {
super();
this._map = _map;
this._objectInstance = _objectInstance;
}
@CordovaInstance({ sync: true })
addMarker(marker: MarkerOptions): void {}
@CordovaInstance({ sync: true })
addMarkers(markers: MarkerOptions[]): void {}
@CordovaInstance({ sync: true })
remove(): void {}
}
/**
* @hidden
*/
+61 -3
View File
@@ -59,9 +59,9 @@ export interface HTTPResponse {
*/
@Plugin({
pluginName: 'HTTP',
plugin: 'cordova-plugin-http',
plugin: 'cordova-plugin-advanced-http',
pluginRef: 'cordovaHTTP',
repo: 'https://github.com/wymsee/cordova-HTTP',
repo: 'https://github.com/silkimen/cordova-plugin-advanced-http',
platforms: ['Android', 'iOS']
})
@Injectable()
@@ -92,6 +92,34 @@ export class HTTP extends IonicNativePlugin {
@Cordova({ sync: true })
setHeader(header: string, value: string): void { }
/**
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
* @param serializer {string} The name of the serializer. Can be urlencoded or json
*/
@Cordova({ sync: true })
setDataSerializer(serializer: string): void { }
/**
* Clear all cookies
*/
@Cordova({ sync: true })
clearCookies(): void { }
/**
* Remove cookies
* @param url {string}
* @param cb
*/
@Cordova({ sync: true })
removeCookies(url: string, cb: () => void): void { }
/**
* Set request timeout
* @param timeout {number} The timeout in seconds. Default 60
*/
@Cordova({ sync: true })
setRequestTimeout(timeout: number): void { }
/**
* Enable or disable SSL Pinning. This defaults to false.
*
@@ -131,7 +159,7 @@ export class HTTP extends IonicNativePlugin {
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
* Make a GET request
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
@@ -140,6 +168,36 @@ export class HTTP extends IonicNativePlugin {
@Cordova()
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
* Make a PUT request
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
put(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/**
* Make a DELETE request
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
* Make a HEAD request
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
* @param url {string} The url to send the request to
@@ -0,0 +1,88 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Keychain Touch Id
* @description
* A cordova plugin adding the iOS TouchID / Android fingerprint to your
* app and allowing you to store a password securely in the device keychain.
*
* @usage
* ```typescript
* import { KeychainTouchId } from '@ionic-native/keychain-touch-id';
*
*
* constructor(private keychainTouchId: KeychainTouchId) { }
*
* ...
*
*
* this.keychainTouchId.isAvailable()
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'KeychainTouchId',
plugin: 'cordova-plugin-keychain-touch-id',
pluginRef: 'plugins.touchid',
repo: 'https://github.com/sjhoeksma/cordova-plugin-keychain-touch-id',
platforms: ['Android', 'iOS']
})
@Injectable()
export class KeychainTouchId extends IonicNativePlugin {
/**
* Check if Touch ID / Fingerprint is supported by the device
* @return {Promise<any>} Returns a promise that resolves when there is hardware support
*/
@Cordova()
isAvailable(): Promise<any> {
return;
}
/**
* Encrypts and Saves a password under the key in the device keychain, which can be retrieved after
* successful authentication using fingerprint
* @param key {string} the key you want to store
* @param password {string} the password you want to encrypt and store
* @return {Promise<any>} Returns a promise that resolves when there is a result
*/
@Cordova()
save(key: string, password: string): Promise<any> { return; }
/**
* Opens the fingerprint dialog, for the given key, showing an additional message. Promise will resolve
* with the password stored in keychain or will resolve an error code, where -1 indicated not available.
* @param key {string} the key you want to retrieve from keychain
* @param message {string} a message to the user
* @return {Promise<any>} Returns a promise that resolves when the key value is successfully retrieved or an error
*/
@Cordova()
verify(key: string, message: string): Promise<any> { return; }
/**
* Checks if there is a password stored within the keychain for the given key.
* @param key {string} the key you want to check from keychain
* @return {Promise<any>} Returns a promise that resolves with success if the key is available or failure if key is not.
*/
@Cordova()
has(key: string): Promise<any> { return; }
/**
* Deletes the password stored under given key from the keychain.
* @param key {string} the key you want to delete from keychain
* @return {Promise<any>} Returns a promise that resolves with success if the key is deleted or failure if key is not
*/
@Cordova()
delete(key: string): Promise<any> { return; }
/**
* Sets the language of the fingerprint dialog
* @param locale {string} locale subtag from [this list](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).
*/
@Cordova()
setLocale(locale: string): void {}
}
@@ -324,5 +324,15 @@ export class LocalNotifications extends IonicNativePlugin {
})
on(eventName: string, callback: any): void { }
/**
* Removes a callback of a specific event
* @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall
* @param callback Call back function. All events return notification and state parameter. clear and clearall return state parameter only.
*/
@Cordova({
sync: true
})
un(eventName: string, callback: any): void { }
}
+2 -2
View File
@@ -137,7 +137,7 @@ export class AuthenticationContext {
@CordovaInstance({
otherPromise: true
})
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId: string, extraQueryParameters?: any): Promise<AuthenticationResult> { return; }
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any): Promise<AuthenticationResult> { return; }
/**
* Acquires token WITHOUT using interactive flow. It checks the cache to return existing result
@@ -152,6 +152,6 @@ export class AuthenticationContext {
@CordovaInstance({
otherPromise: true
})
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId: string): Promise<AuthenticationResult> { return; }
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId?: string): Promise<AuthenticationResult> { return; }
}
@@ -15,7 +15,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
* ...
*
* this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
* .then((result: NativeGeocoderReverseResult) => console.log('The address is ' + result.street + ' in ' + result.countryCode))
* .then((result: NativeGeocoderReverseResult) => console.log(JSON.stringify(result)))
* .catch((error: any) => console.log(error));
*
* this.nativeGeocoder.forwardGeocode('Berlin')
@@ -40,7 +40,7 @@ export class NativeGeocoder extends IonicNativePlugin {
* Reverse geocode a given latitude and longitude to find location address
* @param latitude {number} The latitude
* @param longitude {number} The longitude
* @return {Promise<any>}
* @return {Promise<NativeGeocoderReverseResult>}
*/
@Cordova({
callbackOrder: 'reverse'
@@ -50,48 +50,59 @@ export class NativeGeocoder extends IonicNativePlugin {
/**
* Forward geocode a given address to find coordinates
* @param addressString {string} The address to be geocoded
* @return {Promise<any>}
* @return {Promise<NativeGeocoderForwardResult>}
*/
@Cordova({
callbackOrder: 'reverse'
})
forwardGeocode(addressString: string): Promise<NativeGeocoderForwardResult> { return; }
}
/**
* Encapsulates format information about a reverse geocoding result.
* more Info:
* - https://developer.apple.com/documentation/corelocation/clplacemark
* - https://developer.android.com/reference/android/location/Address.html
*/
export interface NativeGeocoderReverseResult {
/**
* The street.
* The country code.
*/
street: string;
/**
* The house number.
*/
houseNumber: string;
/**
* The postal code.
*/
postalCode: string;
/**
* The city.
*/
city: string;
/**
* The district.
*/
district: string;
countryCode: string;
/**
* The country name.
*/
countryName: string;
/**
* The country code.
* The postal code.
*/
countryCode: string;
postalCode: string;
/**
* The administrativeArea.
*/
administrativeArea: string;
/**
* The subAdministrativeArea.
*/
subAdministrativeArea: string;
/**
* The locality.
*/
locality: string;
/**
* The subLocality.
*/
subLocality: string;
/**
* The thoroughfare.
*/
thoroughfare: string;
/**
* The subThoroughfare.
*/
subThoroughfare: string;
}
/**
* Encapsulates format information about a forward geocoding result.
*/
+11 -2
View File
@@ -23,8 +23,17 @@ declare let window: any;
*
* ...
*
* let message = this.ndef.textRecord('Hello world');
* this.nfc.share([message]).then(onSuccess).catch(onError);
* this.nfc.addNdefListener(() => {
* console.log('successfully attached ndef listener');
* }, (err) => {
* console.log('error attaching ndef listener', err);
* }).subscribe((event) => {
* console.log('received ndef message. the tag contains: ', event.tag);
* console.log('decoded tag id', this.nfc.bytesToHexString(event.tag.id));
*
* let message = this.ndef.textRecord('Hello world');
* this.nfc.share([message]).then(onSuccess).catch(onError);
* });
*
* ```
*/
@@ -204,6 +204,12 @@ export class PayPalPayment {
*/
items: Array<PayPalItem>;
/**
* Optional payee email, if your app is paying a third-party merchant.
* The payee's email. It must be a valid PayPal email address.
*/
payeeEmail: string;
/**
* Optional customer shipping address, if your app wishes to provide this to the SDK.
*/
@@ -31,8 +31,8 @@ import { Injectable } from '@angular/core';
* console.log(libraryItem.albumIds); // array of ids of appropriate AlbumItem, only of includeAlbumsData was used
* });
* },
* error: err => {},
* complete: () => { console.log('could not get photos'); }
* error: err => { console.log('could not get photos'); },
* complete: () => { console.log('done getting photos'); }
* });
* })
* .catch(err => console.log('permissions weren\'t granted'));
+21 -2
View File
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaInstance, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window: any;
declare const window: any;
export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error;
@@ -188,10 +188,25 @@ export interface AndroidPushOptions {
topics?: string[];
}
export interface BrowserPushOptions {
/**
* Optional. Your GCM API key if you are using VAPID keys.
*/
applicationServerKey?: string;
/**
* URL for the push server you want to use.
* Default: http://push.api.phonegap.com/v1/push Optional.
*/
pushServiceURL?: string;
}
export interface PushOptions {
ios?: IOSPushOptions;
android?: AndroidPushOptions;
windows?: any;
browser?: BrowserPushOptions;
}
export type PushEvent = 'registration' | 'error' | 'notification';
@@ -237,7 +252,10 @@ export type PushEvent = 'registration' | 'error' | 'notification';
* badge: true,
* sound: 'false'
* },
* windows: {}
* windows: {},
* browser: {
* pushServiceURL: 'http://push.api.phonegap.com/v1/push'
* }
* };
*
* const pushObject: PushObject = this.push.init(options);
@@ -257,6 +275,7 @@ export type PushEvent = 'registration' | 'error' | 'notification';
* NotificationEventAdditionalData
* IOSPushOptions
* AndroidPushOptions
* BrowserPushOptions
* PushOptions
*/
@Plugin({
@@ -38,7 +38,7 @@ export interface SafariViewControllerOptions {
* enterReaderModeIfAvailable: true,
* tintColor: '#ff0000'
* })
* .then((result: any) => {
* .subscribe((result: any) => {
* if(result.event === 'opened') console.log('Opened');
* else if(result.event === 'loaded') console.log('Loaded');
* else if(result.event === 'closed') console.log('Closed');
+13 -1
View File
@@ -12,6 +12,12 @@ export interface SerialPermissionOptions {
export interface SerialOpenOptions {
baudRate: number;
dataBits: number;
stopBits: number;
parity: number;
dtr: boolean;
rts: boolean;
sleepOnPause: boolean;
}
/**
@@ -29,7 +35,13 @@ export interface SerialOpenOptions {
*
* this.serial.requestPermission().then(() => {
* this.serial.open({
* baudRate: 9800
* baudRate: 9800,
* dataBits: 4,
* stopBits: 1,
* parity: 0,
* dtr: true,
* rts: true,
* sleepOnPause: false
* }).then(() => {
* console.log('Serial connection opened');
* });
@@ -29,7 +29,7 @@ export interface SpinnerDialogIOSOptions {
@Plugin({
pluginName: 'SpinnerDialog',
plugin: 'cordova-plugin-native-spinner',
pluginRef: 'window.plugins.spinnerDialog',
pluginRef: 'SpinnerDialog',
repo: 'https://github.com/greybax/cordova-plugin-native-spinner',
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows']
})
@@ -20,6 +20,10 @@ export interface SQLiteDatabaseConfig {
* support opening pre-filled databases with https://github.com/litehelpers/cordova-sqlite-ext
*/
createFromLocation?: number;
/**
* support encrypted databases with https://github.com/litehelpers/Cordova-sqlcipher-adapter
*/
key?: string;
}
/**
@@ -11,7 +11,7 @@ export interface VideoOptions {
*/
volume?: number;
/**
* There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
* There are two options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
* These strings are the only ones which can be passed as option.
*/
scalingMode?: number;