mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78fcdc8d80 | ||
|
|
53f7056b16 | ||
|
|
b7701cdb16 | ||
|
|
94a4519f2b | ||
|
|
6fe52b610b | ||
|
|
434a6c8ad3 | ||
|
|
97489ba573 | ||
|
|
f525a25b49 | ||
|
|
add49e8b4d | ||
|
|
4ab87d8abb | ||
|
|
69ff7afb48 | ||
|
|
62a30c7d8f | ||
|
|
dc37d8f71c | ||
|
|
8864d1360a | ||
|
|
613141998a | ||
|
|
c2fbb4fb64 | ||
|
|
f0cf86076c | ||
|
|
a03afcf0fa | ||
|
|
3abe0bb97d | ||
|
|
a5b4632ceb | ||
|
|
1c78f77c0f | ||
|
|
cb7d3ef3e0 | ||
|
|
5e83a09056 | ||
|
|
b85393de89 | ||
|
|
68c535fd79 | ||
|
|
1c09ee1fbc | ||
|
|
8b921165bb | ||
|
|
0c837de499 | ||
|
|
a44500d206 | ||
|
|
e063613c8c | ||
|
|
416071a5a1 | ||
|
|
93fdb7eabb | ||
|
|
466437a683 | ||
|
|
a34723b53c | ||
|
|
b9bd5100a2 | ||
|
|
51bafccf38 | ||
|
|
c3127d35bb | ||
|
|
1322c1b089 | ||
|
|
9bf7895386 | ||
|
|
538dcb98eb | ||
|
|
3da0efe38e | ||
|
|
b983de2145 | ||
|
|
9f98f8ef46 | ||
|
|
3e2964b385 | ||
|
|
77ab2c21da | ||
|
|
94025a7fd2 | ||
|
|
8c021bcaa0 | ||
|
|
da7a3707fa | ||
|
|
cb293639bc |
89
CHANGELOG.md
89
CHANGELOG.md
@@ -1,3 +1,92 @@
|
||||
<a name="2.5.1"></a>
|
||||
## [2.5.1](https://github.com/driftyco/ionic-native/compare/v2.5.0...v2.5.1) (2017-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **pin-dialog:** add missing errorIndex ([b7701cd](https://github.com/driftyco/ionic-native/commit/b7701cd))
|
||||
|
||||
|
||||
|
||||
<a name="2.5.0"></a>
|
||||
# [2.5.0](https://github.com/driftyco/ionic-native/compare/v2.4.1...v2.5.0) (2017-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file-transfer:** fix return type of upload method ([a5b4632](https://github.com/driftyco/ionic-native/commit/a5b4632)), closes [#1002](https://github.com/driftyco/ionic-native/issues/1002)
|
||||
* **pinterest:** fix PinterestPin interface ([a03afcf](https://github.com/driftyco/ionic-native/commit/a03afcf))
|
||||
* **safari-view-controller:** fix issue caused by calling show without options ([dc37d8f](https://github.com/driftyco/ionic-native/commit/dc37d8f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **background-geolocation:** add missing properties for Android ([f0cf860](https://github.com/driftyco/ionic-native/commit/f0cf860))
|
||||
* **barcodescanner:** add option disableSuccessBeep ([#1035](https://github.com/driftyco/ionic-native/issues/1035)) ([97489ba](https://github.com/driftyco/ionic-native/commit/97489ba))
|
||||
* **inappbrowser:** add hide function ([#1018](https://github.com/driftyco/ionic-native/issues/1018)) ([4ab87d8](https://github.com/driftyco/ionic-native/commit/4ab87d8))
|
||||
|
||||
|
||||
|
||||
<a name="2.4.1"></a>
|
||||
## [2.4.1](https://github.com/driftyco/ionic-native/compare/v2.4.0...v2.4.1) (2017-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **screen-orientation:** lockOrientation returns a promise ([1c09ee1](https://github.com/driftyco/ionic-native/commit/1c09ee1)), closes [#939](https://github.com/driftyco/ionic-native/issues/939)
|
||||
|
||||
|
||||
|
||||
<a name="2.4.0"></a>
|
||||
# [2.4.0](https://github.com/driftyco/ionic-native/compare/v2.3.3...v2.4.0) (2017-01-24)
|
||||
|
||||
|
||||
|
||||
<a name="2.3.3"></a>
|
||||
## [2.3.3](https://github.com/driftyco/ionic-native/compare/v2.3.2...v2.3.3) (2017-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-maps:** fix event listeners ([416071a](https://github.com/driftyco/ionic-native/commit/416071a)), closes [#999](https://github.com/driftyco/ionic-native/issues/999)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **pinterest:** add pinterest plugin ([466437a](https://github.com/driftyco/ionic-native/commit/466437a))
|
||||
|
||||
|
||||
|
||||
<a name="2.3.2"></a>
|
||||
## [2.3.2](https://github.com/driftyco/ionic-native/compare/v2.3.1...v2.3.2) (2017-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** fix GoogleMapsLaLngBounds ([c3127d3](https://github.com/driftyco/ionic-native/commit/c3127d3)), closes [#972](https://github.com/driftyco/ionic-native/issues/972)
|
||||
|
||||
|
||||
|
||||
<a name="2.3.1"></a>
|
||||
## [2.3.1](https://github.com/driftyco/ionic-native/compare/v2.3.0...v2.3.1) (2017-01-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add clearAllNotifications() ([8c021bc](https://github.com/driftyco/ionic-native/commit/8c021bc))
|
||||
* **battery-status:** add missing pluginRef ([3da0efe](https://github.com/driftyco/ionic-native/commit/3da0efe))
|
||||
* **core:** fix exception in CordovaProperty ([#998](https://github.com/driftyco/ionic-native/issues/998)) ([cb29363](https://github.com/driftyco/ionic-native/commit/cb29363)), closes [#992](https://github.com/driftyco/ionic-native/issues/992)
|
||||
* **core:** fix plugin check ([da7a370](https://github.com/driftyco/ionic-native/commit/da7a370))
|
||||
* **plugin:** adds subscribe() and unsubscribe() ([94025a7](https://github.com/driftyco/ionic-native/commit/94025a7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **core:** add PluginConfig interface ([b983de2](https://github.com/driftyco/ionic-native/commit/b983de2)), closes [#996](https://github.com/driftyco/ionic-native/issues/996)
|
||||
* **google-maps:** add base class functions ([#993](https://github.com/driftyco/ionic-native/issues/993)) ([9f98f8e](https://github.com/driftyco/ionic-native/commit/9f98f8e))
|
||||
|
||||
|
||||
|
||||
<a name="2.3.0"></a>
|
||||
# [2.3.0](https://github.com/driftyco/ionic-native/compare/v2.2.17...v2.3.0) (2017-01-20)
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Let us know or submit a PR! Take a look at [the Developer Guide](https://github.
|
||||
|
||||
# Credits
|
||||
|
||||
Ibrahim Hadeed - [@ihadeed](http://github.com/ihadeed)
|
||||
Ibby Hadeed - [@ihadeed](http://github.com/ihadeed)
|
||||
|
||||
Tim Lancina - [@timlancina](http://twitter.com/timlancina)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.3.0",
|
||||
"version": "2.5.1",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/es5/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
||||
@@ -91,6 +91,7 @@ import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||
import { PayPal } from './plugins/pay-pal';
|
||||
import { PinDialog } from './plugins/pin-dialog';
|
||||
import { Pinterest } from './plugins/pinterest';
|
||||
import { PowerManagement } from './plugins/power-management';
|
||||
import { Printer } from './plugins/printer';
|
||||
import { Push } from './plugins/push';
|
||||
@@ -211,6 +212,7 @@ export * from './plugins/onesignal';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/photo-viewer';
|
||||
export * from './plugins/pin-dialog';
|
||||
export * from './plugins/pinterest';
|
||||
export * from './plugins/plugin';
|
||||
export * from './plugins/power-management';
|
||||
export * from './plugins/printer';
|
||||
@@ -336,6 +338,7 @@ window['IonicNative'] = {
|
||||
PhotoViewer,
|
||||
ScreenOrientation,
|
||||
PinDialog,
|
||||
Pinterest,
|
||||
PowerManagement,
|
||||
Rollbar,
|
||||
SafariViewController,
|
||||
|
||||
@@ -126,10 +126,14 @@ export interface BackgroundGeolocationConfig {
|
||||
|
||||
/**
|
||||
* ANDROID, WP8 ONLY
|
||||
* The minimum time interval between location updates in seconds.
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_DISTANCE_FILTER_PROVIDER:
|
||||
* The minimum time interval between location updates in milliseconds.
|
||||
* @see Android docs (http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent))
|
||||
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
|
||||
* for more information
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER:
|
||||
* Rate in milliseconds at which your app prefers to receive location updates.
|
||||
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getInterval())
|
||||
*/
|
||||
interval?: number;
|
||||
|
||||
@@ -225,6 +229,28 @@ export interface BackgroundGeolocationConfig {
|
||||
* Defaults to 10000
|
||||
*/
|
||||
maxLocations?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* Fastest rate in milliseconds at which your app can handle location updates.
|
||||
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval())
|
||||
*/
|
||||
fastestInterval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life.
|
||||
*/
|
||||
activitiesInterval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* stop() is forced, when the STILL activity is detected (default is true)
|
||||
*/
|
||||
stopOnStillActivity?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,11 @@ export interface BarcodeScannerOptions {
|
||||
*/
|
||||
disableAnimations?: boolean;
|
||||
|
||||
/**
|
||||
* Disable success beep. Supported on iOS only.
|
||||
*/
|
||||
disableSuccessBeep?: boolean;
|
||||
|
||||
/**
|
||||
* Prompt text. Supported on Android only.
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,7 @@ export interface BatteryStatusResponse {
|
||||
@Plugin({
|
||||
pluginName: 'BatteryStatus',
|
||||
plugin: 'cordova-plugin-battery-status',
|
||||
pluginRef: 'navigator.battery',
|
||||
repo: 'https://github.com/apache/cordova-plugin-battery-status',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
||||
})
|
||||
|
||||
@@ -173,6 +173,10 @@ export interface FileTransferError {
|
||||
* cd files
|
||||
* ls
|
||||
* ```
|
||||
*
|
||||
* To store files in a different/publicly accessible directory, please refer to the following link
|
||||
* https://github.com/apache/cordova-plugin-file#where-to-store-files
|
||||
*
|
||||
* @interfaces
|
||||
* FileUploadOptions
|
||||
* FileUploadResult
|
||||
@@ -223,7 +227,7 @@ export class Transfer {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult | FileTransferError> {
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ export class Geolocation {
|
||||
*
|
||||
* ```typescript
|
||||
* var subscription = Geolocation.watchPosition()
|
||||
* .filter((p) => p.code === undefined) //Filter Out Errors
|
||||
* .filter((p) => p.coords !== undefined) //Filter Out Errors
|
||||
* .subscribe(position => {
|
||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||
* });
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var plugin: any;
|
||||
|
||||
@@ -119,7 +120,7 @@ export class GoogleMap {
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
constructor(element: string|HTMLElement, options?: any) {
|
||||
constructor(element: string | HTMLElement, options?: any) {
|
||||
if (!!getPlugin('plugin.google.maps.Map')) {
|
||||
if (typeof element === 'string') {
|
||||
element = document.getElementById(<string>element);
|
||||
@@ -133,12 +134,50 @@ export class GoogleMap {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(event: any): Observable<any> {
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
@@ -147,7 +186,7 @@ export class GoogleMap {
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.on(event, observer.next.bind(observer));
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
@@ -158,15 +197,21 @@ export class GoogleMap {
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(event: any): Promise<any> {
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(event, resolve)
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setDebuggable(isDebuggable: boolean): void { }
|
||||
|
||||
@@ -576,12 +621,26 @@ export class GoogleMapsMarker {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -589,7 +648,7 @@ export class GoogleMapsMarker {
|
||||
* Gets a value
|
||||
* @param key
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
@CordovaInstance({ sync: true })
|
||||
get(key: string): any { return; }
|
||||
|
||||
/**
|
||||
@@ -597,9 +656,49 @@ export class GoogleMapsMarker {
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
@CordovaInstance({ sync: true })
|
||||
set(key: string, value: any): void { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
/**
|
||||
* Return true if the marker is visible
|
||||
*/
|
||||
@@ -797,15 +896,84 @@ export class GoogleMapsCircle {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getCenter(): GoogleMapsLatLng { return; }
|
||||
|
||||
@@ -867,15 +1035,84 @@ export interface GoogleMapsPolylineOptions {
|
||||
export class GoogleMapsPolyline {
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
|
||||
@@ -938,15 +1175,84 @@ export class GoogleMapsPolygon {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
|
||||
@@ -1011,6 +1317,84 @@ export class GoogleMapsTileOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
getVisible(): boolean { return; }
|
||||
|
||||
@@ -1062,6 +1446,84 @@ export class GoogleMapsGroundOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setBearing(bearing: number): void { }
|
||||
|
||||
@@ -1104,6 +1566,84 @@ export class GoogleMapsKmlOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener that works once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
addListenerOnce(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
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 { }
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
on(eventName: string): Observable<any> {
|
||||
if (!this._objectInstance) {
|
||||
return new Observable((observer) => {
|
||||
observer.error({ error: 'plugin_not_installed' });
|
||||
});
|
||||
}
|
||||
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.on(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
one(eventName: string): Promise<any> {
|
||||
if (!this._objectInstance) {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stored values
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
empty(): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void { }
|
||||
|
||||
@@ -1117,9 +1657,9 @@ export class GoogleMapsKmlOverlay {
|
||||
export class GoogleMapsLatLngBounds {
|
||||
private _objectInstance: any;
|
||||
|
||||
@InstanceProperty get northeast(): GoogleMapsLatLng { return; }
|
||||
@InstanceProperty get southwest(): GoogleMapsLatLng { return; }
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty northeast: GoogleMapsLatLng;
|
||||
@InstanceProperty southwest: GoogleMapsLatLng;
|
||||
@InstanceProperty type: string;
|
||||
|
||||
constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) {
|
||||
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Headerolor
|
||||
* @name HeaderColor
|
||||
* @description
|
||||
* Cordova plugin to change color of header in multitask view
|
||||
*
|
||||
@@ -13,7 +13,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'HeaderColor',
|
||||
pluginName: 'HeaderColor',
|
||||
plugin: 'cordova-plugin-headercolor',
|
||||
pluginRef: 'plugins.headerColor',
|
||||
repo: 'https://github.com/tomloprod/cordova-plugin-headercolor',
|
||||
|
||||
@@ -72,6 +72,13 @@ export class InAppBrowser {
|
||||
@CordovaInstance({sync: true})
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
|
||||
* if the InAppBrowser was already hidden.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
hide(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script {Object} Details of the script to run, specifying either a file or code key.
|
||||
|
||||
@@ -23,7 +23,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* NativeGeocoderForwardResult
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'NativeGeocoder',
|
||||
pluginName: 'NativeGeocoder',
|
||||
plugin: 'cordova-plugin-nativegeocoder',
|
||||
pluginRef: 'nativegeocoder',
|
||||
repo: 'https://github.com/sebastianbaar/cordova-plugin-nativegeocoder',
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'NavigationBar',
|
||||
pluginName: 'NavigationBar',
|
||||
plugin: 'cordova-plugin-navigationbar',
|
||||
pluginRef: 'navigationbar',
|
||||
repo: 'https://github.com/cranberrygame/cordova-plugin-navigationbar',
|
||||
|
||||
@@ -34,7 +34,8 @@ export class PinDialog {
|
||||
* @returns {Promise<{ buttonIndex: number, input1: string }>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1
|
||||
successIndex: 1,
|
||||
errorIndex: 4 // no error callback
|
||||
})
|
||||
static prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number, input1: string }> { return; }
|
||||
|
||||
|
||||
361
src/plugins/pinterest.ts
Normal file
361
src/plugins/pinterest.ts
Normal file
@@ -0,0 +1,361 @@
|
||||
import { Plugin, Cordova, CordovaProperty } from './plugin';
|
||||
|
||||
export interface PinterestUser {
|
||||
/**
|
||||
* The unique string of numbers and letters that identifies the user on Pinterest.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The user’s Pinterest username.
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* The user’s first name.
|
||||
*/
|
||||
first_name?: string;
|
||||
/**
|
||||
* The user’s last name.
|
||||
*/
|
||||
last_name?: string;
|
||||
/**
|
||||
* The text in the user’s “About you” section in their profile.
|
||||
*/
|
||||
bio?: string;
|
||||
/**
|
||||
* The date the user created their account in ISO 8601 format
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* The user’s stats, including how many Pins, follows, boards and likes they have.
|
||||
*/
|
||||
counts?: any;
|
||||
/**
|
||||
* The user’s profile image. The response returns the image’s URL, width and height.
|
||||
*/
|
||||
image?: any;
|
||||
}
|
||||
|
||||
export interface PinterestBoard {
|
||||
/**
|
||||
* The unique string of numbers and letters that identifies the board on Pinterest.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The name of the board.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The link to the board.
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* The user-entered description of the board.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The first and last name, ID and profile URL of the user who created the board.
|
||||
*/
|
||||
creator?: PinterestUser;
|
||||
/**
|
||||
* The date the user created the board.
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* The board’s stats, including how many Pins, followers, user's following and collaborators it has.
|
||||
*/
|
||||
counts?: any;
|
||||
/**
|
||||
* The user’s profile image. The response returns the image’s URL, width and height.
|
||||
*/
|
||||
image?: any;
|
||||
}
|
||||
|
||||
export interface PinterestPin {
|
||||
/**
|
||||
* The unique string of numbers and letters that identifies the Pin on Pinterest.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The URL of the webpage where the Pin was created.
|
||||
*/
|
||||
link?: string;
|
||||
/**
|
||||
* The URL of the Pin on Pinterest.
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* The first and last name, ID and profile URL of the user who created the board.
|
||||
*/
|
||||
creator?: PinterestUser;
|
||||
/**
|
||||
* The board that the Pin is on.
|
||||
*/
|
||||
board?: PinterestBoard;
|
||||
/**
|
||||
* The date the Pin was created.
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* The user-entered description of the Pin.
|
||||
*/
|
||||
note?: string;
|
||||
/**
|
||||
* The dominant color of the Pin’s image in hex code format.
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* The Pin’s stats, including the number of repins, comments and likes.
|
||||
*/
|
||||
counts?: any;
|
||||
/**
|
||||
* The media type of the Pin (image or video).
|
||||
*/
|
||||
media?: any;
|
||||
/**
|
||||
* The source data for videos, including the title, URL, provider, author name, author URL and provider name.
|
||||
*/
|
||||
attribution?: any;
|
||||
/**
|
||||
* The Pin’s image. The default response returns the image’s URL, width and height.
|
||||
*/
|
||||
image?: any;
|
||||
/**
|
||||
* Extra information about the Pin for Rich Pins. Includes the Pin type (e.g., article, recipe) and related information (e.g., ingredients, author).
|
||||
*/
|
||||
metadata?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Pinterest
|
||||
* @description
|
||||
* Cordova plugin for Pinterest
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from 'ionic-native';
|
||||
*
|
||||
* const scopes = [
|
||||
* Pinterest.SCOPES.READ_PUBLIC,
|
||||
* Pinterest.SCOPES.WRITE_PUBLIC,
|
||||
* Pinterest.SCOPES.READ_RELATIONSHIPS,
|
||||
* Pinterest.SCOPES.WRITE_RELATIONSHIPS
|
||||
* ];
|
||||
*
|
||||
* Pinterest.login(scopes)
|
||||
* .then(res => console.log('Logged in!', res))
|
||||
* .catch(err => console.error('Error loggin in', err));
|
||||
*
|
||||
* Pinterest.getMyPins()
|
||||
* .then((pins: Array<PinterestPin>) => console.log(pins))
|
||||
* .catch(err => console.error(err));
|
||||
*
|
||||
* Pinterest.getMe()
|
||||
* .then((user: PinterestUser) => console.log(user));
|
||||
*
|
||||
* Pinterest.getMyBoards()
|
||||
* .then((boards: Array<PinterestBoard>) => console.log(boards));
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* PinterestUser
|
||||
* PinterestBoard
|
||||
* PinterestPin
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Pinterest',
|
||||
plugin: 'cordova-plugin-pinterest',
|
||||
pluginRef: 'cordova.plugins.Pinterest',
|
||||
repo: 'https://github.com/zyramedia/cordova-plugin-pinterest',
|
||||
install: 'ionic plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Pinterest {
|
||||
|
||||
/**
|
||||
* Convenience constant for authentication scopes
|
||||
*/
|
||||
@CordovaProperty
|
||||
SCOPES: {
|
||||
READ_PUBLIC: string;
|
||||
WRITE_PUBLIC: string;
|
||||
READ_RELATIONSHIPS: string;
|
||||
WRITE_RELATIONSHIPS: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Logs the user in using their Pinterest account.
|
||||
* @param scopes {Array<string>} Array of scopes that you need access to. You can use Pinterest.SCOPES constant for convenience.
|
||||
* @returns {Promise<any>} The response object will contain the user's profile data, as well as the access token (if you need to use it elsewhere, example: send it to your server and perform actions on behalf of the user).
|
||||
*/
|
||||
@Cordova()
|
||||
static login(scopes: string[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Gets the authenticated user's profile
|
||||
* @param fields {string} Fields to retrieve, separated by commas. Defaults to all available fields.
|
||||
* @returns {Promise<PinterestUser>} Returns a promise that resolves with the user's object
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMe(fields?: string): Promise<PinterestUser> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestPin>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyPins(fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestBoard>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's likes.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestPin>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyLikes(fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's followers.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestUser>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyFollowers(fields?: string, limit?: number): Promise<Array<PinterestUser>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's followed boards.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestBoard>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyFollowedBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's followed interests.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyFollowedInterests(fields?: string, limit?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a user's profile.
|
||||
* @param username
|
||||
* @param fields
|
||||
* @returns {Promise<PinterestUser>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getUser(username: string, fields?: string): Promise<PinterestUser> { return; }
|
||||
|
||||
/**
|
||||
* Get a board's data.
|
||||
* @param boardId
|
||||
* @param fields
|
||||
* @returns {Promise<PinterestBoard>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getBoard(boardId: string, fields?: string): Promise<PinterestBoard> { return; }
|
||||
|
||||
/**
|
||||
* Get Pins of a specific board.
|
||||
* @param boardId {string} The ID of the board
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestPin>>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getBoardPins(boardId: string, fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
|
||||
|
||||
/**
|
||||
* Delete a board.
|
||||
* @param boardId {string} The ID of the board
|
||||
* @returns {Promise<PinterestUser>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteBoard(boardId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create a new board for the authenticated user.
|
||||
* @param name {string} Name of the board
|
||||
* @param desc {string} Optional description of the board
|
||||
* @returns {Promise<PinterestBoard>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static createBoard(name: string, desc?: string): Promise<PinterestBoard> { return; }
|
||||
|
||||
/**
|
||||
* Get a Pin by ID.
|
||||
* @param pinId {string} The ID of the Pin
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @returns {Promise<PinterestPin>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getPin(pinId: string, fields?: string): Promise<PinterestPin> { return; }
|
||||
|
||||
/**
|
||||
* Deletes a pin
|
||||
* @param pinId {string} The ID of the pin
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deletePin(pinId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Creates a Pin
|
||||
* @param note {string} Note/Description of the pin
|
||||
* @param boardId {string} Board ID to put the Pin under
|
||||
* @param imageUrl {string} URL of the image to share
|
||||
* @param link {string} Optional link to share
|
||||
* @returns {Promise<PinterestPin>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 4,
|
||||
errorIndex: 5
|
||||
})
|
||||
static createPin(note: string, boardId: string, imageUrl: string, link?: string): Promise<PinterestPin> { return; }
|
||||
|
||||
}
|
||||
@@ -1,9 +1,106 @@
|
||||
import { get } from '../util';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PluginConfig {
|
||||
/**
|
||||
* Plugin name, this should match the class name
|
||||
*/
|
||||
pluginName: string;
|
||||
/**
|
||||
* Plugin NPM package name
|
||||
*/
|
||||
plugin: string;
|
||||
/**
|
||||
* Plugin object reference
|
||||
*/
|
||||
pluginRef: string;
|
||||
/**
|
||||
* Github repository URL
|
||||
*/
|
||||
repo: string;
|
||||
/**
|
||||
* Custom install command
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface CordovaOptions {
|
||||
/**
|
||||
* Set to true if the wrapped method is a sync function
|
||||
*/
|
||||
sync?: boolean;
|
||||
/**
|
||||
* Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method takes.
|
||||
*/
|
||||
callbackOrder?: 'reverse';
|
||||
/**
|
||||
* Callback style
|
||||
*/
|
||||
callbackStyle?: 'node' | 'object';
|
||||
/**
|
||||
* Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
|
||||
*/
|
||||
successIndex?: number;
|
||||
/**
|
||||
* Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
|
||||
*/
|
||||
errorIndex?: number;
|
||||
/**
|
||||
* Success function property name. This must be set if callbackStyle is set to object.
|
||||
*/
|
||||
successName?: string;
|
||||
/**
|
||||
* Error function property name. This must be set if callbackStyle is set to object.
|
||||
*/
|
||||
errorName?: string;
|
||||
/**
|
||||
* Set to true to return an observable
|
||||
*/
|
||||
observable?: boolean;
|
||||
/**
|
||||
* If observable is set to true, this can be set to a different function name that will cancel the observable.
|
||||
*/
|
||||
clearFunction?: string;
|
||||
/**
|
||||
* This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function.
|
||||
*/
|
||||
clearWithArgs?: boolean;
|
||||
/**
|
||||
* Creates an observable that wraps a global event. Replaces document.addEventListener
|
||||
*/
|
||||
eventObservable?: boolean;
|
||||
/**
|
||||
* Event name, this must be set if eventObservable is set to true
|
||||
*/
|
||||
event?: string;
|
||||
/**
|
||||
* Element to attach the event listener to, this is optional, defaults to `window`
|
||||
*/
|
||||
element?: any;
|
||||
/**
|
||||
* Set to true if the wrapped method returns a promise
|
||||
*/
|
||||
otherPromise?: boolean;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param pluginRef
|
||||
@@ -245,14 +342,12 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
|
||||
/**
|
||||
* Wrap the event with an observable
|
||||
* @param event
|
||||
* @param event even name
|
||||
* @param element The element to attach the event listener to
|
||||
* @returns {Observable}
|
||||
*/
|
||||
function wrapEventObservable(event: string): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
window.addEventListener(event, observer.next.bind(observer), false);
|
||||
return () => window.removeEventListener(event, observer.next.bind(observer), false);
|
||||
});
|
||||
function wrapEventObservable(event: string, element: any = window): Observable<any> {
|
||||
return Observable.fromEvent(element, event);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +398,7 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts:
|
||||
* @param opts
|
||||
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
|
||||
*/
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
|
||||
return (...args) => {
|
||||
if (opts.sync) {
|
||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||
@@ -311,7 +406,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
} else if (opts.observable) {
|
||||
return wrapObservable(pluginObj, methodName, args, opts);
|
||||
} else if (opts.eventObservable && opts.event) {
|
||||
return wrapEventObservable(opts.event);
|
||||
return wrapEventObservable(opts.event, opts.element);
|
||||
} else if (opts.otherPromise) {
|
||||
return wrapOtherPromise(pluginObj, methodName, args, opts);
|
||||
} else {
|
||||
@@ -320,6 +415,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
@@ -339,7 +435,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function Plugin(config) {
|
||||
export function Plugin(config: PluginConfig) {
|
||||
return function(cls) {
|
||||
|
||||
// Add these fields to the class
|
||||
@@ -375,7 +471,7 @@ export function Plugin(config) {
|
||||
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
|
||||
* and the required plugin are installed.
|
||||
*/
|
||||
export function Cordova(opts: any = {}) {
|
||||
export function Cordova(opts: CordovaOptions = {}) {
|
||||
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
@@ -407,9 +503,9 @@ export function CordovaInstance(opts: any = {}) {
|
||||
* Before calling the original method, ensure Cordova and the plugin are installed.
|
||||
*/
|
||||
export function CordovaProperty(target: any, key: string) {
|
||||
const pluginInstance = getPlugin(target.pluginRef);
|
||||
const exists = () => {
|
||||
if (!pluginInstance || pluginInstance[key] === 'undefined') {
|
||||
let pluginInstance = getPlugin(target.pluginRef);
|
||||
if (!pluginInstance || typeof pluginInstance[key] === 'undefined') {
|
||||
pluginWarn(target, key);
|
||||
return false;
|
||||
}
|
||||
@@ -419,14 +515,14 @@ export function CordovaProperty(target: any, key: string) {
|
||||
Object.defineProperty(target, key, {
|
||||
get: () => {
|
||||
if (exists()) {
|
||||
return pluginInstance[key];
|
||||
return getPlugin(target.pluginRef)[key];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
set: (value) => {
|
||||
if (exists()) {
|
||||
pluginInstance[key] = value;
|
||||
getPlugin(target.pluginRef)[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,6 +110,25 @@ export interface PushNotification {
|
||||
unregister(successHandler: () => any, errorHandler?: () => any): void;
|
||||
|
||||
/**
|
||||
* The subscribe method is used when the application wants to subscribe a new topic to receive push notifications.
|
||||
* @param {string} topic: Topic to subscribe to.
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
*/
|
||||
subscribe(topic: string, successHandler: () => any, errorHandler?: () => any): void;
|
||||
|
||||
/**
|
||||
* The unsubscribe method is used when the application no longer wants to receive push notifications
|
||||
* from a specific topic but continue to receive other push messages.
|
||||
* @param {string} topic: Topic to subscribe to.
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
*/
|
||||
unsubscribe(topic: string, successHandler: () => any, errorHandler?: () => any): void;
|
||||
|
||||
/**
|
||||
* iOS & android only
|
||||
*
|
||||
* Set the badge count visible when the app is not running
|
||||
*
|
||||
* The count is an integer indicating what number should show up in the badge.
|
||||
@@ -121,6 +140,8 @@ export interface PushNotification {
|
||||
*/
|
||||
setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count?: number): void;
|
||||
/**
|
||||
* iOS only
|
||||
*
|
||||
* Get the current badge count visible when the app is not running
|
||||
* successHandler gets called with an integer which is the current badge count
|
||||
* @param successHandler
|
||||
@@ -130,6 +151,7 @@ export interface PushNotification {
|
||||
|
||||
/**
|
||||
* iOS only
|
||||
*
|
||||
* Tells the OS that you are done processing a background push notification.
|
||||
* successHandler gets called when background push processing is successfully completed.
|
||||
* @param successHandler
|
||||
@@ -137,6 +159,16 @@ export interface PushNotification {
|
||||
* @param id
|
||||
*/
|
||||
finish(successHandler: () => any, errorHandler: () => any, id?: string): void;
|
||||
|
||||
/**
|
||||
* iOS & android only
|
||||
*
|
||||
* Tells the OS to clear all notifications from the Notification Center.
|
||||
* successHandler gets called when the api successfully clears the notifications
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
*/
|
||||
clearAllNotifications(successHandler: () => any, errorHandler: () => any): void;
|
||||
}
|
||||
|
||||
export interface IOSPushOptions {
|
||||
|
||||
@@ -71,7 +71,10 @@ export class SafariViewController {
|
||||
* @param options {SafariViewControllerOptions} optional
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static show(options?: SafariViewControllerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,9 +49,10 @@ export class ScreenOrientation {
|
||||
* Lock the orientation to the passed value.
|
||||
* See below for accepted values
|
||||
* @param orientation {string} The orientation which should be locked. Accepted values see table below.
|
||||
* @returns {Promise<any>} returns a promise that resolves when the screen orientation is locked, and rejects when an error occurs.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static lockOrientation(orientation: string): void { }
|
||||
@Cordova({ otherPromise: true })
|
||||
static lockOrientation(orientation: string): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Unlock and allow all orientations.
|
||||
|
||||
@@ -21,9 +21,9 @@ import { Plugin, Cordova } from './plugin';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Stepcounter',
|
||||
plugin: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
plugin: 'https://github.com/Slidee/cordova-plugin-stepcounter',
|
||||
pluginRef: 'stepcounter',
|
||||
repo: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
repo: 'https://github.com/Slidee/cordova-plugin-stepcounter',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class Stepcounter {
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface StreamingAudioOptions {
|
||||
* orientation: 'landscape'
|
||||
* };
|
||||
*
|
||||
* StreamingMedia.('https://path/to/video/stream', options);
|
||||
* StreamingMedia.playVideo('https://path/to/video/stream', options);
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
|
||||
@@ -9,6 +9,7 @@ window.plugins = {
|
||||
};
|
||||
|
||||
const testPluginMeta = {
|
||||
pluginName: 'Test',
|
||||
plugin: 'cordova-plugin-test',
|
||||
pluginRef: 'plugins.test',
|
||||
repo: 'https://github.com/apache/cordova-plugin-test',
|
||||
|
||||
40
test/plugins/googlemap.spec.ts
Normal file
40
test/plugins/googlemap.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { GoogleMapsLatLngBounds, GoogleMapsLatLng } from '../../src/plugins/googlemap';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
class LatLngBounds {
|
||||
public southwest: GoogleMapsLatLng;
|
||||
public northeast: GoogleMapsLatLng;
|
||||
|
||||
constructor(latLngArray: GoogleMapsLatLng[]) {
|
||||
this.southwest = latLngArray[0];
|
||||
this.northeast = latLngArray[1];
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin = {
|
||||
google: {
|
||||
maps: {
|
||||
LatLngBounds
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
describe('GoogleMapsLatLngBounds', () => {
|
||||
|
||||
const southwest = new GoogleMapsLatLng(1,1);
|
||||
const northeast = new GoogleMapsLatLng(4,4);
|
||||
let object;
|
||||
|
||||
it('should create an object', () => {
|
||||
object = new GoogleMapsLatLngBounds([southwest, northeast]);
|
||||
expect(object).toBeDefined();
|
||||
});
|
||||
|
||||
it('northwest property should be defined', () => expect(object.northeast).toBeDefined());
|
||||
|
||||
it('southwest property should be defined', () => expect(object.southwest).toBeDefined());
|
||||
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user