Merge branch 'master' of github.com:driftyco/ionic-native

This commit is contained in:
perry 2016-03-15 15:55:55 -05:00
commit f198eabe71
98 changed files with 2227 additions and 4910 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
node_modules/ node_modules/
.idea
dist/

View File

@ -9,25 +9,20 @@ Let's take a look at the existing plugin wrapper for Geolocation to see what goe
``` ```
@Plugin({ @Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation', plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation' pluginRef: 'navigator.geolocation'
}) })
export class Geolocation { export class Geolocation {
@Cordova() @Cordova()
static getCurrentPosition(options: GeolocationOptions){ static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return }
return new Promise<Geoposition>((res, rej) => {});
}
@Cordova({ @Cordova({
callbackOrder: 'reverse', callbackOrder: 'reverse',
observable: true, observable: true,
clearFunction: 'clearWatch' clearFunction: 'clearWatch'
}) })
static watchPosition(options: GeolocationOptions){ static watchPosition(options?: GeolocationOptions): Observable<Geoposition> { return }
return new Observable<Geoposition>(observer => {});
}
} }
``` ```
@ -49,7 +44,6 @@ For example, the `@Plugin` decorator adds information about the plugin to our Ge
``` ```
@Plugin({ @Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation', plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation' pluginRef: 'navigator.geolocation'
}) })
@ -58,9 +52,7 @@ export class Geolocation {
} }
``` ```
Here, `name` refers to the name of the plugin, which is used by Ionic Native for logging messages. Here, `plugin` is the name of the plugin package on npm and used when calling `cordova plugin add`.
`plugin` is the name of the plugin package on npm and used when calling `cordova plugin add`, also used for logging purposes.
`pluginRef` refers to the where on `window` the underlying Cordova plugin is normally exposed. For example, in the case of the Cordova Geolocation plugin, normally you would make calls like `window.navigator.geolocation.getCurrentPosition({}, success, error)`, so the `pluginRef` in this case is `navigator.geolocation`. `pluginRef` refers to the where on `window` the underlying Cordova plugin is normally exposed. For example, in the case of the Cordova Geolocation plugin, normally you would make calls like `window.navigator.geolocation.getCurrentPosition({}, success, error)`, so the `pluginRef` in this case is `navigator.geolocation`.
@ -72,14 +64,14 @@ Let's take a look at `getCurrentPosition` first.
``` ```
@Cordova() @Cordova()
static getCurrentPosition(options: GeolocationOptions){ static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return }
return new Promise<Geoposition>((res, rej) => {});
}
``` ```
It's just a stub. The `return` is only there to keep the TypeScript type-checker from complaining since we indicate that `getCurrentPosition` returns a `Promise<Geoposition>`.
By default, the `@Cordova` decorator wraps the plugin callbacks in a Promise that resolves when the success callback is called and rejects when the error callback is called. It also ensures that Cordova and the underlying plugin are available, and prints helpful diagnostics if they aren't. By default, the `@Cordova` decorator wraps the plugin callbacks in a Promise that resolves when the success callback is called and rejects when the error callback is called. It also ensures that Cordova and the underlying plugin are available, and prints helpful diagnostics if they aren't.
You'll also notice that it is a static method. That's because the plugin class is just a utility class to call the underlying Cordova plugin methods, it's not an instance and has no state. You'll also notice that `getCurrentPosition` is a static method. That's because the plugin class is just a utility class to call the underlying Cordova plugin methods, it's not an instance and has no state.
Next, let's look at the `watchPosition` method. Next, let's look at the `watchPosition` method.
@ -89,9 +81,7 @@ Next, let's look at the `watchPosition` method.
observable: true, observable: true,
clearFunction: 'clearWatch' clearFunction: 'clearWatch'
}) })
static watchPosition(options: GeolocationOptions){ static watchPosition(options?: GeolocationOptions): Observable<Geoposition> { return }
return new Observable<Geoposition>(observer => {});
}
``` ```
The `@Cordova` decorator has a few more options now. The `@Cordova` decorator has a few more options now.
@ -104,4 +94,4 @@ The `@Cordova` decorator has a few more options now.
### 'Wrapping' Up ### 'Wrapping' Up
That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles. That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.

View File

@ -1,3 +1,9 @@
[![Circle CI](https://circleci.com/gh/driftyco/ionic-native.svg?style=shield)](https://circleci.com/gh/driftyco/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native-playground)
[![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/)
# Ionic Native # Ionic Native
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](http://ionicframework.com/), Cordova, or Web View mobile app easy. Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](http://ionicframework.com/), Cordova, or Web View mobile app easy.
@ -26,12 +32,22 @@ watch.unsubscribe();
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it. Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
## Installation
Run following commmand to install ionic-native in your project.
```
npm install ionic-native --save
```
## Plugin Missing? ## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart: Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
# Credits # Credits
Ibrahim Hadeed - [@ihadeed](http://github.com/ihadeed)
Tim Lancina - [@timlancina](http://twitter.com/timlancina) Tim Lancina - [@timlancina](http://twitter.com/timlancina)
Max Lynch - [@maxlynch](http://twitter.com/maxlynch) Max Lynch - [@maxlynch](http://twitter.com/maxlynch)

View File

@ -11,7 +11,8 @@ general:
test: test:
override: override:
- echo "Skipping tests for now" - echo "No tests are written at the moment. But we will attempt to build the library with the latest changes."
- npm run build_bundle
deployment: deployment:
staging: staging:

14
dist/index.d.ts vendored
View File

@ -1,14 +0,0 @@
import { ActionSheet } from './plugins/actionsheet';
import { BarcodeScanner } from './plugins/barcodescanner';
import { BLE } from './plugins/ble';
import { Camera } from './plugins/camera';
import { Calendar } from './plugins/calendar';
import { Contacts } from './plugins/contacts';
import { Device } from './plugins/device';
import { Facebook } from './plugins/facebook';
import { Geolocation } from './plugins/geolocation';
import { Push } from './plugins/push';
import { StatusBar } from './plugins/statusbar';
import { Toast } from './plugins/toast';
import { TouchID } from './plugins/touchid';
export { ActionSheet, BarcodeScanner, BLE, Camera, Calendar, Contacts, Device, Facebook, Geolocation, Push, StatusBar, Toast, TouchID };

61
dist/index.js vendored
View File

@ -1,61 +0,0 @@
var ng1_1 = require('./ng1');
ng1_1.initAngular1();
var DEVICE_READY_TIMEOUT = 2000;
var actionsheet_1 = require('./plugins/actionsheet');
exports.ActionSheet = actionsheet_1.ActionSheet;
var barcodescanner_1 = require('./plugins/barcodescanner');
exports.BarcodeScanner = barcodescanner_1.BarcodeScanner;
var ble_1 = require('./plugins/ble');
exports.BLE = ble_1.BLE;
var camera_1 = require('./plugins/camera');
exports.Camera = camera_1.Camera;
var calendar_1 = require('./plugins/calendar');
exports.Calendar = calendar_1.Calendar;
var contacts_1 = require('./plugins/contacts');
exports.Contacts = contacts_1.Contacts;
var device_1 = require('./plugins/device');
exports.Device = device_1.Device;
var facebook_1 = require('./plugins/facebook');
exports.Facebook = facebook_1.Facebook;
var geolocation_1 = require('./plugins/geolocation');
exports.Geolocation = geolocation_1.Geolocation;
var push_1 = require('./plugins/push');
exports.Push = push_1.Push;
var statusbar_1 = require('./plugins/statusbar');
exports.StatusBar = statusbar_1.StatusBar;
var toast_1 = require('./plugins/toast');
exports.Toast = toast_1.Toast;
var touchid_1 = require('./plugins/touchid');
exports.TouchID = touchid_1.TouchID;
// Window export to use outside of a module loading system
window['IonicNative'] = {
ActionSheet: actionsheet_1.ActionSheet,
BarcodeScanner: barcodescanner_1.BarcodeScanner,
BLE: ble_1.BLE,
Camera: camera_1.Camera,
Calendar: calendar_1.Calendar,
Contacts: contacts_1.Contacts,
Device: device_1.Device,
Facebook: facebook_1.Facebook,
Geolocation: geolocation_1.Geolocation,
Push: push_1.Push,
StatusBar: statusbar_1.StatusBar,
Toast: toast_1.Toast,
TouchID: touchid_1.TouchID
};
// To help developers using cordova, we listen for the device ready event and
// log an error if it didn't fire in a reasonable amount of time. Generally,
// when this happens, developers should remove and reinstall plugins, since
// an inconsistent plugin is often the culprit.
var before = +new Date;
var didFireReady = false;
document.addEventListener('deviceready', function () {
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
didFireReady = true;
});
setTimeout(function () {
if (!didFireReady && window.cordova) {
console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.');
}
}, DEVICE_READY_TIMEOUT);
//# sourceMappingURL=index.js.map

1
dist/index.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAA2B,OAAO,CAAC,CAAA;AACnC,kBAAY,EAAE,CAAC;AAEf,IAAM,oBAAoB,GAAG,IAAI,CAAC;AAKlC,4BAA0B,uBAAuB,CAAC,CAAA;AAehD,mBAAW;AAdb,+BAA6B,0BAA0B,CAAC,CAAA;AAetD,sBAAc;AAdhB,oBAAkB,eAAe,CAAC,CAAA;AAehC,WAAG;AAdL,uBAAqB,kBAAkB,CAAC,CAAA;AAetC,cAAM;AAdR,yBAAuB,oBAAoB,CAAC,CAAA;AAe1C,gBAAQ;AAdV,yBAAuB,oBAAoB,CAAC,CAAA;AAe1C,gBAAQ;AAdV,uBAAqB,kBAAkB,CAAC,CAAA;AAetC,cAAM;AAdR,yBAAuB,oBAAoB,CAAC,CAAA;AAe1C,gBAAQ;AAdV,4BAA0B,uBAAuB,CAAC,CAAA;AAehD,mBAAW;AAdb,qBAAmB,gBAAgB,CAAC,CAAA;AAelC,YAAI;AAdN,0BAAwB,qBAAqB,CAAC,CAAA;AAe5C,iBAAS;AAdX,sBAAoB,iBAAiB,CAAC,CAAA;AAepC,aAAK;AAdP,wBAAsB,mBAAmB,CAAC,CAAA;AAexC,eAAO;AAGT,0DAA0D;AAC1D,MAAM,CAAC,aAAa,CAAC,GAAG;IACtB,WAAW,EAAE,yBAAW;IACxB,gBAAA,+BAAc;IACd,GAAG,EAAE,SAAG;IACR,MAAM,EAAE,eAAM;IACd,QAAQ,EAAE,mBAAQ;IAClB,QAAQ,EAAE,mBAAQ;IAClB,MAAM,EAAE,eAAM;IACd,QAAQ,EAAE,mBAAQ;IAClB,WAAW,EAAE,yBAAW;IACxB,IAAI,EAAE,WAAI;IACV,SAAS,EAAE,qBAAS;IACpB,KAAK,EAAE,aAAK;IACZ,OAAO,EAAE,iBAAO;CACjB,CAAA;AAED,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,+CAA+C;AAC/C,IAAI,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC;AAEvB,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE;IACvC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC,IAAI,IAAI,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA;IACnE,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC,CAAA;AAEF,UAAU,CAAC;IACT,EAAE,CAAA,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,0CAA0C,GAAG,oBAAoB,GAAG,0HAA0H,CAAC,CAAC;IAC/M,CAAC;AACH,CAAC,EAAE,oBAAoB,CAAC,CAAC"}

View File

View File

@ -1 +0,0 @@
//# sourceMappingURL=ionic.native.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"ionic.native.js","sourceRoot":"","sources":[],"names":[],"mappings":""}

8
dist/ng1.d.ts vendored
View File

@ -1,8 +0,0 @@
/**
* Initialize the ngCordova Angular module if we're running in ng1
*/
export declare function initAngular1(): void;
/**
* Publish a new Angular 1 service for this plugin.
*/
export declare function publishAngular1Service(config: any, cls: any): void;

24
dist/ng1.js vendored
View File

@ -1,24 +0,0 @@
/**
* Initialize the ngCordova Angular module if we're running in ng1
*/
function initAngular1() {
if (window.angular) {
window.angular.module('ngCordova', []);
}
}
exports.initAngular1 = initAngular1;
/**
* Publish a new Angular 1 service for this plugin.
*/
function publishAngular1Service(config, cls) {
var serviceName = '$cordova' + cls.name;
console.log('Registering Angular1 service', serviceName);
window.angular.module('ngCordova').service(serviceName, [function () {
var funcs = {};
for (var k in cls) {
}
return funcs;
}]);
}
exports.publishAngular1Service = publishAngular1Service;
//# sourceMappingURL=ng1.js.map

1
dist/ng1.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"ng1.js","sourceRoot":"","sources":["../src/ng1.ts"],"names":["initAngular1","publishAngular1Service"],"mappings":"AAEA;;GAEG;AACH;IACEA,EAAEA,CAAAA,CAACA,MAAMA,CAACA,OAAOA,CAACA,CAACA,CAACA;QAClBA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,WAAWA,EAAEA,EAAEA,CAACA,CAACA;IACzCA,CAACA;AACHA,CAACA;AAJe,oBAAY,eAI3B,CAAA;AAED;;GAEG;AACH,gCAAuC,MAAU,EAAE,GAAO;IACxDC,IAAIA,WAAWA,GAAGA,UAAUA,GAAGA,GAAGA,CAACA,IAAIA,CAACA;IACxCA,OAAOA,CAACA,GAAGA,CAACA,8BAA8BA,EAAEA,WAAWA,CAACA,CAACA;IACzDA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,WAAWA,CAACA,CAACA,OAAOA,CAACA,WAAWA,EAAEA,CAACA;YACvD,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,GAAG,CAAA,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,KAAK,CAAC;QACf,CAAC,CAACA,CAACA,CAACA;AACNA,CAACA;AATe,8BAAsB,yBASrC,CAAA"}

View File

@ -1,52 +0,0 @@
/**
* The ActionSheet plugin shows a native list of options the user can choose from.
*
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
*
* ```
* import {ActionSheet} from 'ionic-native';
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
* 'title': 'What do you want with this image?',
* 'buttonLabels': buttonLabels,
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
* }).then(buttonIndex => {
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
* });
* ```
*
*/
export declare class ActionSheet {
/**
* Show the ActionSheet.
* @param {options} options
* `buttonLabels`: string[]
* `title`: string
* `androidTheme` (Android only): number 1-5
* `androidEnableCancelButton` (Android only): boolean, default false
* `winphoneEnableCancelButton` (WP only): boolean, default false
* `addCancelButtonWithLabel`: string
* `addDestructiveButtonWithLabel`: string
* `position`: [x, y] (iPad pass in [x, y] coords of popover)
* @returns {Promise} Returns a Promise that resolves with the index of the
* button pressed (1 based, so 1, 2, 3, etc.)
*/
static show(options?: {
buttonLabels: string[];
title?: string;
androidTheme?: number;
androidEnableCancelButton?: boolean;
winphoneEnableCancelButton?: boolean;
addCancelButtonWithLabel?: string;
addDestructiveButtonWithLabel?: string;
position?: number[];
}): Promise<any>;
/**
* Hide the ActionSheet.
*/
static hide(): Promise<any>;
}

View File

@ -1,83 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* The ActionSheet plugin shows a native list of options the user can choose from.
*
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
*
* ```
* import {ActionSheet} from 'ionic-native';
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
* 'title': 'What do you want with this image?',
* 'buttonLabels': buttonLabels,
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
* }).then(buttonIndex => {
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
* });
* ```
*
*/
var ActionSheet = (function () {
function ActionSheet() {
}
/**
* Show the ActionSheet.
* @param {options} options
* `buttonLabels`: string[]
* `title`: string
* `androidTheme` (Android only): number 1-5
* `androidEnableCancelButton` (Android only): boolean, default false
* `winphoneEnableCancelButton` (WP only): boolean, default false
* `addCancelButtonWithLabel`: string
* `addDestructiveButtonWithLabel`: string
* `position`: [x, y] (iPad pass in [x, y] coords of popover)
* @returns {Promise} Returns a Promise that resolves with the index of the
* button pressed (1 based, so 1, 2, 3, etc.)
*/
ActionSheet.show = function (options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Hide the ActionSheet.
*/
ActionSheet.hide = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
__decorate([
plugin_1.Cordova()
], ActionSheet, "show", null);
__decorate([
plugin_1.Cordova()
], ActionSheet, "hide", null);
ActionSheet = __decorate([
plugin_1.Plugin({
name: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet'
})
], ActionSheet);
return ActionSheet;
})();
exports.ActionSheet = ActionSheet;
//# sourceMappingURL=actionsheet.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"actionsheet.js","sourceRoot":"","sources":["../../src/plugins/actionsheet.ts"],"names":["ActionSheet","ActionSheet.constructor","ActionSheet.show","ActionSheet.hide"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAAAA;IAsDAC,CAACA;IA9CCD;;;;;;;;;;;;;OAaGA;IAEIA,gBAAIA,GADXA,UACYA,OASXA;QACCE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAGDF;;OAEGA;IAEIA,gBAAIA,GADXA;QAEEG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IA/BDH;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAgBVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAOVA;IArDHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,qBAAqBA;YAChCA,IAAIA,EAAEA,8DAA8DA;SACrEA,CAACA;oBAiDDA;IAADA,kBAACA;AAADA,CAACA,AAtDD,IAsDC;AAhDY,mBAAW,cAgDvB,CAAA"}

View File

@ -1,21 +0,0 @@
/**
* The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
*
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
* ```js
* BarcodeScanner.scan().then((barcodeData) => {
* // Success! Barcode data is here
* }, (err) => {
* // An error occurred
* });
* ```
*/
export declare class BarcodeScanner {
/**
* Open the barcode scanner.
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
static scan(): Promise<any>;
}

View File

@ -1,51 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
*
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
* ```js
* BarcodeScanner.scan().then((barcodeData) => {
* // Success! Barcode data is here
* }, (err) => {
* // An error occurred
* });
* ```
*/
var BarcodeScanner = (function () {
function BarcodeScanner() {
}
/**
* Open the barcode scanner.
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
BarcodeScanner.scan = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
__decorate([
plugin_1.Cordova()
], BarcodeScanner, "scan", null);
BarcodeScanner = __decorate([
plugin_1.Plugin({
name: 'BarcodeScanner',
plugin: 'phonegap-plugin-barcodescanner',
pluginRef: 'cordova.plugins.barcodeScanner'
})
], BarcodeScanner);
return BarcodeScanner;
})();
exports.BarcodeScanner = BarcodeScanner;
//# sourceMappingURL=barcodescanner.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"barcodescanner.js","sourceRoot":"","sources":["../../src/plugins/barcodescanner.ts"],"names":["BarcodeScanner","BarcodeScanner.constructor","BarcodeScanner.scan"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;;;;;;;;;;;;;GAaG;AACH;IAAAA;IAwBAC,CAACA;IAjBCD;;;OAGGA;IAEIA,mBAAIA,GADXA;QAEEE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IARDF;QAACA,gBAAOA,EAAEA;OACHA,sBAAIA,QAOVA;IAnBHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,gBAAgBA;YACtBA,MAAMA,EAAEA,gCAAgCA;YACxCA,SAASA,EAAEA,gCAAgCA;SAC5CA,CAACA;uBAoBDA;IAADA,qBAACA;AAADA,CAACA,AAxBD,IAwBC;AAnBY,sBAAc,iBAmB1B,CAAA"}

337
dist/plugins/ble.d.ts vendored
View File

@ -1,337 +0,0 @@
import { Observable } from 'rxjs/Observable';
/**
* This plugin enables communication between a phone and Bluetooth Low Energy (BLE) peripherals.
*
* The plugin provides a simple JavaScript API for iOS and Android.
*
* - Scan for peripherals
* - Connect to a peripheral
* - Read the value of a characteristic
* - Write new value to a characteristic
* - Get notified when characteristic's value changes
*
* Advertising information is returned when scanning for peripherals. Service, characteristic, and property info is returned when connecting to a peripheral. All access is via service and characteristic UUIDs. The plugin manages handles internally.
*
* Simultaneous connections to multiple peripherals are supported.
*
* ## Peripheral Data
*
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
* ```
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
* "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
* "rssi": -55
* }
* ```
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
* ```
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
* "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
* "rssi": -55,
* "services": [
* "1800",
* "1801",
* "180f"
* ],
* "characteristics": [
* {
* "service": "1800",
* "characteristic": "2a00",
* "properties": [
* "Read"
* ]
* },
* {
* "service": "1800",
* "characteristic": "2a01",
* "properties": [
* "Read"
* ]
* },
* {
* "service": "1801",
* "characteristic": "2a05",
* "properties": [
* "Read"
* ]
* },
* {
* "service": "180f",
* "characteristic": "2a19",
* "properties": [
* "Read"
* ],
* "descriptors": [
* {
* "uuid": "2901"
* },
* {
* "uuid": "2904"
* }
* ]
* }
* ]
* }
* ```
*
* ## Advertising Data
* Bluetooth advertising data is returned in when scanning for devices. The format format varies depending on your platform. On Android advertising data will be the raw advertising bytes. iOS does not allow access to raw advertising data, so a dictionary of data is returned.
*
* The advertising information for both Android and iOS appears to be a combination of advertising data and scan response data.
*
* ### Android
* ```
* {
* "name": "demo",
* "id": "00:1A:7D:DA:71:13",
* "advertising": ArrayBuffer,
* "rssi": -37
* }
* ```
*
* Convert the advertising info to a Uint8Array for processing. `var adData = new Uint8Array(peripheral.advertising)`
*
* ### iOS
*
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
* ```
* {
* "name": "demo",
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
* "advertising": {
* "kCBAdvDataChannel": 37,
* "kCBAdvDataServiceData": {
* "FED8": {
* "byteLength": 7 // data not shown
* }
* },
* "kCBAdvDataLocalName": "demo",
* "kCBAdvDataServiceUUIDs": ["FED8"],
* "kCBAdvDataManufacturerData": {
* "byteLength": 7 // data not shown
* },
* "kCBAdvDataTxPowerLevel": 32,
* "kCBAdvDataIsConnectable": true
* },
* "rssi": -53
* }
* ```
*
* ## Typed Arrays
*
* This plugin uses typed Arrays or ArrayBuffers for sending and receiving data.
*
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
* ```
* // ASCII only
* function stringToBytes(string) {
* var array = new Uint8Array(string.length);
* for (var i = 0, l = string.length; i < l; i++) {
* array[i] = string.charCodeAt(i);
* }
* return array.buffer;
* }
*
* // ASCII only
* function bytesToString(buffer) {
* return String.fromCharCode.apply(null, new Uint8Array(buffer));
* }
* ```
* You can read more about typed arrays in these articles on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) and [HTML5 Rocks](http://www.html5rocks.com/en/tutorials/webgl/typed_arrays/).
*
* ## UUIDs
*
* UUIDs are always strings and not numbers. Some 16-bit UUIDs, such as '2220' look like integers, but they're not. (The integer 2220 is 0x8AC in hex.) This isn't a problem with 128 bit UUIDs since they look like strings 82b9e6e1-593a-456f-be9b-9215160ebcac. All 16-bit UUIDs should also be passed to methods as strings.
*
*/
export declare class BLE {
/**
* Scan and discover BLE peripherals for the specified amount of time.
*
* @usage
* ```
* BLE.scan([], 5).subscribe(device => {
* console.log(JSON.stringify(device));
* });
* ```
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
* @param {number} seconds Number of seconds to run discovery
* @return Returns an Observable that notifies of each peripheral that is discovered during the specified time.
*/
static scan(services: string[], seconds: number): Observable<any>;
/**
* Scan and discover BLE peripherals until `stopScan` is called.
*
* @usage
* ```
* BLE.startScan([]).subscribe(device => {
* console.log(JSON.stringify(device));
* });
*
* setTimeout(() => {
* BLE.stopScan();
* }, 5000);
* ```
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
* @return Returns an Observable that notifies of each peripheral discovered.
*/
static startScan(services: string[]): Observable<any>;
/**
* Stop a scan started by `startScan`.
*
* @usage
* ```
* BLE.startScan([]).subscribe(device => {
* console.log(JSON.stringify(device));
* });
* setTimeout(() => {
* BLE.stopScan().then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @return returns a Promise.
*/
static stopScan(): Promise<any>;
/**
* Connect to a peripheral.
* @usage
* ```
* BLE.connect('12:34:56:78:9A:BC').subscribe(peripheralData => {
* console.log(peripheralData);
* },
* peripheralData => {
* console.log('disconnected');
* });
* ```
* @param deviceId {string} UUID or MAC address of the peripheral
* @return Returns an Observable that notifies of connect/disconnect.
*/
static connect(deviceId: string): Observable<any>;
/**
* Disconnect from a peripheral.
* @usage
* ```
* BLE.disconnect('12:34:56:78:9A:BC').then(() => {
* console.log('Disconnected');
* });
* ```
* @param deviceId {string} UUID or MAC address of the peripheral
* @return Returns a Promise
*/
static disconnect(deviceId: string): Promise<any>;
/**
* Read the value of a characteristic.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @return Returns a Promise
*/
static read(deviceId: string, serviceUUID: string, characteristicUUID: string): Promise<any>;
/**
* Write the value of a characteristic.
* @usage
* ```
* // send 1 byte to switch a light on
* var data = new Uint8Array(1);
* data[0] = 1;
* BLE.write(device_id, "FF10", "FF11", data.buffer);
*
* // send a 3 byte value with RGB color
* var data = new Uint8Array(3);
* data[0] = 0xFF; // red
* data[0] = 0x00; // green
* data[0] = 0xFF; // blue
* BLE.write(device_id, "ccc0", "ccc1", data.buffer);
*
* // send a 32 bit integer
* var data = new Uint32Array(1);
* data[0] = counterInput.value;
* BLE.write(device_id, SERVICE, CHARACTERISTIC, data.buffer);
*
* ```
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
* @return Returns a Promise
*/
static write(deviceId: string, serviceUUID: string, characteristicUUID: string, value: ArrayBuffer): Promise<any>;
/**
* Write the value of a characteristic without waiting for confirmation from the peripheral.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
* @return Returns a Promise
*/
static writeWithoutResponse(deviceId: string, serviceUUID: string, characteristicUUID: string, value: ArrayBuffer): Promise<any>;
/**
* Register to be notified when the value of a characteristic changes.
*
* @usage
* ```
* BLE.startNotification(device_id, "FF10", "FF11").subscribe(buffer => {
* console.log(String.fromCharCode.apply(null, new Uint8Array(buffer));
* });
* ```
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @return Returns an Observable that notifies of characteristic changes.
*/
static startNotification(deviceId: string, serviceUUID: string, characteristicUUID: string): Observable<any>;
/**
* Stop being notified when the value of a characteristic changes.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @return Returns a Promise.
*/
static stopNotification(deviceId: string, serviceUUID: string, characteristicUUID: string): Promise<any>;
/**
* Report the connection status.
*
* @usage
* ```
* BLE.isConnected('FFCA0B09-CB1D-4DC0-A1EF-31AFD3EDFB53').then(
* () => { console.log('connected'); },
* () => { console.log('not connected'); }
* );
* ```
* @param {string} device_id UUID or MAC address of the peripheral
* @return Returns a Promise.
*/
static isConnected(deviceId: string): Promise<any>;
/**
* Report if bluetooth is enabled.
*
* @usage
* ```
* BLE.isEnabled().then(
* () => { console.log('enabled'); },
* () => { console.log('not enabled'); }
* );
* ```
* @return Returns a Promise.
*/
static isEnabled(): Promise<any>;
/**
* Open System Bluetooth settings (Android only).
*
* @return Returns a Promise.
*/
static showBluetoothSettings(): Promise<any>;
/**
* Enable Bluetooth on the device (Android only).
*
* @return Returns a Promise.
*/
static enable(): Promise<any>;
}

520
dist/plugins/ble.js vendored
View File

@ -1,520 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
var Observable_1 = require('rxjs/Observable');
/**
* This plugin enables communication between a phone and Bluetooth Low Energy (BLE) peripherals.
*
* The plugin provides a simple JavaScript API for iOS and Android.
*
* - Scan for peripherals
* - Connect to a peripheral
* - Read the value of a characteristic
* - Write new value to a characteristic
* - Get notified when characteristic's value changes
*
* Advertising information is returned when scanning for peripherals. Service, characteristic, and property info is returned when connecting to a peripheral. All access is via service and characteristic UUIDs. The plugin manages handles internally.
*
* Simultaneous connections to multiple peripherals are supported.
*
* ## Peripheral Data
*
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
* ```
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
* "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
* "rssi": -55
* }
* ```
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
* ```
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
* "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
* "rssi": -55,
* "services": [
* "1800",
* "1801",
* "180f"
* ],
* "characteristics": [
* {
* "service": "1800",
* "characteristic": "2a00",
* "properties": [
* "Read"
* ]
* },
* {
* "service": "1800",
* "characteristic": "2a01",
* "properties": [
* "Read"
* ]
* },
* {
* "service": "1801",
* "characteristic": "2a05",
* "properties": [
* "Read"
* ]
* },
* {
* "service": "180f",
* "characteristic": "2a19",
* "properties": [
* "Read"
* ],
* "descriptors": [
* {
* "uuid": "2901"
* },
* {
* "uuid": "2904"
* }
* ]
* }
* ]
* }
* ```
*
* ## Advertising Data
* Bluetooth advertising data is returned in when scanning for devices. The format format varies depending on your platform. On Android advertising data will be the raw advertising bytes. iOS does not allow access to raw advertising data, so a dictionary of data is returned.
*
* The advertising information for both Android and iOS appears to be a combination of advertising data and scan response data.
*
* ### Android
* ```
* {
* "name": "demo",
* "id": "00:1A:7D:DA:71:13",
* "advertising": ArrayBuffer,
* "rssi": -37
* }
* ```
*
* Convert the advertising info to a Uint8Array for processing. `var adData = new Uint8Array(peripheral.advertising)`
*
* ### iOS
*
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
* ```
* {
* "name": "demo",
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
* "advertising": {
* "kCBAdvDataChannel": 37,
* "kCBAdvDataServiceData": {
* "FED8": {
* "byteLength": 7 // data not shown
* }
* },
* "kCBAdvDataLocalName": "demo",
* "kCBAdvDataServiceUUIDs": ["FED8"],
* "kCBAdvDataManufacturerData": {
* "byteLength": 7 // data not shown
* },
* "kCBAdvDataTxPowerLevel": 32,
* "kCBAdvDataIsConnectable": true
* },
* "rssi": -53
* }
* ```
*
* ## Typed Arrays
*
* This plugin uses typed Arrays or ArrayBuffers for sending and receiving data.
*
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
* ```
* // ASCII only
* function stringToBytes(string) {
* var array = new Uint8Array(string.length);
* for (var i = 0, l = string.length; i < l; i++) {
* array[i] = string.charCodeAt(i);
* }
* return array.buffer;
* }
*
* // ASCII only
* function bytesToString(buffer) {
* return String.fromCharCode.apply(null, new Uint8Array(buffer));
* }
* ```
* You can read more about typed arrays in these articles on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) and [HTML5 Rocks](http://www.html5rocks.com/en/tutorials/webgl/typed_arrays/).
*
* ## UUIDs
*
* UUIDs are always strings and not numbers. Some 16-bit UUIDs, such as '2220' look like integers, but they're not. (The integer 2220 is 0x8AC in hex.) This isn't a problem with 128 bit UUIDs since they look like strings 82b9e6e1-593a-456f-be9b-9215160ebcac. All 16-bit UUIDs should also be passed to methods as strings.
*
*/
var BLE = (function () {
function BLE() {
}
/**
* Scan and discover BLE peripherals for the specified amount of time.
*
* @usage
* ```
* BLE.scan([], 5).subscribe(device => {
* console.log(JSON.stringify(device));
* });
* ```
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
* @param {number} seconds Number of seconds to run discovery
* @return Returns an Observable that notifies of each peripheral that is discovered during the specified time.
*/
BLE.scan = function (services, seconds) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Scan and discover BLE peripherals until `stopScan` is called.
*
* @usage
* ```
* BLE.startScan([]).subscribe(device => {
* console.log(JSON.stringify(device));
* });
*
* setTimeout(() => {
* BLE.stopScan();
* }, 5000);
* ```
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
* @return Returns an Observable that notifies of each peripheral discovered.
*/
BLE.startScan = function (services) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
;
/**
* Stop a scan started by `startScan`.
*
* @usage
* ```
* BLE.startScan([]).subscribe(device => {
* console.log(JSON.stringify(device));
* });
* setTimeout(() => {
* BLE.stopScan().then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @return returns a Promise.
*/
BLE.stopScan = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Connect to a peripheral.
* @usage
* ```
* BLE.connect('12:34:56:78:9A:BC').subscribe(peripheralData => {
* console.log(peripheralData);
* },
* peripheralData => {
* console.log('disconnected');
* });
* ```
* @param deviceId {string} UUID or MAC address of the peripheral
* @return Returns an Observable that notifies of connect/disconnect.
*/
BLE.connect = function (deviceId) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
;
/**
* Disconnect from a peripheral.
* @usage
* ```
* BLE.disconnect('12:34:56:78:9A:BC').then(() => {
* console.log('Disconnected');
* });
* ```
* @param deviceId {string} UUID or MAC address of the peripheral
* @return Returns a Promise
*/
BLE.disconnect = function (deviceId) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Read the value of a characteristic.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @return Returns a Promise
*/
BLE.read = function (deviceId, serviceUUID, characteristicUUID) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Write the value of a characteristic.
* @usage
* ```
* // send 1 byte to switch a light on
* var data = new Uint8Array(1);
* data[0] = 1;
* BLE.write(device_id, "FF10", "FF11", data.buffer);
*
* // send a 3 byte value with RGB color
* var data = new Uint8Array(3);
* data[0] = 0xFF; // red
* data[0] = 0x00; // green
* data[0] = 0xFF; // blue
* BLE.write(device_id, "ccc0", "ccc1", data.buffer);
*
* // send a 32 bit integer
* var data = new Uint32Array(1);
* data[0] = counterInput.value;
* BLE.write(device_id, SERVICE, CHARACTERISTIC, data.buffer);
*
* ```
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
* @return Returns a Promise
*/
BLE.write = function (deviceId, serviceUUID, characteristicUUID, value) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Write the value of a characteristic without waiting for confirmation from the peripheral.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
* @return Returns a Promise
*/
BLE.writeWithoutResponse = function (deviceId, serviceUUID, characteristicUUID, value) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Register to be notified when the value of a characteristic changes.
*
* @usage
* ```
* BLE.startNotification(device_id, "FF10", "FF11").subscribe(buffer => {
* console.log(String.fromCharCode.apply(null, new Uint8Array(buffer));
* });
* ```
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @return Returns an Observable that notifies of characteristic changes.
*/
BLE.startNotification = function (deviceId, serviceUUID, characteristicUUID) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
;
/**
* Stop being notified when the value of a characteristic changes.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @return Returns a Promise.
*/
BLE.stopNotification = function (deviceId, serviceUUID, characteristicUUID) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Report the connection status.
*
* @usage
* ```
* BLE.isConnected('FFCA0B09-CB1D-4DC0-A1EF-31AFD3EDFB53').then(
* () => { console.log('connected'); },
* () => { console.log('not connected'); }
* );
* ```
* @param {string} device_id UUID or MAC address of the peripheral
* @return Returns a Promise.
*/
BLE.isConnected = function (deviceId) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Report if bluetooth is enabled.
*
* @usage
* ```
* BLE.isEnabled().then(
* () => { console.log('enabled'); },
* () => { console.log('not enabled'); }
* );
* ```
* @return Returns a Promise.
*/
BLE.isEnabled = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Open System Bluetooth settings (Android only).
*
* @return Returns a Promise.
*/
BLE.showBluetoothSettings = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Enable Bluetooth on the device (Android only).
*
* @return Returns a Promise.
*/
BLE.enable = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
__decorate([
plugin_1.Cordova({
observable: true
})
], BLE, "scan", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'stopScan',
clearWithArgs: true
})
], BLE, "startScan", null);
__decorate([
plugin_1.Cordova()
], BLE, "stopScan", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'disconnect',
clearWithArgs: true
})
], BLE, "connect", null);
__decorate([
plugin_1.Cordova()
], BLE, "disconnect", null);
__decorate([
plugin_1.Cordova()
], BLE, "read", null);
__decorate([
plugin_1.Cordova()
], BLE, "write", null);
__decorate([
plugin_1.Cordova()
], BLE, "writeWithoutResponse", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'stopNotification',
clearWithArgs: true
})
], BLE, "startNotification", null);
__decorate([
plugin_1.Cordova()
], BLE, "stopNotification", null);
__decorate([
plugin_1.Cordova()
], BLE, "isConnected", null);
__decorate([
plugin_1.Cordova()
], BLE, "isEnabled", null);
__decorate([
plugin_1.Cordova()
], BLE, "showBluetoothSettings", null);
__decorate([
plugin_1.Cordova()
], BLE, "enable", null);
BLE = __decorate([
plugin_1.Plugin({
name: 'BLE',
plugin: 'cordova-plugin-ble-central',
pluginRef: 'ble',
pluginRepo: 'https://github.com/don/cordova-plugin-ble-central'
})
], BLE);
return BLE;
})();
exports.BLE = BLE;
//# sourceMappingURL=ble.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,220 +0,0 @@
export interface CalendarOptions {
firstReminderMinutes?: number;
secondReminderMinutes?: number;
recurrence?: string;
recurrenceInterval?: number;
recurrenceEndDate?: Date;
calendarName?: string;
calendarId?: number;
url?: string;
}
export interface Calendar {
id: number;
name: string;
}
/**
* This plugin allows you to add events to the Calendar of the mobile device.
*
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
*
*/
export declare class Calendar {
/**
* Create a calendar. (iOS only)
*
* @usage
* ```
* Calendar.createCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
* @param {string | Object} nameOrOptions either a string name or a options object.
* options:
* calendarName: string the name of the calendar
* calendarColor: string the hex color of the calendar
* @return Returns a Promise
*/
static createCalendar(nameOrOptions: string | {
calendarName: string;
calendarColor: string;
}): Promise<any>;
/**
* Delete a calendar. (iOS only)
*
* @usage
* ```
* Calendar.deleteCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
* @param {string} name Name of the calendar to delete.
* @return Returns a Promise
*/
static deleteCalendar(name: string): Promise<any>;
/**
* Returns the default calendar options.
*
* @return Returns an object with the default calendar options:
* firstReminderMinutes: 60,
* secondReminderMinutes: null,
* recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly'
* recurrenceInterval: 1, // only used when recurrence is set
* recurrenceEndDate: null,
* calendarName: null,
* calendarId: null,
* url: null
*/
static getCalendarOptions(): CalendarOptions;
/**
* Silently create an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
static createEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>;
/**
* Silently create an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
static createEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise<any>;
/**
* Interactively create an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
static createEventInteractively(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>;
/**
* Interactively create an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
static createEventInteractivelyWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise<any>;
/**
* Find an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
static findEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>;
/**
* Find an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise that resolves with the event, or rejects with an error.
*/
static findEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise<any>;
/**
* Find a list of events within the specified date range. (Android only)
*
* @param {Date} [startDate] The start date
* @param {Date} [endDate] The end date
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
static listEventsInRange(startDate: Date, endDate: Date): Promise<any>;
/**
* Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error.
*/
static listCalendars(): Promise<any>;
/**
* Get a list of all future events in the specified calendar. (iOS only)
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
static findAllEventsInNamedCalendar(calendarName: string): Promise<any>;
/**
* Modify an event. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} [newTitle] The new event title
* @param {string} [newLocation] The new event location
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @return Returns a Promise
*/
static modifyEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, newTitle?: string, newLocation?: string, newNotes?: string, newStartDate?: Date, newEndDate?: Date): Promise<any>;
/**
* Modify an event with additional options. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} [newTitle] The new event title
* @param {string} [newLocation] The new event location
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
static modifyEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, newTitle?: string, newLocation?: string, newNotes?: string, newStartDate?: Date, newEndDate?: Date, options?: CalendarOptions): Promise<any>;
/**
* Delete an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
static deleteEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>;
/**
* Delete an event from the specified Calendar. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} calendarName
* @return Returns a Promise
*/
static deleteEventFromNamedCalendar(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, calendarName?: string): Promise<any>;
/**
* Open the calendar at the specified date.
* @return {Date} date
*/
static openCalendar(date: Date): Promise<any>;
}

View File

@ -1,403 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* This plugin allows you to add events to the Calendar of the mobile device.
*
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
*
*/
var Calendar = (function () {
function Calendar() {
}
/**
* Create a calendar. (iOS only)
*
* @usage
* ```
* Calendar.createCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
* @param {string | Object} nameOrOptions either a string name or a options object.
* options:
* calendarName: string the name of the calendar
* calendarColor: string the hex color of the calendar
* @return Returns a Promise
*/
Calendar.createCalendar = function (nameOrOptions) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Delete a calendar. (iOS only)
*
* @usage
* ```
* Calendar.deleteCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
*
* @param {string} name Name of the calendar to delete.
* @return Returns a Promise
*/
Calendar.deleteCalendar = function (name) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Returns the default calendar options.
*
* @return Returns an object with the default calendar options:
* firstReminderMinutes: 60,
* secondReminderMinutes: null,
* recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly'
* recurrenceInterval: 1, // only used when recurrence is set
* recurrenceEndDate: null,
* calendarName: null,
* calendarId: null,
* url: null
*/
Calendar.getCalendarOptions = function () {
return {
firstReminderMinutes: 60,
secondReminderMinutes: null,
recurrence: null,
recurrenceInterval: 1,
recurrenceEndDate: null,
calendarName: null,
calendarId: null,
url: null
};
};
/**
* Silently create an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
Calendar.createEvent = function (title, location, notes, startDate, endDate) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Silently create an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Interactively create an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Interactively create an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
// deprecated
// @Cordova()
// static createEventInNamedCalendar(
// title?: string,
// location?: string,
// notes?: string,
// startDate?: Date,
// endDate?: Date,
// calendarName?: string
// ) {}
/**
* Find an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
Calendar.findEvent = function (title, location, notes, startDate, endDate) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Find an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise that resolves with the event, or rejects with an error.
*/
Calendar.findEventWithOptions = function (title, location, notes, startDate, endDate, options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Find a list of events within the specified date range. (Android only)
*
* @param {Date} [startDate] The start date
* @param {Date} [endDate] The end date
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
Calendar.listEventsInRange = function (startDate, endDate) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error.
*/
Calendar.listCalendars = function () {
return new Promise(function (res, rej) { });
};
/**
* Get a list of all future events in the specified calendar. (iOS only)
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
Calendar.findAllEventsInNamedCalendar = function (calendarName) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Modify an event. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} [newTitle] The new event title
* @param {string} [newLocation] The new event location
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @return Returns a Promise
*/
Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Modify an event with additional options. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} [newTitle] The new event title
* @param {string} [newLocation] The new event location
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate, options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Delete an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
Calendar.deleteEvent = function (title, location, notes, startDate, endDate) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Delete an event from the specified Calendar. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} calendarName
* @return Returns a Promise
*/
Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Open the calendar at the specified date.
* @return {Date} date
*/
Calendar.openCalendar = function (date) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
__decorate([
plugin_1.Cordova()
], Calendar, "createCalendar", null);
__decorate([
plugin_1.Cordova()
], Calendar, "deleteCalendar", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], Calendar, "getCalendarOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEvent", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEventWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEventInteractively", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEventInteractivelyWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "findEvent", null);
__decorate([
plugin_1.Cordova()
], Calendar, "findEventWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "listEventsInRange", null);
__decorate([
plugin_1.Cordova()
], Calendar, "listCalendars", null);
__decorate([
plugin_1.Cordova()
], Calendar, "findAllEventsInNamedCalendar", null);
__decorate([
plugin_1.Cordova()
], Calendar, "modifyEvent", null);
__decorate([
plugin_1.Cordova()
], Calendar, "modifyEventWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "deleteEvent", null);
__decorate([
plugin_1.Cordova()
], Calendar, "deleteEventFromNamedCalendar", null);
__decorate([
plugin_1.Cordova()
], Calendar, "openCalendar", null);
Calendar = __decorate([
plugin_1.Plugin({
name: 'Calendar',
plugin: 'cordova-plugin-calendar',
pluginRef: 'plugins.calendar'
})
], Calendar);
return Calendar;
})();
exports.Calendar = Calendar;
//# sourceMappingURL=calendar.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,111 +0,0 @@
export interface CameraOptions {
/** Picture quality in range 0-100. Default is 50 */
quality?: number;
/**
* Choose the format of the return value.
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
* DATA_URL : 0, Return image as base64-encoded string
* FILE_URI : 1, Return image file URI
* NATIVE_URI : 2 Return image native URI
* (e.g., assets-library:// on iOS or content:// on Android)
*/
destinationType?: number;
/**
* Set the source of the picture.
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
* PHOTOLIBRARY : 0,
* CAMERA : 1,
* SAVEDPHOTOALBUM : 2
*/
sourceType?: number;
/** Allow simple editing of image before selection. */
allowEdit?: boolean;
/**
* Choose the returned image file's encoding.
* Defined in navigator.camera.EncodingType. Default is JPEG
* JPEG : 0 Return JPEG encoded image
* PNG : 1 Return PNG encoded image
*/
encodingType?: number;
/**
* Width in pixels to scale image. Must be used with targetHeight.
* Aspect ratio remains constant.
*/
targetWidth?: number;
/**
* Height in pixels to scale image. Must be used with targetWidth.
* Aspect ratio remains constant.
*/
targetHeight?: number;
/**
* Set the type of media to select from. Only works when PictureSourceType
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
* Will return format specified via DestinationType
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
* ALLMEDIA : 2 allow selection from all media types
*/
mediaType?: number;
/** Rotate the image to correct for the orientation of the device during capture. */
correctOrientation?: boolean;
/** Save the image to the photo album on the device after capture. */
saveToPhotoAlbum?: boolean;
/**
* Choose the camera to use (front- or back-facing).
* Defined in navigator.camera.Direction. Default is BACK.
* FRONT: 0
* BACK: 1
*/
cameraDirection?: number;
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
popoverOptions?: CameraPopoverOptions;
}
/**
* iOS-only parameters that specify the anchor element location and arrow direction
* of the popover when selecting images from an iPad's library or album.
*/
export interface CameraPopoverOptions {
x: number;
y: number;
width: number;
height: number;
/**
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
* Matches iOS UIPopoverArrowDirection constants.
* ARROW_UP : 1,
* ARROW_DOWN : 2,
* ARROW_LEFT : 4,
* ARROW_RIGHT : 8,
* ARROW_ANY : 15
*/
arrowDir: number;
}
/**
* Take a photo or capture video.
*
* Requires Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
*
* @usage
* ```js
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
* let base64Image = "data:image/jpeg;base64," + imageData;
* }, (err) => {
* });
* ```
*/
export declare class Camera {
/**
* Take a picture or video, or load one from the library.
* @param {CameraOptions} options
* @return Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
*/
static getPicture(options: CameraOptions): Promise<any>;
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
* @return Returns a Promise
*/
static cleanup(): void;
}

View File

@ -1,65 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Take a photo or capture video.
*
* Requires Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
*
* @usage
* ```js
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
* let base64Image = "data:image/jpeg;base64," + imageData;
* }, (err) => {
* });
* ```
*/
var Camera = (function () {
function Camera() {
}
/**
* Take a picture or video, or load one from the library.
* @param {CameraOptions} options
* @return Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
*/
Camera.getPicture = function (options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
* @return Returns a Promise
*/
Camera.cleanup = function () { };
;
__decorate([
plugin_1.Cordova({
callbackOrder: 'reverse'
})
], Camera, "getPicture", null);
__decorate([
plugin_1.Cordova()
], Camera, "cleanup", null);
Camera = __decorate([
plugin_1.Plugin({
name: 'Camera',
plugin: 'cordova-plugin-camera',
pluginRef: 'navigator.camera'
})
], Camera);
return Camera;
})();
exports.Camera = Camera;
//# sourceMappingURL=camera.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/plugins/camera.ts"],"names":["Camera","Camera.constructor","Camera.getPicture","Camera.cleanup"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAsFzC;;;;;;;;;;;;;;GAcG;AACH;IAAAA;IA8BAC,CAACA;IAxBCD;;;;OAIGA;IAIIA,iBAAUA,GAHjBA,UAGkBA,OAAsBA;QACtCE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IAEDF;;;;OAIGA;IAEIA,cAAOA,GADdA,cACiBG,CAACA;;IAlBlBH;QAACA,gBAAOA,CAACA;YACPA,aAAaA,EAAEA,SAASA;SACzBA,CAACA;OACKA,oBAAUA,QAOhBA;IAODA;QAACA,gBAAOA,EAAEA;OACHA,iBAAOA,QAAIA;IA7BpBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;eA0BDA;IAADA,aAACA;AAADA,CAACA,AA9BD,IA8BC;AAzBY,cAAM,SAyBlB,CAAA"}

View File

@ -1,149 +0,0 @@
export interface ContactProperties {
/** A globally unique identifier. */
id?: string;
/** The name of this Contact, suitable for display to end users. */
displayName?: string;
/** An object containing all components of a persons name. */
name?: ContactName;
/** A casual name by which to address the contact. */
nickname?: string;
/** An array of all the contact's phone numbers. */
phoneNumbers?: ContactField[];
/** An array of all the contact's email addresses. */
emails?: ContactField[];
/** An array of all the contact's addresses. */
addresses?: ContactAddress[];
/** An array of all the contact's IM addresses. */
ims?: ContactField[];
/** An array of all the contact's organizations. */
organizations?: ContactOrganization[];
/** The birthday of the contact. */
birthday?: Date;
/** A note about the contact. */
note?: string;
/** An array of the contact's photos. */
photos?: ContactField[];
/** An array of all the user-defined categories associated with the contact. */
categories?: ContactField[];
/** An array of web pages associated with the contact. */
urls?: ContactField[];
}
export interface Contact extends ContactProperties {
/**
* Returns a new Contact object that is a deep copy of the calling object, with the id property set to null
*/
clone(): Contact;
/**
* Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object.
* @param onSuccess Success callback function invoked on success operation.
* @param onError Error callback function, invoked when an error occurs.
*/
remove(onSuccess?: () => void, onError?: (error: Error) => void): void;
/**
* Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists.
* @param onSuccess Success callback function invoked on success operation with che Contact object.
* @param onError Error callback function, invoked when an error occurs.
*/
save(onSuccess?: (contact: Contact) => void, onError?: (error: Error) => void): void;
}
export interface ContactName {
/** The complete name of the contact. */
formatted?: string;
/** The contact's family name. */
familyName?: string;
/** The contact's given name. */
givenName?: string;
/** The contact's middle name. */
middleName?: string;
/** The contact's prefix (example Mr. or Dr.) */
honorificPrefix?: string;
/** The contact's suffix (example Esq.). */
honorificSuffix?: string;
}
export interface ContactField {
/** A string that indicates what type of field this is, home for example. */
type: string;
/** The value of the field, such as a phone number or email address. */
value: string;
/** Set to true if this ContactField contains the user's preferred value. */
pref: boolean;
}
export interface ContactAddress {
/** Set to true if this ContactAddress contains the user's preferred value. */
pref?: boolean;
/** A string indicating what type of field this is, home for example. */
type?: string;
/** The full address formatted for display. */
formatted?: string;
/** The full street address. */
streetAddress?: string;
/** The city or locality. */
locality?: string;
/** The state or region. */
region?: string;
/** The zip code or postal code. */
postalCode?: string;
/** The country name. */
country?: string;
}
export interface ContactOrganization {
/** Set to true if this ContactOrganization contains the user's preferred value. */
pref?: boolean;
/** A string that indicates what type of field this is, home for example. */
type?: string;
/** The name of the organization. */
name?: string;
/** The department the contract works for. */
department?: string;
/** The contact's title at the organization. */
title?: string;
}
/**
* Access and manage Contacts on the device.
*
* Requires plugin: `cordova-plugin-contacts`
* For full info, please see the [Cordova Contacts plugin docs](https://github.com/apache/cordova-plugin-contacts)
*
* @usage
*
* ```js
* Contacts.save({
* displayName: "Mr. Ionitron"
* }).then((contact) => {}, (err) => {})
* ```
*
* See the `save()` docs for a full list of fields.
*
*/
export declare class Contacts {
/**
* Create a new Contact object.
*
* @param options {Object} Object whose properties the created Contact should have.
* @return {Contact} Returns the created contact
*/
static create(options: ContactProperties): Contact;
/**
* Search for contacts in the Contacts list.
*
* Example: Contacts.find(['*'], { filter: 'Max' }) // will search for a displayName of 'Max'
*
* @param fields {string[]} Contact fields to be used as a search qualifier.
* A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR.
* A contactFields value of "*" searches all contact fields.
*
* @param options {Object} the options to query with:
* filter: The search string used to find navigator.contacts. (string) (Default: "")
* multiple: Determines if the find operation returns multiple navigator.contacts. (Boolean) (Default: false)
* desiredFields: Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. (DOMString[]) [Optional]
* hasPhoneNumber(Android only): Filters the search to only return contacts with a phone number informed. (Boolean) (Default: false)
*
* @return Returns a Promise that resolves with the search results (an array of Contact objects)
*/
static find(fields: string[], options?: any): Promise<Contact[]>;
/**
* Select a single Contact.
* @return Returns a Promise that resolves with the selected Contact
*/
static pickContact(): Promise<Contact>;
}

View File

@ -1,102 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Access and manage Contacts on the device.
*
* Requires plugin: `cordova-plugin-contacts`
* For full info, please see the [Cordova Contacts plugin docs](https://github.com/apache/cordova-plugin-contacts)
*
* @usage
*
* ```js
* Contacts.save({
* displayName: "Mr. Ionitron"
* }).then((contact) => {}, (err) => {})
* ```
*
* See the `save()` docs for a full list of fields.
*
*/
var Contacts = (function () {
function Contacts() {
}
/**
* Create a new Contact object.
*
* @param options {Object} Object whose properties the created Contact should have.
* @return {Contact} Returns the created contact
*/
Contacts.create = function (options) {
return new Contact();
};
;
/**
* Search for contacts in the Contacts list.
*
* Example: Contacts.find(['*'], { filter: 'Max' }) // will search for a displayName of 'Max'
*
* @param fields {string[]} Contact fields to be used as a search qualifier.
* A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR.
* A contactFields value of "*" searches all contact fields.
*
* @param options {Object} the options to query with:
* filter: The search string used to find navigator.contacts. (string) (Default: "")
* multiple: Determines if the find operation returns multiple navigator.contacts. (Boolean) (Default: false)
* desiredFields: Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. (DOMString[]) [Optional]
* hasPhoneNumber(Android only): Filters the search to only return contacts with a phone number informed. (Boolean) (Default: false)
*
* @return Returns a Promise that resolves with the search results (an array of Contact objects)
*/
Contacts.find = function (fields, options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Select a single Contact.
* @return Returns a Promise that resolves with the selected Contact
*/
Contacts.pickContact = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
__decorate([
plugin_1.Cordova({
sync: true
})
], Contacts, "create", null);
__decorate([
plugin_1.Cordova({
successIndex: 1,
errorIndex: 2
})
], Contacts, "find", null);
__decorate([
plugin_1.Cordova()
], Contacts, "pickContact", null);
Contacts = __decorate([
plugin_1.Plugin({
name: 'Contacts',
plugin: 'cordova-plugin-contacts',
pluginRef: 'navigator.contacts',
repo: 'https://github.com/apache/cordova-plugin-contacts'
})
], Contacts);
return Contacts;
})();
exports.Contacts = Contacts;
//# sourceMappingURL=contacts.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/plugins/contacts.ts"],"names":["Contacts","Contacts.constructor","Contacts.create","Contacts.find","Contacts.pickContact"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AA6LzC;;;;;;;;;;;;;;;;GAgBG;AACH;IAAAA;IA+DAC,CAACA;IAxDCD;;;;;OAKGA;IAIIA,eAAMA,GAHbA,UAGcA,OAA0BA;QACtCE,MAAMA,CAACA,IAAIA,OAAOA,EAAEA,CAACA;IACvBA,CAACA;;IAEDF;;;;;;;;;;;;;;;;OAgBGA;IAKIA,aAAIA,GAJXA,UAIYA,MAAgBA,EAAEA,OAAaA;QACzCG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAYA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAClDA,CAACA;;IAEDH;;;OAGGA;IAEIA,oBAAWA,GADlBA;QAEEI,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAUA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAChDA,CAACA;;IAjDDJ;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,kBAAMA,QAEZA;IAmBDA;QAACA,gBAAOA,CAACA;YACPA,YAAYA,EAAEA,CAACA;YACfA,UAAUA,EAAEA,CAACA;SACdA,CAACA;OACKA,gBAAIA,QAOVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAOjBA;IA9DHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,oBAAoBA;YAC/BA,IAAIA,EAAEA,mDAAmDA;SAC1DA,CAACA;iBA0DDA;IAADA,eAACA;AAADA,CAACA,AA/DD,IA+DC;AAzDY,gBAAQ,WAyDpB,CAAA"}

View File

@ -1,37 +0,0 @@
export interface Device {
/** Get the version of Cordova running on the device. */
cordova: string;
/**
* The device.model returns the name of the device's model or product. The value is set
* by the device manufacturer and may be different across versions of the same product.
*/
model: string;
/** Get the device's operating system name. */
platform: string;
/** Get the device's Universally Unique Identifier (UUID). */
uuid: string;
/** Get the operating system version. */
version: string;
/** Get the device's manufacturer. */
manufacturer: string;
/** Whether the device is running on a simulator. */
isVirtual: boolean;
/** Get the device hardware serial number. */
serial: string;
}
/**
* Access information about the underlying device and platform.
*
* @usage
* ```js
* let info = Device.getDevice();
* ```
*/
export declare class Device {
/**
* Returns the whole device object.
*
* @returns {Object} The device object.
*/
static getDevice(): Device;
}

View File

@ -1,40 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Access information about the underlying device and platform.
*
* @usage
* ```js
* let info = Device.getDevice();
* ```
*/
var Device = (function () {
function Device() {
}
/**
* Returns the whole device object.
*
* @returns {Object} The device object.
*/
Device.getDevice = function () {
return window.device;
};
__decorate([
plugin_1.RequiresPlugin
], Device, "getDevice", null);
Device = __decorate([
plugin_1.Plugin({
name: 'Device',
plugin: 'cordova-plugin-device',
pluginRef: 'device'
})
], Device);
return Device;
})();
exports.Device = Device;
//# sourceMappingURL=device.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/plugins/device.ts"],"names":["Device","Device.constructor","Device.getDevice"],"mappings":";;;;;;AAAA,uBAAqC,UAAU,CAAC,CAAA;AA4BhD;;;;;;;GAOG;AACH;IAAAA;IAgBAC,CAACA;IATDD;;;;OAIGA;IAEMA,gBAASA,GADhBA;QAEEE,MAAMA,CAACA,MAAMA,CAACA,MAAMA,CAACA;IACvBA,CAACA;IAHDF;QAACA,uBAAcA;OACRA,mBAASA,QAEfA;IAfHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,QAAQA;SACpBA,CAACA;eAYDA;IAADA,aAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,cAAM,SAWlB,CAAA"}

View File

@ -1,198 +0,0 @@
/**
* Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
*
* Requires Cordova plugin: `cordova-plugin-facebook4`. For more info, please see the [Facebook Connect](https://github.com/jeduan/cordova-plugin-facebook4).
*
* #### Installation
*
* To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps).
*
* [![fb-getstarted-1](/img/docs/native/Facebook/1.png)](https://developers.facebook.com/apps/)
*
* Retrieve the `App ID` and `App Name`.
*
* [![fb-getstarted-2](/img/docs/native/Facebook/2.png)](https://developers.facebook.com/apps/)
*
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
*
* ```bash
* cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
* ```
*
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
*
* [![fb-getstarted-3](/img/docs/native/Facebook/3.png)](https://developers.facebook.com/apps/)
*
* Click `'Add Platform'`.
*
* [![fb-getstarted-4](/img/docs/native/Facebook/4.png)](https://developers.facebook.com/apps/)
*
* At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project.
*
* Take note of the `id` for the next step:
* ```
* <widget id="com.mycompany.testapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
* ```
*
* You can also edit the `id` to whatever you'd like it to be.
*
* #### iOS Install
* Under 'Bundle ID', add the `id` from your `config.xml` file:
*
* [![fb-getstarted-5](/img/docs/native/Facebook/5.png)](https://developers.facebook.com/apps/)
*
*
* #### Android Install
* Under 'Google Play Package Name', add the `id` from your `config.xml` file:
*
* [![fb-getstarted-6](/img/docs/native/Facebook/6.png)](https://developers.facebook.com/apps/)
*
*
* And that's it! You can now make calls to Facebook using the plugin.
*
* ## Events
*
* App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
*
* - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)
* - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)
* - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
*
* Activation events are automatically tracked for you in the plugin.
*
* Events are listed on the [insights page](https://www.facebook.com/insights/).
*
* For tracking events, see `logEvent` and `logPurchase`.
*
*/
export declare class Facebook {
/**
* Login to Facebook to authenticate this app.
*
* ```
* {
* status: "connected",
* authResponse: {
* session_key: true,
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
* expiresIn: 5183979,
* sig: "...",
* secret: "...",
* userID: "634565435"
* }
* }
* ```
*
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
*/
static login(permissions: string[]): Promise<any>;
/**
* Logout of Facebook.
*
* For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
*/
static logout(): Promise<any>;
/**
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
*
* 1) the user is logged into Facebook and has authenticated your application (connected)
* 2) the user is logged into Facebook but has not authenticated your application (not_authorized)
* 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown)
*
* Resolves with a response like:
*
* ```
* {
* authResponse: {
* userID: "12345678912345",
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
* session_Key: true,
* expiresIn: "5183738",
* sig: "..."
* },
* status: "connected"
* }
* ```
*
* For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
*
* @return Returns a Promise that resolves with a status, or rejects with an error
*/
static getLoginStatus(): Promise<any>;
/**
* Get a Facebook access token for using Facebook services.
*
* @return Returns a Promise that resolves with an access token, or rejects with an error
*/
static getAccessToken(): Promise<string>;
/**
* Show one of various Facebook dialogs. Example of options for a Share dialog:
*
* ```
* {
* method: "share",
* href: "http://example.com",
* caption: "Such caption, very feed.",
* description: "Much description",
* picture: 'http://example.com/image.png'
* }
* ```
*
* For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
* @options {Object} options The dialog options
* @return Returns a Promise that resolves with success data, or rejects with an error
*/
static showDialog(options: any): Promise<any>;
/**
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
*
* For more information see:
*
* Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api
* Graph Explorer - https://developers.facebook.com/tools/explorer
* Graph API - https://developers.facebook.com/docs/graph-api
*
* @param {string} requestPath Graph API endpoint you want to call
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
*/
static api(requestPath: string, permissions: string[]): Promise<any>;
/**
* Log an event. For more information see the Events section above.
*
* @param {string} name Name of the event
* @param {Object} [params] An object containing extra data to log with the event
* @param {number} [valueToSum] any value to be added to added to a sum on each event
* @return
*/
static logEvent(name: string, params?: Object, valueToSum?: number): Promise<any>;
/**
* Log a purchase. For more information see the Events section above.
*
* @param {number} value Value of the purchase.
* @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
* @return Returns a Promise
*/
static logPurchase(value: number, currency: string): Promise<any>;
/**
* Open App Invite dialog. Does not require login.
*
* For more information see:
*
* the App Invites Overview - https://developers.facebook.com/docs/app-invites/overview
* the App Links docs - https://developers.facebook.com/docs/applinks
*
*
* @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
* picture: image to be displayed in the App Invite dialog
*
* @return Returns a Promise that resolves with the result data, or rejects with an error
*/
static appInvite(options: {
url: string;
picture: string;
}): Promise<any>;
}

View File

@ -1,308 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
*
* Requires Cordova plugin: `cordova-plugin-facebook4`. For more info, please see the [Facebook Connect](https://github.com/jeduan/cordova-plugin-facebook4).
*
* #### Installation
*
* To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps).
*
* [![fb-getstarted-1](/img/docs/native/Facebook/1.png)](https://developers.facebook.com/apps/)
*
* Retrieve the `App ID` and `App Name`.
*
* [![fb-getstarted-2](/img/docs/native/Facebook/2.png)](https://developers.facebook.com/apps/)
*
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
*
* ```bash
* cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
* ```
*
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
*
* [![fb-getstarted-3](/img/docs/native/Facebook/3.png)](https://developers.facebook.com/apps/)
*
* Click `'Add Platform'`.
*
* [![fb-getstarted-4](/img/docs/native/Facebook/4.png)](https://developers.facebook.com/apps/)
*
* At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project.
*
* Take note of the `id` for the next step:
* ```
* <widget id="com.mycompany.testapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
* ```
*
* You can also edit the `id` to whatever you'd like it to be.
*
* #### iOS Install
* Under 'Bundle ID', add the `id` from your `config.xml` file:
*
* [![fb-getstarted-5](/img/docs/native/Facebook/5.png)](https://developers.facebook.com/apps/)
*
*
* #### Android Install
* Under 'Google Play Package Name', add the `id` from your `config.xml` file:
*
* [![fb-getstarted-6](/img/docs/native/Facebook/6.png)](https://developers.facebook.com/apps/)
*
*
* And that's it! You can now make calls to Facebook using the plugin.
*
* ## Events
*
* App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
*
* - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)
* - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)
* - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
*
* Activation events are automatically tracked for you in the plugin.
*
* Events are listed on the [insights page](https://www.facebook.com/insights/).
*
* For tracking events, see `logEvent` and `logPurchase`.
*
*/
var Facebook = (function () {
function Facebook() {
}
// @Cordova()
// static browserInit(appId: number){
// return new Promise<any>((res, rej) => {});
// }
/**
* Login to Facebook to authenticate this app.
*
* ```
* {
* status: "connected",
* authResponse: {
* session_key: true,
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
* expiresIn: 5183979,
* sig: "...",
* secret: "...",
* userID: "634565435"
* }
* }
* ```
*
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
*/
Facebook.login = function (permissions) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Logout of Facebook.
*
* For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
*/
Facebook.logout = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
*
* 1) the user is logged into Facebook and has authenticated your application (connected)
* 2) the user is logged into Facebook but has not authenticated your application (not_authorized)
* 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown)
*
* Resolves with a response like:
*
* ```
* {
* authResponse: {
* userID: "12345678912345",
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
* session_Key: true,
* expiresIn: "5183738",
* sig: "..."
* },
* status: "connected"
* }
* ```
*
* For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
*
* @return Returns a Promise that resolves with a status, or rejects with an error
*/
Facebook.getLoginStatus = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Get a Facebook access token for using Facebook services.
*
* @return Returns a Promise that resolves with an access token, or rejects with an error
*/
Facebook.getAccessToken = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Show one of various Facebook dialogs. Example of options for a Share dialog:
*
* ```
* {
* method: "share",
* href: "http://example.com",
* caption: "Such caption, very feed.",
* description: "Much description",
* picture: 'http://example.com/image.png'
* }
* ```
*
* For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
* @options {Object} options The dialog options
* @return Returns a Promise that resolves with success data, or rejects with an error
*/
Facebook.showDialog = function (options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
*
* For more information see:
*
* Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api
* Graph Explorer - https://developers.facebook.com/tools/explorer
* Graph API - https://developers.facebook.com/docs/graph-api
*
* @param {string} requestPath Graph API endpoint you want to call
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
*/
Facebook.api = function (requestPath, permissions) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Log an event. For more information see the Events section above.
*
* @param {string} name Name of the event
* @param {Object} [params] An object containing extra data to log with the event
* @param {number} [valueToSum] any value to be added to added to a sum on each event
* @return
*/
Facebook.logEvent = function (name, params, valueToSum) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Log a purchase. For more information see the Events section above.
*
* @param {number} value Value of the purchase.
* @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
* @return Returns a Promise
*/
Facebook.logPurchase = function (value, currency) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Open App Invite dialog. Does not require login.
*
* For more information see:
*
* the App Invites Overview - https://developers.facebook.com/docs/app-invites/overview
* the App Links docs - https://developers.facebook.com/docs/applinks
*
*
* @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
* picture: image to be displayed in the App Invite dialog
*
* @return Returns a Promise that resolves with the result data, or rejects with an error
*/
Facebook.appInvite = function (options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
__decorate([
plugin_1.Cordova()
], Facebook, "login", null);
__decorate([
plugin_1.Cordova()
], Facebook, "logout", null);
__decorate([
plugin_1.Cordova()
], Facebook, "getLoginStatus", null);
__decorate([
plugin_1.Cordova()
], Facebook, "getAccessToken", null);
__decorate([
plugin_1.Cordova()
], Facebook, "showDialog", null);
__decorate([
plugin_1.Cordova()
], Facebook, "api", null);
__decorate([
plugin_1.Cordova()
], Facebook, "logEvent", null);
__decorate([
plugin_1.Cordova()
], Facebook, "logPurchase", null);
__decorate([
plugin_1.Cordova()
], Facebook, "appInvite", null);
Facebook = __decorate([
plugin_1.Plugin({
name: 'Facebook',
plugin: 'cordova-plugin-facebook4',
pluginRef: 'facebookConnectPlugin'
})
], Facebook);
return Facebook;
})();
exports.Facebook = Facebook;
//# sourceMappingURL=facebook.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/plugins/facebook.ts"],"names":["Facebook","Facebook.constructor","Facebook.login","Facebook.logout","Facebook.getLoginStatus","Facebook.getAccessToken","Facebook.showDialog","Facebook.api","Facebook.logEvent","Facebook.logPurchase","Facebook.appInvite"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH;IAAAA;IA6NAC,CAACA;IAtNCD,aAAaA;IACbA,qCAAqCA;IACrCA,+CAA+CA;IAC/CA,IAAIA;IAEJA;;;;;;;;;;;;;;;;;;;OAmBGA;IAEIA,cAAKA,GADZA,UACaA,WAAqBA;QAChCE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDF;;;;;OAKGA;IAEIA,eAAMA,GADbA;QAEEG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBGA;IAEIA,uBAAcA,GADrBA;QAEEI,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDJ;;;;OAIGA;IAEIA,uBAAcA,GADrBA;QAEEK,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAASA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC/CA,CAACA;IAEDL;;;;;;;;;;;;;;;;OAgBGA;IAEIA,mBAAUA,GADjBA,UACkBA,OAAYA;QAC5BM,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDN;;;;;;;;;;;;OAYGA;IAEIA,YAAGA,GADVA,UACWA,WAAmBA,EAAEA,WAAqBA;QACnDO,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDP;;;;;;;OAOGA;IAEIA,iBAAQA,GADfA,UACgBA,IAAYA,EAAEA,MAAeA,EAAEA,UAAmBA;QAChEQ,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDR;;;;;;OAMGA;IAEIA,oBAAWA,GADlBA,UACmBA,KAAaA,EAAEA,QAAgBA;QAChDS,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDT;;;;;;;;;;;;;;OAcGA;IAEIA,kBAASA,GADhBA,UACiBA,OAGhBA;QACCU,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IA5LDV;QAACA,gBAAOA,EAAEA;OACHA,iBAAKA,QAOXA;IAQDA;QAACA,gBAAOA,EAAEA;OACHA,kBAAMA,QAOZA;IA4BDA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAOpBA;IAODA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAOpBA;IAmBDA;QAACA,gBAAOA,EAAEA;OACHA,sBAAUA,QAOhBA;IAeDA;QAACA,gBAAOA,EAAEA;OACHA,eAAGA,QAOTA;IAUDA;QAACA,gBAAOA,EAAEA;OACHA,oBAAQA,QAOdA;IASDA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAOjBA;IAiBDA;QAACA,gBAAOA,EAAEA;OACHA,qBAASA,QAUfA;IA5NHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,0BAA0BA;YAClCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;iBAyNDA;IAADA,eAACA;AAADA,CAACA,AA7ND,IA6NC;AAxNY,gBAAQ,WAwNpB,CAAA"}

View File

@ -1,120 +0,0 @@
import { Observable } from 'rxjs/Observable';
export interface Coordinates {
/**
* a double representing the position's latitude in decimal degrees.
*/
latitude: number;
/**
* A double representing the position's longitude in decimal degrees.
*/
longitude: number;
/**
* A double representing the accuracy of the latitude and longitude properties,
* expressed in meters.
*/
accuracy: number;
/**
* A double representing the position's altitude in metres, relative to sea
* level. This value can be null if the implementation cannot provide the data.
*/
altitude: number;
/**
* A double representing the accuracy of the altitude expressed in meters.
* This value can be null.
*/
altitudeAccuracy: number;
/**
* A double representing the direction in which the device is traveling. This
* value, specified in degrees, indicates how far off from heading true north
* the device is. 0 degrees represents true north, and the direction is
* determined clockwise (which means that east is 90 degrees and west is 270
* degrees). If speed is 0, heading is NaN. If the device is unable to provide
* heading information, this value is null.
*/
heading: number;
/**
* A double representing the velocity of the device in meters per second.
* This value can be null.
*/
speed: number;
}
export interface Geoposition {
/**
* A Coordinates object defining the current location
*/
coords: Coordinates;
/**
* A timestamp representing the time at which the location was retrieved.
*/
timestamp: number;
}
export interface GeolocationOptions {
/**
* Is a positive long value indicating the maximum age in milliseconds of a
* possible cached position that is acceptable to return. If set to 0, it
* means that the device cannot use a cached position and must attempt to
* retrieve the real current position. If set to Infinity the device must
* return a cached position regardless of its age. Default: 0.
*/
maximumAge: number;
/**
* Is a positive long value representing the maximum length of time
* (in milliseconds) the device is allowed to take in order to return a
* position. The default value is Infinity, meaning that getCurrentPosition()
* won't return until the position is available.
*/
timeout: number;
/**
* Indicates the application would like to receive the best possible results.
* If true and if the device is able to provide a more accurate position, it
* will do so. Note that this can result in slower response times or increased
* power consumption (with a GPS chip on a mobile device for example). On the
* other hand, if false, the device can take the liberty to save resources by
* responding more quickly and/or using less power. Default: false.
* @type {boolean}
*/
enableHighAccuracy: boolean;
}
/**
* Get geolocation data.
*
* @usage
* ```js
* Geolocation.getCurrentPosition().then((resp) => {
* //resp.coords.latitude
* //resp.coords.longitude
* })
*
* let watch = Geolocation.watchPosition();
* watch.subscribe((data) => {
* //data.coords.latitude
* //data.coords.longitude
* })
* ```
*/
export declare class Geolocation {
/**
* Get the device's current position.
*
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
*/
static getCurrentPosition(options: GeolocationOptions): Promise<Geoposition>;
/**
* Watch the current device's position. Clear the watch by unsubscribing from
* Observable changes.
*
* ```
* var subscription = Geolocation.watchPosition().subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
* });
*
* // To stop notifications
* subscription.unsubscribe();
* ```
*
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
*/
static watchPosition(options: GeolocationOptions): Observable<Geoposition>;
}

View File

@ -1,88 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
var Observable_1 = require('rxjs/Observable');
/**
* Get geolocation data.
*
* @usage
* ```js
* Geolocation.getCurrentPosition().then((resp) => {
* //resp.coords.latitude
* //resp.coords.longitude
* })
*
* let watch = Geolocation.watchPosition();
* watch.subscribe((data) => {
* //data.coords.latitude
* //data.coords.longitude
* })
* ```
*/
var Geolocation = (function () {
function Geolocation() {
}
/**
* Get the device's current position.
*
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
*/
Geolocation.getCurrentPosition = function (options) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Watch the current device's position. Clear the watch by unsubscribing from
* Observable changes.
*
* ```
* var subscription = Geolocation.watchPosition().subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
* });
*
* // To stop notifications
* subscription.unsubscribe();
* ```
*
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
*/
Geolocation.watchPosition = function (options) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
;
__decorate([
plugin_1.Cordova()
], Geolocation, "getCurrentPosition", null);
__decorate([
plugin_1.Cordova({
callbackOrder: 'reverse',
observable: true,
clearFunction: 'clearWatch'
})
], Geolocation, "watchPosition", null);
Geolocation = __decorate([
plugin_1.Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation'
})
], Geolocation);
return Geolocation;
})();
exports.Geolocation = Geolocation;
//# sourceMappingURL=geolocation.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../src/plugins/geolocation.ts"],"names":["Geolocation","Geolocation.constructor","Geolocation.getCurrentPosition","Geolocation.watchPosition"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AACzC,2BAAyB,iBAAiB,CAAC,CAAA;AA6F3C;;;;;;;;;;;;;;;;GAgBG;AACH;IAAAA;IAmDAC,CAACA;IA7CCD;;;;;OAKGA;IAEIA,8BAAkBA,GADzBA,UAC0BA,OAA2BA;QACnDE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAcA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IACpDA,CAACA;IAEDF;;;;;;;;;;;;;;;OAeGA;IAMIA,yBAAaA,GALpBA,UAKqBA,OAA2BA;QAC9CG,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAcA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IACrDA,CAACA;;IAtCDH;QAACA,gBAAOA,EAAEA;OACHA,iCAAkBA,QAOxBA;IAkBDA;QAACA,gBAAOA,CAACA;YACPA,aAAaA,EAAEA,SAASA;YACxBA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,YAAYA;SAC5BA,CAACA;OACKA,4BAAaA,QAOnBA;IAlDHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;oBA+CDA;IAADA,kBAACA;AAADA,CAACA,AAnDD,IAmDC;AA9CY,mBAAW,cA8CvB,CAAA"}

View File

@ -1,20 +0,0 @@
export declare const getPlugin: (pluginRef: string) => any;
export declare const isInstalled: (pluginRef: string) => boolean;
export declare const pluginWarn: (pluginName: string, method: string, plugin: string) => void;
export declare const cordovaWarn: (pluginName: string, method: string) => void;
export declare const wrap: (pluginObj: any, methodName: string, opts?: any) => (...args: any[]) => any;
/**
* Class decorator specifying Plugin metadata. Required for all plugins.
*/
export declare function Plugin(config: any): (cls: any) => any;
/**
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export declare function Cordova(opts?: any): (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
value: (...args: any[]) => any;
};
/**
* Before calling the original method, ensure Cordova and the plugin are installed.
*/
export declare function RequiresPlugin(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>): TypedPropertyDescriptor<any>;

189
dist/plugins/plugin.js vendored
View File

@ -1,189 +0,0 @@
var util_1 = require('../util');
var Observable_1 = require('rxjs/Observable');
exports.getPlugin = function (pluginRef) {
return util_1.get(window, pluginRef);
};
exports.isInstalled = function (pluginRef) {
return !!exports.getPlugin(pluginRef);
};
exports.pluginWarn = function (pluginName, method, plugin) {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method +
', but the ' + pluginName + ' plugin is not installed. Install the ' +
plugin + ' plugin');
}
else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed. Install the ' + plugin + ' plugin');
}
};
exports.cordovaWarn = function (pluginName, method) {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
}
else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
}
};
function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
// Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers.
if (opts === void 0) { opts = {}; }
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder == 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
args.unshift(reject);
args.unshift(resolve);
}
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
// If we've specified a success/error index
args.splice(opts.successIndex, 0, resolve);
args.splice(opts.errorIndex, 0, reject);
}
else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
args.push(resolve);
args.push(reject);
}
var pluginInstance = exports.getPlugin(pluginObj.pluginRef);
if (!pluginInstance) {
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
if (!window.cordova) {
exports.cordovaWarn(pluginObj.name, methodName);
reject({
error: 'cordova_not_available'
});
return;
}
exports.pluginWarn(pluginObj.name, methodName, pluginObj.name);
reject({
error: 'plugin_not_installed'
});
return;
}
console.log('Cordova calling', pluginObj.name, methodName, args);
// TODO: Illegal invocation needs window context
return util_1.get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
}
function getPromise(cb) {
if (window.Promise) {
console.log('Native promises available...');
return new Promise(function (resolve, reject) {
cb(resolve, reject);
});
}
else if (window.angular) {
var $q_1 = window.angular.injector(['ng']).get('$q');
console.log('Loaded $q', $q_1);
return $q_1(function (resolve, reject) {
cb(resolve, reject);
});
}
else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
}
}
function wrapPromise(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
return getPromise(function (resolve, reject) {
callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
});
}
function wrapObservable(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
return new Observable_1.Observable(function (observer) {
var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
return function () {
try {
if (opts.clearWithArgs) {
return util_1.get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
}
return util_1.get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
}
catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
console.log(e);
}
};
});
}
exports.wrap = function (pluginObj, methodName, opts) {
if (opts === void 0) { opts = {}; }
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
if (opts.sync) {
return callCordovaPlugin(pluginObj, methodName, args, opts);
}
else if (opts.observable) {
return wrapObservable(pluginObj, methodName, args, opts);
}
else {
return wrapPromise(pluginObj, methodName, args, opts);
}
};
};
/**
* Class decorator specifying Plugin metadata. Required for all plugins.
*/
function Plugin(config) {
return function (cls) {
// Add these fields to the class
for (var k in config) {
cls[k] = config[k];
}
cls['installed'] = function () {
return !!exports.getPlugin(config.pluginRef);
};
return cls;
};
}
exports.Plugin = Plugin;
/**
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
function Cordova(opts) {
if (opts === void 0) { opts = {}; }
return function (target, methodName, descriptor) {
var originalMethod = descriptor.value;
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return exports.wrap(this, methodName, opts).apply(this, args);
}
};
};
}
exports.Cordova = Cordova;
/**
* Before calling the original method, ensure Cordova and the plugin are installed.
*/
function RequiresPlugin(target, key, descriptor) {
var originalMethod = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
console.log('Calling', this);
if (!window.cordova) {
exports.cordovaWarn(this.name, null);
return;
}
var pluginInstance = exports.getPlugin(this.pluginRef);
if (!pluginInstance) {
exports.pluginWarn(this.name, null, this.name);
return;
}
return originalMethod.apply(this, args);
};
return descriptor;
}
exports.RequiresPlugin = RequiresPlugin;
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

252
dist/plugins/push.d.ts vendored
View File

@ -1,252 +0,0 @@
export declare type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
export interface RegistrationEventResponse {
/**
* The registration ID provided by the 3rd party remote push service.
*/
registrationId: string;
}
export interface NotificationEventResponse {
/**
* The text of the push message sent from the 3rd party service.
*/
message: string;
/**
* The optional title of the push message sent from the 3rd party service.
*/
title?: string;
/**
* The number of messages to be displayed in the badge iOS or message count in the notification shade in Android.
* For windows, it represents the value in the badge notification which could be a number or a status glyph.
*/
count: string;
/**
* The name of the sound file to be played upon receipt of the notification.
*/
sound: string;
/**
* The path of the image file to be displayed in the notification.
*/
image: string;
/**
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
*/
additionalData: NotificationEventAdditionalData;
}
/**
* TODO: document all possible properties (not just Android)
*
* Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation
*
* Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one
* so that he could specify any custom code without having to use array notation (map['prop']) for all of them.
*/
export interface NotificationEventAdditionalData {
[name: string]: any;
/**
* Whether the notification was received while the app was in the foreground
*/
foreground?: boolean;
collapse_key?: string;
from?: string;
notId?: string;
}
export interface PushNotification {
/**
* The event registration will be triggered on each successful registration with the 3rd party push service.
* @param event
* @param callback
*/
on(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
/**
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
* @param event
* @param callback
*/
on(event: "notification", callback: (response: NotificationEventResponse) => any): void;
/**
* The event error will trigger when an internal error occurs and the cache is aborted.
* @param event
* @param callback
*/
on(event: "error", callback: (response: Error) => any): void;
/**
*
* @param event Name of the event to listen to. See below(above) for all the event names.
* @param callback is called when the event is triggered.
* @param event
* @param callback
*/
on(event: string, callback: (response: EventResponse) => any): void;
off(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
off(event: "notification", callback: (response: NotificationEventResponse) => any): void;
off(event: "error", callback: (response: Error) => any): void;
/**
* As stated in the example, you will have to store your event handler if you are planning to remove it.
* @param event Name of the event type. The possible event names are the same as for the push.on function.
* @param callback handle to the function to get removed.
* @param event
* @param callback
*/
off(event: string, callback: (response: EventResponse) => any): void;
/**
* The unregister method is used when the application no longer wants to receive push notifications.
* Beware that this cleans up all event handlers previously registered,
* so you will need to re-register them if you want them to function again without an application reload.
* @param successHandler
* @param errorHandler
*/
unregister(successHandler: () => any, errorHandler?: () => any): void;
/**
* 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.
* Passing 0 will clear the badge.
* Each notification event contains a data.count value which can be used to set the badge to correct number.
* @param successHandler
* @param errorHandler
* @param count
*/
setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count?: number): void;
/**
* 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
* @param errorHandler
*/
getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void;
/**
* 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
* @param errorHandler
*/
finish(successHandler: () => any, errorHandler: () => any): void;
}
export interface iOSPushOptions {
/**
* Maps to the project number in the Google Developer Console. Setting this
* uses GCM for notifications instead of native.
*/
senderID: string;
/**
* Whether to use prod or sandbox GCM setting.
*/
gcmSandbox?: boolean | string;
/**
* If true the device shows an alert on receipt of notification.
* **Note**: the value you set this option to the first time you call the init
* method will be how the application always acts. Once this is set
* programmatically in the init method it can only be changed manually by the
* user in Settings>Notifications>App Name. This is normal iOS behaviour.
*/
alert?: boolean | string;
/**
* If true the device sets the badge number on receipt of notification.
* **Note**: the value you set this option to the first time you call the init
* method will be how the application always acts. Once this is set
* programmatically in the init method it can only be changed manually by the
* user in Settings>Notifications>App Name. This is normal iOS behaviour.
*/
badge?: boolean | string;
/**
* If true the device plays a sound on receipt of notification.
* **Note**: the value you set this option to the first time you call the init
* method will be how the application always acts. Once this is set
* programmatically in the init method it can only be changed manually by the
* user in Settings>Notifications>App Name. This is normal iOS behaviour.
*/
sound?: boolean | string;
/**
* If true the badge will be cleared on app startup.
*/
clearBadge?: boolean | string;
/**
* If the array contains one or more strings each string will be used to
* subscribe to a GcmPubSub topic.
* **Note**: only usable in conjunction with `senderID`.
*/
topics?: string[];
}
export interface AndroidPushOptions {
/**
* Maps to the project number in the Google Developer Console.
*/
senderID: string;
/**
* The name of a drawable resource to use as the small-icon. The name should
* not include the extension.
*/
icon?: string;
/**
* Sets the background color of the small icon on Android 5.0 and greater.
* [Supported Formats](http://developer.android.com/intl/ru/reference/android/graphics/Color.html#parseColor(java.lang.String))
*/
iconColor?: string;
/**
* If true it plays the sound specified in the push data or the default system
* sound.
*/
sound?: boolean | string;
/**
* If true the device vibrates on receipt of notification.
*/
vibrate?: boolean | string;
/**
* If true the app clears all pending notifications when it is closed.
*/
clearNotifications?: boolean | string;
/**
* If true will always show a notification, even when the app is on the
* foreground.
*/
forceShow?: boolean | string;
/**
* If the array contains one or more strings each string will be used to
* subscribe to a GcmPubSub topic.
*/
topics: string[];
}
export interface PushOptions {
ios?: iOSPushOptions;
android?: AndroidPushOptions;
windows?: {};
}
/**
* Register and receive push notifications.
*
* Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push).
*
*
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
*/
export declare class Push {
/**
* Initialize the plugin on the native side.
*
* ```
* var push = Push.init({
* android: {
* senderID: "12345679"
* },
* ios: {
* alert: "true",
* badge: true,
* sound: 'false'
* },
* windows: {}
* });
* ```
*
* @param {PushOptions} options The Push [options](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#parameters).
* @return {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object.
*/
static init(options: PushOptions): PushNotification;
/**
* Check whether the push notification permission has been granted.
* @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
*/
static hasPermission(): Promise<{
isEnabled: boolean;
}>;
}

72
dist/plugins/push.js vendored
View File

@ -1,72 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Register and receive push notifications.
*
* Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push).
*
*
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
*/
var Push = (function () {
function Push() {
}
/**
* Initialize the plugin on the native side.
*
* ```
* var push = Push.init({
* android: {
* senderID: "12345679"
* },
* ios: {
* alert: "true",
* badge: true,
* sound: 'false'
* },
* windows: {}
* });
* ```
*
* @param {PushOptions} options The Push [options](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#parameters).
* @return {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object.
*/
Push.init = function (options) {
return new PushNotification();
};
/**
* Check whether the push notification permission has been granted.
* @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
*/
Push.hasPermission = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
__decorate([
plugin_1.Cordova({
sync: true
})
], Push, "init", null);
__decorate([
plugin_1.Cordova()
], Push, "hasPermission", null);
Push = __decorate([
plugin_1.Plugin({
name: 'Push',
plugin: 'phonegap-plugin-push',
pluginRef: 'PushNotification'
})
], Push);
return Push;
})();
exports.Push = Push;
//# sourceMappingURL=push.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/plugins/push.ts"],"names":["Push","Push.constructor","Push.init","Push.hasPermission"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAuPzC;;;;;;;GAOG;AACH;IAAAA;IA+CAC,CAACA;IAxCCD;;;;;;;;;;;;;;;;;;;OAmBGA;IAIIA,SAAIA,GAHXA,UAGYA,OAAoBA;QAC9BE,MAAMA,CAACA,IAAIA,gBAAgBA,EAAEA,CAACA;IAChCA,CAACA;IAEDF;;;OAGGA;IAEIA,kBAAaA,GADpBA;QAEEG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAyBA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC/DA,CAACA;IAnBDH;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,YAAIA,QAEVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,qBAAaA,QAOnBA;IA9CHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,MAAMA;YACZA,MAAMA,EAAEA,sBAAsBA;YAC9BA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;aA2CDA;IAADA,WAACA;AAADA,CAACA,AA/CD,IA+CC;AA1CY,YAAI,OA0ChB,CAAA"}

View File

@ -1,59 +0,0 @@
/**
* Manage the appearance of the native status bar.
*
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*/
export declare class StatusBar {
/**
* Set whether the status bar overlays the main app view. The default
* is true.
*
* @param {boolean} doesOverlay Whether the status bar overlays the main app view.
*/
static overlaysWebView(doesOverlay: boolean): void;
/**
* Use the default statusbar (dark text, for light backgrounds).
*/
static styleDefault(): void;
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
static styleLightContent(): void;
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
static styleBlackTranslucent(): void;
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
static styleBlackOpaque(): void;
/**
* Set the status bar to a specific named color. Valid options:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
*
* iOS note: you must call StatusBar.setOverlay(false) to enable color changing.
*
* @param {string} colorName The name of the color (from above)
*/
static backgroundColorByName(colorName: string): void;
/**
* Set the status bar to a specific hex color (CSS shorthand supported!).
*
* iOS note: you must call StatusBar.setOverlay(false) to enable color changing.
*
* @param {string} hexString The hex value of the color.
*/
static backgroundColorByHexString(hexString: string): void;
/**
* Hide the StatusBar
*/
static hide(): void;
/**
* Show the StatusBar
*/
static show(): void;
/**
* Whether the StatusBar is currently visible or not.
*/
static isVisible(): any;
}

View File

@ -1,137 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Manage the appearance of the native status bar.
*
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*/
var StatusBar = (function () {
function StatusBar() {
}
/**
* Set whether the status bar overlays the main app view. The default
* is true.
*
* @param {boolean} doesOverlay Whether the status bar overlays the main app view.
*/
StatusBar.overlaysWebView = function (doesOverlay) { };
;
/**
* Use the default statusbar (dark text, for light backgrounds).
*/
StatusBar.styleDefault = function () { };
;
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
StatusBar.styleLightContent = function () { };
;
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
StatusBar.styleBlackTranslucent = function () { };
;
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
StatusBar.styleBlackOpaque = function () { };
;
/**
* Set the status bar to a specific named color. Valid options:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
*
* iOS note: you must call StatusBar.setOverlay(false) to enable color changing.
*
* @param {string} colorName The name of the color (from above)
*/
StatusBar.backgroundColorByName = function (colorName) { };
;
/**
* Set the status bar to a specific hex color (CSS shorthand supported!).
*
* iOS note: you must call StatusBar.setOverlay(false) to enable color changing.
*
* @param {string} hexString The hex value of the color.
*/
StatusBar.backgroundColorByHexString = function (hexString) { };
;
/**
* Hide the StatusBar
*/
StatusBar.hide = function () { };
;
/**
* Show the StatusBar
*/
StatusBar.show = function () { };
;
/**
* Whether the StatusBar is currently visible or not.
*/
StatusBar.isVisible = function () {
return window.StatusBar.isVisible;
};
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "overlaysWebView", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "styleDefault", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "styleLightContent", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "styleBlackTranslucent", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "styleBlackOpaque", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "backgroundColorByName", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "backgroundColorByHexString", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "hide", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], StatusBar, "show", null);
__decorate([
plugin_1.RequiresPlugin
], StatusBar, "isVisible", null);
StatusBar = __decorate([
plugin_1.Plugin({
name: 'StatusBar',
plugin: 'cordova-plugin-statusbar',
pluginRef: 'StatusBar'
})
], StatusBar);
return StatusBar;
})();
exports.StatusBar = StatusBar;
//# sourceMappingURL=statusbar.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"statusbar.js","sourceRoot":"","sources":["../../src/plugins/statusbar.ts"],"names":["StatusBar","StatusBar.constructor","StatusBar.overlaysWebView","StatusBar.styleDefault","StatusBar.styleLightContent","StatusBar.styleBlackTranslucent","StatusBar.styleBlackOpaque","StatusBar.backgroundColorByName","StatusBar.backgroundColorByHexString","StatusBar.hide","StatusBar.show","StatusBar.isVisible"],"mappings":";;;;;;AAAA,uBAA8C,UAAU,CAAC,CAAA;AAIzD;;;;GAIG;AACH;IAAAA;IAiGAC,CAACA;IA3FCD;;;;;OAKGA;IAIIA,yBAAeA,GAHtBA,UAGuBA,WAAoBA,IAAEE,CAACA;;IAE9CF;;OAEGA;IAIIA,sBAAYA,GAHnBA,cAGsBG,CAACA;;IAEvBH;;OAEGA;IAIIA,2BAAiBA,GAHxBA,cAG2BI,CAACA;;IAE5BJ;;OAEGA;IAIIA,+BAAqBA,GAH5BA,cAG+BK,CAACA;;IAEhCL;;OAEGA;IAIIA,0BAAgBA,GAHvBA,cAG0BM,CAACA;;IAE3BN;;;;;;;OAOGA;IAIIA,+BAAqBA,GAH5BA,UAG6BA,SAAiBA,IAAEO,CAACA;;IAEjDP;;;;;;OAMGA;IAIIA,oCAA0BA,GAHjCA,UAGkCA,SAAiBA,IAAEQ,CAACA;;IAEtDR;;OAEGA;IAIIA,cAAIA,GAHXA,cAGcS,CAACA;;IAEfT;;MAEEA;IAIKA,cAAIA,GAHXA,cAGcU,CAACA;;IAEfV;;OAEGA;IAEIA,mBAASA,GADhBA;QAEEW,MAAMA,CAACA,MAAMA,CAACA,SAASA,CAACA,SAASA,CAACA;IACpCA,CAACA;IApFDX;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,4BAAeA,QAAwBA;IAK9CA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,yBAAYA,QAAIA;IAKvBA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,8BAAiBA,QAAIA;IAK5BA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,kCAAqBA,QAAIA;IAKhCA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,6BAAgBA,QAAIA;IAU3BA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,kCAAqBA,QAAqBA;IASjDA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,uCAA0BA,QAAqBA;IAKtDA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,iBAAIA,QAAIA;IAKfA;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,iBAAIA,QAAIA;IAKfA;QAACA,uBAAcA;OACRA,sBAASA,QAEfA;IAhGHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,WAAWA;YACjBA,MAAMA,EAAEA,0BAA0BA;YAClCA,SAASA,EAAEA,WAAWA;SACvBA,CAACA;kBA6FDA;IAADA,gBAACA;AAADA,CAACA,AAjGD,IAiGC;AA5FY,iBAAS,YA4FrB,CAAA"}

View File

@ -1,70 +0,0 @@
import { Observable } from 'rxjs/Observable';
export interface ToastOptions {
message?: string;
duration?: string;
position?: string;
addPixelsY?: number;
}
/**
* This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser.
*
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
*/
export declare class Toast {
/**
* Show a native toast for the given duration at the specified position.
*
* @param {string} message The message to display.
* @param {string} duration Duration to show the toast, either 'short' or 'long'.
* @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static show(message: string, duration: string, position: string): Observable<any>;
/**
* Manually hide any currently visible toast.
* @return {Promise} Returns a Promise that resolves on success.
*/
static hide(): Promise<any>;
/**
* Show a native toast with the given options.
*
* @param {Object} options Options for showing a toast. Available options:
* message The message to display.
* duration Duration to show the toast, either 'short' or 'long'.
* position Where to position the toast, either 'top', 'center', or 'bottom'.
* addPixelsY Offset in pixels to move the toast up or down from its specified position.
*
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showWithOptions(options: ToastOptions): Observable<any>;
/**
* Shorthand for `show(message, 'short', 'top')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showShortTop(message: string): Observable<any>;
/**
* Shorthand for `show(message, 'short', 'center')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showShortCenter(message: string): Observable<any>;
/**
* Shorthand for `show(message, 'short', 'bottom')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showShortBottom(message: string): Observable<any>;
/**
* Shorthand for `show(message, 'long', 'top')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showLongTop(message: string): Observable<any>;
/**
* Shorthand for `show(message, 'long', 'center')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showLongCenter(message: string): Observable<any>;
/**
* Shorthand for `show(message, 'long', 'bottom')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
static showLongBottom(message: string): Observable<any>;
}

198
dist/plugins/toast.js vendored
View File

@ -1,198 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
var Observable_1 = require('rxjs/Observable');
/**
* This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser.
*
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
*/
var Toast = (function () {
function Toast() {
}
/**
* Show a native toast for the given duration at the specified position.
*
* @param {string} message The message to display.
* @param {string} duration Duration to show the toast, either 'short' or 'long'.
* @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.show = function (message, duration, position) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Manually hide any currently visible toast.
* @return {Promise} Returns a Promise that resolves on success.
*/
Toast.hide = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Show a native toast with the given options.
*
* @param {Object} options Options for showing a toast. Available options:
* message The message to display.
* duration Duration to show the toast, either 'short' or 'long'.
* position Where to position the toast, either 'top', 'center', or 'bottom'.
* addPixelsY Offset in pixels to move the toast up or down from its specified position.
*
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showWithOptions = function (options) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Shorthand for `show(message, 'short', 'top')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showShortTop = function (message) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Shorthand for `show(message, 'short', 'center')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showShortCenter = function (message) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Shorthand for `show(message, 'short', 'bottom')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showShortBottom = function (message) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Shorthand for `show(message, 'long', 'top')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showLongTop = function (message) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Shorthand for `show(message, 'long', 'center')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showLongCenter = function (message) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
/**
* Shorthand for `show(message, 'long', 'bottom')`.
* @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
*/
Toast.showLongBottom = function (message) {
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable_1.Observable(function (observer) { });
};
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "show", null);
__decorate([
plugin_1.Cordova()
], Toast, "hide", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showWithOptions", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showShortTop", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showShortCenter", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showShortBottom", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showLongTop", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showLongCenter", null);
__decorate([
plugin_1.Cordova({
observable: true,
clearFunction: 'hide'
})
], Toast, "showLongBottom", null);
Toast = __decorate([
plugin_1.Plugin({
name: 'Toast',
plugin: 'cordova-plugin-x-toast',
pluginRef: 'plugins.toast',
repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin'
})
], Toast);
return Toast;
})();
exports.Toast = Toast;
//# sourceMappingURL=toast.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/plugins/toast.ts"],"names":["Toast","Toast.constructor","Toast.show","Toast.hide","Toast.showWithOptions","Toast.showShortTop","Toast.showShortCenter","Toast.showShortBottom","Toast.showLongTop","Toast.showLongCenter","Toast.showLongBottom"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AACzC,2BAAyB,iBAAiB,CAAC,CAAA;AAQ3C;;;;GAIG;AACH;IAAAA;IAwKAC,CAACA;IAhKCD;;;;;;;OAOGA;IAKIA,UAAIA,GAJXA,UAIYA,OAAeA,EAAEA,QAAgBA,EAAEA,QAAgBA;QAC7DE,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDF;;;OAGGA;IAEIA,UAAIA,GADXA;QAEEG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDH;;;;;;;;;;OAUGA;IAKIA,qBAAeA,GAJtBA,UAIuBA,OAAqBA;QAC1CI,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDJ;;;OAGGA;IAKIA,kBAAYA,GAJnBA,UAIoBA,OAAeA;QACjCK,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDL;;;OAGGA;IAKIA,qBAAeA,GAJtBA,UAIuBA,OAAeA;QACpCM,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDN;;;OAGGA;IAKIA,qBAAeA,GAJtBA,UAIuBA,OAAeA;QACpCO,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDP;;;OAGGA;IAKIA,iBAAWA,GAJlBA,UAImBA,OAAeA;QAChCQ,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDR;;;OAGGA;IAKIA,oBAAcA,GAJrBA,UAIsBA,OAAeA;QACnCS,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAEDT;;;OAGGA;IAKIA,oBAAcA,GAJrBA,UAIsBA,OAAeA;QACnCU,4EAA4EA;QAC5EA,oEAAoEA;QACpEA,2EAA2EA;QAC3EA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,uBAAUA,CAAMA,UAAAA,QAAQA,IAAKA,CAACA,CAACA,CAACA;IAC7CA,CAACA;IAvJDV;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,aAAIA,QAOVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,aAAIA,QAOVA;IAaDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,wBAAeA,QAOrBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,qBAAYA,QAOlBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,wBAAeA,QAOrBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,wBAAeA,QAOrBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,oBAAWA,QAOjBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,uBAAcA,QAOpBA;IAMDA;QAACA,gBAAOA,CAACA;YACPA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,MAAMA;SACtBA,CAACA;OACKA,uBAAcA,QAOpBA;IAvKHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,OAAOA;YACbA,MAAMA,EAAEA,wBAAwBA;YAChCA,SAASA,EAAEA,eAAeA;YAC1BA,IAAIA,EAAEA,yDAAyDA;SAChEA,CAACA;cAmKDA;IAADA,YAACA;AAADA,CAACA,AAxKD,IAwKC;AAlKY,aAAK,QAkKjB,CAAA"}

View File

@ -1,49 +0,0 @@
/**
* Scan the fingerprint of a user with the TouchID sensor.
*
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
*
* ### Error Codes
*
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
*
* Here is a list of some of the error codes:
*
* `-1` - Fingerprint scan failed more than 3 times
* `-2` or `-128` - User tapped the 'Cancel' button
* `-3` - User tapped the 'Enter Passcode' or 'Enter Password' button
* `-4` - The scan was cancelled by the system (Home button for example)
* `-6` - TouchID is not Available
* `-8` - TouchID is locked out from too many tries
*
*/
export declare class TouchID {
/**
* Whether TouchID is available or not.
*
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/
isAvailable(): Promise<any>;
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
*
* @param {string} message The message to display
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
static verifyFingerprint(message: string): Promise<any>;
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
*
* @param {string} message The message to display
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
static verifyFingerprintWithCustomPasswordFallback(message: string): Promise<any>;
/**
* Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
*
* @param {string} message The message to display
* @param {string} enterPasswordLabel Custom text for the 'Enter Password' button
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any>;
}

View File

@ -1,110 +0,0 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* Scan the fingerprint of a user with the TouchID sensor.
*
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
*
* ### Error Codes
*
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
*
* Here is a list of some of the error codes:
*
* `-1` - Fingerprint scan failed more than 3 times
* `-2` or `-128` - User tapped the 'Cancel' button
* `-3` - User tapped the 'Enter Passcode' or 'Enter Password' button
* `-4` - The scan was cancelled by the system (Home button for example)
* `-6` - TouchID is not Available
* `-8` - TouchID is locked out from too many tries
*
*/
var TouchID = (function () {
function TouchID() {
}
/**
* Whether TouchID is available or not.
*
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/
TouchID.prototype.isAvailable = function () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
;
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
*
* @param {string} message The message to display
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
TouchID.verifyFingerprint = function (message) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
*
* @param {string} message The message to display
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
TouchID.verifyFingerprintWithCustomPasswordFallback = function (message) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
/**
* Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
*
* @param {string} message The message to display
* @param {string} enterPasswordLabel Custom text for the 'Enter Password' button
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
TouchID.verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel = function (message, enterPasswordLabel) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise(function (res, rej) { });
};
__decorate([
plugin_1.Cordova()
], TouchID.prototype, "isAvailable", null);
__decorate([
plugin_1.Cordova()
], TouchID, "verifyFingerprint", null);
__decorate([
plugin_1.Cordova()
], TouchID, "verifyFingerprintWithCustomPasswordFallback", null);
__decorate([
plugin_1.Cordova()
], TouchID, "verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel", null);
TouchID = __decorate([
plugin_1.Plugin({
name: 'TouchID',
plugin: 'cordova-plugin-touch-id',
pluginRef: 'plugins.touchid',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id'
})
], TouchID);
return TouchID;
})();
exports.TouchID = TouchID;
//# sourceMappingURL=touchid.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"touchid.js","sourceRoot":"","sources":["../../src/plugins/touchid.ts"],"names":["TouchID","TouchID.constructor","TouchID.isAvailable","TouchID.verifyFingerprint","TouchID.verifyFingerprintWithCustomPasswordFallback","TouchID.verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAAAA;IAuEAC,CAACA;IA/DCD;;;;OAIGA;IAEHA,6BAAWA,GADXA;QAEEE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IAEDF;;;;;OAKGA;IAEIA,yBAAiBA,GADxBA,UACyBA,OAAeA;QACtCG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDH;;;;;OAKGA;IAEIA,mDAA2CA,GADlDA,UACmDA,OAAeA;QAChEI,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDJ;;;;;;OAMGA;IAEIA,wEAAgEA,GADvEA,UACwEA,OAAeA,EAAEA,kBAA0BA;QACjHK,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAzDDL;QAACA,gBAAOA,EAAEA;OACVA,gCAAWA,QAOVA;IAQDA;QAACA,gBAAOA,EAAEA;OACHA,4BAAiBA,QAOvBA;IAQDA;QAACA,gBAAOA,EAAEA;OACHA,sDAA2CA,QAOjDA;IASDA;QAACA,gBAAOA,EAAEA;OACHA,2EAAgEA,QAOtEA;IAtEHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,SAASA;YACfA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,iBAAiBA;YAC5BA,IAAIA,EAAEA,2DAA2DA;SAClEA,CAACA;gBAkEDA;IAADA,cAACA;AAADA,CAACA,AAvED,IAuEC;AAjEY,eAAO,UAiEnB,CAAA"}

1
dist/util.d.ts vendored
View File

@ -1 +0,0 @@
export declare function get(obj: any, path: any): any;

12
dist/util.js vendored
View File

@ -1,12 +0,0 @@
function get(obj, path) {
for (var i = 0, path = path.split('.'), len = path.length; i < len; i++) {
if (!obj) {
return null;
}
obj = obj[path[i]];
}
return obj;
}
exports.get = get;
;
//# sourceMappingURL=util.js.map

1
dist/util.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":["get"],"mappings":"AAAA,aAAoB,GAAG,EAAE,IAAI;IAC3BA,GAAGA,CAAAA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,IAAIA,GAAGA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,EAAEA,GAAGA,GAAGA,IAAIA,CAACA,MAAMA,EAAEA,CAACA,GAAGA,GAAGA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;QACvEA,EAAEA,CAAAA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA;YAACA,MAAMA,CAACA,IAAIA,CAACA;QAACA,CAACA;QACzBA,GAAGA,GAAGA,GAAGA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA;IACrBA,CAACA;IACDA,MAAMA,CAACA,GAAGA,CAACA;AACbA,CAACA;AANe,WAAG,MAMlB,CAAA;AAAA,CAAC"}

View File

@ -1,11 +1,14 @@
{ {
"name": "ionic-native", "name": "ionic-native",
"version": "1.0.9", "version": "1.0.12",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js", "main": "dist/index.js",
"directories": { "directories": {
"test": "test" "test": "test"
}, },
"files": [
"dist"
],
"dependencies": { "dependencies": {
"rxjs": "5.0.0-beta.0" "rxjs": "5.0.0-beta.0"
}, },
@ -47,4 +50,4 @@
"path": "./node_modules/cz-conventional-changelog" "path": "./node_modules/cz-conventional-changelog"
} }
} }
} }

View File

@ -12,65 +12,65 @@ docType: "<$ doc.docType $>"
--- ---
<@ macro paramList(paramData) -@> <@ macro paramList(paramData) -@>
<@- if paramData -@><span class="params">( <@- if paramData -@><span class="params">(
<@- for param in paramData -@> <@- for param in paramData -@>
<span class="param"><$ param | escape $><@ if not loop.last @>, <@ endif @></span> <span class="param"><$ param | escape $><@ if not loop.last @>, <@ endif @></span>
<@- endfor @>)</span> <@- endfor @>)</span>
<@- endif @> <@- endif @>
<@- endmacro -@> <@- endmacro -@>
<@ macro githubViewLink(doc) -@> <@ macro githubViewLink(doc) -@>
<a href="https://github.com/<$ versionInfo.gitRepoInfo.owner $>/<$ versionInfo.gitRepoInfo.repo $>/tree/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line+1 $>-L<$ doc.location.end.line+1 $>"><$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>)</a> <a href="https://github.com/<$ versionInfo.gitRepoInfo.owner $>/<$ versionInfo.gitRepoInfo.repo $>/tree/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line+1 $>-L<$ doc.location.end.line+1 $>"><$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>)</a>
<@- endmacro -@> <@- endmacro -@>
<@ macro paramTable(params, isDirective) -@> <@ macro paramTable(params, isDirective) -@>
<table class="table param-table" style="margin:0;"> <table class="table param-table" style="margin:0;">
<thead> <thead>
<tr> <tr>
<th><@ if isDirective @>Attr<@ else @>Param<@ endif @></th> <th><@ if isDirective @>Attr<@ else @>Param<@ endif @></th>
<th>Type</th> <th>Type</th>
<th>Details</th> <th>Details</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<@ for param in params @> <@ for param in params @>
<tr> <tr>
<td> <td>
<$ param.name $> <$ param.name $>
<@ if param.alias @>| <$ param.alias $><@ endif @> <@ if param.alias @>| <$ param.alias $><@ endif @>
<@ if param.type.optional @><div><em>(optional)</em></div><@ endif @> <@ if param.type.optional @><div><em>(optional)</em></div><@ endif @>
</td> </td>
<td> <td>
<$ typeList(param.typeList) $> <$ typeList(param.typeList) $>
</td> </td>
<td> <td>
<$ param.description | marked $> <$ param.description | marked $>
<@ if param.default @><p><em>(default: <$ param.default $>)</em></p><@ endif @> <@ if param.default @><p><em>(default: <$ param.default $>)</em></p><@ endif @>
</td> </td>
</tr> </tr>
<@ endfor @> <@ endfor @>
</tbody> </tbody>
</table> </table>
<@- endmacro -@> <@- endmacro -@>
<@- macro functionSyntax(fn) @> <@- macro functionSyntax(fn) @>
<@- set sep = joiner(',&nbsp;') -@> <@- set sep = joiner(',&nbsp;') -@>
<code><$ fn.name $>(<@- for param in fn.params @><$ sep() $> <code><$ fn.name $>(<@- for param in fn.params @><$ sep() $>
<@- if param.type.optional @>[<@ endif -@> <@- if param.type.optional @>[<@ endif -@>
<$ param.name $> <$ param.name $>
<@- if param.type.optional @>]<@ endif -@> <@- if param.type.optional @>]<@ endif -@>
<@ endfor @>)</code> <@ endfor @>)</code>
<@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @> <@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @>
<@ endmacro -@> <@ endmacro -@>
<@ macro typeList(types) -@> <@ macro typeList(types) -@>
<@ set separator = joiner("|") @> <@ set separator = joiner("|") @>
<@ for type in types @><$ separator() $><$ type | code $><@ endfor @> <@ for type in types @><$ separator() $><$ type | code $><@ endfor @>
<@- endmacro -@> <@- endmacro -@>
<@- macro typeInfo(fn) -@> <@- macro typeInfo(fn) -@>
<$ typeList(fn.typeList) $> <$ fn.description $> <$ typeList(fn.typeList) $> <$ fn.description $>
<@- endmacro -@> <@- endmacro -@>
<@ block body @> <@ block body @>
@ -82,30 +82,30 @@ docType: "<$ doc.docType $>"
<h1 class="api-title"> <h1 class="api-title">
<@ if doc.docType == "directive" @> <@ if doc.docType == "directive" @>
<$ doc.name | dashCase $> <$ doc.name | dashCase $>
<@ else @> <@ else @>
<$ doc.name $> <$ doc.name $>
<@ endif @> <@ endif @>
<@ if doc.parent @> <@ if doc.parent @>
<br /> <br />
<small> <small>
Child of <$ doc.parent $> Child of <$ doc.parent $>
</small> </small>
<@ endif @> <@ endif @>
<@ if doc.delegate @> <@ if doc.delegate @>
<br/> <br/>
<small> <small>
Delegate: <$ doc.delegate $> Delegate: <$ doc.delegate $>
</small> </small>
<@ endif @> <@ endif @>
</h1> </h1>
<a class="improve-v2-docs" href='http://github.com/driftyco/ionic/edit/2.0/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line $>'> <a class="improve-v2-docs" href='http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line $>'>
Improve this doc Improve this doc
</a> </a>
<@ if doc.codepen @> <@ if doc.codepen @>
@ -117,16 +117,25 @@ Improve this doc
<!-- decorators --> <!-- decorators -->
<@- if doc.decorators @> <@- if doc.decorators @>
<@ for prop in doc.decorators[0].argumentInfo @> <@ for prop in doc.decorators[0].argumentInfo @>
<pre> <pre><code>$ cordova plugin add <$ prop.plugin $></code></pre>
<code> <p>Repo:
$ ionic plugin add <$ prop.plugin $> <a href="<$ prop.repo $>">
</code> <$ prop.repo $>
</pre> </a>
<p>
<a href="<$ prop.repo $>">
Repo: <$ prop.repo $>
</a>
</p> </p>
<@ if prop.platforms @>
<!-- @platforms tag -->
<h2>Supported platforms</h2>
<@ block platforms @>
<ul>
<@- for platform in prop.platforms @>
<li><$ platform $></li>
<@ endfor -@>
</ul>
<@ endblock @>
<@ endif @>
<@ endfor @> <@ endfor @>
<@ endif -@> <@ endif -@>
@ -153,42 +162,42 @@ Repo: <$ prop.repo $>
<@ if doc.properties @> <@ if doc.properties @>
<h2>Attributes:</h2> <h2>Attributes:</h2>
<table class="table" style="margin:0;"> <table class="table" style="margin:0;">
<thead> <thead>
<tr> <tr>
<th>Attribute</th> <th>Attribute</th>
<@ set hasTypes = false @> <@ set hasTypes = false @>
<@ for prop in doc.properties @> <@ for prop in doc.properties @>
<@ if prop.type @> <@ if prop.type @>
<@ set hasTypes = true @> <@ set hasTypes = true @>
<@ endif @> <@ endif @>
<@ endfor @> <@ endfor @>
<@ if hasTypes @> <@ if hasTypes @>
<th>Type</th> <th>Type</th>
<@ endif @> <@ endif @>
<th>Description</th> <th>Description</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<@ for prop in doc.properties @> <@ for prop in doc.properties @>
<tr> <tr>
<td> <td>
<$ prop.name $> <$ prop.name $>
</td> </td>
<@ if hasTypes @> <@ if hasTypes @>
<td> <td>
<$ prop.type.name $> <$ prop.type.name $>
</td> </td>
<@ endif @> <@ endif @>
<td> <td>
<$ prop.description $> <$ prop.description $>
</td> </td>
</tr> </tr>
<@ endfor @> <@ endfor @>
</tbody> </tbody>
</table> </table>
<@ endif @> <@ endif @>
@ -198,6 +207,19 @@ Repo: <$ prop.repo $>
<div id="<$ method.name $>"></div> <div id="<$ method.name $>"></div>
<h3><$ functionSyntax(method) $></h3> <h3><$ functionSyntax(method) $></h3>
<@- if method.decorators @>
<@ for prop in method.decorators[0].argumentInfo @>
<@ if prop.platforms @>
<h4>Platforms:</h4>
<ul>
<@- for platform in prop.platforms @>
<li><$ platform $></li>
<@ endfor -@>
</ul>
<@ endif @>
<@ endfor @>
<@ endif -@>
<$ method.description $> <$ method.description $>
<@ if method.params @> <@ if method.params @>
@ -206,14 +228,14 @@ Repo: <$ prop.repo $>
<@ if method.this @> <@ if method.this @>
<h4> Method's `this` <h4> Method's `this`
<$ method.this $> <$ method.this $>
</h4> </h4>
<@ endif @> <@ endif @>
<@ if method.returns @> <@ if method.returns @>
<div class="return-value" markdown="1"> <div class="return-value" markdown="1">
<i class="icon ion-arrow-return-left"></i> <i class="icon ion-arrow-return-left"></i>
<b>Returns:</b> <$ typeInfo(method.returns) $> <b>Returns:</b> <$ typeInfo(method.returns) $>
</div> </div>
<@ endif @> <@ endif @>
<@ endif @> <@ endif @>
@ -229,7 +251,7 @@ Repo: <$ prop.repo $>
<div id="<$ method.name $>"></div> <div id="<$ method.name $>"></div>
<h3> <h3>
<$ functionSyntax(method) $> <$ functionSyntax(method) $>
</h3> </h3>
<$ method.description $> <$ method.description $>
@ -240,14 +262,14 @@ Repo: <$ prop.repo $>
<@ if method.this @> <@ if method.this @>
<h4> Method's `this` <h4> Method's `this`
<$ method.this $> <$ method.this $>
</h4> </h4>
<@ endif @> <@ endif @>
<@ if method.returns @> <@ if method.returns @>
<div class="return-value" markdown="1"> <div class="return-value" markdown="1">
<i class="icon ion-arrow-return-left"></i> <i class="icon ion-arrow-return-left"></i>
<b>Returns:</b> <$ typeInfo(method.returns) $> <b>Returns:</b> <$ typeInfo(method.returns) $>
</div> </div>
<@ endif @> <@ endif @>

View File

@ -3,55 +3,125 @@ initAngular1();
const DEVICE_READY_TIMEOUT = 2000; const DEVICE_READY_TIMEOUT = 2000;
declare var window; declare var window;
import {ActionSheet} from './plugins/actionsheet'; import {ActionSheet} from './plugins/actionsheet';
import {AppAvailability} from './plugins/appavailability';
import {AppRate} from './plugins/apprate';
import {AppVersion} from './plugins/appversion';
import {Badge} from './plugins/badge';
import {BarcodeScanner} from './plugins/barcodescanner'; import {BarcodeScanner} from './plugins/barcodescanner';
import {Base64ToGallery} from './plugins/base64togallery';
import {BatteryStatus} from './plugins/batterystatus';
import {BLE} from './plugins/ble'; import {BLE} from './plugins/ble';
import {Camera} from './plugins/camera';
import {Calendar} from './plugins/calendar'; import {Calendar} from './plugins/calendar';
import {Camera} from './plugins/camera';
import {Clipboard} from './plugins/clipboard';
import {Contacts} from './plugins/contacts'; import {Contacts} from './plugins/contacts';
import {DatePicker} from './plugins/datepicker';
import {DBMeter} from './plugins/dbmeter';
import {Device} from './plugins/device'; import {Device} from './plugins/device';
import {DeviceMotion} from './plugins/devicemotion';
import {DeviceOrientation} from './plugins/deviceorientation';
import {Dialogs} from './plugins/dialogs';
import {Facebook} from './plugins/facebook'; import {Facebook} from './plugins/facebook';
//import {File} from './plugins/file';
import {Flashlight} from './plugins/flashlight';
import {Geolocation} from './plugins/geolocation'; import {Geolocation} from './plugins/geolocation';
import {Globalization} from './plugins/globalization';
import {Hotspot} from './plugins/hotspot';
import {ImagePicker} from './plugins/imagepicker';
import {Keyboard} from './plugins/keyboard';
import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
import {Push} from './plugins/push'; import {Push} from './plugins/push';
import {SMS} from './plugins/sms';
import {Splashscreen} from './plugins/splashscreen';
import {StatusBar} from './plugins/statusbar'; import {StatusBar} from './plugins/statusbar';
import {Toast} from './plugins/toast'; import {Toast} from './plugins/toast';
import {TouchID} from './plugins/touchid'; import {TouchID} from './plugins/touchid';
import {Vibration} from './plugins/vibration';
export { export {
ActionSheet, ActionSheet,
AppAvailability,
AppRate,
AppVersion,
Badge,
BarcodeScanner, BarcodeScanner,
Base64ToGallery,
BatteryStatus,
BLE, BLE,
Camera,
Calendar, Calendar,
Camera,
Clipboard,
Contacts, Contacts,
DatePicker,
DBMeter,
Device, Device,
DeviceMotion,
DeviceOrientation,
Dialogs,
Facebook, Facebook,
//File,
Flashlight,
Geolocation, Geolocation,
Globalization,
Hotspot,
ImagePicker,
Keyboard,
LaunchNavigator,
LocalNotifications,
Push, Push,
SMS,
Splashscreen,
StatusBar, StatusBar,
Toast, Toast,
TouchID TouchID,
Vibration
} }
export * from './plugins/plugin';
// Window export to use outside of a module loading system // Window export to use outside of a module loading system
window['IonicNative'] = { window['IonicNative'] = {
ActionSheet: ActionSheet, ActionSheet: ActionSheet,
BarcodeScanner, AppAvailability: AppAvailability,
AppRate: AppRate,
AppVersion: AppVersion,
Badge: Badge,
BarcodeScanner: BarcodeScanner,
Base64ToGallery: Base64ToGallery,
BatteryStatus: BatteryStatus,
BLE: BLE, BLE: BLE,
Camera: Camera,
Calendar: Calendar, Calendar: Calendar,
Camera: Camera,
Clipboard: Clipboard,
Contacts: Contacts, Contacts: Contacts,
DatePicker: DatePicker,
DBMeter: DBMeter,
Device: Device, Device: Device,
DeviceMotion: DeviceMotion,
DeviceOrientation: DeviceOrientation,
Dialogs: Dialogs,
Facebook: Facebook, Facebook: Facebook,
//File: File,
Flashlight: Flashlight,
Geolocation: Geolocation, Geolocation: Geolocation,
Globalization: Globalization,
Hotspot: Hotspot,
ImagePicker: ImagePicker,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications,
Push: Push, Push: Push,
SMS: SMS,
Splashscreen: Splashscreen,
StatusBar: StatusBar, StatusBar: StatusBar,
Toast: Toast, Toast: Toast,
TouchID: TouchID TouchID: TouchID,
} Vibration: Vibration
};
// To help developers using cordova, we listen for the device ready event and // To help developers using cordova, we listen for the device ready event and
// log an error if it didn't fire in a reasonable amount of time. Generally, // log an error if it didn't fire in a reasonable amount of time. Generally,
@ -61,9 +131,9 @@ let before = +new Date;
let didFireReady = false; let didFireReady = false;
document.addEventListener('deviceready', function() { document.addEventListener('deviceready', function() {
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms') console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
didFireReady = true; didFireReady = true;
}) });
setTimeout(function() { setTimeout(function() {
if(!didFireReady && window.cordova) { if(!didFireReady && window.cordova) {

View File

@ -1,14 +1,13 @@
import {Plugin, Cordova} from './plugin'; import {Plugin, Cordova} from './plugin';
/** /**
* @name ActionSheet * @name Action Sheet
* @description * @description
* The ActionSheet plugin shows a native list of options the user can choose from. * The ActionSheet plugin shows a native list of options the user can choose from.
* *
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
* *
* @usage * @usage
*
* ```ts * ```ts
* import {ActionSheet} from 'ionic-native'; * import {ActionSheet} from 'ionic-native';
* *
@ -25,24 +24,28 @@ import {Plugin, Cordova} from './plugin';
* *
*/ */
@Plugin({ @Plugin({
name: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet', plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet', pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet' repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
platforms: ['Android', 'iOS', 'Windows Phone 8']
}) })
export class ActionSheet { export class ActionSheet {
/** /**
* Show the ActionSheet. * Show the ActionSheet. The ActionSheet's options is an object with the following propterties.
* @param {options} options *
* `buttonLabels`: string[] * | Option | Type | Description |
* `title`: string * |-------------------------------|-----------|----------------------------------------------|
* `androidTheme` (Android only): number 1-5 * | title |`string` | The title for the actionsheet |
* `androidEnableCancelButton` (Android only): boolean, default false * | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
* `winphoneEnableCancelButton` (WP only): boolean, default false * | androidTheme |`number` | Theme to bue used on Android |
* `addCancelButtonWithLabel`: string * | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
* `addDestructiveButtonWithLabel`: string * | winphoneEnableCancelButton |`boolean` | Enable a cancel on Android |
* `position`: [x, y] (iPad pass in [x, y] coords of popover) * | addCancelButtonWithLabel |`string` | Add a cancle button with text |
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
* | position |`number[]` | On an iPad, set the X,Y position |
*
* @param {options} Options See table above
* @returns {Promise} Returns a Promise that resolves with the index of the * @returns {Promise} Returns a Promise that resolves with the index of the
* button pressed (1 based, so 1, 2, 3, etc.) * button pressed (1 based, so 1, 2, 3, etc.)
*/ */
@ -56,26 +59,12 @@ export class ActionSheet {
addCancelButtonWithLabel?: string, addCancelButtonWithLabel?: string,
addDestructiveButtonWithLabel?: string, addDestructiveButtonWithLabel?: string,
position?: number[] position?: number[]
}) { }): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Hide the ActionSheet. * Hide the ActionSheet.
*/ */
@Cordova() @Cordova()
static hide() { static hide(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
} }

View File

@ -0,0 +1,43 @@
import {Plugin, Cordova} from './plugin';
/**
* @name App Availability
* @description
* This plugin allows you to check if an app is installed on the user's device. It requires an URI Scheme (e.g. twitter://) on iOS or a Package Name (e.g com.twitter.android) on Android.
*
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
*
* @usage
* ```js
* var app;
*
* if(device.platform === 'iOS') {
* app = 'twitter://';
* }else if(device.platform === 'Android'){
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* .then(
* yes => console.log(app + " is available"),
* no => console.log(app + " is NOT available")
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-appavailability',
pluginRef: 'appAvailability',
repo: 'https://github.com/ohh2ahh/AppAvailability',
platforms: ['Android','iOS']
})
export class AppAvailability {
/**
* Checks if an app is available on device
* @param app Package name on android, or URI scheme on iOS
* @returns {Promise<boolean>}
*/
@Cordova()
static check(app: string): Promise<boolean> { return }
}

58
src/plugins/apprate.ts Normal file
View File

@ -0,0 +1,58 @@
import {Plugin, Cordova, CordovaProperty} from './plugin';
declare var window;
/**
* @name App Rate
* @description
* The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never.
*
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
*
* @usage
* ```js
* AppRate.preferences.storeAppURL.ios = '<my_app_id>';
* AppRate.preferences.storeAppURL.android = 'market://details?id=<package_name>';
* AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/';
* AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=<the Package Family Name of the application>';
* AppRate.promptForRating();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-apprate',
pluginRef: 'AppRate',
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
platforms: ['Android','iOS']
})
export class AppRate {
/**
* Rating dialog preferences
*
* useLanguage {String} null - custom BCP 47 language tag
* displayAppName {String} '' - custom application title
* promptAgainForEachNewVersion {Boolean} true - show dialog again when application version will be updated
* usesUntilPrompt {Integer} 3 - count of runs of application before dialog will be displayed
* openStoreInApp {Boolean} false - leave app or no when application page opened in app store (now supported only for iOS)
* useCustomRateDialog {Boolean} false - use custom view for rate dialog
* callbacks.onButtonClicked {Function} null - call back function. called when user clicked on rate-dialog buttons
* callbacks.onRateDialogShow {Function} null - call back function. called when rate-dialog showing
* storeAppURL.ios {String} null - application id in AppStore
* storeAppURL.android {String} null - application URL in GooglePlay
* storeAppURL.blackberry {String} null - application URL in AppWorld
* storeAppURL.windows8 {String} null - application URL in WindowsStore
* customLocale {Object} null - custom locale object
* @type {{}}
*/
@CordovaProperty
static get preferences() { return window.AppRate.preferences; }
/**
* Prompts the user for rating
*
* @param {boolean} immediately Show the rating prompt immediately.
*/
@Cordova()
static promptForRating(immediately: boolean): void {};
}

53
src/plugins/appversion.ts Normal file
View File

@ -0,0 +1,53 @@
import {Plugin, Cordova} from './plugin';
/**
* @name App Version
* @description
* Reads the version of your app from the target build settings.
*
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
*
* @usage
* ```js
* AppVersion.getAppName();
* AppVersion.getPackageName();
* AppVersion.getVersionCode();
* AppVersion.getVersionNumber();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-app-version',
pluginRef: 'cordova.getAppVersion',
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
platforms: ['Android', 'iOS']
})
export class AppVersion {
/**
* Returns the name of the app
* @returns {Promise}
*/
@Cordova()
static getAppName(): Promise<any> { return }
/**
* Returns the package name of the app
* @returns {Promise}
*/
@Cordova()
static getPackageName(): Promise<any> { return }
/**
* Returns the build identifier of the app
* @returns {Promise}
*/
@Cordova()
static getVersionCode(): Promise<any> { return }
/**
* Returns the version of the app
* @returns {Promise}
*/
@Cordova()
static getVersionNumber(): Promise<any> { return }
}

74
src/plugins/badge.ts Normal file
View File

@ -0,0 +1,74 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Badge
* @description
* The essential purpose of badge numbers is to enable an application to inform its users that it has something for them for example, unread messages when the application isnt running in the foreground.
*
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
*
* @usage
* ```js
* Badge.set(10);
* Badge.increase();
* Badge.clear();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-badge',
pluginRef: 'cordova.plugins.notification.badge',
repo: 'https://github.com/katzer/cordova-plugin-badge',
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
})
export class Badge {
/**
* Clear the badge of the app icon.
*/
@Cordova()
static clear(): Promise<boolean> { return }
/**
* Set the badge of the app icon.
* @param {number} number The new badge number.
* @returns {Promise}
*/
@Cordova()
static set(number: number): Promise<any> { return }
/**
* Get the badge of the app icon.
* @returns {Promise}
*/
@Cordova()
static get(): Promise<any> { return }
/**
* Increase the badge number.
* @param {number} count Count to add to the current badge number
* @returns {Promise}
*/
@Cordova()
static increase(number: number): Promise<any> { return }
/**
* Decrease the badge number.
* @param {number} count Count to subtract from the current badge number
* @returns {Promise}
*/
@Cordova()
static decrease(number: number): Promise<any> { return }
/**
* Determine if the app has permission to show badges.
*/
@Cordova()
static hasPermission(): Promise<any> { return }
/**
* Register permission to set badge notifications
* @returns {Promise}
*/
@Cordova()
static registerPermission(): Promise<any> { return }
}

View File

@ -1,7 +1,7 @@
import {Plugin, Cordova} from './plugin'; import {Plugin, Cordova} from './plugin';
/** /**
* @name BarcodeScanner * @name Barcode Scanner
* @description * @description
* The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you. * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
* *
@ -17,10 +17,10 @@ import {Plugin, Cordova} from './plugin';
* ``` * ```
*/ */
@Plugin({ @Plugin({
name: 'BarcodeScanner',
plugin: 'phonegap-plugin-barcodescanner', plugin: 'phonegap-plugin-barcodescanner',
pluginRef: 'cordova.plugins.barcodeScanner', pluginRef: 'cordova.plugins.barcodeScanner',
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner' repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
pltaforms: ['Android','iOS','Windows Phone 8','Windows 10','Windows 8','BlackBerry 10', 'Browser']
}) })
export class BarcodeScanner { export class BarcodeScanner {
@ -29,14 +29,7 @@ export class BarcodeScanner {
* @return Returns a Promise that resolves with scanner data, or rejects with an error. * @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/ */
@Cordova() @Cordova()
static scan(){ static scan(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
// Not well supported // Not well supported
// @Cordova() // @Cordova()

View File

@ -0,0 +1,32 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
* @platforms Android, iOS, Windows Phone
* @usage
* ```ts
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
* res => console.log("Saved image to gallery ", res),
* err => console.log("Error saving image to gallery ", err)
* );
* ```
*/
@Plugin({
plugin: 'cordova-base64-to-gallery',
pluginRef: 'cordova',
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
platforms: ['Android' ,'iOS', 'Windows Phone 8']
})
export class Base64ToGallery {
/**
*
* @param data
* @param prefix
*/
@Cordova()
base64ToGallery(data : string , prefix? : string ) : Promise<any> {
return
}
}

View File

@ -0,0 +1,79 @@
import {Plugin} from './plugin';
import {Observable} from "rxjs/Observable";
/**
* @name Battery Status
* @description
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
*
* @usage
* ```js
* // watch change in battery status
* let subscription = BatteryStatus.onChange().subscribe(
* status => {
* console.log(status.level, status.isPlugged);
* }
* );
*
* // stop watch
* subscription.unsubscribe();
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-batterystatus',
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']
})
export class BatteryStatus {
/**
* Watch the change in battery level
* @returns {Observable} Returns an observable that pushes a status object
*/
static onChange () : Observable<StatusObject> {
return getEventObservable("batterylevel");
}
/**
* Watch when the battery level goes low
* @returns {Observable<StatusObject>} Returns an observable that pushes a status object
*/
static onLow () : Observable<StatusObject> {
return getEventObservable("batterylow");
}
/**
* Watch when the battery level goes to critial
* @returns {Observable<StatusObject>} Returns an observable that pushes a status object
*/
static onCritical () : Observable<StatusObject> {
return getEventObservable("batterycritical");
}
}
export interface StatusObject {
/**
* The battery charge percentage
*/
level : number,
/**
* A boolean that indicates whether the device is plugged in
*/
isPlugged : boolean
}
/**
* Wrap the event with an observable
* @param event
* @returns {Observable}
*/
function getEventObservable (event : string) : Observable<StatusObject> {
return new Observable(observer => {
let callback = (status : any) => observer.next(status);
window.addEventListener(event, callback, false);
return () => window.removeEventListener(event, callback, false);
});
}

View File

@ -160,10 +160,10 @@ import {Observable} from 'rxjs/Observable';
* *
*/ */
@Plugin({ @Plugin({
name: 'BLE',
plugin: 'cordova-plugin-ble-central', plugin: 'cordova-plugin-ble-central',
pluginRef: 'ble', pluginRef: 'ble',
repo: 'https://github.com/don/cordova-plugin-ble-central' repo: 'https://github.com/don/cordova-plugin-ble-central',
platforms: ['iOS','Android']
}) })
export class BLE { export class BLE {
/** /**
@ -182,14 +182,7 @@ export class BLE {
@Cordova({ @Cordova({
observable: true observable: true
}) })
static scan(services:string[], seconds:number) { static scan(services: string[], seconds: number): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Scan and discover BLE peripherals until `stopScan` is called. * Scan and discover BLE peripherals until `stopScan` is called.
@ -212,14 +205,7 @@ export class BLE {
clearFunction: 'stopScan', clearFunction: 'stopScan',
clearWithArgs: true clearWithArgs: true
}) })
static startScan(services:string[]){ static startScan(services: string[]): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
};
/** /**
* Stop a scan started by `startScan`. * Stop a scan started by `startScan`.
@ -236,14 +222,7 @@ export class BLE {
* @return returns a Promise. * @return returns a Promise.
*/ */
@Cordova() @Cordova()
static stopScan(){ static stopScan(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
/** /**
* Connect to a peripheral. * Connect to a peripheral.
@ -264,14 +243,7 @@ export class BLE {
clearFunction: 'disconnect', clearFunction: 'disconnect',
clearWithArgs: true clearWithArgs: true
}) })
static connect(deviceId:string){ static connect(deviceId: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
};
/** /**
* Disconnect from a peripheral. * Disconnect from a peripheral.
@ -285,14 +257,7 @@ export class BLE {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static disconnect(deviceId:string) { static disconnect(deviceId: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
/** /**
* Read the value of a characteristic. * Read the value of a characteristic.
@ -303,14 +268,11 @@ export class BLE {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static read(deviceId:string, serviceUUID:string, characteristicUUID:string){ static read(
// This Promise is replaced by one from the @Cordova decorator that wraps deviceId: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript serviceUUID: string,
// knows that the correct return type is Promise, because there's no way characteristicUUID: string
// for it to know the return type from a decorator. ): Promise<any> { return };
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
/** /**
* Write the value of a characteristic. * Write the value of a characteristic.
@ -341,14 +303,12 @@ export class BLE {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static write(deviceId:string, serviceUUID:string, characteristicUUID:string, value:ArrayBuffer){ static write(
// This Promise is replaced by one from the @Cordova decorator that wraps deviceId: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript serviceUUID: string,
// knows that the correct return type is Promise, because there's no way characteristicUUID: string,
// for it to know the return type from a decorator. value: ArrayBuffer
// See https://github.com/Microsoft/TypeScript/issues/4881 ): Promise<any> { return }
return new Promise<any>((res, rej) => {});
};
/** /**
* Write the value of a characteristic without waiting for confirmation from the peripheral. * Write the value of a characteristic without waiting for confirmation from the peripheral.
@ -360,14 +320,12 @@ export class BLE {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static writeWithoutResponse(deviceId:string, serviceUUID:string, characteristicUUID:string, value:ArrayBuffer){ static writeWithoutResponse(
// This Promise is replaced by one from the @Cordova decorator that wraps deviceId: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript serviceUUID: string,
// knows that the correct return type is Promise, because there's no way characteristicUUID: string,
// for it to know the return type from a decorator. value: ArrayBuffer
// See https://github.com/Microsoft/TypeScript/issues/4881 ): Promise<any> { return }
return new Promise<any>((res, rej) => {});
};
/** /**
* Register to be notified when the value of a characteristic changes. * Register to be notified when the value of a characteristic changes.
@ -389,14 +347,11 @@ export class BLE {
clearFunction: 'stopNotification', clearFunction: 'stopNotification',
clearWithArgs: true clearWithArgs: true
}) })
static startNotification(deviceId:string, serviceUUID:string, characteristicUUID:string){ static startNotification(
// This Observable is replaced by one from the @Cordova decorator that wraps deviceId: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript serviceUUID: string,
// knows that the correct return type is Observable, because there's no way characteristicUUID: string
// for it to know the return type from a decorator. ): Observable<any> { return }
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
};
/** /**
* Stop being notified when the value of a characteristic changes. * Stop being notified when the value of a characteristic changes.
@ -407,14 +362,11 @@ export class BLE {
* @return Returns a Promise. * @return Returns a Promise.
*/ */
@Cordova() @Cordova()
static stopNotification(deviceId:string, serviceUUID:string, characteristicUUID:string){ static stopNotification(
// This Promise is replaced by one from the @Cordova decorator that wraps deviceId: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript serviceUUID: string,
// knows that the correct return type is Promise, because there's no way characteristicUUID: string
// for it to know the return type from a decorator. ): Promise<any> { return }
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
/** /**
* Report the connection status. * Report the connection status.
@ -430,14 +382,7 @@ export class BLE {
* @return Returns a Promise. * @return Returns a Promise.
*/ */
@Cordova() @Cordova()
static isConnected(deviceId:string){ static isConnected(deviceId: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Report if bluetooth is enabled. * Report if bluetooth is enabled.
@ -452,14 +397,7 @@ export class BLE {
* @return Returns a Promise. * @return Returns a Promise.
*/ */
@Cordova() @Cordova()
static isEnabled(){ static isEnabled(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Open System Bluetooth settings (Android only). * Open System Bluetooth settings (Android only).
@ -467,14 +405,7 @@ export class BLE {
* @return Returns a Promise. * @return Returns a Promise.
*/ */
@Cordova() @Cordova()
static showBluetoothSettings(){ static showBluetoothSettings(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Enable Bluetooth on the device (Android only). * Enable Bluetooth on the device (Android only).
@ -482,12 +413,5 @@ export class BLE {
* @return Returns a Promise. * @return Returns a Promise.
*/ */
@Cordova() @Cordova()
static enable(){ static enable(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
} }

View File

@ -23,12 +23,14 @@ export interface Calendar {
* *
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
* *
* @usage
*
*/ */
@Plugin({ @Plugin({
name: 'Calendar',
plugin: 'cordova-plugin-calendar', plugin: 'cordova-plugin-calendar',
pluginRef: 'plugins.calendar', pluginRef: 'plugins.calendar',
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin' repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
platforms: ['Android','iOS']
}) })
export class Calendar { export class Calendar {
/** /**
@ -49,14 +51,9 @@ export class Calendar {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static createCalendar(nameOrOptions: string | { calendarName: string, calendarColor: string }) { static createCalendar(
// This Promise is replaced by one from the @Cordova decorator that wraps nameOrOptions: string | { calendarName: string, calendarColor: string }
// the plugin's callbacks. We provide a dummy one here so TypeScript ): Promise<any> { return }
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Delete a calendar. (iOS only) * Delete a calendar. (iOS only)
@ -73,14 +70,7 @@ export class Calendar {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static deleteCalendar(name: string) { static deleteCalendar(name: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Returns the default calendar options. * Returns the default calendar options.
@ -128,14 +118,7 @@ export class Calendar {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Silently create an event with additional options. * Silently create an event with additional options.
@ -156,14 +139,7 @@ export class Calendar {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
options?: CalendarOptions options?: CalendarOptions
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Interactively create an event. * Interactively create an event.
@ -182,14 +158,7 @@ export class Calendar {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Interactively create an event with additional options. * Interactively create an event with additional options.
@ -210,14 +179,7 @@ export class Calendar {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
options?: CalendarOptions options?: CalendarOptions
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
// deprecated // deprecated
// @Cordova() // @Cordova()
@ -247,14 +209,7 @@ export class Calendar {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Find an event with additional options. * Find an event with additional options.
@ -275,14 +230,7 @@ export class Calendar {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
options?: CalendarOptions options?: CalendarOptions
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Find a list of events within the specified date range. (Android only) * Find a list of events within the specified date range. (Android only)
@ -292,37 +240,21 @@ export class Calendar {
* @return Returns a Promise that resolves with the list of events, or rejects with an error. * @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/ */
@Cordova() @Cordova()
static listEventsInRange(startDate: Date, endDate: Date) { static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Get a list of all calendars. * Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error. * @return A Promise that resolves with the list of calendars, or rejects with an error.
*/ */
@Cordova() @Cordova()
static listCalendars(){ static listCalendars(){ return }
return new Promise<any>((res, rej) => {});
}
/** /**
* Get a list of all future events in the specified calendar. (iOS only) * Get a list of all future events in the specified calendar. (iOS only)
* @return Returns a Promise that resolves with the list of events, or rejects with an error. * @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/ */
@Cordova() @Cordova()
static findAllEventsInNamedCalendar(calendarName: string) { static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Modify an event. (iOS only) * Modify an event. (iOS only)
@ -351,14 +283,7 @@ export class Calendar {
newNotes?: string, newNotes?: string,
newStartDate?: Date, newStartDate?: Date,
newEndDate?: Date newEndDate?: Date
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Modify an event with additional options. (iOS only) * Modify an event with additional options. (iOS only)
@ -389,14 +314,7 @@ export class Calendar {
newStartDate?: Date, newStartDate?: Date,
newEndDate?: Date, newEndDate?: Date,
options?: CalendarOptions options?: CalendarOptions
) { ) { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Delete an event. * Delete an event.
@ -415,14 +333,7 @@ export class Calendar {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Delete an event from the specified Calendar. (iOS only) * Delete an event from the specified Calendar. (iOS only)
@ -443,26 +354,12 @@ export class Calendar {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
calendarName?: string calendarName?: string
) { ): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Open the calendar at the specified date. * Open the calendar at the specified date.
* @return {Date} date * @return {Date} date
*/ */
@Cordova() @Cordova()
static openCalendar(date: Date) { static openCalendar(date: Date): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
} }

View File

@ -102,10 +102,10 @@ export interface CameraPopoverOptions {
* ``` * ```
*/ */
@Plugin({ @Plugin({
name: 'Camera',
plugin: 'cordova-plugin-camera', plugin: 'cordova-plugin-camera',
pluginRef: 'navigator.camera', pluginRef: 'navigator.camera',
repo: 'https://github.com/apache/cordova-plugin-camera' repo: 'https://github.com/apache/cordova-plugin-camera',
platforms: ['Android','BlackBerry','Browser','Firefox','FireOS','iOS','Windows','Windows Phone 8','Ubuntu']
}) })
export class Camera { export class Camera {
/** /**
@ -116,21 +116,16 @@ export class Camera {
@Cordova({ @Cordova({
callbackOrder: 'reverse' callbackOrder: 'reverse'
}) })
static getPicture(options: CameraOptions){ static getPicture(options: CameraOptions): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
/** /**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI. * Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova({
platforms: ['iOS']
})
static cleanup(){}; static cleanup(){};
} }

49
src/plugins/clipboard.ts Normal file
View File

@ -0,0 +1,49 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Clipboard
* @description
* Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8.
*
* Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
*
* @usage
* ```js
* Clipboard.copy("Hello world");
*
* Clipboard.paste().then(
* (resolve : string) => {
* alert(resolve);
* },
* (reject : string) => {
* alert("Error: " + reject);
* }
* );
* );
* ```
*/
@Plugin({
plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
pluginRef: 'cordova.plugins.clipboard',
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})
export class Clipboard {
/**
* Copies the given text
* @param text
* @returns {Promise<T>}
*/
@Cordova()
static copy(text: string): Promise<any> { return }
/**
* Pastes the text stored in clipboard
* @returns {Promise<T>}
*/
@Cordova()
static paste(): Promise<any> { return }
}

View File

@ -207,7 +207,6 @@ declare var Contact: {
* *
*/ */
@Plugin({ @Plugin({
name: 'Contacts',
plugin: 'cordova-plugin-contacts', plugin: 'cordova-plugin-contacts',
pluginRef: 'navigator.contacts', pluginRef: 'navigator.contacts',
repo: 'https://github.com/apache/cordova-plugin-contacts' repo: 'https://github.com/apache/cordova-plugin-contacts'
@ -247,26 +246,13 @@ export class Contacts {
successIndex: 1, successIndex: 1,
errorIndex: 2 errorIndex: 2
}) })
static find(fields: string[], options?: any){ static find(fields: string[], options?: any): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<Contact[]>((res, rej) => {});
};
/** /**
* Select a single Contact. * Select a single Contact.
* @return Returns a Promise that resolves with the selected Contact * @return Returns a Promise that resolves with the selected Contact
*/ */
@Cordova() @Cordova()
static pickContact(){ static pickContact(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<Contact>((res, rej) => {});
};
} }

102
src/plugins/datepicker.ts Normal file
View File

@ -0,0 +1,102 @@
import {Plugin, Cordova} from './plugin';
export interface datePickerOptions {
/**
* Platforms: iOS, Android, Windows
* The mode of the date picker
* Values: date | time | datetime
*/
mode: string,
/**
* Platforms: iOS, Android, Windows
* Selected date
*/
date: Date,
/**
* Platforms: iOS, Android, Windows
* Minimum date
* Type: Date | empty String
* Default: empty String
*/
minDate?: Date,
/**
* Platforms?: iOS, Android, Windows
* Maximum date
* Type?: Date | empty String
* Default?: empty String
*/
maxDate?: Date,
/**
* Platforms?: Android
* Label for the dialog title. If empty, uses android default (Set date/Set time).
* Type?: String
* Default?: empty String
*/
titleText?: string,
/**
* Platforms?: Android
* Label of BUTTON_POSITIVE (done button) on Android
*/
okText?: string,
// TODO complete documentation here, and copy params & docs to main plugin docs
cancelText?: string,
todayText?: string,
nowText?: string,
is24Hour?: boolean,
androidTheme?: number,
allowOldDate?: boolean,
allowFutureDates?: boolean,
doneButtonLabel?: string,
doneButtonColor?: string,
cancelButtonLabel?: string,
cancelButtonColor?: string,
x?: number,
y?: number,
minuteInterval?: number,
popoverArrowDirection?: string,
locale?: string
}
/**
* @name Date Picker
* @description
* The DatePicker plugin allows the user to fetch date or time using native dialogs.
*
* Platforms supported: iOS, Android, Windows
*
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
*
* @usage
* ```js
* DatePicker.show({
* date: new Date(),
* mode: 'date'
* }).then(
* date => console.log("Got date: ", date),
* err => console.log("Error occurred while getting date:", err)
* );
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-datepicker',
pluginRef: 'datePicker',
repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker'
})
export class DatePicker {
/**
* Shows the date and/or time picker dialog(s)
* @param options
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova()
static show(options: datePickerOptions): Promise<Date> { return }
}

67
src/plugins/dbmeter.ts Normal file
View File

@ -0,0 +1,67 @@
import {Plugin, Cordova} from './plugin'
import {Observable} from "rxjs/Observable";
/**
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
* @platforms Android, iOS
* @usage
* ```ts
* // Start listening
* let subscription = DBMeter.start().subscribe(
* data => console.log(data)
* );
*
* // Check if we are listening
* DBMeter.isListening().then(
* (isListening : boolean) => console.log(isListening)
* );
*
* // Stop listening
* subscription.unsubscribe();
*
* // Delete DBMeter instance from memory
* DBMeter.delete().then(
* () => console.log("Deleted DB Meter instance"),
* error => console.log("Error occurred while deleting DB Meter instance")
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-dbmeter',
pluginRef: 'DBMeter',
repo: 'https://github.com/akofman/cordova-plugin-dbmeter'
})
export class DBMeter {
/**
* Starts listening
* @return {Observable<string>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
*/
@Cordova({
observable: true,
clearFunction: 'stop'
})
static start () : Observable<any> {return}
/**
* Stops listening
* @private
*/
@Cordova()
static stop () : Promise<any> {return}
/**
* Check if the DB Meter is listening
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
*/
@Cordova()
static isListening() : Promise<boolean> {return}
/**
* Delete the DB Meter instance
* @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/
@Cordova()
static delete() : Promise<any> {return}
}

View File

@ -1,4 +1,4 @@
import {Plugin, RequiresPlugin} from './plugin'; import {Plugin, CordovaProperty} from './plugin';
declare var window: { declare var window: {
device: Device device: Device
@ -37,7 +37,6 @@ export interface Device {
* ``` * ```
*/ */
@Plugin({ @Plugin({
name: 'Device',
plugin: 'cordova-plugin-device', plugin: 'cordova-plugin-device',
pluginRef: 'device', pluginRef: 'device',
repo: 'https://github.com/apache/cordova-plugin-device' repo: 'https://github.com/apache/cordova-plugin-device'
@ -49,8 +48,6 @@ export class Device {
* *
* @returns {Object} The device object. * @returns {Object} The device object.
*/ */
@RequiresPlugin @CordovaProperty
static getDevice() { static get device() { return window.device; }
return window.device;
}
} }

View File

@ -0,0 +1,97 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
export interface accelerationData {
/**
* Amount of acceleration on the x-axis. (in m/s^2)
*/
x : number,
/**
* Amount of acceleration on the y-axis. (in m/s^2)
*/
y : number,
/**
* Amount of acceleration on the z-axis. (in m/s^2)
*/
z : number,
/**
* Creation timestamp in milliseconds.
*/
timestamp : any
}
export interface accelerometerOptions {
/**
* Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000
*/
frequency? : number
}
/**
* @name Device Motion
* @description
* Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
*
* @usage
* ```ts
*
* // Get the device current acceleration
* DeviceMotion.getCurrentAcceleration().then(
* acceleration => console.log(acceleration),
* error => console.log(error)
* );
*
* // Watch device acceleration
* var subscription = DeviceMotion.watchPosition().subscribe(acceleration => {
* console.log(acceleration);
* });
*
* // Stop watch
* subscription.unsubscribe();
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-device-motion',
pluginRef: 'navigator.accelerometer',
repo: 'https://github.com/apache/cordova-plugin-device-motion'
})
export class DeviceMotion {
/**
* Get the current acceleration along the x, y, and z axes.
*
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
static getCurrentAcceleration(): Promise<accelerationData> { return }
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
*
* ```ts
* // Watch device acceleration
* var subscription = DeviceMotion.watchPosition().subscribe(acceleration => {
* console.log(acceleration);
* });
*
* // Stop watch
* subscription.unsubscribe();
* ```
* @param options
* @returns {Observable<accelerationData>}
*/
@Cordova({
callbackOrder: 'reverse',
observable: true,
clearFunction: 'clearWatch'
})
static watchAcceleration (options?: accelerometerOptions): Observable<accelerationData> { return }
}

View File

@ -0,0 +1,92 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
export interface CompassHeading {
/**
* The heading in degrees from 0-359.99 at a single moment in time. (Number)
*/
magneticHeading : number,
/**
* The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. (Number)
*/
trueHeading : number,
/**
* The deviation in degrees between the reported heading and the true heading. (Number)
*/
headingAccuracy : number,
/**
* The time at which this heading was determined. (DOMTimeStamp)
*/
timestamp : any
}
export interface CompassOptions {
/**
* How often to retrieve the compass heading in milliseconds. (Number) (Default: 100)
*/
frequency? : number,
/**
* The change in degrees required to initiate a watchHeading success callback. When this value is set, frequency is ignored. (Number)
*/
filter? : number
}
/**
* @name Device Orientation
* @description
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
*
* @usage
* ```ts
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
* data => console.log(data),
* error => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
* data => console.log(data)
* );
*
* // Stop watching heading change
* subscription.unsubscribe();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-device-orientation',
pluginRef: 'navigator.compass',
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
})
export class DeviceOrientation {
/**
* Get the current compass heading.
* @returns {Promise<CompassHeading>}
*/
@Cordova()
static getCurrentHeading(): Promise<CompassHeading> { return }
/**
* Get the device current heading at a regular interval
*
* Stop the watch by unsubscribing from the observable
* @param options
* @returns {Observable<CompassHeading>}
*/
@Cordova({
callbackOrder: 'reverse',
observable: true,
cancelFunction: 'clearWatch'
})
static watchHeading(options?: CompassOptions): Observable<CompassHeading> { return }
}

99
src/plugins/dialogs.ts Normal file
View File

@ -0,0 +1,99 @@
import {Plugin, Cordova} from './plugin';
export interface promptCallback {
/**
* The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
*/
buttonIndex : number,
/**
* The text entered in the prompt dialog box. (String)
*/
input1 : string
}
/**
* @name Dialogs
* @description
* This plugin gives you ability to access and customize the device native dialogs.
*
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
*
* @usage
* ```js
* ```
*/
@Plugin({
plugin: 'cordova-plugin-dialogs',
pluginRef: 'navigator.notification',
repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
})
export class Dialogs {
/**
* Shows a custom alert or dialog box.
* @param message Dialog message. (String)
* @param title Dialog title. (String) (Optional, defaults to Alert)
* @param buttonName Button name. (String) (Optional, defaults to OK)
* @returns {Promise<any>} Returns a blank promise once the user has dismissed the alert.
*/
@Cordova({
successIndex: 1,
errorIndex: 4
})
static alert(
message,
title: string = 'Alert',
buttonName: string = 'OK'
): Promise<any>{ return }
/**
* Displays a customizable confirmation dialog box.
* @param message Dialog message. (String)
* @param title Dialog title. (String) (Optional, defaults to Confirm)
* @param buttonLabels Array of strings specifying button labels. (Array) (Optional, defaults to [OK,Cancel])
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
*/
@Cordova({
successIndex: 1,
errorIndex: 4
})
static confirm(
message,
title: string = 'Confirm',
buttonLabels: Array<string> = ['OK', 'Cancel']
): Promise<number>{ return }
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param message Dialog message. (String)
* @param title Dialog title (String) (Optional, defaults to Prompt)
* @param buttonLabels Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"])
* @param defaultText Default textbox input value (String) (Optional, Default: empty string)
* @returns {Promise<any>} Returns a promise that resolves an object with the button index clicked and the text entered
*/
@Cordova({
successIndex: 1,
errorIndex: 5
})
static prompt(
message?: string,
title: string = 'Prompt',
buttonLabels: Array<string> = ['OK', 'Cancel'],
defaultText: string = ''
): Promise<any>{ return }
/**
* The device plays a beep sound.
* @param times The number of times to repeat the beep. (Number)
*/
@Cordova({
sync: true
})
static beep(times: number): void {}
}

View File

@ -70,7 +70,6 @@ import {Plugin, Cordova} from './plugin';
* *
*/ */
@Plugin({ @Plugin({
name: 'Facebook',
plugin: 'cordova-plugin-facebook4', plugin: 'cordova-plugin-facebook4',
pluginRef: 'facebookConnectPlugin', pluginRef: 'facebookConnectPlugin',
repo: 'https://github.com/jeduan/cordova-plugin-facebook4' repo: 'https://github.com/jeduan/cordova-plugin-facebook4'
@ -103,14 +102,7 @@ export class Facebook {
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. * @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
*/ */
@Cordova() @Cordova()
static login(permissions: string[]){ static login(permissions: string[]): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Logout of Facebook. * Logout of Facebook.
@ -119,14 +111,7 @@ export class Facebook {
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails. * @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
*/ */
@Cordova() @Cordova()
static logout(){ static logout(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user: * Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
@ -155,14 +140,7 @@ export class Facebook {
* @return Returns a Promise that resolves with a status, or rejects with an error * @return Returns a Promise that resolves with a status, or rejects with an error
*/ */
@Cordova() @Cordova()
static getLoginStatus(){ static getLoginStatus(): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Get a Facebook access token for using Facebook services. * Get a Facebook access token for using Facebook services.
@ -170,14 +148,7 @@ export class Facebook {
* @return Returns a Promise that resolves with an access token, or rejects with an error * @return Returns a Promise that resolves with an access token, or rejects with an error
*/ */
@Cordova() @Cordova()
static getAccessToken(){ static getAccessToken(): Promise<string> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<string>((res, rej) => {});
}
/** /**
* Show one of various Facebook dialogs. Example of options for a Share dialog: * Show one of various Facebook dialogs. Example of options for a Share dialog:
@ -197,14 +168,7 @@ export class Facebook {
* @return Returns a Promise that resolves with success data, or rejects with an error * @return Returns a Promise that resolves with success data, or rejects with an error
*/ */
@Cordova() @Cordova()
static showDialog(options: any){ static showDialog(options: any): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login. * Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
@ -220,14 +184,7 @@ export class Facebook {
* @return Returns a Promise that resolves with the result of the request, or rejects with an error * @return Returns a Promise that resolves with the result of the request, or rejects with an error
*/ */
@Cordova() @Cordova()
static api(requestPath: string, permissions: string[]){ static api(requestPath: string, permissions: string[]): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Log an event. For more information see the Events section above. * Log an event. For more information see the Events section above.
@ -238,14 +195,11 @@ export class Facebook {
* @return * @return
*/ */
@Cordova() @Cordova()
static logEvent(name: string, params?: Object, valueToSum?: number){ static logEvent(
// This Promise is replaced by one from the @Cordova decorator that wraps name: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript params?: Object,
// knows that the correct return type is Promise, because there's no way valueToSum?: number
// for it to know the return type from a decorator. ): Promise<any> { return }
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Log a purchase. For more information see the Events section above. * Log a purchase. For more information see the Events section above.
@ -255,14 +209,7 @@ export class Facebook {
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova()
static logPurchase(value: number, currency: string){ static logPurchase(value: number, currency: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Open App Invite dialog. Does not require login. * Open App Invite dialog. Does not require login.
@ -283,12 +230,5 @@ export class Facebook {
static appInvite(options: { static appInvite(options: {
url: string, url: string,
picture: string picture: string
}){ }): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
} }

59
src/plugins/flashlight.ts Normal file
View File

@ -0,0 +1,59 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Flashlight
* @description This plugin allows you to switch the flashlight / torch of the device on and off.
*
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
*
* @usage
* ```js
* ```
*/
@Plugin({
plugin: 'cordova-plugin-flashlight',
pluginRef: 'window.plugins.flashlight',
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
})
export class Flashlight {
/**
* Checks if the flash light is available
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flash light is available.
*/
@Cordova()
static available(): Promise<boolean> { return }
/**
* Switches the flashlight on
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOn(): Promise<boolean> { return }
/**
* Switches the flash light off
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOff(): Promise<boolean> { return }
/**
* Toggles the flashlight
* @returns {Promise<any>}
*/
@Cordova()
static toggle(): Promise<any> { return }
/**
* Checks if the flash light is turned on.
* Returns a boolean
*/
@Cordova({
sync: true
})
static isSwitchedOn(): boolean { return }
}

View File

@ -69,7 +69,7 @@ export interface GeolocationOptions {
* retrieve the real current position. If set to Infinity the device must * retrieve the real current position. If set to Infinity the device must
* return a cached position regardless of its age. Default: 0. * return a cached position regardless of its age. Default: 0.
*/ */
maximumAge: number; maximumAge?: number;
/** /**
* Is a positive long value representing the maximum length of time * Is a positive long value representing the maximum length of time
@ -77,7 +77,7 @@ export interface GeolocationOptions {
* position. The default value is Infinity, meaning that getCurrentPosition() * position. The default value is Infinity, meaning that getCurrentPosition()
* won't return until the position is available. * won't return until the position is available.
*/ */
timeout: number; timeout?: number;
/** /**
* Indicates the application would like to receive the best possible results. * Indicates the application would like to receive the best possible results.
@ -88,7 +88,7 @@ export interface GeolocationOptions {
* responding more quickly and/or using less power. Default: false. * responding more quickly and/or using less power. Default: false.
* @type {boolean} * @type {boolean}
*/ */
enableHighAccuracy: boolean; enableHighAccuracy?: boolean;
} }
@ -115,9 +115,9 @@ export interface GeolocationOptions {
* ``` * ```
*/ */
@Plugin({ @Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation', plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation' pluginRef: 'navigator.geolocation',
repo: 'https://github.com/apache/cordova-plugin-geolocation'
}) })
export class Geolocation { export class Geolocation {
/** /**
@ -126,15 +126,10 @@ export class Geolocation {
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error. * @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
*/ */
@Cordova() @Cordova({
static getCurrentPosition(options: GeolocationOptions){ callbackOrder: 'reverse'
// This Promise is replaced by one from the @Cordova decorator that wraps })
// the plugin's callbacks. We provide a dummy one here so TypeScript static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return }
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<Geoposition>((res, rej) => {});
}
/** /**
* Watch the current device's position. Clear the watch by unsubscribing from * Watch the current device's position. Clear the watch by unsubscribing from
@ -157,12 +152,5 @@ export class Geolocation {
observable: true, observable: true,
clearFunction: 'clearWatch' clearFunction: 'clearWatch'
}) })
static watchPosition(options: GeolocationOptions){ static watchPosition(options?: GeolocationOptions): Observable<Geoposition> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<Geoposition>(observer => {});
};
} }

View File

@ -0,0 +1,122 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Globalization
* @description
* @usage
*/
@Plugin({
plugin: 'cordova-plugin-globalization',
pluginRef: 'navigator.globalization',
repo: 'https://github.com/apache/cordova-plugin-globalization'
})
export class Globalization {
/**
* Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
* @return {Promise<{value:string}>}
*/
@Cordova()
static getPreferredLanguage() : Promise<{value:string}> {return}
/**
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
* @return {Promise<{value:string}>}
*/
@Cordova()
static getLocaleName() : Promise<{value:string}> {return}
/**
* Converts date to string
* @param date
* @param options
* @return {Promise<{value:string}>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static dateToString(date : Date, options : {formatLength:string, selector:string}) : Promise<{value:string}> {return}
/**
*
* @param dateString
* @param options
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static stringToDate(dateString:string, options:{formatLength:string, selector:string}) : Promise<{year : number, month : number, day:number, hour:number, minute:number, second:number, millisecond:number}> {return}
/**
*
* @param options
*/
@Cordova({
callbackOrder: 'reverse'
})
static getDatePattern(options:{formatLength:string, selector:string}) : Promise<{pattern:string}> {return}
/**
*
* @param options
*/
@Cordova({
callbackOrder: 'reverse'
})
static getDateNames(options:{type:string,item:string}) : Promise<{value:Array<string>}> {return}
/**
* Check if day light saving is active
* @param date
*/
@Cordova()
static isDayLightSavingsTime(date:Date) : Promise<{dst:string}> {return}
/**
* Get first day of week
*/
@Cordova()
static getFirstDayOfWeek() : Promise<{value:string}> {return}
/**
*
* @param options
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static numberToString(options:{type:string}) : Promise<{value:string}> {return}
/**
*
* @param string
* @param options
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static stringToNumber(string:string, options:{type:string}) :Promise<{value}> {return}
/**
*
* @param options
*/
@Cordova({
callbackOrder: 'reverse'
})
static getNumberPattern(options:{type:string}) : Promise<{pattern:string, symbol:string, fraction:number, rounding:number, positive:string, negative:string, decimal:string, grouping:string}> {return}
/**
*
* @param currencyCode
*/
@Cordova()
static getCurrencyPattern(currencyCode:string) : Promise<{pattern:string, code:string, fraction:number, rounding:number, decimal:number, grouping:string}> {return}
}

100
src/plugins/hotspot.ts Normal file
View File

@ -0,0 +1,100 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Hotspot
* @description
* @platforms Android
* @usage
*/
@Plugin({
plugin: 'cordova-plugin-hotspot',
pluginRef: 'cordova.plugnis.hotspot',
repo: 'https://github.com/hypery2k/cordova-hotspot-plugin'
})
export class Hotspot {
@Cordova()
static isAvailable() : Promise<boolean> {return}
@Cordova()
static toggleWifi() : Promise<any> {return}
@Cordova()
static createHotspot(ssid : string, mode : string, password : string) : Promise<any> {return}
@Cordova()
static startHotspot() : Promise<any> {return}
@Cordova()
static configureHotspot(ssid : string, mode : string, password : string) : Promise<any> {return}
@Cordova()
static stopHotspot() : Promise<any> {return}
@Cordova()
static isHotspotEnabled() : Promise<any> {return}
@Cordova()
static getAllHotspotDevices() : Promise<any> {return}
@Cordova()
static connectToHotspot(ssid, password) : Promise<any> {return}
@Cordova()
static connectToWifiAuthEncrypt(ssid, password, authentication, encryption) : Promise<any> {return}
@Cordova()
static addWifiNetwork(ssid, mode, password) : Promise<any> {return}
@Cordova()
static removeWifiNetwork(ssid) : Promise<any> {return}
@Cordova()
static isConnectedToInternet() : Promise<any> {return}
@Cordova()
static isConnectedToInternetViaWifi() : Promise<any> {return}
@Cordova()
static isWifiOn() : Promise<any> {return}
@Cordova()
static isWifiSupported() : Promise<any> {return}
@Cordova()
static isWifiDirectSupported() : Promise<any> {return}
@Cordova()
static scanWifi() : Promise<any> {return}
@Cordova()
static scanWifiByLevel() : Promise<any> {return}
@Cordova()
static startPeriodicallyScan(interval, duration) : Promise<any> {return}
@Cordova()
static stopPeriodicallyScan() : Promise<any> {return}
@Cordova()
static getNetConfig() : Promise<any> {return}
@Cordova()
static getConnectionInfo() : Promise<any> {return}
@Cordova()
static pingHost(ip) : Promise<any> {return}
@Cordova()
static getMacAddressOfHost(ip) : Promise<any> {return}
@Cordova()
static isDnsLive(ip) : Promise<any> {return}
@Cordova()
static isPortLife(ip) : Promise<any> {return}
@Cordova()
static isRooted() : Promise<any> {return}
}

View File

@ -0,0 +1,54 @@
import {Plugin, Cordova} from './plugin';
export interface ImagePickerOptions {
// max images to be selected, defaults to 15. If this is set to 1, upon
// selection of a single image, the plugin will return it.
maximumImagesCount?: number,
// max width and height to allow the images to be. Will keep aspect
// ratio no matter what. So if both are 800, the returned image
// will be at most 800 pixels wide and 800 pixels tall. If the width is
// 800 and height 0 the image will be 800 pixels wide if the source
// is at least that wide.
width?: number,
height?: number,
// quality of resized image, defaults to 100
quality?: number
}
/**
* @name Image Picker
* @description
* Cordova Plugin For Multiple Image Selection
*
* Requires Cordova plugin: `cordova-plugin-image-picker`.
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
*
* @usage
* ```js
* ImagePicker.getPictures(options).then((results) => {
* for (var i = 0; i < results.length; i++) {
* console.log('Image URI: ' + results[i]);
* }
* }, (err) => {
* });
* ```
*/
@Plugin({
plugin: 'cordova-plugin-image-picker',
pluginRef: 'window.imagePicker',
repo: 'https://github.com/wymsee/cordova-imagePicker'
})
export class ImagePicker {
/**
* Pick pictures from the library.
* @param {ImagePickerOptions} options
* @return Returns a Promise that resolves the image file URI
* otherwise rejects with an error.
*/
@Cordova({
callbackOrder: 'reverse'
})
static getPictures(options: ImagePickerOptions): Promise<any> { return }
}

40
src/plugins/keyboard.ts Normal file
View File

@ -0,0 +1,40 @@
import {Cordova, Plugin} from './plugin'
import {Observable} from "rxjs/Observable";
@Plugin({
plugin: 'ionic-plugin-keyboard',
pluginRef: 'cordova.plugins.Keyboard',
repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
})
export class Keyboard {
/**
* Hide the keyboard accessory bar with the next, previous and done buttons.
* @param hide {boolean}
*/
@Cordova({
sync: true
})
static hideKeyboardAccessoryBar(hide : boolean) : void {}
/**
* Close the keyboard if open
*/
@Cordova({
sync: true
})
static close() : void {}
@Cordova({
sync: true
})
static disableScroll(disable : boolean) : void {}
@Cordova({
sync: true
})
static show() : void {}
// TODO add event listener
}

View File

@ -0,0 +1,87 @@
import {Plugin, Cordova} from './plugin';
export interface launchNavigatorOptions {
/**
* iOS, Android, Windows
* If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false.
*/
disableAutoGeolocation? : boolean,
/**
* iOS, Android, Windows
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
*/
transportMode? : string,
/**
* iOS
* If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps.
*/
preferGoogleMaps? : boolean,
/**
* iOS
* If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app.
*/
urlScheme? : string,
/**
* iOS
* If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified.
*/
backButtonText? : string,
/**
* iOS
* If true, debug log output will be generated by the plugin. Defaults to false.
*/
enableDebug? : boolean,
/**
* Android
* Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified.
*/
navigationMode? : string,
}
/**
* @name Launch Navigator
* @description
* Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator).
*
* @usage
* ```js
* LaunchNavigator.navigate("Toronto, ON", "London, ON")
* .then(
* success => console.log("Launched navigator"),
* error => console.log("Error launching navigator", error)
* );
* ```
*/
@Plugin({
plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
pluginRef: 'launchnavigator',
repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
})
export class LaunchNavigator {
/**
* Launches navigator app
* @param destination Location name or coordinates
* @param start Location name or coordinates
* @param options
* @returns {Promise<any>}
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
static navigate(
destination: any,
start: any,
options?: launchNavigatorOptions
): Promise<any> { return }
}

View File

@ -0,0 +1,272 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Local Notifications
* @description
* This plugin allows you to display local notifications on the device
*
* @usage
* ```ts
* // Schedule a single notification
* LocalNotifications.schedule({
* id: 1,
* text: "Single Notification",
* sound: isAndroid? 'file://sound.mp3' : 'file://beep.caf'
* data: { secret: key }
* });
*
*
* // Schedule multiple notifications
* LocalNotifications.schedule([{
* id: 1,
* text: "Multi Notification 1",
* sound: isAndroid ? 'file://sound.mp3' : 'file://beep.caf',
* data: { secret:key }
* },{
* id: 2,
* title: "Local Notification Example",
* text: "Multi Notification 2",
* icon: "http://example.com/icon.png"
* }]);
*
*
* // Schedule delayed notification
* LocalNotifications.schedule({
* t ext: "Delayed Notification",
* at: new Date(new Date() + 3600),
* led: "FF0000",
* sound: null
* });
* ```
*
*/
@Plugin({
plugin: 'de.appplant.cordova.plugin.local-notification',
pluginRef: 'cordova.plugins.notification.local',
repo: 'https://github.com/katzer/cordova-plugin-local-notifications'
})
export class LocalNotifications {
/**
* Schedules a single or multiple notifications
* @param options
*/
@Cordova({
sync: true
})
static schedule(options? : Notification) : void {}
/**
* Updates a previously scheduled notification. Must include the id in the options parameter.
* @param options
*/
@Cordova({
sync: true
})
static update(options? : Notification) : void {}
/**
* Clears single or multiple notifications
* @param notificationId A single notification id, or an array of notification ids.
*/
@Cordova()
static clear(notificationId : any) : Promise<any> {return}
/**
* Clears all notifications
*/
@Cordova({
successIndex: 0,
errorIndex: 2
})
static clearAll() : Promise<any> {return}
/**
* Cancels single or multiple notifications
* @param notificationId A single notification id, or an array of notification ids.
*/
@Cordova()
static cancel(notificationId : any) : Promise<any> {return}
/**
* Cancels all notifications
*/
@Cordova({
successIndex: 0,
errorIndex: 2
})
static cancelAll() : Promise<any> {return}
/**
* Checks presence of a notification
* @param notificationId
*/
@Cordova()
static isPresent (notificationId : number) : Promise<boolean> {return}
/**
* Checks is a notification is scheduled
* @param notificationId
*/
@Cordova()
static isScheduled (notificationId : number) : Promise<boolean> {return}
/**
* Checks if a notification is triggered
* @param notificationId
*/
@Cordova()
static isTriggered (notificationId : number) : Promise<boolean> {return}
/**
* Get all the notification ids
*/
@Cordova()
static getAllIds () : Promise<Array<number>> {return}
/**
* Get the ids of triggered notifications
*/
@Cordova()
static getTriggeredIds () : Promise<Array<number>> {return}
/**
* Get the ids of scheduled notifications
*/
@Cordova()
static getScheduledIds () : Promise<Array<number>> {return}
/**
* Get a notification object
* @param notificationId The id of the notification to get
*/
@Cordova()
static get (notificationId : any) : Promise <Notification> {return}
/**
* Get a scheduled notification object
* @param notificationId The id of the notification to get
*/
@Cordova()
static getScheduled (notificationId : any) : Promise <Notification> {return}
/**
* Get a triggered notification object
* @param notificationId The id of the notification to get
*/
@Cordova()
static getTriggered (notificationId : any) : Promise <Notification> {return}
/**
* Get all notification objects
*/
@Cordova()
static getAll() : Promise<Array<Notification>> {return}
/**
* Get all scheduled notification objects
*/
@Cordova()
static getAllScheduled() : Promise<Array<Notification>> {return}
/**
* Get all triggered notification objects
*/
@Cordova()
static getAllTriggered() : Promise<Array<Notification>> {return}
/**
* Sets a callback for a specific event
* @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall
* @param callback Call back function. All events return notification and state parameter. clear and clearall return state parameter only.
*/
@Cordova({
sync: true
})
static on(eventName : string, callback : any) : void {}
}
export interface Notification {
/**
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future
* Default: 0
*/
id? : number,
/**
* First row of the notification
* Default: Empty string (iOS) or the app name (Android)
*/
title? : string,
/**
* Second row of the notification
* Default: Empty string
*/
text? : string,
/**
* The interval at which to reschedule the local notification. That can be a value of second, minute, hour, day, week, month or year
* Default: 0 (which means that the system triggers the local notification once)
*/
every? : string,
/**
* The date and time when the system should deliver the local notification. If the specified value is nil or is a date in the past, the local notification is delivered immediately.
* Default: now ~ new Date()
*/
at? : any,
firstAt? : any,
/**
* The number currently set as the badge of the app icon in Springboard (iOS) or at the right-hand side of the local notification (Android)
* Default: 0 (which means don't show a number)
*/
badge? : number,
/**
* Uri of the file containing the sound to play when an alert is displayed
* Default: res://platform_default
*/
sound? : string,
/**
* Arbitrary data, objects will be encoded to JSON string
* Default: null
*/
data? : any,
/**
* ANDROID ONLY
* Uri of the icon that is shown in the ticker and notification
* Default: res://icon
*/
icon? : string,
/**
* ANDROID ONLY
* Uri of the resource (only res://) to use in the notification layouts. Different classes of devices may return different sizes
* Default: res://ic_popup_reminder
*/
smallIcon? : string,
/**
* ANDROID ONLY
* Ongoing notifications differ from regular notifications in the following ways:
* - They are sorted above the regular notifications in the notification panel
* - They do not have an 'X' close button, and are not affected by the "Clear all" button
* Default: false
*/
ongoing? : boolean,
/**
* ANDROID ONLY
* ARGB value that you would like the LED on the device to blink
* Default: FFFFFF
*/
led? : string
}

View File

@ -8,29 +8,52 @@ declare var $q;
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
/**
* @private
* @param pluginRef
* @returns {null|*}
*/
export const getPlugin = function(pluginRef: string): any { export const getPlugin = function(pluginRef: string): any {
return get(window, pluginRef); return get(window, pluginRef);
} };
/**
* @private
* @param pluginRef
* @returns {boolean}
*/
export const isInstalled = function(pluginRef: string): boolean { export const isInstalled = function(pluginRef: string): boolean {
return !!getPlugin(pluginRef); return !!getPlugin(pluginRef);
} };
export const pluginWarn = function(pluginName: string, method: string, plugin: string) {
/**
* @private
* @param pluginObj
* @param method
*/
export const pluginWarn = function(pluginObj: any, method: string) {
var pluginName = pluginObj.name;
var plugin = pluginObj.plugin;
if(method) { if(method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
', but the ' + pluginName + ' plugin is not installed. Install the ' +
plugin + ' plugin');
} else { } else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed. Install the ' + plugin + ' plugin'); console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
} }
} console.warn('Install the ' + pluginName + ' plugin: \'cordova plugin add ' + plugin + '\'');
};
/**
* @private
* @param pluginName
* @param method
*/
export const cordovaWarn = function(pluginName: string, method: string) { export const cordovaWarn = function(pluginName: string, method: string) {
if(method) { if(method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'); console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
} else { } else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'); console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
} }
} };
function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:any={}, resolve?: Function, reject?: Function) { function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:any={}, resolve?: Function, reject?: Function) {
// Try to figure out where the success/error callbacks need to be bound // Try to figure out where the success/error callbacks need to be bound
@ -58,20 +81,20 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation). // Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
if(!window.cordova) { if(!window.cordova) {
cordovaWarn(pluginObj.name, methodName); cordovaWarn(pluginObj.name, methodName);
reject({ reject && reject({
error: 'cordova_not_available' error: 'cordova_not_available'
}) });
return; return;
} }
pluginWarn(pluginObj.name, methodName, pluginObj.name); pluginWarn(pluginObj, methodName);
reject({ reject && reject({
error: 'plugin_not_installed' error: 'plugin_not_installed'
}); });
return; return;
} }
console.log('Cordova calling', pluginObj.name, methodName, args); // console.log('Cordova calling', pluginObj.name, methodName, args);
// TODO: Illegal invocation needs window context // TODO: Illegal invocation needs window context
return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args); return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
@ -79,13 +102,13 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an
function getPromise(cb) { function getPromise(cb) {
if(window.Promise) { if(window.Promise) {
console.log('Native promises available...'); // console.log('Native promises available...');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cb(resolve, reject); cb(resolve, reject);
}) })
} else if(window.angular) { } else if(window.angular) {
let $q = window.angular.injector(['ng']).get('$q'); let $q = window.angular.injector(['ng']).get('$q');
console.log('Loaded $q', $q); // console.log('Loaded $q', $q);
return $q((resolve, reject) => { return $q((resolve, reject) => {
cb(resolve, reject); cb(resolve, reject);
}); });
@ -112,27 +135,67 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any =
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult); return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
} catch(e) { } catch(e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName); console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
console.log(e); console.error(e);
} }
} }
}); });
} }
export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) { /**
return (...args) => { * Wrap the event with an observable
* @param event
if (opts.sync){ * @returns {Observable}
return callCordovaPlugin(pluginObj, methodName, args, opts); */
} else if (opts.observable) { function wrapEventObservable (event : string) : Observable<any> {
return wrapObservable(pluginObj, methodName, args, opts); return new Observable(observer => {
} else { let callback = (status : any) => observer.next(status);
return wrapPromise(pluginObj, methodName, args, opts); window.addEventListener(event, callback, false);
} return () => window.removeEventListener(event, callback, false);
} });
} }
/** /**
* @private
* @param pluginObj
* @param methodName
* @param opts
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
*/
export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) {
return (...args) => {
if (opts.sync)
return callCordovaPlugin(pluginObj, methodName, args, opts);
else if (opts.observable)
return wrapObservable(pluginObj, methodName, args, opts);
else if (opts.eventObservable && opts.event)
return wrapEventObservable(opts.event);
else
return wrapPromise(pluginObj, methodName, args, opts);
}
};
/**
* @private
*
* Class decorator specifying Plugin metadata. Required for all plugins. * Class decorator specifying Plugin metadata. Required for all plugins.
*
* @usage
* ```ts
* @Plugin({
* name: 'MyPlugin',
* plugin: 'cordova-plugin-myplugin',
* pluginRef: 'window.myplugin'
* })
* export class MyPlugin {
*
* // Plugin wrappers, properties, and functions go here ...
*
* }
* ```
*/ */
export function Plugin(config) { export function Plugin(config) {
return function(cls) { return function(cls) {
@ -144,13 +207,15 @@ export function Plugin(config) {
cls['installed'] = function() { cls['installed'] = function() {
return !!getPlugin(config.pluginRef); return !!getPlugin(config.pluginRef);
} };
return cls; return cls;
} }
} }
/** /**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova * Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed. * and the required plugin are installed.
*/ */
@ -167,25 +232,28 @@ export function Cordova(opts:any = {}) {
} }
/** /**
* @private
*
*
* Before calling the original method, ensure Cordova and the plugin are installed. * Before calling the original method, ensure Cordova and the plugin are installed.
*/ */
export function RequiresPlugin(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>) { export function CordovaProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>) {
let originalMethod = descriptor.value; let originalMethod = descriptor.get;
descriptor.value = function(...args: any[]) { descriptor.get = function(...args: any[]) {
console.log('Calling', this); // console.log('Calling', this);
if(!window.cordova) { if(!window.cordova) {
cordovaWarn(this.name, null); cordovaWarn(this.name, null);
return; return {};
} }
let pluginInstance = getPlugin(this.pluginRef); let pluginInstance = getPlugin(this.pluginRef);
if(!pluginInstance) { if(!pluginInstance) {
pluginWarn(this.name, null, this.name); pluginWarn(this, key);
return; return {};
} }
return originalMethod.apply(this, args); return originalMethod.apply(this, args);
} };
return descriptor; return descriptor;
} }

View File

@ -232,7 +232,7 @@ export interface AndroidPushOptions {
* If the array contains one or more strings each string will be used to * If the array contains one or more strings each string will be used to
* subscribe to a GcmPubSub topic. * subscribe to a GcmPubSub topic.
*/ */
topics: string[]; topics?: string[];
} }
export interface PushOptions { export interface PushOptions {
@ -252,11 +252,9 @@ declare var PushNotification: {
* *
* Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push). * Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push).
* *
*
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md). * For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
*/ */
@Plugin({ @Plugin({
name: 'Push',
plugin: 'phonegap-plugin-push', plugin: 'phonegap-plugin-push',
pluginRef: 'PushNotification', pluginRef: 'PushNotification',
repo: 'https://github.com/phonegap/phonegap-plugin-push' repo: 'https://github.com/phonegap/phonegap-plugin-push'
@ -286,21 +284,13 @@ export class Push {
@Cordova({ @Cordova({
sync: true sync: true
}) })
static init(options: PushOptions){ static init(options: PushOptions): PushNotification { return }
return new PushNotification();
}
/** /**
* Check whether the push notification permission has been granted. * Check whether the push notification permission has been granted.
* @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted. * @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
*/ */
@Cordova() @Cordova()
static hasPermission(){ static hasPermission(): Promise<{ isEnabled: boolean }> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<{ isEnabled: boolean }>((res, rej) => {});
}
} }

62
src/plugins/sms.ts Normal file
View File

@ -0,0 +1,62 @@
import {Plugin, Cordova} from './plugin';
/**
* Options for sending an SMS
*/
export interface smsOptions {
/**
* Set to true to replace \n by a new line. Default: false
*/
replaceLineBreaks? : boolean,
android? : smsOptionsAndroid
}
export interface smsOptionsAndroid {
/**
* Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app.
*/
intent? : string
}
/**
* @name SMS
* @description
*
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
*
* @usage
* ```ts
*
* // Send a text message using default options
* SMS.send('416123456','Hello world!');
*
* ```
*/
@Plugin({
plugin: 'cordova-sms-plugin',
pluginRef: 'sms',
repo: 'https://github.com/cordova-sms/cordova-sms-plugin',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class SMS {
/**
* Sends sms to a number
* @param number {string|Array<string>} Phone number
* @param message {string} Message
* @param options {smsOptions} Options
* @returns {Promise<any>} Resolves promise when the SMS has been sent
*/
@Cordova()
static send(
number: string | string[],
message: string,
options?: smsOptions
): Promise<any> { return }
}

View File

@ -0,0 +1,36 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Splashscreen
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
* @usage
* ```ts
* Splashscreen.show();
*
* Splashscreen.hide();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-splashscreen',
pluginRef: 'navigator.splashscreen',
repo: 'https://github.com/apache/cordova-plugin-splashscreen'
})
export class Splashscreen {
/**
* Shows the splashscreen
*/
@Cordova({
sync: true
})
static show() : void {}
/**
* Hides the splashscreen
*/
@Cordova({
sync: true
})
static hide() : void {}
}

View File

@ -1,15 +1,23 @@
import {Plugin, Cordova, RequiresPlugin} from './plugin'; import {Plugin, Cordova, CordovaProperty} from './plugin';
declare var window; declare var window;
/** /**
* * @name StatusBar
* @description
* Manage the appearance of the native status bar. * Manage the appearance of the native status bar.
* *
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar). * Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*
* @usage
* ```ts
* StatuBar.overlaysWebView(true);
*
* StatusBar.
* ```
*
*/ */
@Plugin({ @Plugin({
name: 'StatusBar',
plugin: 'cordova-plugin-statusbar', plugin: 'cordova-plugin-statusbar',
pluginRef: 'StatusBar', pluginRef: 'StatusBar',
repo: 'https://github.com/apache/cordova-plugin-statusbar' repo: 'https://github.com/apache/cordova-plugin-statusbar'
@ -102,8 +110,6 @@ export class StatusBar {
/** /**
* Whether the StatusBar is currently visible or not. * Whether the StatusBar is currently visible or not.
*/ */
@RequiresPlugin @CordovaProperty
static isVisible() { static get isVisible() { return window.StatusBar.isVisible; }
return window.StatusBar.isVisible;
}
} }

View File

@ -8,12 +8,22 @@ export interface ToastOptions {
addPixelsY?: number; addPixelsY?: number;
} }
/** /**
* @name Toast
* @description
* This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser. * This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser.
* *
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin). * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
*
* @usage
* ```ts
* Toast.show("I'm a toast", 5000, "center").subscribe(
* toast => {
* console.log(toast);
* }
* );
* ```
*/ */
@Plugin({ @Plugin({
name: 'Toast',
plugin: 'cordova-plugin-x-toast', plugin: 'cordova-plugin-x-toast',
pluginRef: 'plugins.toast', pluginRef: 'plugins.toast',
repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin' repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin'
@ -32,28 +42,18 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static show(message: string, duration: string, position: string){ static show(
// This Observable is replaced by one from the @Cordova decorator that wraps message: string,
// the plugin's callbacks. We provide a dummy one here so TypeScript duration: string,
// knows that the correct return type is Observable, because there's no way position: string
// for it to know the return type from a decorator. ): Observable<any> { return }
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Manually hide any currently visible toast. * Manually hide any currently visible toast.
* @return {Promise} Returns a Promise that resolves on success. * @return {Promise} Returns a Promise that resolves on success.
*/ */
@Cordova() @Cordova()
static hide(){ static hide(): Promise<any>{ return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Show a native toast with the given options. * Show a native toast with the given options.
@ -70,14 +70,7 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showWithOptions(options: ToastOptions){ static showWithOptions(options: ToastOptions): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Shorthand for `show(message, 'short', 'top')`. * Shorthand for `show(message, 'short', 'top')`.
@ -87,14 +80,7 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showShortTop(message: string){ static showShortTop(message: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Shorthand for `show(message, 'short', 'center')`. * Shorthand for `show(message, 'short', 'center')`.
@ -104,14 +90,8 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showShortCenter(message: string){ static showShortCenter(message: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Shorthand for `show(message, 'short', 'bottom')`. * Shorthand for `show(message, 'short', 'bottom')`.
@ -121,14 +101,8 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showShortBottom(message: string){ static showShortBottom(message: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Shorthand for `show(message, 'long', 'top')`. * Shorthand for `show(message, 'long', 'top')`.
@ -138,14 +112,8 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showLongTop(message: string){ static showLongTop(message: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Shorthand for `show(message, 'long', 'center')`. * Shorthand for `show(message, 'long', 'center')`.
@ -155,14 +123,8 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showLongCenter(message: string){ static showLongCenter(message: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
/** /**
* Shorthand for `show(message, 'long', 'bottom')`. * Shorthand for `show(message, 'long', 'bottom')`.
@ -172,12 +134,6 @@ export class Toast {
observable: true, observable: true,
clearFunction: 'hide' clearFunction: 'hide'
}) })
static showLongBottom(message: string){ static showLongBottom(message: string): Observable<any> { return }
// This Observable is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Observable, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Observable<any>(observer => {});
}
} }

View File

@ -22,7 +22,6 @@ import {Plugin, Cordova} from './plugin';
* *
*/ */
@Plugin({ @Plugin({
name: 'TouchID',
plugin: 'cordova-plugin-touch-id', plugin: 'cordova-plugin-touch-id',
pluginRef: 'plugins.touchid', pluginRef: 'plugins.touchid',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id' repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id'
@ -35,14 +34,7 @@ export class TouchID {
* @return {Promise} Returns a Promise that resolves if yes, rejects if no. * @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/ */
@Cordova() @Cordova()
isAvailable() { isAvailable(): Promise<any>{ return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
};
/** /**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen. * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
@ -51,14 +43,7 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/ */
@Cordova() @Cordova()
static verifyFingerprint(message: string) { static verifyFingerprint(message: string): Promise<any>{ return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above). * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
@ -67,14 +52,7 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/ */
@Cordova() @Cordova()
static verifyFingerprintWithCustomPasswordFallback(message: string) { static verifyFingerprintWithCustomPasswordFallback(message: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
/** /**
* Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above). * Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
@ -84,12 +62,5 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/ */
@Cordova() @Cordova()
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string) { static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return }
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
} }

37
src/plugins/vibration.ts Normal file
View File

@ -0,0 +1,37 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Vibration
* @description Vibrates the device
* @usage
* ```ts
* // Vibrate the device for a second
* Vibration.vibrate(1000);
*
* // Vibrate 2 seconds
* // Pause for 1 second
* // Vibrate for 2 seconds
* // Patterns work on Android and Windows only
* Vibration.vibrate([2000,1000,2000]);
*
* // Stop any current vibrations immediately
* // Works on Android and Windows only
* Vibration.vibrate(0);
* ```
*/
@Plugin({
plugin: 'cordova-plugin-vibration',
pluginRef: 'navigator.vibrate',
repo: 'https://github.com/apache/cordova-plugin-vibration'
})
export class Vibration {
/**
* Vibrates the device for given amount of time.
* @param time {Number|Array<Number>} Milliseconds to vibrate the device. If passed an array of numbers, it will define a vibration pattern. Pass 0 to stop any vibration immediately.
*/
@Cordova({
sync: true
})
static vibrate(time : any) {}
}

View File

@ -9,16 +9,15 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true "experimentalDecorators": true
}, },
"exclude": [ "filesGlob": [
"node_modules" "**/*.ts"
], ],
"files": [ "exclude": [
"src/index.ts", "node_modules"
"typings/es6-shim/es6-shim.d.ts"
], ],
"compileOnSave": false, "compileOnSave": false,
"buildOnSave": false, "buildOnSave": false,
"atom": { "atom": {
"rewriteTsconfig": true "rewriteTsconfig": false
} }
} }