mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
60
CHANGELOG.md
60
CHANGELOG.md
@@ -1,3 +1,63 @@
|
||||
<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.4.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,
|
||||
|
||||
@@ -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']
|
||||
})
|
||||
|
||||
@@ -119,7 +119,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 +133,55 @@ export class GoogleMap {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +190,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 +201,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,20 +625,39 @@ export class GoogleMapsMarker {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
addEventListener(event: any): Observable<any> {
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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})
|
||||
@CordovaInstance({ sync: true })
|
||||
get(key: string): any { return; }
|
||||
|
||||
/**
|
||||
@@ -597,9 +665,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 +905,89 @@ 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 new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 })
|
||||
getCenter(): GoogleMapsLatLng { return; }
|
||||
|
||||
@@ -867,15 +1049,89 @@ 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 new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 })
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
|
||||
@@ -938,15 +1194,89 @@ 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 new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 })
|
||||
getPoints(): Array<GoogleMapsLatLng> { return; }
|
||||
|
||||
@@ -1011,6 +1341,89 @@ export class GoogleMapsTileOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +1475,89 @@ export class GoogleMapsGroundOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +1600,89 @@ export class GoogleMapsKmlOverlay {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
/**
|
||||
* Adds an event listener.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +1696,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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
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; }
|
||||
|
||||
}
|
||||
@@ -4,6 +4,98 @@ import { Observable } from 'rxjs/Observable';
|
||||
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;
|
||||
/**
|
||||
* Set to true if the wrapped method returns a promise
|
||||
*/
|
||||
otherPromise?: boolean;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param pluginRef
|
||||
@@ -303,7 +395,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
|
||||
@@ -320,6 +412,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
@@ -339,7 +432,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 +468,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 +500,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 +512,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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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