From e8ae0db44cdab543683177ae63dd75de8fd2e2cc Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Feb 2016 17:05:37 -0500 Subject: [PATCH 001/112] Added .idea for webstorm --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c2658d7d..a5199f68 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +.idea \ No newline at end of file From 9e62d791c516e113dd30d04227eac55ece66d04b Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Feb 2016 17:22:50 -0500 Subject: [PATCH 002/112] Added DatePicker plugin --- src/plugins/datepicker.ts | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/plugins/datepicker.ts diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts new file mode 100644 index 00000000..893afed3 --- /dev/null +++ b/src/plugins/datepicker.ts @@ -0,0 +1,60 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * The DatePicker plugin allows the user to fetch date or time using native dialogs. + * + * Platforms supported: iOS, Android, Windows + * + * Requires cordova-plugin-datepicker by VitaliiBlagodir that can be [found here](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). + * + * Install the plugin by running the following command: + * ```shell + * ionic plugin add cordova-plugin-datepicker + * ``` + * + * @usage + * ```js + * DatePicker. + * ``` + * + */ +@Plugin({ + name: 'DatePicker', + plugin: '', + pluginRef: '' +}) +export class DatePicker { + + /** + * Shows the date and/or time picker dialog(s) + * @param options + * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. + */ + static show(options? : { + mode : string, + date : string, + minDate : string, + maxDate : string, + titleText : string, + okText : string, + cancelText : string, + todayText : string, + nowText : string, + is24Hour : boolean, + androidTheme : number, + allowOldDate: boolean, + allowFutureDates : boolean, + doneButtonLabel : string, + doneButtonColor : string, + cancelButtonLabel : string, + cancelButtonColor : string, + x : string, + y : string, + minuteInterval : number, + popoverArrowDirection : string, + locale : string + }) : Promise { + return new Promise((res, rej) => {}); + } + +} \ No newline at end of file From 5afa58fee4d89c3266fa8049274892e807d99439 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Feb 2016 17:25:15 -0500 Subject: [PATCH 003/112] feat(DatePicker): Added DatePicker --- src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 542073f0..5c42a083 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,7 @@ import {Push} from './plugins/push'; import {StatusBar} from './plugins/statusbar'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; +import {DatePicker} from './plugins/datepicker'; export { ActionSheet, @@ -33,7 +34,8 @@ export { Push, StatusBar, Toast, - TouchID + TouchID, + DatePicker } // Window export to use outside of a module loading system @@ -50,7 +52,8 @@ window['IonicNative'] = { Push: Push, StatusBar: StatusBar, Toast: Toast, - TouchID: TouchID + TouchID: TouchID, + DatePicker: DatePicker } // To help developers using cordova, we listen for the device ready event and From 499ead3aae5df2de29da1eccfb6d663ee3d9f418 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 02:23:56 -0500 Subject: [PATCH 004/112] fix(): datepicker plugin, pluginref, and @Cordova wrapper --- src/plugins/datepicker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 893afed3..4c55dd8c 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -20,8 +20,8 @@ import {Plugin, Cordova} from './plugin'; */ @Plugin({ name: 'DatePicker', - plugin: '', - pluginRef: '' + plugin: 'cordova-plugin-datepicker', + pluginRef: 'plugins.datePicker' }) export class DatePicker { @@ -30,6 +30,7 @@ export class DatePicker { * @param options * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ + @Cordova static show(options? : { mode : string, date : string, From 0dd4fecc062fb78eac8a328a60dfa4d7b0cab0ee Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:17:40 -0500 Subject: [PATCH 005/112] feat(): add apprate --- src/plugins/apprate.ts | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/plugins/apprate.ts diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts new file mode 100644 index 00000000..4e1dde3d --- /dev/null +++ b/src/plugins/apprate.ts @@ -0,0 +1,55 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * 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 [cordova-plugin-apprate docs](https://github.com/pushandplay/cordova-plugin-apprate). + * + * ``` + * ionic plugin add https://github.com/pushandplay/cordova-plugin-apprate.git + * ```` + * + * @usage + * ```js + * AppRate.preferences.storeAppURL.ios = ''; + * AppRate.preferences.storeAppURL.android = 'market://details?id='; + * AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/'; + * AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name='; + * AppRate.prompt(); + * ``` + */ +@Plugin({ + name: 'AppRate', + plugin: 'cordova-plugin-apprate', + pluginRef: 'AppRate' +}) +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 {{}} + */ + @Cordova() + static preferences = {}; + + /** + * Prompts the user for rating + */ + @Cordova() + static prompt () : void {}; + +} From 8b7852129b186e6a14a42eaac92def8a35a94936 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:25:03 -0500 Subject: [PATCH 006/112] feat(): add app version plugin --- src/plugins/appversion.ts | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/plugins/appversion.ts diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts new file mode 100644 index 00000000..6b92bd6b --- /dev/null +++ b/src/plugins/appversion.ts @@ -0,0 +1,59 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * Reads the version of your app from the target build settings. + * + * Requires Cordova plugin: cordova-plugin-appversion. For more info, please see the [cordova-plugin-version docs](ttps://github.com/whiteoctober/cordova-plugin-app-version). + * + * ``` + * ionic plugin add https://github.com/whiteoctober/cordova-plugin-app-version.git + * ```` + * + * @usage + * ```js + * AppVersion.getAppName(); + * AppVersion.getPackageName(); + * AppVersion.getVersionCode(); + * AppVersion.getVersionNumber(); + * ``` + */ +@Plugin({ + name: 'AppRate', + plugin: 'cordova-plugin-appversion', + pluginRef: 'cordova.getAppVersion' +}) +export class AppVersion { + + /** + * Returns the name of the app + */ + @Cordova + static getAppName () : string { + return; + } + + /** + * Returns the package name of the app + */ + @Cordova + static getPackageName () : string { + return; + } + + /** + * Returns the build identifier of the app + */ + @Cordova + static getVersionCode () : string { + return; + } + + /** + * Returns the version of the app + */ + @Cordova + static getVersionNumber () : string { + return; + } + +} From 20cb01fd9e83b0a4328c3904fc1ad48c1921370d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:25:44 -0500 Subject: [PATCH 007/112] feat(): add app version plugin --- src/plugins/appversion.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 6b92bd6b..816c6461 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -18,7 +18,7 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - name: 'AppRate', + name: 'AppVersion', plugin: 'cordova-plugin-appversion', pluginRef: 'cordova.getAppVersion' }) From 3088df441ba903ec5eb3e7171621844d7ced578e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:36:38 -0500 Subject: [PATCH 008/112] feat(): add badge plugin --- .idea/workspace.xml | 366 +++++++++++++++++++++++++++++++++++++++++++ src/plugins/badge.ts | 68 ++++++++ 2 files changed, 434 insertions(+) create mode 100644 .idea/workspace.xml create mode 100644 src/plugins/badge.ts diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..1b3e9df6 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $PROJECT_DIR$ + true + + bdd + + DIRECTORY + + false + + + + + + + + + + + 1455573664683 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts new file mode 100644 index 00000000..592ae79d --- /dev/null +++ b/src/plugins/badge.ts @@ -0,0 +1,68 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * 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 isn’t running in the foreground. + * + * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [cordova-plugin-badge docs](https://github.com/katzer/cordova-plugin-badge). + * + * ``` + * ionic plugin add https://github.com/katzer/cordova-plugin-badge.git + * ```` + * + * @usage + * ```js + * Badge.setBadge(10); + * Badge.increaseBadge(); + * Badge.clearBadge(); + * ``` + */ +@Plugin({ + name: 'Badge', + plugin: 'cordova-plugin-badge', + pluginRef: 'cordova.plugins.notification.badge' +}) +export class Badge { + + /** + * Determine permission to set badge notifications + */ + @Cordova() + static hasPermission () : boolean { + return; + } + + /** + * Register permission to set badge notifications + * @returns {Promise} + */ + @Cordova() + static registerPermission () : Promise { + return new Promise((res,rej) => {}); + } + + /** + * Sets the badge number + * @param number + */ + @Cordova() + static setBadge (number : number) : void {} + + /** + * Clears the badge number + */ + @Cordova() + static clearBadge () : void {} + + /** + * Increases the badge number + */ + @Cordova() + static increaseBadge () : void {} + + /** + * Decreases the badge number + */ + @Cordova() + static decreaseBadge () : void {} + +} From 7f01fb2b2a94c827878ab069e7b0f3516cba4975 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:37:02 -0500 Subject: [PATCH 009/112] feat(): add badge plugin --- .idea/workspace.xml | 366 -------------------------------------------- 1 file changed, 366 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 1b3e9df6..00000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $PROJECT_DIR$ - true - - bdd - - DIRECTORY - - false - - - - - - - - - - - 1455573664683 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From fa4c266cb7ef5860999a8b5352b5de0c2c49651d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:49:26 -0500 Subject: [PATCH 010/112] feat(): add clipboard plugin --- src/plugins/clipboard.ts | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/plugins/clipboard.ts diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts new file mode 100644 index 00000000..b97adad2 --- /dev/null +++ b/src/plugins/clipboard.ts @@ -0,0 +1,53 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8. + * + * Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard + * + * ``` + * ionic plugin add 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({ + name: 'Clipboard', + plugin: 'com.verso.cordova.clipboard', + pluginRef: 'cordova.plugins.clipboard' +}) +export class Clipboard { + + /** + * Copies the given text + * @param text + * @returns {Promise} + */ + @Cordova + static copy(text : string) : Promise { + return new Promise((res, resj) => {}); + } + + /** + * Pastes the text stored in clipboard + * @returns {Promise} + */ + @Cordova + static paste() : Promise { + return new Promise((res, rej) => {}); + } + +} From 0b6cca7a286c8b1413c692b2d8cc131d21709209 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:52:00 -0500 Subject: [PATCH 011/112] feat(): add clipboard plugin --- src/plugins/clipboard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index b97adad2..d66d8a92 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -36,7 +36,7 @@ export class Clipboard { * @param text * @returns {Promise} */ - @Cordova + @Cordova() static copy(text : string) : Promise { return new Promise((res, resj) => {}); } @@ -45,7 +45,7 @@ export class Clipboard { * Pastes the text stored in clipboard * @returns {Promise} */ - @Cordova + @Cordova() static paste() : Promise { return new Promise((res, rej) => {}); } From c881de41e2165d3d3ecf50f855fdbb8d65d949b4 Mon Sep 17 00:00:00 2001 From: mhartington Date: Tue, 23 Feb 2016 15:52:47 -0500 Subject: [PATCH 012/112] update template --- scripts/docs/templates/common.template.html | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index b15f0c53..9032f0d2 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -117,14 +117,10 @@ Improve this doc <@- if doc.decorators @> <@ for prop in doc.decorators[0].argumentInfo @> -
-
-$ ionic plugin add <$ prop.plugin $>
-
-
-

+

$ ionic plugin add <$ prop.plugin $>
+

Repo: -Repo: <$ prop.repo $> +<$ prop.repo $>

<@ endfor @> From e05f901bf3ed6b8c5b1ba7c8fa45d054a462f354 Mon Sep 17 00:00:00 2001 From: mhartington Date: Wed, 24 Feb 2016 16:20:16 -0500 Subject: [PATCH 013/112] doc(actionsheet): update options docs --- src/plugins/actionsheet.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 9d4c139c..6a367660 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -33,16 +33,20 @@ import {Plugin, Cordova} from './plugin'; export 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) + * Show the ActionSheet. The ActionSheet's options is an object with the following propterties. + * + * | Option | Type | Description | + * |-------------------------------|-----------|----------------------------------------------| + * | title |`string` | The title for the actionsheet | + * | buttonLabels |`string[]` | the labels for the buttons. Uses the index x | + * | androidTheme |`number` | Theme to bue used on Android | + * | androidEnableCancelButton |`boolean` | Enable a cancel on Android | + * | winphoneEnableCancelButton |`boolean` | Enable a cancel on Android | + * | 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 * button pressed (1 based, so 1, 2, 3, etc.) */ From daf577537e3936456cd642703753535ae18174b5 Mon Sep 17 00:00:00 2001 From: Basit Date: Fri, 26 Feb 2016 13:02:07 +0000 Subject: [PATCH 014/112] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 9aaf83c9..97895411 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,14 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or ## 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: + +## Installation Guide + +Run following commmand to install ionic-native on your ionic2 project. +``` +npm install ionic-native --save +``` + # Credits Tim Lancina - [@timlancina](http://twitter.com/timlancina) From 427611d109a9d6dcc2cf265e48ea0bdcc98e1739 Mon Sep 17 00:00:00 2001 From: Basit Date: Fri, 26 Feb 2016 13:09:53 +0000 Subject: [PATCH 015/112] options are optional --- src/plugins/geolocation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 9b7dc103..f4c23548 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -127,7 +127,7 @@ export class Geolocation { * @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() - static getCurrentPosition(options: GeolocationOptions){ + static getCurrentPosition(options?: GeolocationOptions){ // 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 @@ -157,7 +157,7 @@ export class Geolocation { observable: true, clearFunction: 'clearWatch' }) - static watchPosition(options: GeolocationOptions){ + static watchPosition(options?: GeolocationOptions){ // 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 From 1e73d3574a4f2694ffa268d26cb7572c5c743aa7 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 26 Feb 2016 11:31:21 -0600 Subject: [PATCH 016/112] Update README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 97895411..6c717f44 100644 --- a/README.md +++ b/README.md @@ -26,18 +26,18 @@ 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. +## Installation + +Run following commmand to install ionic-native in your project. +``` +npm install ionic-native --save +``` + ## 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: -## Installation Guide - -Run following commmand to install ionic-native on your ionic2 project. -``` -npm install ionic-native --save -``` - # Credits Tim Lancina - [@timlancina](http://twitter.com/timlancina) From 6c90530f5cd7f486364d6e204e0e2f3cc1273d10 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 10:26:55 -0600 Subject: [PATCH 017/112] chore(): fix 'improve this doc' link --- scripts/docs/templates/common.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index 9032f0d2..b8da35c3 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -104,7 +104,7 @@ Delegate: <$ doc.delegate $> - + Improve this doc From 09fd745c92c3a9564eb06b2d03ded7f730688fdd Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 10:33:36 -0600 Subject: [PATCH 018/112] chore(clipboard): add to index --- src/index.ts | 2 ++ src/plugins/clipboard.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 542073f0..c3059217 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import {BarcodeScanner} from './plugins/barcodescanner'; import {BLE} from './plugins/ble'; import {Camera} from './plugins/camera'; import {Calendar} from './plugins/calendar'; +import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; import {Device} from './plugins/device'; import {Facebook} from './plugins/facebook'; @@ -26,6 +27,7 @@ export { BLE, Camera, Calendar, + Clipboard, Contacts, Device, Facebook, diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index d66d8a92..fdbd768c 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -7,7 +7,7 @@ import {Plugin, Cordova} from './plugin'; * * ``` * ionic plugin add https://github.com/VersoSolutions/CordovaClipboard.git - * ```` + * ``` * * @usage * ```js From ea0067297cf2679f4893455087ff36b019f5438c Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 12:24:00 -0600 Subject: [PATCH 019/112] chore(): don't track dist --- .gitignore | 3 +- dist/index.d.ts | 14 - dist/index.js | 61 ---- dist/index.js.map | 1 - dist/ionic.native.d.ts | 0 dist/ionic.native.js | 1 - dist/ionic.native.js.map | 1 - dist/ng1.d.ts | 8 - dist/ng1.js | 24 -- dist/ng1.js.map | 1 - dist/plugins/actionsheet.d.ts | 52 --- dist/plugins/actionsheet.js | 83 ----- dist/plugins/actionsheet.js.map | 1 - dist/plugins/barcodescanner.d.ts | 21 -- dist/plugins/barcodescanner.js | 51 --- dist/plugins/barcodescanner.js.map | 1 - dist/plugins/ble.d.ts | 337 ------------------- dist/plugins/ble.js | 520 ----------------------------- dist/plugins/ble.js.map | 1 - dist/plugins/calendar.d.ts | 220 ------------ dist/plugins/calendar.js | 403 ---------------------- dist/plugins/calendar.js.map | 1 - dist/plugins/camera.d.ts | 111 ------ dist/plugins/camera.js | 65 ---- dist/plugins/camera.js.map | 1 - dist/plugins/contacts.d.ts | 149 --------- dist/plugins/contacts.js | 102 ------ dist/plugins/contacts.js.map | 1 - dist/plugins/device.d.ts | 37 -- dist/plugins/device.js | 40 --- dist/plugins/device.js.map | 1 - dist/plugins/facebook.d.ts | 198 ----------- dist/plugins/facebook.js | 308 ----------------- dist/plugins/facebook.js.map | 1 - dist/plugins/geolocation.d.ts | 120 ------- dist/plugins/geolocation.js | 88 ----- dist/plugins/geolocation.js.map | 1 - dist/plugins/plugin.d.ts | 20 -- dist/plugins/plugin.js | 189 ----------- dist/plugins/plugin.js.map | 1 - dist/plugins/push.d.ts | 252 -------------- dist/plugins/push.js | 72 ---- dist/plugins/push.js.map | 1 - dist/plugins/statusbar.d.ts | 59 ---- dist/plugins/statusbar.js | 137 -------- dist/plugins/statusbar.js.map | 1 - dist/plugins/toast.d.ts | 70 ---- dist/plugins/toast.js | 198 ----------- dist/plugins/toast.js.map | 1 - dist/plugins/touchid.d.ts | 49 --- dist/plugins/touchid.js | 110 ------ dist/plugins/touchid.js.map | 1 - dist/util.d.ts | 1 - dist/util.js | 12 - dist/util.js.map | 1 - 55 files changed, 2 insertions(+), 4201 deletions(-) delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 dist/ionic.native.d.ts delete mode 100644 dist/ionic.native.js delete mode 100644 dist/ionic.native.js.map delete mode 100644 dist/ng1.d.ts delete mode 100644 dist/ng1.js delete mode 100644 dist/ng1.js.map delete mode 100644 dist/plugins/actionsheet.d.ts delete mode 100644 dist/plugins/actionsheet.js delete mode 100644 dist/plugins/actionsheet.js.map delete mode 100644 dist/plugins/barcodescanner.d.ts delete mode 100644 dist/plugins/barcodescanner.js delete mode 100644 dist/plugins/barcodescanner.js.map delete mode 100644 dist/plugins/ble.d.ts delete mode 100644 dist/plugins/ble.js delete mode 100644 dist/plugins/ble.js.map delete mode 100644 dist/plugins/calendar.d.ts delete mode 100644 dist/plugins/calendar.js delete mode 100644 dist/plugins/calendar.js.map delete mode 100644 dist/plugins/camera.d.ts delete mode 100644 dist/plugins/camera.js delete mode 100644 dist/plugins/camera.js.map delete mode 100644 dist/plugins/contacts.d.ts delete mode 100644 dist/plugins/contacts.js delete mode 100644 dist/plugins/contacts.js.map delete mode 100644 dist/plugins/device.d.ts delete mode 100644 dist/plugins/device.js delete mode 100644 dist/plugins/device.js.map delete mode 100644 dist/plugins/facebook.d.ts delete mode 100644 dist/plugins/facebook.js delete mode 100644 dist/plugins/facebook.js.map delete mode 100644 dist/plugins/geolocation.d.ts delete mode 100644 dist/plugins/geolocation.js delete mode 100644 dist/plugins/geolocation.js.map delete mode 100644 dist/plugins/plugin.d.ts delete mode 100644 dist/plugins/plugin.js delete mode 100644 dist/plugins/plugin.js.map delete mode 100644 dist/plugins/push.d.ts delete mode 100644 dist/plugins/push.js delete mode 100644 dist/plugins/push.js.map delete mode 100644 dist/plugins/statusbar.d.ts delete mode 100644 dist/plugins/statusbar.js delete mode 100644 dist/plugins/statusbar.js.map delete mode 100644 dist/plugins/toast.d.ts delete mode 100644 dist/plugins/toast.js delete mode 100644 dist/plugins/toast.js.map delete mode 100644 dist/plugins/touchid.d.ts delete mode 100644 dist/plugins/touchid.js delete mode 100644 dist/plugins/touchid.js.map delete mode 100644 dist/util.d.ts delete mode 100644 dist/util.js delete mode 100644 dist/util.js.map diff --git a/.gitignore b/.gitignore index a5199f68..faa71d20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ -.idea \ No newline at end of file +.idea +dist/ diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index a814f870..00000000 --- a/dist/index.d.ts +++ /dev/null @@ -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 }; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 173f12dd..00000000 --- a/dist/index.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 4c57b3ac..00000000 --- a/dist/index.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/ionic.native.d.ts b/dist/ionic.native.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/dist/ionic.native.js b/dist/ionic.native.js deleted file mode 100644 index 73c245c3..00000000 --- a/dist/ionic.native.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=ionic.native.js.map \ No newline at end of file diff --git a/dist/ionic.native.js.map b/dist/ionic.native.js.map deleted file mode 100644 index ed0487d7..00000000 --- a/dist/ionic.native.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ionic.native.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ng1.d.ts b/dist/ng1.d.ts deleted file mode 100644 index ffb86be5..00000000 --- a/dist/ng1.d.ts +++ /dev/null @@ -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; diff --git a/dist/ng1.js b/dist/ng1.js deleted file mode 100644 index 08fe5811..00000000 --- a/dist/ng1.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/ng1.js.map b/dist/ng1.js.map deleted file mode 100644 index e26f61a2..00000000 --- a/dist/ng1.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/actionsheet.d.ts b/dist/plugins/actionsheet.d.ts deleted file mode 100644 index 4109872e..00000000 --- a/dist/plugins/actionsheet.d.ts +++ /dev/null @@ -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; - /** - * Hide the ActionSheet. - */ - static hide(): Promise; -} diff --git a/dist/plugins/actionsheet.js b/dist/plugins/actionsheet.js deleted file mode 100644 index 7595060a..00000000 --- a/dist/plugins/actionsheet.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/actionsheet.js.map b/dist/plugins/actionsheet.js.map deleted file mode 100644 index 32dfc1ee..00000000 --- a/dist/plugins/actionsheet.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/barcodescanner.d.ts b/dist/plugins/barcodescanner.d.ts deleted file mode 100644 index 5f48b2b7..00000000 --- a/dist/plugins/barcodescanner.d.ts +++ /dev/null @@ -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; -} diff --git a/dist/plugins/barcodescanner.js b/dist/plugins/barcodescanner.js deleted file mode 100644 index af186180..00000000 --- a/dist/plugins/barcodescanner.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/barcodescanner.js.map b/dist/plugins/barcodescanner.js.map deleted file mode 100644 index 2f00a941..00000000 --- a/dist/plugins/barcodescanner.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/ble.d.ts b/dist/plugins/ble.d.ts deleted file mode 100644 index 2f69e32b..00000000 --- a/dist/plugins/ble.d.ts +++ /dev/null @@ -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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * Report if bluetooth is enabled. - * - * @usage - * ``` - * BLE.isEnabled().then( - * () => { console.log('enabled'); }, - * () => { console.log('not enabled'); } - * ); - * ``` - * @return Returns a Promise. - */ - static isEnabled(): Promise; - /** - * Open System Bluetooth settings (Android only). - * - * @return Returns a Promise. - */ - static showBluetoothSettings(): Promise; - /** - * Enable Bluetooth on the device (Android only). - * - * @return Returns a Promise. - */ - static enable(): Promise; -} diff --git a/dist/plugins/ble.js b/dist/plugins/ble.js deleted file mode 100644 index 1ee119cf..00000000 --- a/dist/plugins/ble.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/ble.js.map b/dist/plugins/ble.js.map deleted file mode 100644 index fe76cbca..00000000 --- a/dist/plugins/ble.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ble.js","sourceRoot":"","sources":["../../src/plugins/ble.ts"],"names":["BLE","BLE.constructor","BLE.scan","BLE.startScan","BLE.stopScan","BLE.connect","BLE.disconnect","BLE.read","BLE.write","BLE.writeWithoutResponse","BLE.startNotification","BLE.stopNotification","BLE.isConnected","BLE.isEnabled","BLE.showBluetoothSettings","BLE.enable"],"mappings":"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"} \ No newline at end of file diff --git a/dist/plugins/calendar.d.ts b/dist/plugins/calendar.d.ts deleted file mode 100644 index d1045e23..00000000 --- a/dist/plugins/calendar.d.ts +++ /dev/null @@ -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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * Get a list of all calendars. - * @return A Promise that resolves with the list of calendars, or rejects with an error. - */ - static listCalendars(): Promise; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * Open the calendar at the specified date. - * @return {Date} date - */ - static openCalendar(date: Date): Promise; -} diff --git a/dist/plugins/calendar.js b/dist/plugins/calendar.js deleted file mode 100644 index 09909f58..00000000 --- a/dist/plugins/calendar.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/calendar.js.map b/dist/plugins/calendar.js.map deleted file mode 100644 index e7bd838c..00000000 --- a/dist/plugins/calendar.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/plugins/calendar.ts"],"names":["Calendar","Calendar.constructor","Calendar.createCalendar","Calendar.deleteCalendar","Calendar.getCalendarOptions","Calendar.createEvent","Calendar.createEventWithOptions","Calendar.createEventInteractively","Calendar.createEventInteractivelyWithOptions","Calendar.findEvent","Calendar.findEventWithOptions","Calendar.listEventsInRange","Calendar.listCalendars","Calendar.findAllEventsInNamedCalendar","Calendar.modifyEvent","Calendar.modifyEventWithOptions","Calendar.deleteEvent","Calendar.deleteEventFromNamedCalendar","Calendar.openCalendar"],"mappings":"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"} \ No newline at end of file diff --git a/dist/plugins/camera.d.ts b/dist/plugins/camera.d.ts deleted file mode 100644 index 9a31021b..00000000 --- a/dist/plugins/camera.d.ts +++ /dev/null @@ -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; - /** - * 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; -} diff --git a/dist/plugins/camera.js b/dist/plugins/camera.js deleted file mode 100644 index b8d687f4..00000000 --- a/dist/plugins/camera.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/camera.js.map b/dist/plugins/camera.js.map deleted file mode 100644 index 78b65bea..00000000 --- a/dist/plugins/camera.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/contacts.d.ts b/dist/plugins/contacts.d.ts deleted file mode 100644 index 48ed9f94..00000000 --- a/dist/plugins/contacts.d.ts +++ /dev/null @@ -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; - /** - * Select a single Contact. - * @return Returns a Promise that resolves with the selected Contact - */ - static pickContact(): Promise; -} diff --git a/dist/plugins/contacts.js b/dist/plugins/contacts.js deleted file mode 100644 index 7ff94998..00000000 --- a/dist/plugins/contacts.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/contacts.js.map b/dist/plugins/contacts.js.map deleted file mode 100644 index df11034b..00000000 --- a/dist/plugins/contacts.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/device.d.ts b/dist/plugins/device.d.ts deleted file mode 100644 index ce5120b3..00000000 --- a/dist/plugins/device.d.ts +++ /dev/null @@ -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; -} diff --git a/dist/plugins/device.js b/dist/plugins/device.js deleted file mode 100644 index 7a5f9200..00000000 --- a/dist/plugins/device.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/device.js.map b/dist/plugins/device.js.map deleted file mode 100644 index f0593c76..00000000 --- a/dist/plugins/device.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/facebook.d.ts b/dist/plugins/facebook.d.ts deleted file mode 100644 index 059abe73..00000000 --- a/dist/plugins/facebook.d.ts +++ /dev/null @@ -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: - * ``` - * - * ``` - * - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; -} diff --git a/dist/plugins/facebook.js b/dist/plugins/facebook.js deleted file mode 100644 index cad618dc..00000000 --- a/dist/plugins/facebook.js +++ /dev/null @@ -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: - * ``` - * - * ``` - * - * 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((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 \ No newline at end of file diff --git a/dist/plugins/facebook.js.map b/dist/plugins/facebook.js.map deleted file mode 100644 index 94975e96..00000000 --- a/dist/plugins/facebook.js.map +++ /dev/null @@ -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":"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"} \ No newline at end of file diff --git a/dist/plugins/geolocation.d.ts b/dist/plugins/geolocation.d.ts deleted file mode 100644 index 2d91e199..00000000 --- a/dist/plugins/geolocation.d.ts +++ /dev/null @@ -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; - /** - * 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; -} diff --git a/dist/plugins/geolocation.js b/dist/plugins/geolocation.js deleted file mode 100644 index 71cd22f2..00000000 --- a/dist/plugins/geolocation.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/geolocation.js.map b/dist/plugins/geolocation.js.map deleted file mode 100644 index 8d53fb88..00000000 --- a/dist/plugins/geolocation.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/plugin.d.ts b/dist/plugins/plugin.d.ts deleted file mode 100644 index a2a2045f..00000000 --- a/dist/plugins/plugin.d.ts +++ /dev/null @@ -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) => { - 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): TypedPropertyDescriptor; diff --git a/dist/plugins/plugin.js b/dist/plugins/plugin.js deleted file mode 100644 index 1c84a177..00000000 --- a/dist/plugins/plugin.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/plugin.js.map b/dist/plugins/plugin.js.map deleted file mode 100644 index c39cc63a..00000000 --- a/dist/plugins/plugin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugins/plugin.ts"],"names":["callCordovaPlugin","getPromise","wrapPromise","wrapObservable","Plugin","Cordova","RequiresPlugin"],"mappings":"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"} \ No newline at end of file diff --git a/dist/plugins/push.d.ts b/dist/plugins/push.d.ts deleted file mode 100644 index 968b3768..00000000 --- a/dist/plugins/push.d.ts +++ /dev/null @@ -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; - }>; -} diff --git a/dist/plugins/push.js b/dist/plugins/push.js deleted file mode 100644 index bc6e9ab5..00000000 --- a/dist/plugins/push.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/push.js.map b/dist/plugins/push.js.map deleted file mode 100644 index f5c8a07b..00000000 --- a/dist/plugins/push.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/statusbar.d.ts b/dist/plugins/statusbar.d.ts deleted file mode 100644 index 42d5b354..00000000 --- a/dist/plugins/statusbar.d.ts +++ /dev/null @@ -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; -} diff --git a/dist/plugins/statusbar.js b/dist/plugins/statusbar.js deleted file mode 100644 index a53d5255..00000000 --- a/dist/plugins/statusbar.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/statusbar.js.map b/dist/plugins/statusbar.js.map deleted file mode 100644 index 0779589c..00000000 --- a/dist/plugins/statusbar.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/plugins/toast.d.ts b/dist/plugins/toast.d.ts deleted file mode 100644 index d8033e43..00000000 --- a/dist/plugins/toast.d.ts +++ /dev/null @@ -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; - /** - * Manually hide any currently visible toast. - * @return {Promise} Returns a Promise that resolves on success. - */ - static hide(): Promise; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; - /** - * 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; -} diff --git a/dist/plugins/toast.js b/dist/plugins/toast.js deleted file mode 100644 index e7d13f58..00000000 --- a/dist/plugins/toast.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/toast.js.map b/dist/plugins/toast.js.map deleted file mode 100644 index 273cc12d..00000000 --- a/dist/plugins/toast.js.map +++ /dev/null @@ -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":"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"} \ No newline at end of file diff --git a/dist/plugins/touchid.d.ts b/dist/plugins/touchid.d.ts deleted file mode 100644 index 49e065c1..00000000 --- a/dist/plugins/touchid.d.ts +++ /dev/null @@ -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; - /** - * 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; - /** - * 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; - /** - * 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; -} diff --git a/dist/plugins/touchid.js b/dist/plugins/touchid.js deleted file mode 100644 index ce399b47..00000000 --- a/dist/plugins/touchid.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/plugins/touchid.js.map b/dist/plugins/touchid.js.map deleted file mode 100644 index 33b9cb30..00000000 --- a/dist/plugins/touchid.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/dist/util.d.ts b/dist/util.d.ts deleted file mode 100644 index 9c046eed..00000000 --- a/dist/util.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function get(obj: any, path: any): any; diff --git a/dist/util.js b/dist/util.js deleted file mode 100644 index 19dd6ac9..00000000 --- a/dist/util.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dist/util.js.map b/dist/util.js.map deleted file mode 100644 index 33a54c14..00000000 --- a/dist/util.js.map +++ /dev/null @@ -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"} \ No newline at end of file From c48a851d877f1ca6a8252e2af36e00f9717993f4 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 13:52:57 -0600 Subject: [PATCH 020/112] feat(plugin): show instructions if plugin not installed --- src/plugins/plugin.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index bc69eef4..d45eda10 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -15,14 +15,15 @@ export const getPlugin = function(pluginRef: string): any { export const isInstalled = function(pluginRef: string): boolean { return !!getPlugin(pluginRef); } -export const pluginWarn = function(pluginName: string, method: string, plugin: string) { +export const pluginWarn = function(pluginObj: any, method: string) { + var pluginName = pluginObj.name; + var plugin = pluginObj.plugin; if(method) { - console.warn('Native: tried calling ' + pluginName + '.' + method + - ', but the ' + pluginName + ' plugin is not installed. Install the ' + - plugin + ' plugin'); + console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.'); } 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 + '\''); } export const cordovaWarn = function(pluginName: string, method: string) { if(method) { @@ -64,7 +65,7 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an return; } - pluginWarn(pluginObj.name, methodName, pluginObj.name); + pluginWarn(pluginObj, methodName); reject({ error: 'plugin_not_installed' }); @@ -181,7 +182,7 @@ export function RequiresPlugin(target: Function, key: string, descriptor: TypedP let pluginInstance = getPlugin(this.pluginRef); if(!pluginInstance) { - pluginWarn(this.name, null, this.name); + pluginWarn(this, key); return; } return originalMethod.apply(this, args); From f360827b20f5fd477b134ffa5553798fee5636ff Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 13:53:59 -0600 Subject: [PATCH 021/112] chore(): comment out debug statements --- src/plugins/plugin.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index d45eda10..776b8d47 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -72,7 +72,7 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an return; } - console.log('Cordova calling', pluginObj.name, methodName, args); + // console.log('Cordova calling', pluginObj.name, methodName, args); // TODO: Illegal invocation needs window context return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args); @@ -80,13 +80,13 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an function getPromise(cb) { if(window.Promise) { - console.log('Native promises available...'); + // console.log('Native promises available...'); return new Promise((resolve, reject) => { cb(resolve, reject); }) } else if(window.angular) { let $q = window.angular.injector(['ng']).get('$q'); - console.log('Loaded $q', $q); + // console.log('Loaded $q', $q); return $q((resolve, reject) => { cb(resolve, reject); }); @@ -113,7 +113,7 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any = return 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); + console.error(e); } } }); @@ -174,7 +174,7 @@ export function RequiresPlugin(target: Function, key: string, descriptor: TypedP let originalMethod = descriptor.value; descriptor.value = function(...args: any[]) { - console.log('Calling', this); + // console.log('Calling', this); if(!window.cordova) { cordovaWarn(this.name, null); return; From fc54fefde55b17b1c2877ff605d021a0ecd94390 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 13:56:22 -0600 Subject: [PATCH 022/112] feat(plugin): proxy plugin properties Rename RequiresPlugin decorator to CordovaProperty and replace getter so we can forward property access to the underlying plugin property. --- src/plugins/apprate.ts | 10 +++++++--- src/plugins/device.ts | 6 +++--- src/plugins/plugin.ts | 10 +++++----- src/plugins/statusbar.ts | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 4e1dde3d..be2b8048 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -1,4 +1,6 @@ -import {Plugin, Cordova} from './plugin'; +import {Plugin, Cordova, CordovaProperty} from './plugin'; + +declare var window; /** * The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never. @@ -43,8 +45,10 @@ export class AppRate { * customLocale {Object} null - custom locale object * @type {{}} */ - @Cordova() - static preferences = {}; + @CordovaProperty + static get preferences(){ + return window.AppRate.preferences; + } /** * Prompts the user for rating diff --git a/src/plugins/device.ts b/src/plugins/device.ts index 0273c2e7..99829e45 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -1,4 +1,4 @@ -import {Plugin, RequiresPlugin} from './plugin'; +import {Plugin, CordovaProperty} from './plugin'; declare var window: { device: Device @@ -49,8 +49,8 @@ export class Device { * * @returns {Object} The device object. */ - @RequiresPlugin - static getDevice() { + @CordovaProperty + static get device() { return window.device; } } diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 776b8d47..321eb068 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -170,20 +170,20 @@ export function Cordova(opts:any = {}) { /** * Before calling the original method, ensure Cordova and the plugin are installed. */ -export function RequiresPlugin(target: Function, key: string, descriptor: TypedPropertyDescriptor) { - let originalMethod = descriptor.value; +export function CordovaProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor) { + let originalMethod = descriptor.get; - descriptor.value = function(...args: any[]) { + descriptor.get = function(...args: any[]) { // console.log('Calling', this); if(!window.cordova) { cordovaWarn(this.name, null); - return; + return {}; } let pluginInstance = getPlugin(this.pluginRef); if(!pluginInstance) { pluginWarn(this, key); - return; + return {}; } return originalMethod.apply(this, args); } diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index 803ec124..f1814e3e 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova, RequiresPlugin} from './plugin'; +import {Plugin, Cordova, CordovaProperty} from './plugin'; declare var window; @@ -102,8 +102,8 @@ export class StatusBar { /** * Whether the StatusBar is currently visible or not. */ - @RequiresPlugin - static isVisible() { + @CordovaProperty + static get isVisible() { return window.StatusBar.isVisible; } } From 5ad72de3d393d3befc476c64e4c3d8289fe9fc4b Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 14:04:38 -0600 Subject: [PATCH 023/112] chore(): remove unnecessary name option from Plugin decorator At least for now, we get the name of the plugin from the class. --- DEVELOPER.md | 6 +----- src/plugins/actionsheet.ts | 3 +-- src/plugins/apprate.ts | 1 - src/plugins/appversion.ts | 1 - src/plugins/badge.ts | 1 - src/plugins/barcodescanner.ts | 1 - src/plugins/ble.ts | 1 - src/plugins/calendar.ts | 1 - src/plugins/camera.ts | 1 - src/plugins/clipboard.ts | 1 - src/plugins/contacts.ts | 1 - src/plugins/datepicker.ts | 1 - src/plugins/facebook.ts | 1 - src/plugins/geolocation.ts | 1 - src/plugins/push.ts | 1 - src/plugins/statusbar.ts | 1 - src/plugins/toast.ts | 1 - src/plugins/touchid.ts | 1 - 18 files changed, 2 insertions(+), 23 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index b22aa9ab..9aede5f9 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -9,7 +9,6 @@ Let's take a look at the existing plugin wrapper for Geolocation to see what goe ``` @Plugin({ - name: 'Geolocation', plugin: 'cordova-plugin-geolocation', pluginRef: 'navigator.geolocation' }) @@ -49,7 +48,6 @@ For example, the `@Plugin` decorator adds information about the plugin to our Ge ``` @Plugin({ - name: 'Geolocation', plugin: 'cordova-plugin-geolocation', pluginRef: 'navigator.geolocation' }) @@ -58,9 +56,7 @@ export class Geolocation { } ``` -Here, `name` refers to the name of the plugin, which is used by Ionic Native for logging messages. - -`plugin` is the name of the plugin package on npm and used when calling `cordova plugin add`, also used for logging purposes. +Here, `plugin` is the name of the plugin package on npm and used when calling `cordova plugin add`. `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`. diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 6a367660..67a6f755 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -25,7 +25,6 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - name: 'ActionSheet', plugin: 'cordova-plugin-actionsheet', pluginRef: 'plugins.actionsheet', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet' @@ -46,7 +45,7 @@ export class ActionSheet { * | addDestructiveButtonWithLabel |`string` | Add a destructive button with text | * | position |`number[]` | On an iPad, set the X,Y position | * - * @param {options} Options See table above + * @param {options} Options See table above * @returns {Promise} Returns a Promise that resolves with the index of the * button pressed (1 based, so 1, 2, 3, etc.) */ diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index be2b8048..63d269ed 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -21,7 +21,6 @@ declare var window; * ``` */ @Plugin({ - name: 'AppRate', plugin: 'cordova-plugin-apprate', pluginRef: 'AppRate' }) diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 816c6461..d74005e2 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -18,7 +18,6 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - name: 'AppVersion', plugin: 'cordova-plugin-appversion', pluginRef: 'cordova.getAppVersion' }) diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index 592ae79d..6bafae52 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -17,7 +17,6 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - name: 'Badge', plugin: 'cordova-plugin-badge', pluginRef: 'cordova.plugins.notification.badge' }) diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 33cce31e..ae0eb481 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -17,7 +17,6 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - name: 'BarcodeScanner', plugin: 'phonegap-plugin-barcodescanner', pluginRef: 'cordova.plugins.barcodeScanner', repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner' diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index f121bca1..f4db8b11 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -160,7 +160,6 @@ import {Observable} from 'rxjs/Observable'; * */ @Plugin({ - name: 'BLE', plugin: 'cordova-plugin-ble-central', pluginRef: 'ble', repo: 'https://github.com/don/cordova-plugin-ble-central' diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 0ff05dce..f9a1377c 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -25,7 +25,6 @@ export interface Calendar { * */ @Plugin({ - name: 'Calendar', plugin: 'cordova-plugin-calendar', pluginRef: 'plugins.calendar', repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin' diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 52a2e366..10105989 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -102,7 +102,6 @@ export interface CameraPopoverOptions { * ``` */ @Plugin({ - name: 'Camera', plugin: 'cordova-plugin-camera', pluginRef: 'navigator.camera', repo: 'https://github.com/apache/cordova-plugin-camera' diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index fdbd768c..0e24ea00 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -25,7 +25,6 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - name: 'Clipboard', plugin: 'com.verso.cordova.clipboard', pluginRef: 'cordova.plugins.clipboard' }) diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 8a2fbc7b..3fdaf731 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -207,7 +207,6 @@ declare var Contact: { * */ @Plugin({ - name: 'Contacts', plugin: 'cordova-plugin-contacts', pluginRef: 'navigator.contacts', repo: 'https://github.com/apache/cordova-plugin-contacts' diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 4c55dd8c..4b16b1f3 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -19,7 +19,6 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - name: 'DatePicker', plugin: 'cordova-plugin-datepicker', pluginRef: 'plugins.datePicker' }) diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 4d0d98ee..40f096ca 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -70,7 +70,6 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - name: 'Facebook', plugin: 'cordova-plugin-facebook4', pluginRef: 'facebookConnectPlugin', repo: 'https://github.com/jeduan/cordova-plugin-facebook4' diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index f4c23548..6e5ebc99 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -115,7 +115,6 @@ export interface GeolocationOptions { * ``` */ @Plugin({ - name: 'Geolocation', plugin: 'cordova-plugin-geolocation', pluginRef: 'navigator.geolocation' }) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index a16da648..b55caa0c 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -256,7 +256,6 @@ declare var PushNotification: { * 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({ - name: 'Push', plugin: 'phonegap-plugin-push', pluginRef: 'PushNotification', repo: 'https://github.com/phonegap/phonegap-plugin-push' diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index f1814e3e..36ac19f2 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -9,7 +9,6 @@ declare var window; * Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar). */ @Plugin({ - name: 'StatusBar', plugin: 'cordova-plugin-statusbar', pluginRef: 'StatusBar', repo: 'https://github.com/apache/cordova-plugin-statusbar' diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index cc35d514..92a8b8ad 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -13,7 +13,6 @@ export interface ToastOptions { * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin). */ @Plugin({ - name: 'Toast', plugin: 'cordova-plugin-x-toast', pluginRef: 'plugins.toast', repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin' diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index 64098d8f..bd50118e 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -22,7 +22,6 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - name: 'TouchID', plugin: 'cordova-plugin-touch-id', pluginRef: 'plugins.touchid', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id' From 98fbe6c7ceb0627c2a970a5ede3960febafbcc43 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 4 Mar 2016 15:42:21 -0600 Subject: [PATCH 024/112] chore(): new plugin cleanup --- src/index.ts | 22 +++++-- src/plugins/apprate.ts | 14 ++-- src/plugins/appversion.ts | 55 +++++++++++----- src/plugins/badge.ts | 132 +++++++++++++++++++++++++++----------- src/plugins/clipboard.ts | 5 +- src/plugins/datepicker.ts | 2 +- 6 files changed, 161 insertions(+), 69 deletions(-) diff --git a/src/index.ts b/src/index.ts index 841ea57e..f1011094 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,12 +7,16 @@ const DEVICE_READY_TIMEOUT = 2000; declare var window; import {ActionSheet} from './plugins/actionsheet'; +import {AppRate} from './plugins/apprate'; +import {AppVersion} from './plugins/appversion'; import {BarcodeScanner} from './plugins/barcodescanner'; +import {Badge} from './plugins/badge'; import {BLE} from './plugins/ble'; import {Camera} from './plugins/camera'; import {Calendar} from './plugins/calendar'; import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; +import {DatePicker} from './plugins/datepicker'; import {Device} from './plugins/device'; import {Facebook} from './plugins/facebook'; import {Geolocation} from './plugins/geolocation'; @@ -20,42 +24,48 @@ import {Push} from './plugins/push'; import {StatusBar} from './plugins/statusbar'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; -import {DatePicker} from './plugins/datepicker'; export { ActionSheet, + AppRate, + AppVersion, BarcodeScanner, + Badge, BLE, Camera, Calendar, Clipboard, Contacts, + DatePicker, Device, Facebook, Geolocation, Push, StatusBar, Toast, - TouchID, - DatePicker + TouchID } // Window export to use outside of a module loading system window['IonicNative'] = { ActionSheet: ActionSheet, - BarcodeScanner, + AppRate: AppRate, + AppVersion: AppVersion, + BarcodeScanner: BarcodeScanner, + Badge: Badge, BLE: BLE, Camera: Camera, Calendar: Calendar, + Clipboard: Clipboard, Contacts: Contacts, + DatePicker: DatePicker, Device: Device, Facebook: Facebook, Geolocation: Geolocation, Push: Push, StatusBar: StatusBar, Toast: Toast, - TouchID: TouchID, - DatePicker: DatePicker + TouchID: TouchID } // To help developers using cordova, we listen for the device ready event and diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 63d269ed..b7ac8833 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -5,10 +5,10 @@ declare var window; /** * 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 [cordova-plugin-apprate docs](https://github.com/pushandplay/cordova-plugin-apprate). + * Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate). * * ``` - * ionic plugin add https://github.com/pushandplay/cordova-plugin-apprate.git + * cordova plugin add https://github.com/pushandplay/cordova-plugin-apprate.git * ```` * * @usage @@ -17,11 +17,11 @@ declare var window; * AppRate.preferences.storeAppURL.android = 'market://details?id='; * AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/'; * AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name='; - * AppRate.prompt(); + * AppRate.promptForRating(); * ``` */ @Plugin({ - plugin: 'cordova-plugin-apprate', + plugin: 'https://github.com/pushandplay/cordova-plugin-apprate.git', pluginRef: 'AppRate' }) export class AppRate { @@ -45,14 +45,16 @@ export class AppRate { * @type {{}} */ @CordovaProperty - static get preferences(){ + static get preferences() { return window.AppRate.preferences; } /** * Prompts the user for rating + * + * @param {boolean} immediately Show the rating prompt immediately. */ @Cordova() - static prompt () : void {}; + static promptForRating(immediately: boolean) : void {}; } diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index d74005e2..10a0e6b9 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -3,10 +3,10 @@ import {Plugin, Cordova} from './plugin'; /** * Reads the version of your app from the target build settings. * - * Requires Cordova plugin: cordova-plugin-appversion. For more info, please see the [cordova-plugin-version docs](ttps://github.com/whiteoctober/cordova-plugin-app-version). + * Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](ttps://github.com/whiteoctober/cordova-plugin-app-version). * * ``` - * ionic plugin add https://github.com/whiteoctober/cordova-plugin-app-version.git + * cordova plugin add cordova-plugin-app-version * ```` * * @usage @@ -18,41 +18,64 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - plugin: 'cordova-plugin-appversion', + plugin: 'cordova-plugin-app-version', pluginRef: 'cordova.getAppVersion' }) export class AppVersion { - /** * Returns the name of the app + * @returns {Promise} */ - @Cordova - static getAppName () : string { - return; + @Cordova() + static getAppName () { + // 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((res, rej) => {}); } /** * Returns the package name of the app + * @returns {Promise} */ - @Cordova - static getPackageName () : string { - return; + @Cordova() + static getPackageName () { + // 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((res, rej) => {}); } /** * Returns the build identifier of the app + * @returns {Promise} */ - @Cordova - static getVersionCode () : string { - return; + @Cordova() + static getVersionCode () { + // 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((res, rej) => {}); } /** * Returns the version of the app + * @returns {Promise} */ - @Cordova - static getVersionNumber () : string { - return; + @Cordova() + static getVersionNumber() { + // 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((res, rej) => {}); } } diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index 6bafae52..b4fc2d51 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -3,17 +3,17 @@ import {Plugin, Cordova} from './plugin'; /** * 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 isn’t running in the foreground. * - * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [cordova-plugin-badge docs](https://github.com/katzer/cordova-plugin-badge). + * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge). * * ``` - * ionic plugin add https://github.com/katzer/cordova-plugin-badge.git - * ```` + * cordova plugin add cordova-plugin-badge + * ``` * * @usage * ```js - * Badge.setBadge(10); - * Badge.increaseBadge(); - * Badge.clearBadge(); + * Badge.set(10); + * Badge.increase(); + * Badge.clear(); * ``` */ @Plugin({ @@ -23,45 +23,101 @@ import {Plugin, Cordova} from './plugin'; export class Badge { /** - * Determine permission to set badge notifications + * Clear the badge of the app icon. */ @Cordova() - static hasPermission () : boolean { - return; + static clear() { + // 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((res, rej) => {}); + } + + /** + * Set the badge of the app icon. + * @param {number} number The new badge number. + * @returns {Promise} + */ + @Cordova() + static set(number: number) { + // 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((res, rej) => {}); + } + + /** + * Get the badge of the app icon. + * @returns {Promise} + */ + @Cordova() + static get() { + // 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((res, rej) => {}); + } + + /** + * Increase the badge number. + * @param {number} count Count to add to the current badge number + * @returns {Promise} + */ + @Cordova() + static increase(number: number) { + // 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((res, rej) => {}); + } + + /** + * Decrease the badge number. + * @param {number} count Count to subtract from the current badge number + * @returns {Promise} + */ + @Cordova() + static decrease(number: number) { + // 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((res, rej) => {}); + } + + /** + * Determine if the app has permission to show badges. + */ + @Cordova() + static hasPermission() { + // 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((res, rej) => {}); } /** * Register permission to set badge notifications - * @returns {Promise} + * @returns {Promise} */ @Cordova() - static registerPermission () : Promise { - return new Promise((res,rej) => {}); + static registerPermission() { + // 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((res, rej) => {}); } - - /** - * Sets the badge number - * @param number - */ - @Cordova() - static setBadge (number : number) : void {} - - /** - * Clears the badge number - */ - @Cordova() - static clearBadge () : void {} - - /** - * Increases the badge number - */ - @Cordova() - static increaseBadge () : void {} - - /** - * Decreases the badge number - */ - @Cordova() - static decreaseBadge () : void {} - } diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 0e24ea00..6b5ba9ee 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -4,9 +4,10 @@ import {Plugin, Cordova} from './plugin'; * 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). * * ``` - * ionic plugin add https://github.com/VersoSolutions/CordovaClipboard.git + * cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git * ``` * * @usage @@ -25,7 +26,7 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - plugin: 'com.verso.cordova.clipboard', + plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git', pluginRef: 'cordova.plugins.clipboard' }) export class Clipboard { diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 4b16b1f3..24d81a81 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -29,7 +29,7 @@ export class DatePicker { * @param options * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ - @Cordova + @Cordova() static show(options? : { mode : string, date : string, From 803237940a5330a382cf7faa87952fde3f978420 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sat, 5 Mar 2016 15:41:53 -0600 Subject: [PATCH 025/112] chore(): bump version to 1.0.10 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1381f6db..30bb593e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.0.9", + "version": "1.0.10", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "directories": { @@ -47,4 +47,4 @@ "path": "./node_modules/cz-conventional-changelog" } } -} \ No newline at end of file +} From 3f5db6d6fee6a599d260af375e3ff37048122f4e Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 6 Mar 2016 08:33:25 -0600 Subject: [PATCH 026/112] chore(): bump to 1.0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30bb593e..ba70a23c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.0.10", + "version": "1.0.11", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "directories": { From 1334f60b681fa5440174ca984d5a3a8b2d2814e6 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 6 Mar 2016 08:34:05 -0600 Subject: [PATCH 027/112] fix(plugin): don't call reject when sync --- src/plugins/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 321eb068..3b9a3d49 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -59,14 +59,14 @@ 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). if(!window.cordova) { cordovaWarn(pluginObj.name, methodName); - reject({ + reject && reject({ error: 'cordova_not_available' }) return; } pluginWarn(pluginObj, methodName); - reject({ + reject && reject({ error: 'plugin_not_installed' }); return; From 2330670661c06078d0fb941812628f05c3ec2b92 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 6 Mar 2016 08:35:32 -0600 Subject: [PATCH 028/112] chore(package): only publish dist --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index ba70a23c..da375536 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "directories": { "test": "test" }, + "files": [ + "dist" + ], "dependencies": { "rxjs": "5.0.0-beta.0" }, From c11e31ba6746d3a2062ef66c83a1373c1d93f3ee Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 6 Mar 2016 08:38:16 -0600 Subject: [PATCH 029/112] chore(package): bump to 1.0.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da375536..c88bdf6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.0.11", + "version": "1.0.12", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "directories": { From c3cfd14c5e15a6bef546e00500a2cba91777f515 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 6 Mar 2016 08:56:31 -0600 Subject: [PATCH 030/112] fix(datepicker): datepicker options are optional --- src/plugins/datepicker.ts | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 24d81a81..a8172438 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -5,7 +5,7 @@ import {Plugin, Cordova} from './plugin'; * * Platforms supported: iOS, Android, Windows * - * Requires cordova-plugin-datepicker by VitaliiBlagodir that can be [found here](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). + * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [Datepicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). * * Install the plugin by running the following command: * ```shell @@ -30,30 +30,30 @@ export class DatePicker { * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ @Cordova() - static show(options? : { - mode : string, - date : string, - minDate : string, - maxDate : string, - titleText : string, - okText : string, - cancelText : string, - todayText : string, - nowText : string, - is24Hour : boolean, - androidTheme : number, - allowOldDate: boolean, - allowFutureDates : boolean, - doneButtonLabel : string, - doneButtonColor : string, - cancelButtonLabel : string, - cancelButtonColor : string, - x : string, - y : string, - minuteInterval : number, - popoverArrowDirection : string, - locale : string - }) : Promise { + static show(options?: { + mode?: string, + date?: string, + minDate?: string, + maxDate?: string, + titleText?: string, + okText?: string, + cancelText?: string, + todayText?: string, + nowText?: string, + is24Hour?: boolean, + androidTheme?: number, + allowOldDate?: boolean, + allowFutureDates?: boolean, + doneButtonLabel?: string, + doneButtonColor?: string, + cancelButtonLabel?: string, + cancelButtonColor?: string, + x?: string, + y?: string, + minuteInterval?: number, + popoverArrowDirection?: string, + locale?: string + }): Promise { return new Promise((res, rej) => {}); } From ce6adccb9a2c95b772f63790c959b8dcb16ef875 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 6 Mar 2016 09:01:37 -0600 Subject: [PATCH 031/112] fix(datepicker): dates are Dates --- src/plugins/datepicker.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index a8172438..a0d1d24d 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -32,9 +32,9 @@ export class DatePicker { @Cordova() static show(options?: { mode?: string, - date?: string, - minDate?: string, - maxDate?: string, + date?: Date, + minDate?: Date, + maxDate?: Date, titleText?: string, okText?: string, cancelText?: string, @@ -48,8 +48,8 @@ export class DatePicker { doneButtonColor?: string, cancelButtonLabel?: string, cancelButtonColor?: string, - x?: string, - y?: string, + x?: number, + y?: number, minuteInterval?: number, popoverArrowDirection?: string, locale?: string From 82d3c258c9c82905e6c5aacb86e2ef3ac5a5fba2 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 12:48:20 -0500 Subject: [PATCH 032/112] add batterystatus --- src/plugins/batterystatus.ts | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/plugins/batterystatus.ts diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts new file mode 100644 index 00000000..1a0dc28d --- /dev/null +++ b/src/plugins/batterystatus.ts @@ -0,0 +1,41 @@ +import {Plugin} from './plugin'; +import {Observable} from "rxjs/Observable"; + +/** + * + * + * Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status). + * + * ``` + * cordova plugin add cordova-plugin-batterystatus + * ``` + * + * @usage + * ```js + * + * BatteryStatus.onChange().subscribe( + * status => { + * + * } + * ); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-batterystatus' +}) +export class BatteryStatus { + + /** + * Watches the change in battery level + * @returns {Observable} Returns an observable that pushes the new battery level + */ + static onChange () : Observable { + return new Observable(observer => { + let callback = (status : any) => observer.next(status); + window.addEventListener("batterystatus", callback, false); + return () => window.removeEventListener("batterystatus", callback, false); + }); + } + +} From 6843177377608baf74894d43bb3f9bc3fc8c6211 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 13:23:30 -0500 Subject: [PATCH 033/112] feat(plugin): add sms --- src/plugins/push.ts | 8 +++--- src/plugins/sms.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 src/plugins/sms.ts diff --git a/src/plugins/push.ts b/src/plugins/push.ts index b55caa0c..b9c2031d 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -296,10 +296,10 @@ export class Push { @Cordova() static hasPermission(){ // 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 + // 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) => {}); } } diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts new file mode 100644 index 00000000..4a0bbf3e --- /dev/null +++ b/src/plugins/sms.ts @@ -0,0 +1,64 @@ +import {Plugin, Cordova} from './plugin'; +import {isInstalled} from "./plugin"; +import {pluginWarn} from "./plugin"; + +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 + +} + +declare var sms : any; + +/** + * + * + * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). + * + * ``` + * cordova plugin add cordova-plugin-sms + * ``` + * + * @usage + * ```js + * + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-sms', + pluginRef: 'sms' +}) +export class SMS { + + /** + * Sends sms to a number + * @param number [number] Phone number + * @param message [string] Message + * @param options [object] Options + * @param options.replaceLineBreaks [boolean] Set to true to replace \n by a new line. Default: false + * @param options.android.intent [string] Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app. + * @returns {Promise} + */ + static send(number : number, message : string, options : smsOptions) : Promise { + return new Promise((res, rej) => { + // TODO handle error in case plugin doesn't exist + sms.send(number, message, options, () => res(), (error : any) => rej(error)); + }); + } + +} From 4302abd02b500291a5c276c3b47df3d132d675d8 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 13:24:49 -0500 Subject: [PATCH 034/112] undo --- src/plugins/push.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index b9c2031d..b55caa0c 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -296,10 +296,10 @@ export class Push { @Cordova() static hasPermission(){ // 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 + // 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) => {}); } } From 91de9715fed2bbaa8ac0889689ee30e74187cd4e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 13:51:12 -0500 Subject: [PATCH 035/112] fix(datepicker): fix plugin functionality --- src/plugins/datepicker.ts | 105 +++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 29 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index a0d1d24d..f48b5255 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -1,26 +1,91 @@ import {Plugin, Cordova} from './plugin'; +export interface datePickerOptions { + /** + * Platforms: iOS, Android, Windows + * The mode of the date picker + * Values: date | time | datetime + * Default: date + */ + mode?: string, + + /** + * Platforms: iOS, Android, Windows + * Selected date + * Default: new 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 +} + /** * 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). + * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). * * Install the plugin by running the following command: * ```shell - * ionic plugin add cordova-plugin-datepicker + * cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git * ``` * * @usage * ```js - * DatePicker. + * DatePicker.show(); * ``` * */ @Plugin({ - plugin: 'cordova-plugin-datepicker', - pluginRef: 'plugins.datePicker' + plugin: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git', + pluginRef: 'datePicker' }) export class DatePicker { @@ -30,30 +95,12 @@ export class DatePicker { * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ @Cordova() - static show(options?: { - mode?: string, - date?: Date, - minDate?: Date, - maxDate?: Date, - titleText?: string, - okText?: string, - 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 - }): Promise { + static show(options?: datePickerOptions): Promise { + // 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((res, rej) => {}); } From 1a778e7f10ff383eabf32495845d12c07530a373 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 14:31:00 -0500 Subject: [PATCH 036/112] fix(datepicker): fix plugin functionality Fixed and tested the core plugin functionality --- src/plugins/datepicker.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index f48b5255..d1bfa908 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -5,16 +5,14 @@ export interface datePickerOptions { * Platforms: iOS, Android, Windows * The mode of the date picker * Values: date | time | datetime - * Default: date */ - mode?: string, + mode: string, /** * Platforms: iOS, Android, Windows * Selected date - * Default: new Date() */ - date?: Date, + date: Date, /** * Platforms: iOS, Android, Windows @@ -79,7 +77,13 @@ export interface datePickerOptions { * * @usage * ```js - * DatePicker.show(); + * DatePicker.show({ + * date: new Date(), + * mode: 'date' + * }).then( + * date => console.log("Got date: ", date), + * err => console.log("Error occurred while getting date:", err) + * ); * ``` * */ @@ -95,7 +99,7 @@ export class DatePicker { * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ @Cordova() - static show(options?: datePickerOptions): Promise { + static show(options: datePickerOptions): Promise { // 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 From aa7e04c2e70cd360cb4ca89ffdaa428dfc5ad80d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 14:51:26 -0500 Subject: [PATCH 037/112] feat(plugin): add sms plugin --- src/plugins/sms.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 4a0bbf3e..be15d57d 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -1,6 +1,4 @@ import {Plugin, Cordova} from './plugin'; -import {isInstalled} from "./plugin"; -import {pluginWarn} from "./plugin"; export interface smsOptions { @@ -22,15 +20,13 @@ export interface smsOptionsAndroid { } -declare var sms : any; - /** * * * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). * * ``` - * cordova plugin add cordova-plugin-sms + * cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git * ``` * * @usage @@ -40,25 +36,28 @@ declare var sms : any; * ``` */ @Plugin({ - plugin: 'cordova-plugin-sms', + plugin: 'https://github.com/cordova-sms/cordova-sms-plugin.git', pluginRef: 'sms' }) export class SMS { /** * Sends sms to a number - * @param number [number] Phone number + * @param number [string or array of strings] Phone number * @param message [string] Message * @param options [object] Options * @param options.replaceLineBreaks [boolean] Set to true to replace \n by a new line. Default: false * @param options.android.intent [string] Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app. * @returns {Promise} */ - static send(number : number, message : string, options : smsOptions) : Promise { - return new Promise((res, rej) => { - // TODO handle error in case plugin doesn't exist - sms.send(number, message, options, () => res(), (error : any) => rej(error)); - }); + @Cordova() + static send(number : any, message : string, options? : smsOptions) : Promise { + // 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((res, rej) => {}); } } From 18df9a5aeb436ade2676c20137353fee58afd1d9 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:08:19 -0500 Subject: [PATCH 038/112] feat(plugin): add launch navigator https://github.com/driftyco/ionic-native/issues/18 --- src/plugins/launchnavigator.ts | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/plugins/launchnavigator.ts diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts new file mode 100644 index 00000000..8b930090 --- /dev/null +++ b/src/plugins/launchnavigator.ts @@ -0,0 +1,90 @@ +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, + +} + +/** + * + * 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). + * + * ``` + * cordova plugin add https://github.com/dpa99c/phonegap-launch-navigator.git + * ``` + * + * @usage + * ```js + * Badge.set(10); + * Badge.increase(); + * Badge.clear(); + * ``` + */ +@Plugin({ + plugin: 'https://github.com/dpa99c/phonegap-launch-navigator', + pluginRef: 'launchnavigator' +}) +export class LaunchNavigator { + + /** + * Launches navigator app + * @param destination Location name or coordinates + * @param start Location name or coordinates + * @param options + * @returns {Promise} + */ + @Cordova({ + successIndex: 2, + errorIndex: 3 + }) + static navigate(destination : any, start : any, options? : launchNavigatorOptions) : Promise { + // 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((res, rej) => {}); + } + +} From 984e7fc9d1fcde19682bad7d7fe49c2668710bdf Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:11:19 -0500 Subject: [PATCH 039/112] feat(plugin): add launch navigator https://github.com/driftyco/ionic-native/issues/18 --- src/plugins/launchnavigator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 8b930090..2e42da1e 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -56,9 +56,11 @@ export interface launchNavigatorOptions { * * @usage * ```js - * Badge.set(10); - * Badge.increase(); - * Badge.clear(); + * LaunchNavigator.navigate("Toronto, ON", "London, ON") + * .then( + * success => console.log("Launched navigator"), + * error => console.log("Error launching navigator", error) + * ); * ``` */ @Plugin({ From 9e17e2542776d32a0b5c9e8f3e99c73f4adb1637 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:17:49 -0500 Subject: [PATCH 040/112] fix(launchnavigator): fix Plugin decorator property value --- src/plugins/launchnavigator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 2e42da1e..295e1aba 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -64,7 +64,7 @@ export interface launchNavigatorOptions { * ``` */ @Plugin({ - plugin: 'https://github.com/dpa99c/phonegap-launch-navigator', + plugin: 'https://github.com/dpa99c/phonegap-launch-navigator.git', pluginRef: 'launchnavigator' }) export class LaunchNavigator { From c144b87e136b6800acae9d5ac658f43d91b20bcd Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:27:26 -0500 Subject: [PATCH 041/112] refactor: added semi-columns --- src/index.ts | 6 +++--- src/plugins/plugin.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index f1011094..a94f4e82 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,7 @@ window['IonicNative'] = { StatusBar: StatusBar, Toast: Toast, TouchID: 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, @@ -76,9 +76,9 @@ let before = +new Date; let didFireReady = false; 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; -}) +}); setTimeout(function() { if(!didFireReady && window.cordova) { diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 3b9a3d49..3459cdc6 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -11,10 +11,10 @@ import {Observable} from 'rxjs/Observable'; export const getPlugin = function(pluginRef: string): any { return get(window, pluginRef); -} +}; export const isInstalled = function(pluginRef: string): boolean { return !!getPlugin(pluginRef); -} +}; export const pluginWarn = function(pluginObj: any, method: string) { var pluginName = pluginObj.name; var plugin = pluginObj.plugin; @@ -24,14 +24,14 @@ export const pluginWarn = function(pluginObj: any, method: string) { console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.'); } console.warn('Install the ' + pluginName + ' plugin: \'cordova plugin add ' + plugin + '\''); -} +}; export const cordovaWarn = function(pluginName: string, method: string) { 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:any, methodName:string, args:any[], opts:any={}, resolve?: Function, reject?: Function) { // Try to figure out where the success/error callbacks need to be bound @@ -61,7 +61,7 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an cordovaWarn(pluginObj.name, methodName); reject && reject({ error: 'cordova_not_available' - }) + }); return; } @@ -130,7 +130,7 @@ export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) { return wrapPromise(pluginObj, methodName, args, opts); } } -} +}; /** * Class decorator specifying Plugin metadata. Required for all plugins. @@ -145,7 +145,7 @@ export function Plugin(config) { cls['installed'] = function() { return !!getPlugin(config.pluginRef); - } + }; return cls; } @@ -186,7 +186,7 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed return {}; } return originalMethod.apply(this, args); - } + }; return descriptor; } From 3d188e1f312cd0429677aa0e57d15aa1508b310e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:33:37 -0500 Subject: [PATCH 042/112] feat(plugin): add app availability plugin --- src/plugins/appavailability.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/plugins/appavailability.ts diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts new file mode 100644 index 00000000..73f31229 --- /dev/null +++ b/src/plugins/appavailability.ts @@ -0,0 +1,20 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability). + * + * ``` + * cordova plugin add https://github.com/ohh2ahh/AppAvailability.git + * ``` + * + * @usage + * ```js + * ``` + */ +@Plugin({ + plugin: 'https://github.com/ohh2ahh/AppAvailability.git', + pluginRef: 'appAvailability' +}) +export class AppAvailability { + +} From bc4dcaae535b12a2c2a62f44d7d894c2d99bb598 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:35:59 -0500 Subject: [PATCH 043/112] feat(plugin): add functionality to app-availablity plugin --- src/plugins/appavailability.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 73f31229..52cd1510 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -17,4 +17,19 @@ import {Plugin, Cordova} from './plugin'; }) export class AppAvailability { + /** + * Checks if an app is available on device + * @param app Package name on android, or URI scheme on iOS + * @returns {Promise} + */ + @Cordova() + static check(app : string) : Promise { + // 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((res, rej) => {}); + } + } From 80e7eedcae703ab07f77924493f70a765c433d01 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:39:09 -0500 Subject: [PATCH 044/112] docs(plugin): add docs and usage --- src/plugins/appavailability.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 52cd1510..38480b99 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -1,6 +1,8 @@ import {Plugin, Cordova} from './plugin'; /** + * 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). * * ``` @@ -9,6 +11,19 @@ import {Plugin, Cordova} from './plugin'; * * @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({ From a4df21e99cb914ddb1226d4493b004381c516e9d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:43:13 -0500 Subject: [PATCH 045/112] feat(plugin): add device motion plugin --- src/plugins/devicemotion.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/plugins/devicemotion.ts diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts new file mode 100644 index 00000000..a49bb104 --- /dev/null +++ b/src/plugins/devicemotion.ts @@ -0,0 +1,26 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion). + * + * ``` + * cordova plugin add https://github.com/apache/cordova-plugin-device-motion.git + * ```` + * + * @usage + * ```js + * ``` + */ +@Plugin({ + plugin: 'https://github.com/apache/cordova-plugin-device-motion.git', + pluginRef: 'navigator.accelerometer' +}) +export class DeviceMotion { + + // 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 + +} From 7f7ba3b52abc523c96114eb749608d303f7e1635 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 15:54:55 -0500 Subject: [PATCH 046/112] feat(plugin): add functionality to device motion plugin --- src/plugins/devicemotion.ts | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index a49bb104..4ea6ad3d 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -1,5 +1,38 @@ import {Plugin, Cordova} from './plugin'; +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 + +} + /** * Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion). * @@ -17,10 +50,45 @@ import {Plugin, Cordova} from './plugin'; }) export class DeviceMotion { + /** + * Get the current acceleration along the x, y, and z axes. + * @returns {Promise} Returns object with x, y, z, and timestamp properties + */ + @Cordova() + static getCurrentAcceleration () : Promise { // 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((res, rej) => {}); + } + + /** + * + * @param options + * @returns {Observable} + */ + @Cordova({ + successIndex: 0, + errorIndex: 1 + }) + static watchAcceleration (options? : accelerometerOptions) : Promise { + // 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((res, rej) => {}); + } + + /** + * Stop watching the Acceleration referenced by the watchID parameter. + * @param watchID The ID returned by watchAcceleration method + */ + @Cordova({ + sync: true + }) + static clearWatch(watchID : any) : void {} } From 9766aab59ffcfba76e93cb265a62fa35436d5722 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:06:43 -0500 Subject: [PATCH 047/112] feat(plugin): add device orientation plugin --- src/plugins/deviceorientation.ts | 99 ++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/plugins/deviceorientation.ts diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts new file mode 100644 index 00000000..b5b8c3f5 --- /dev/null +++ b/src/plugins/deviceorientation.ts @@ -0,0 +1,99 @@ +import {Plugin, Cordova} from './plugin'; + +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 + +} + +/** + * Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation). + * + * ``` + * cordova plugin add https://github.com/apache/cordova-plugin-device-orientation.git + * ```` + * + * @usage + * ```js + * ``` + */ +@Plugin({ + plugin: 'https://github.com/apache/cordova-plugin-device-orientation', + pluginRef: 'navigator.compass' +}) +export class DeviceOrientation { + + /** + * Get the current compass heading. + * @returns {Promise} + */ + @Cordova() + static getCurrentHeading() : Promise { + // 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((res, rej) => {}); + } + + /** + * Gets the device's current heading at a regular interval + * @param options + * @returns {Promise} + */ + @Cordova({ + successIndex: 0, + errorIndex: 1 + }) + static watchHeading(options? : CompassOptions) : Promise { + // 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((res, rej) => {}); + } + + /** + * Stop watching the compass referenced by the watch ID parameter. + * @param watchID + */ + @Cordova({ + sync: true + }) + static clearWatch(watchID) : void {} + +} From 5944bd13d31bc137457496ac0e604eefbb4529a0 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:16:04 -0500 Subject: [PATCH 048/112] fix: fix callback order --- src/plugins/deviceorientation.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index b5b8c3f5..66159367 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -75,8 +75,7 @@ export class DeviceOrientation { * @returns {Promise} */ @Cordova({ - successIndex: 0, - errorIndex: 1 + callbackOrder: 'reverse' }) static watchHeading(options? : CompassOptions) : Promise { // This Promise is replaced by one from the @Cordova decorator that wraps From 5fda6d49cc6ccb6be3772522b356bc87ec957fad Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:17:07 -0500 Subject: [PATCH 049/112] fix: fix callback order --- src/plugins/devicemotion.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 4ea6ad3d..6f9b0158 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -70,8 +70,7 @@ export class DeviceMotion { * @returns {Observable} */ @Cordova({ - successIndex: 0, - errorIndex: 1 + callbackOrder: 'reverse' }) static watchAcceleration (options? : accelerometerOptions) : Promise { // This Promise is replaced by one from the @Cordova decorator that wraps From b27e799526f6ad7e3276941d1d4c0efc1bd78226 Mon Sep 17 00:00:00 2001 From: Brian Holub Date: Sun, 6 Mar 2016 13:19:50 -0800 Subject: [PATCH 050/112] Fixing typo in link to github docs --- src/plugins/appversion.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 10a0e6b9..01c3f00d 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -3,7 +3,7 @@ import {Plugin, Cordova} from './plugin'; /** * 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](ttps://github.com/whiteoctober/cordova-plugin-app-version). + * 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). * * ``` * cordova plugin add cordova-plugin-app-version From b5f92671ae6d689fe7bfd1dc208cf386f9f1d003 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:40:24 -0500 Subject: [PATCH 051/112] feat(plugin): add dialogs plugin --- src/plugins/dialogs.ts | 113 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 src/plugins/dialogs.ts diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts new file mode 100644 index 00000000..5815665a --- /dev/null +++ b/src/plugins/dialogs.ts @@ -0,0 +1,113 @@ +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 + +} + +export interface confirmCallback { + + /** + * 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, + +} + +/** + * @name Dialogs + * @description + * + * 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: 'https://github.com/apache/cordova-plugin-dialogs.git', + pluginRef: 'navigator.notification' +}) +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} 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{ + // 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((res, rej) => {}); + } + + /** + * 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} 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 = ['OK', 'Cancel']) : Promise{ + // 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((res, rej) => {}); + } + + /** + * 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} Returns a promise that resolves an object with the button index clicked and the text entered + */ + @Cordova({ + successIndex: 1, + errorIndex: 5 + }) + static prompt(message, title : string = 'Prompt', buttonLabels : Array = ['OK', 'Cancel'], defaultText : string = '') : Promise{ + // 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((res, rej) => {}); + } + + + /** + * 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 {} + +} \ No newline at end of file From 662d8ce079207e4c4a46f998ef122ab57cfbddcd Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:42:58 -0500 Subject: [PATCH 052/112] fix: remove confirm callback, not needed. --- src/plugins/dialogs.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index 5815665a..28e3d016 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -14,14 +14,6 @@ export interface promptCallback { } -export interface confirmCallback { - - /** - * 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, - -} /** * @name Dialogs From 3ec25fa63b0b955352a4a1b14a2a7d82018a033e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:56:29 -0500 Subject: [PATCH 053/112] feat(plugin): add flashlight plugin --- src/plugins/flashlight.ts | 90 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/plugins/flashlight.ts diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts new file mode 100644 index 00000000..9cd9f23c --- /dev/null +++ b/src/plugins/flashlight.ts @@ -0,0 +1,90 @@ +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: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git', + pluginRef: 'window.plugins.flashlight' +}) +export class Flashlight { + + + /** + * Checks if the flash light is available + * @returns {Promise} Returns a promise that resolves with a boolean stating if the flash light is available. + */ + @Cordova() + static available() : Promise{ + // 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((res,rej)=>{}); + } + + /** + * Switches the flashlight on + * @returns {Promise} + */ + @Cordova() + static switchOn() : Promise{ + // 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((res,rej)=>{}); + } + + /** + * Switches the flash light off + * @returns {Promise} + */ + @Cordova() + static switchOff() : Promise{ + // 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((res,rej)=>{}); + } + + /** + * Toggles the flashlight + * @returns {Promise} + */ + @Cordova() + static toggle() : Promise { + // 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((res,rej)=>{}); + } + + + /** + * Checks if the flash light is turned on. + * Returns a boolean + */ + @Cordova({ + sync: true + }) + static isSwitchedOn() {} + +} \ No newline at end of file From 2caa1516ab6f52da212dded63ccfd3c1b67588c4 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 6 Mar 2016 16:59:09 -0500 Subject: [PATCH 054/112] fix: added dummy boolean not sure if required --- src/plugins/flashlight.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 9cd9f23c..68cd68f0 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -85,6 +85,9 @@ export class Flashlight { @Cordova({ sync: true }) - static isSwitchedOn() {} + static isSwitchedOn() : boolean { + // DUMMY BOOLEAN, @Cordova decorator will replace value. + return true; + } } \ No newline at end of file From 37aaa3d09cda6a885b35943554f7febd3c8403fd Mon Sep 17 00:00:00 2001 From: Tim Behety Date: Mon, 7 Mar 2016 09:04:33 +0100 Subject: [PATCH 055/112] Fix link of ActionSheet documentation --- src/plugins/actionsheet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 67a6f755..d1febb0d 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -5,7 +5,7 @@ import {Plugin, Cordova} from './plugin'; * @description * 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 * From d17f62d82f29528ccbafc00ed2d38c6e0e3462ed Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 8 Mar 2016 13:18:06 -0500 Subject: [PATCH 056/112] fix(devicemotion): combine watch and clear into one function convert the watch function to an observable function that handles cancellation too --- src/plugins/devicemotion.ts | 53 +++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 6f9b0158..4196080b 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -1,4 +1,5 @@ import {Plugin, Cordova} from './plugin'; +import {Observable} from "rxjs/Observable"; export interface accelerationData { @@ -36,12 +37,27 @@ export interface accelerometerOptions { /** * Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion). * - * ``` + * ```shell * cordova plugin add https://github.com/apache/cordova-plugin-device-motion.git * ```` * * @usage - * ```js + * ```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({ @@ -52,6 +68,7 @@ export class DeviceMotion { /** * Get the current acceleration along the x, y, and z axes. + * * @returns {Promise} Returns object with x, y, z, and timestamp properties */ @Cordova() @@ -65,29 +82,31 @@ export class DeviceMotion { } /** + * 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} */ @Cordova({ - callbackOrder: 'reverse' + callbackOrder: 'reverse', + observable: true, + clearFunction: 'clearWatch' }) - static watchAcceleration (options? : accelerometerOptions) : Promise { - // This Promise is replaced by one from the @Cordova decorator that wraps + static watchAcceleration (options? : accelerometerOptions) : Observable { + // 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 Promise, because there's no way + // knows that the correct return type is PrObservableomise, 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((res, rej) => {}); + return new Observable(observer => {}); } - - /** - * Stop watching the Acceleration referenced by the watchID parameter. - * @param watchID The ID returned by watchAcceleration method - */ - @Cordova({ - sync: true - }) - static clearWatch(watchID : any) : void {} - } From 88553595272bfddf20a64bc4eabd20118792a536 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 8 Mar 2016 13:26:55 -0500 Subject: [PATCH 057/112] fix(plugin): combine watch and clearwatch functions --- src/plugins/deviceorientation.ts | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 66159367..1f193f65 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -1,4 +1,5 @@ import {Plugin, Cordova} from './plugin'; +import {Observable} from "rxjs/Observable"; export interface CompassHeading { @@ -70,29 +71,24 @@ export class DeviceOrientation { } /** - * Gets the device's current heading at a regular interval + * Get the device current heading at a regular interval + * + * Stop the watch by unsubscribing from the observable * @param options - * @returns {Promise} + * @returns {Observable} */ @Cordova({ - callbackOrder: 'reverse' + callbackOrder: 'reverse', + observable: true, + cancelFunction: 'clearWatch' }) - static watchHeading(options? : CompassOptions) : Promise { - // This Promise is replaced by one from the @Cordova decorator that wraps + static watchHeading(options? : CompassOptions) : Observable { + // 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 Promise, because there's no way + // 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 Promise((res, rej) => {}); + return new Observable(observer => {}); } - /** - * Stop watching the compass referenced by the watch ID parameter. - * @param watchID - */ - @Cordova({ - sync: true - }) - static clearWatch(watchID) : void {} - } From e053c945eed95cef39d844b248a3f47d1ca1b42e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 8 Mar 2016 13:29:03 -0500 Subject: [PATCH 058/112] docs(plugin): add docs --- src/plugins/deviceorientation.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 1f193f65..b9d9c749 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -47,7 +47,20 @@ export interface CompassOptions { * ```` * * @usage - * ```js + * ```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({ From 1fac3873841488cf519c83bd469983e81a3e818a Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 8 Mar 2016 13:41:34 -0500 Subject: [PATCH 059/112] fix(geolocation): set callback order to reverse on getCurrentPosition https://github.com/driftyco/ionic-native/issues/34 --- src/plugins/geolocation.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 6e5ebc99..524a9f5f 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -125,7 +125,9 @@ export class Geolocation { * @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. */ - @Cordova() + @Cordova({ + callbackOrder: 'reverse' + }) static getCurrentPosition(options?: GeolocationOptions){ // This Promise is replaced by one from the @Cordova decorator that wraps // the plugin's callbacks. We provide a dummy one here so TypeScript From 44365f4c603dcbd8a30424768080d2ba0632807e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 8 Mar 2016 14:23:22 -0500 Subject: [PATCH 060/112] fix(plugin): fix options properties --- src/plugins/datepicker.ts | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index d1bfa908..3758db96 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -20,7 +20,7 @@ export interface datePickerOptions { * Type: Date | empty String * Default: empty String */ - minDate?: Date, + minDate: Date, /** * Platforms: iOS, Android, Windows @@ -28,7 +28,7 @@ export interface datePickerOptions { * Type: Date | empty String * Default: empty String */ - maxDate?: Date, + maxDate: Date, /** * Platforms: Android @@ -36,31 +36,31 @@ export interface datePickerOptions { * Type: String * Default: empty String */ - titleText?: string, + titleText: string, /** * Platforms: Android * Label of BUTTON_POSITIVE (done button) on Android */ - okText?: string, + 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 + 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 } /** From c71f8d49e1dace06dd60855c2b53f40be7fe4e17 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 8 Mar 2016 14:25:22 -0500 Subject: [PATCH 061/112] fix: fix options params --- src/plugins/launchnavigator.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 295e1aba..70805c37 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -6,43 +6,43 @@ 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, + disableAutoGeolocation : boolean, /** * iOS, Android, Windows * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. */ - transportMode? : string, + 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, + 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, + 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, + backButtonText : string, /** * iOS * If true, debug log output will be generated by the plugin. Defaults to false. */ - enableDebug? : boolean, + 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, + navigationMode : string, } From 848d70631c20fcccbce5199aa7f3f9bb9ccab1f6 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 10:29:03 -0600 Subject: [PATCH 062/112] feat(package): expose decorators and wrapper functions Addresses https://github.com/driftyco/ionic-native/issues/37. --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index a94f4e82..62681d6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,6 +46,8 @@ export { TouchID } +export * from './plugins/plugin'; + // Window export to use outside of a module loading system window['IonicNative'] = { ActionSheet: ActionSheet, From 046d17e574eba569478795a754c35e1bffcc9f3d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 15:14:55 -0500 Subject: [PATCH 063/112] docs(batterystatus): improve docs --- src/plugins/batterystatus.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 1a0dc28d..ea739af4 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -2,7 +2,7 @@ import {Plugin} from './plugin'; import {Observable} from "rxjs/Observable"; /** - * + * @name Battery Status * * Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status). * @@ -12,13 +12,16 @@ import {Observable} from "rxjs/Observable"; * * @usage * ```js - * - * BatteryStatus.onChange().subscribe( + * // watch change in battery status + * let subscription = BatteryStatus.onChange().subscribe( * status => { - * + * console.log(status); * } * ); * + * // stop watch + * subscription.unsubscribe(); + * * ``` */ @Plugin({ @@ -27,7 +30,7 @@ import {Observable} from "rxjs/Observable"; export class BatteryStatus { /** - * Watches the change in battery level + * Watch the change in battery level * @returns {Observable} Returns an observable that pushes the new battery level */ static onChange () : Observable { @@ -38,4 +41,4 @@ export class BatteryStatus { }); } -} +} \ No newline at end of file From e776541ca070cb68558c13b724cebb0237f1f3ab Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 15:17:51 -0500 Subject: [PATCH 064/112] refactor(batterystatus): add interface for battery status object --- src/plugins/batterystatus.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index ea739af4..81c39397 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -31,9 +31,9 @@ export class BatteryStatus { /** * Watch the change in battery level - * @returns {Observable} Returns an observable that pushes the new battery level + * @returns {Observable} Returns an observable that pushes a status object */ - static onChange () : Observable { + static onChange () : Observable { return new Observable(observer => { let callback = (status : any) => observer.next(status); window.addEventListener("batterystatus", callback, false); @@ -41,4 +41,16 @@ export class BatteryStatus { }); } +} + +interface StatusObject { + /** + * The battery charge percentage + */ + level : number, + + /** + * A boolean that indicates whether the device is plugged in + */ + isPlugged : boolean } \ No newline at end of file From e7a09d901864790b0bfec6c984f49f034ca4dc7f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 15:24:04 -0500 Subject: [PATCH 065/112] feat(batterystatus): complete functionality --- src/plugins/batterystatus.ts | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 81c39397..9912ed58 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -15,7 +15,7 @@ import {Observable} from "rxjs/Observable"; * // watch change in battery status * let subscription = BatteryStatus.onChange().subscribe( * status => { - * console.log(status); + * console.log(status.level, status.isPlugged); * } * ); * @@ -34,10 +34,35 @@ export class BatteryStatus { * @returns {Observable} Returns an observable that pushes a status object */ static onChange () : Observable { + return BatteryStatus.getObservable("batterylevel"); + } + + /** + * Watch when the battery level goes low + * @returns {Observable} Returns an observable that pushes a status object + */ + static onLow () : Observable { + return BatteryStatus.getObservable("batterylow"); + } + + /** + * Watch when the battery level goes to critial + * @returns {Observable} Returns an observable that pushes a status object + */ + static onCritical () : Observable { + return BatteryStatus.getObservable("batterycritical"); + } + + /** + * Wrap the event with an observable + * @param event + * @returns {Observable} + */ + static getObservable (event : string) : Observable { return new Observable(observer => { let callback = (status : any) => observer.next(status); - window.addEventListener("batterystatus", callback, false); - return () => window.removeEventListener("batterystatus", callback, false); + window.addEventListener(event, callback, false); + return () => window.removeEventListener(event, callback, false); }); } From 35bfe40d9e9d00887c49f9aa7763b112a2373f37 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 15:27:01 -0500 Subject: [PATCH 066/112] refactor(batterystatus): extract getObservable() from class extracted the getObservable() function from class so it doesn't show as a method (in docs and auto-complete) --- src/plugins/batterystatus.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 9912ed58..510eed59 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -34,7 +34,7 @@ export class BatteryStatus { * @returns {Observable} Returns an observable that pushes a status object */ static onChange () : Observable { - return BatteryStatus.getObservable("batterylevel"); + return getEventObservable("batterylevel"); } /** @@ -42,7 +42,7 @@ export class BatteryStatus { * @returns {Observable} Returns an observable that pushes a status object */ static onLow () : Observable { - return BatteryStatus.getObservable("batterylow"); + return getEventObservable("batterylow"); } /** @@ -50,20 +50,7 @@ export class BatteryStatus { * @returns {Observable} Returns an observable that pushes a status object */ static onCritical () : Observable { - return BatteryStatus.getObservable("batterycritical"); - } - - /** - * Wrap the event with an observable - * @param event - * @returns {Observable} - */ - static getObservable (event : string) : Observable { - return new Observable(observer => { - let callback = (status : any) => observer.next(status); - window.addEventListener(event, callback, false); - return () => window.removeEventListener(event, callback, false); - }); + return getEventObservable("batterycritical"); } } @@ -78,4 +65,17 @@ interface StatusObject { * 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 { + return new Observable(observer => { + let callback = (status : any) => observer.next(status); + window.addEventListener(event, callback, false); + return () => window.removeEventListener(event, callback, false); + }); } \ No newline at end of file From 287d1291378a0cd4caa0d9a583c7d134bb72fa72 Mon Sep 17 00:00:00 2001 From: cho-is Date: Thu, 10 Mar 2016 20:29:50 +0000 Subject: [PATCH 067/112] feat(plugin): add imagePicker plugin --- src/plugins/imagepicker.ts | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/plugins/imagepicker.ts diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts new file mode 100644 index 00000000..145f7f34 --- /dev/null +++ b/src/plugins/imagepicker.ts @@ -0,0 +1,61 @@ +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 imagePicker + * @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 + * ImagePiker.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: 'navigator.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) { + // 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((res, rej) => {}); + }; +} From 01d797261b411c317d5d06a8d0da779bafec1287 Mon Sep 17 00:00:00 2001 From: cho-is Date: Thu, 10 Mar 2016 20:39:14 +0000 Subject: [PATCH 068/112] fix(imagepicker): pluginRef --- src/plugins/imagepicker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 145f7f34..854fb5cf 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -37,7 +37,7 @@ export interface ImagePickerOptions { */ @Plugin({ plugin: 'cordova-plugin-image-picker', - pluginRef: 'navigator.imagepicker', + pluginRef: 'window.imagePicker', repo: 'https://github.com/wymsee/cordova-imagePicker' }) export class ImagePicker { From 78fdbcd42e4dd46daf9bf0086ac66309da0cd23c Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 14:54:25 -0600 Subject: [PATCH 069/112] chore(): remove returned Promises Addresses: https://github.com/driftyco/ionic-native/issues/38. --- src/plugins/actionsheet.ts | 18 ++-------- src/plugins/appavailability.ts | 9 +---- src/plugins/apprate.ts | 6 ++-- src/plugins/appversion.ts | 36 +++---------------- src/plugins/badge.ts | 63 ++++------------------------------ 5 files changed, 16 insertions(+), 116 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index d1febb0d..c9f64ffe 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -59,26 +59,12 @@ export class ActionSheet { addCancelButtonWithLabel?: string, addDestructiveButtonWithLabel?: string, position?: number[] - }) { - // 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((res, rej) => {}); - } + }): Promise { return } /** * Hide the ActionSheet. */ @Cordova() - static hide() { - // 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((res, rej) => {}); - } + static hide(): Promise { return } } diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 38480b99..f8327796 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -38,13 +38,6 @@ export class AppAvailability { * @returns {Promise} */ @Cordova() - static check(app : string) : Promise { - // 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((res, rej) => {}); - } + static check(app: string): Promise { return } } diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index b7ac8833..e82ff5e4 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -45,9 +45,7 @@ export class AppRate { * @type {{}} */ @CordovaProperty - static get preferences() { - return window.AppRate.preferences; - } + static get preferences() { return window.AppRate.preferences; } /** * Prompts the user for rating @@ -55,6 +53,6 @@ export class AppRate { * @param {boolean} immediately Show the rating prompt immediately. */ @Cordova() - static promptForRating(immediately: boolean) : void {}; + static promptForRating(immediately: boolean): void {}; } diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 01c3f00d..829021d6 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -27,55 +27,27 @@ export class AppVersion { * @returns {Promise} */ @Cordova() - static getAppName () { - // 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((res, rej) => {}); - } + static getAppName(): Promise { return } /** * Returns the package name of the app * @returns {Promise} */ @Cordova() - static getPackageName () { - // 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((res, rej) => {}); - } + static getPackageName(): Promise { return } /** * Returns the build identifier of the app * @returns {Promise} */ @Cordova() - static getVersionCode () { - // 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((res, rej) => {}); - } + static getVersionCode(): Promise { return } /** * Returns the version of the app * @returns {Promise} */ @Cordova() - static getVersionNumber() { - // 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((res, rej) => {}); - } + static getVersionNumber(): Promise { return } } diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index b4fc2d51..de7f9fa7 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -26,14 +26,7 @@ export class Badge { * Clear the badge of the app icon. */ @Cordova() - static clear() { - // 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((res, rej) => {}); - } + static clear(): Promise { return } /** * Set the badge of the app icon. @@ -41,28 +34,14 @@ export class Badge { * @returns {Promise} */ @Cordova() - static set(number: number) { - // 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((res, rej) => {}); - } + static set(number: number): Promise { return } /** * Get the badge of the app icon. * @returns {Promise} */ @Cordova() - static get() { - // 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((res, rej) => {}); - } + static get(): Promise { return } /** * Increase the badge number. @@ -70,14 +49,7 @@ export class Badge { * @returns {Promise} */ @Cordova() - static increase(number: number) { - // 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((res, rej) => {}); - } + static increase(number: number): Promise { return } /** * Decrease the badge number. @@ -85,39 +57,18 @@ export class Badge { * @returns {Promise} */ @Cordova() - static decrease(number: number) { - // 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((res, rej) => {}); - } + static decrease(number: number): Promise { return } /** * Determine if the app has permission to show badges. */ @Cordova() - static hasPermission() { - // 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((res, rej) => {}); - } + static hasPermission(): Promise { return } /** * Register permission to set badge notifications * @returns {Promise} */ @Cordova() - static registerPermission() { - // 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((res, rej) => {}); - } + static registerPermission(): Promise { return } } From 998a58e036f3e0752c03b3f3e38b2e8b303e7aba Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 15:48:20 -0600 Subject: [PATCH 070/112] chore(): cleanup return values Addresses https://github.com/driftyco/ionic-native/issues/38. --- src/plugins/barcodescanner.ts | 9 +- src/plugins/ble.ts | 148 ++++++++----------------------- src/plugins/calendar.ts | 141 ++++------------------------- src/plugins/camera.ts | 9 +- src/plugins/clipboard.ts | 8 +- src/plugins/contacts.ts | 19 +--- src/plugins/datepicker.ts | 9 +- src/plugins/device.ts | 4 +- src/plugins/devicemotion.ts | 18 +--- src/plugins/deviceorientation.ts | 18 +--- src/plugins/dialogs.ts | 42 ++++----- src/plugins/facebook.ts | 85 +++--------------- src/plugins/flashlight.ts | 45 ++-------- src/plugins/geolocation.ts | 18 +--- src/plugins/imagepicker.ts | 9 +- src/plugins/launchnavigator.ts | 13 ++- src/plugins/push.ts | 14 +-- src/plugins/sms.ts | 13 ++- src/plugins/statusbar.ts | 4 +- src/plugins/toast.ts | 90 ++++--------------- src/plugins/touchid.ts | 36 +------- 21 files changed, 141 insertions(+), 611 deletions(-) diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index ae0eb481..63537300 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -28,14 +28,7 @@ export class BarcodeScanner { * @return Returns a Promise that resolves with scanner data, or rejects with an error. */ @Cordova() - static scan(){ - // 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((res, rej) => {}); - }; + static scan(): Promise { return } // Not well supported // @Cordova() diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index f4db8b11..3e986454 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -181,14 +181,7 @@ export class BLE { @Cordova({ observable: true }) - static scan(services:string[], seconds:number) { - // 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(observer => {}); - } + static scan(services: string[], seconds: number): Observable { return } /** * Scan and discover BLE peripherals until `stopScan` is called. @@ -211,14 +204,7 @@ export class BLE { clearFunction: 'stopScan', clearWithArgs: true }) - static startScan(services:string[]){ - // 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(observer => {}); - }; + static startScan(services: string[]): Observable { return } /** * Stop a scan started by `startScan`. @@ -235,14 +221,7 @@ export class BLE { * @return returns a Promise. */ @Cordova() - static stopScan(){ - // 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((res, rej) => {}); - }; + static stopScan(): Promise { return } /** * Connect to a peripheral. @@ -263,14 +242,7 @@ export class BLE { clearFunction: 'disconnect', clearWithArgs: true }) - static connect(deviceId:string){ - // 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(observer => {}); - }; + static connect(deviceId: string): Observable { return } /** * Disconnect from a peripheral. @@ -284,14 +256,7 @@ export class BLE { * @return Returns a Promise */ @Cordova() - static disconnect(deviceId:string) { - // 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((res, rej) => {}); - }; + static disconnect(deviceId: string): Promise { return } /** * Read the value of a characteristic. @@ -302,14 +267,11 @@ export class BLE { * @return Returns a Promise */ @Cordova() - static read(deviceId:string, serviceUUID:string, characteristicUUID:string){ - // 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((res, rej) => {}); - }; + static read( + deviceId: string, + serviceUUID: string, + characteristicUUID: string + ): Promise { return }; /** * Write the value of a characteristic. @@ -340,14 +302,12 @@ export class BLE { * @return Returns a Promise */ @Cordova() - static write(deviceId:string, serviceUUID:string, characteristicUUID:string, value:ArrayBuffer){ - // 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((res, rej) => {}); - }; + static write( + deviceId: string, + serviceUUID: string, + characteristicUUID: string, + value: ArrayBuffer + ): Promise { return } /** * Write the value of a characteristic without waiting for confirmation from the peripheral. @@ -359,14 +319,12 @@ export class BLE { * @return Returns a Promise */ @Cordova() - static writeWithoutResponse(deviceId:string, serviceUUID:string, characteristicUUID:string, value:ArrayBuffer){ - // 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((res, rej) => {}); - }; + static writeWithoutResponse( + deviceId: string, + serviceUUID: string, + characteristicUUID: string, + value: ArrayBuffer + ): Promise { return } /** * Register to be notified when the value of a characteristic changes. @@ -388,14 +346,11 @@ export class BLE { clearFunction: 'stopNotification', clearWithArgs: true }) - static startNotification(deviceId:string, serviceUUID:string, characteristicUUID:string){ - // 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(observer => {}); - }; + static startNotification( + deviceId: string, + serviceUUID: string, + characteristicUUID: string + ): Observable { return } /** * Stop being notified when the value of a characteristic changes. @@ -406,14 +361,11 @@ export class BLE { * @return Returns a Promise. */ @Cordova() - static stopNotification(deviceId:string, serviceUUID:string, characteristicUUID:string){ - // 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((res, rej) => {}); - }; + static stopNotification( + deviceId: string, + serviceUUID: string, + characteristicUUID: string + ): Promise { return } /** * Report the connection status. @@ -429,14 +381,7 @@ export class BLE { * @return Returns a Promise. */ @Cordova() - static isConnected(deviceId:string){ - // 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((res, rej) => {}); - } + static isConnected(deviceId: string): Promise { return } /** * Report if bluetooth is enabled. @@ -451,14 +396,7 @@ export class BLE { * @return Returns a Promise. */ @Cordova() - static isEnabled(){ - // 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((res, rej) => {}); - } + static isEnabled(): Promise { return } /** * Open System Bluetooth settings (Android only). @@ -466,14 +404,7 @@ export class BLE { * @return Returns a Promise. */ @Cordova() - static showBluetoothSettings(){ - // 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((res, rej) => {}); - } + static showBluetoothSettings(): Promise { return } /** * Enable Bluetooth on the device (Android only). @@ -481,12 +412,5 @@ export class BLE { * @return Returns a Promise. */ @Cordova() - static enable(){ - // 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((res, rej) => {}); - } + static enable(): Promise { return } } diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index f9a1377c..c581c963 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -48,14 +48,9 @@ export class Calendar { * @return Returns a Promise */ @Cordova() - static createCalendar(nameOrOptions: string | { calendarName: string, calendarColor: string }) { - // 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((res, rej) => {}); - } + static createCalendar( + nameOrOptions: string | { calendarName: string, calendarColor: string } + ): Promise { return } /** * Delete a calendar. (iOS only) @@ -72,14 +67,7 @@ export class Calendar { * @return Returns a Promise */ @Cordova() - static deleteCalendar(name: string) { - // 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((res, rej) => {}); - } + static deleteCalendar(name: string): Promise { return } /** * Returns the default calendar options. @@ -127,14 +115,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: 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((res, rej) => {}); - } + ): Promise { return } /** * Silently create an event with additional options. @@ -155,14 +136,7 @@ export class Calendar { startDate?: Date, endDate?: Date, options?: CalendarOptions - ) { - // 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((res, rej) => {}); - } + ): Promise { return } /** * Interactively create an event. @@ -181,14 +155,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: 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((res, rej) => {}); - } + ): Promise { return } /** * Interactively create an event with additional options. @@ -209,14 +176,7 @@ export class Calendar { startDate?: Date, endDate?: Date, options?: CalendarOptions - ) { - // 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((res, rej) => {}); - } + ): Promise { return } // deprecated // @Cordova() @@ -246,14 +206,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: 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((res, rej) => {}); - } + ): Promise { return } /** * Find an event with additional options. @@ -274,14 +227,7 @@ export class Calendar { startDate?: Date, endDate?: Date, options?: CalendarOptions - ) { - // 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((res, rej) => {}); - } + ): Promise { return } /** * Find a list of events within the specified date range. (Android only) @@ -291,37 +237,21 @@ export class Calendar { * @return Returns a Promise that resolves with the list of events, or rejects with an error. */ @Cordova() - static listEventsInRange(startDate: Date, endDate: 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((res, rej) => {}); - } + static listEventsInRange(startDate: Date, endDate: Date): Promise { return } /** * Get a list of all calendars. * @return A Promise that resolves with the list of calendars, or rejects with an error. */ @Cordova() - static listCalendars(){ - return new Promise((res, rej) => {}); - } + static listCalendars(){ return } /** * 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. */ @Cordova() - static findAllEventsInNamedCalendar(calendarName: string) { - // 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((res, rej) => {}); - } + static findAllEventsInNamedCalendar(calendarName: string): Promise { return } /** * Modify an event. (iOS only) @@ -350,14 +280,7 @@ export class Calendar { newNotes?: string, newStartDate?: Date, newEndDate?: 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((res, rej) => {}); - } + ): Promise { return } /** * Modify an event with additional options. (iOS only) @@ -388,14 +311,7 @@ export class Calendar { newStartDate?: Date, newEndDate?: Date, options?: CalendarOptions - ) { - // 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((res, rej) => {}); - } + ) { return } /** * Delete an event. @@ -414,14 +330,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: 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((res, rej) => {}); - } + ): Promise { return } /** * Delete an event from the specified Calendar. (iOS only) @@ -442,26 +351,12 @@ export class Calendar { startDate?: Date, endDate?: Date, calendarName?: string - ) { - // 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((res, rej) => {}); - } + ): Promise { return } /** * Open the calendar at the specified date. * @return {Date} date */ @Cordova() - static openCalendar(date: 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((res, rej) => {}); - } + static openCalendar(date: Date): Promise { return } } diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 10105989..29dc1059 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -115,14 +115,7 @@ export class Camera { @Cordova({ callbackOrder: 'reverse' }) - static getPicture(options: CameraOptions){ - // 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((res, rej) => {}); - }; + static getPicture(options: CameraOptions): Promise { return } /** * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 6b5ba9ee..a6690271 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -37,17 +37,13 @@ export class Clipboard { * @returns {Promise} */ @Cordova() - static copy(text : string) : Promise { - return new Promise((res, resj) => {}); - } + static copy(text: string): Promise { return } /** * Pastes the text stored in clipboard * @returns {Promise} */ @Cordova() - static paste() : Promise { - return new Promise((res, rej) => {}); - } + static paste(): Promise { return } } diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 3fdaf731..ea6955be 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -246,26 +246,13 @@ export class Contacts { successIndex: 1, errorIndex: 2 }) - static find(fields: string[], options?: any){ - // 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((res, rej) => {}); - }; + static find(fields: string[], options?: any): Promise { return } + /** * Select a single Contact. * @return Returns a Promise that resolves with the selected Contact */ @Cordova() - static pickContact(){ - // 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((res, rej) => {}); - }; + static pickContact(): Promise { return } } diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 3758db96..3e9bd91e 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -99,13 +99,6 @@ export class DatePicker { * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ @Cordova() - static show(options: datePickerOptions): Promise { - // 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((res, rej) => {}); - } + static show(options: datePickerOptions): Promise { return } } \ No newline at end of file diff --git a/src/plugins/device.ts b/src/plugins/device.ts index 99829e45..c1b9f7a6 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -50,7 +50,5 @@ export class Device { * @returns {Object} The device object. */ @CordovaProperty - static get device() { - return window.device; - } + static get device() { return window.device; } } diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 4196080b..69795f42 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -72,14 +72,7 @@ export class DeviceMotion { * @returns {Promise} Returns object with x, y, z, and timestamp properties */ @Cordova() - static getCurrentAcceleration () : Promise { - // 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((res, rej) => {}); - } + static getCurrentAcceleration(): Promise { return } /** * Watch the device acceleration. Clear the watch by unsubscribing from the observable. @@ -101,12 +94,5 @@ export class DeviceMotion { observable: true, clearFunction: 'clearWatch' }) - static watchAcceleration (options? : accelerometerOptions) : Observable { - // 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 PrObservableomise, 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(observer => {}); - } + static watchAcceleration (options?: accelerometerOptions): Observable { return } } diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index b9d9c749..c11d16ba 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -74,14 +74,7 @@ export class DeviceOrientation { * @returns {Promise} */ @Cordova() - static getCurrentHeading() : Promise { - // 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((res, rej) => {}); - } + static getCurrentHeading(): Promise { return } /** * Get the device current heading at a regular interval @@ -95,13 +88,6 @@ export class DeviceOrientation { observable: true, cancelFunction: 'clearWatch' }) - static watchHeading(options? : CompassOptions) : Observable { - // 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(observer => {}); - } + static watchHeading(options?: CompassOptions): Observable { return } } diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index 28e3d016..0395295a 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -42,14 +42,11 @@ export class Dialogs { successIndex: 1, errorIndex: 4 }) - static alert(message, title : string = 'Alert', buttonName : string = 'OK') : Promise{ - // 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((res, rej) => {}); - } + static alert( + message, + title: string = 'Alert', + buttonName: string = 'OK' + ): Promise{ return } /** * Displays a customizable confirmation dialog box. @@ -62,14 +59,11 @@ export class Dialogs { successIndex: 1, errorIndex: 4 }) - static confirm(message, title : string = 'Confirm', buttonLabels : Array = ['OK', 'Cancel']) : Promise{ - // 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((res, rej) => {}); - } + static confirm( + message, + title: string = 'Confirm', + buttonLabels: Array = ['OK', 'Cancel'] + ): Promise{ return } /** * Displays a native dialog box that is more customizable than the browser's prompt function. @@ -83,14 +77,12 @@ export class Dialogs { successIndex: 1, errorIndex: 5 }) - static prompt(message, title : string = 'Prompt', buttonLabels : Array = ['OK', 'Cancel'], defaultText : string = '') : Promise{ - // 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((res, rej) => {}); - } + static prompt( + message?: string, + title: string = 'Prompt', + buttonLabels: Array = ['OK', 'Cancel'], + defaultText: string = '' + ): Promise{ return } /** @@ -100,6 +92,6 @@ export class Dialogs { @Cordova({ sync: true }) - static beep(times : number) : void {} + static beep(times: number): void {} } \ No newline at end of file diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 40f096ca..fce34683 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -102,14 +102,7 @@ export class Facebook { * @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. */ @Cordova() - static login(permissions: string[]){ - // 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((res, rej) => {}); - } + static login(permissions: string[]): Promise { return } /** * Logout of Facebook. @@ -118,14 +111,7 @@ export class Facebook { * @return Returns a Promise that resolves on a successful logout, and rejects if logout fails. */ @Cordova() - static logout(){ - // 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((res, rej) => {}); - } + static logout(): Promise { return } /** * Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user: @@ -154,14 +140,7 @@ export class Facebook { * @return Returns a Promise that resolves with a status, or rejects with an error */ @Cordova() - static getLoginStatus(){ - // 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((res, rej) => {}); - } + static getLoginStatus(): Promise { return } /** * Get a Facebook access token for using Facebook services. @@ -169,14 +148,7 @@ export class Facebook { * @return Returns a Promise that resolves with an access token, or rejects with an error */ @Cordova() - static getAccessToken(){ - // 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((res, rej) => {}); - } + static getAccessToken(): Promise { return } /** * Show one of various Facebook dialogs. Example of options for a Share dialog: @@ -196,14 +168,7 @@ export class Facebook { * @return Returns a Promise that resolves with success data, or rejects with an error */ @Cordova() - static showDialog(options: any){ - // 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((res, rej) => {}); - } + static showDialog(options: any): Promise { return } /** * Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login. @@ -219,14 +184,7 @@ export class Facebook { * @return Returns a Promise that resolves with the result of the request, or rejects with an error */ @Cordova() - static api(requestPath: string, permissions: string[]){ - // 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((res, rej) => {}); - } + static api(requestPath: string, permissions: string[]): Promise { return } /** * Log an event. For more information see the Events section above. @@ -237,14 +195,11 @@ export class Facebook { * @return */ @Cordova() - static logEvent(name: string, params?: Object, valueToSum?: number){ - // 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((res, rej) => {}); - } + static logEvent( + name: string, + params?: Object, + valueToSum?: number + ): Promise { return } /** * Log a purchase. For more information see the Events section above. @@ -254,14 +209,7 @@ export class Facebook { * @return Returns a Promise */ @Cordova() - static logPurchase(value: number, currency: string){ - // 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((res, rej) => {}); - } + static logPurchase(value: number, currency: string): Promise { return } /** * Open App Invite dialog. Does not require login. @@ -282,12 +230,5 @@ export class Facebook { static appInvite(options: { url: string, picture: string - }){ - // 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((res, rej) => {}); - } + }): Promise { return } } diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 68cd68f0..9a0ffa3c 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -22,60 +22,28 @@ export class Flashlight { * @returns {Promise} Returns a promise that resolves with a boolean stating if the flash light is available. */ @Cordova() - static available() : Promise{ - // 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((res,rej)=>{}); - } + static available(): Promise { return } /** * Switches the flashlight on * @returns {Promise} */ @Cordova() - static switchOn() : Promise{ - // 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((res,rej)=>{}); - } + static switchOn(): Promise { return } /** * Switches the flash light off * @returns {Promise} */ @Cordova() - static switchOff() : Promise{ - // 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((res,rej)=>{}); - } + static switchOff(): Promise { return } /** * Toggles the flashlight * @returns {Promise} */ @Cordova() - static toggle() : Promise { - // 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((res,rej)=>{}); - } + static toggle(): Promise { return } /** @@ -85,9 +53,6 @@ export class Flashlight { @Cordova({ sync: true }) - static isSwitchedOn() : boolean { - // DUMMY BOOLEAN, @Cordova decorator will replace value. - return true; - } + static isSwitchedOn(): boolean { return } } \ No newline at end of file diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 524a9f5f..1c8d02d9 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -128,14 +128,7 @@ export class Geolocation { @Cordova({ callbackOrder: 'reverse' }) - static getCurrentPosition(options?: GeolocationOptions){ - // 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((res, rej) => {}); - } + static getCurrentPosition(options?: GeolocationOptions): Promise { return } /** * Watch the current device's position. Clear the watch by unsubscribing from @@ -158,12 +151,5 @@ export class Geolocation { observable: true, clearFunction: 'clearWatch' }) - static watchPosition(options?: GeolocationOptions){ - // 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(observer => {}); - }; + static watchPosition(options?: GeolocationOptions): Observable { return } } diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 854fb5cf..f6fb90b6 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -50,12 +50,5 @@ export class ImagePicker { @Cordova({ callbackOrder: 'reverse' }) - static getPictures(options: ImagePickerOptions) { - // 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((res, rej) => {}); - }; + static getPictures(options: ImagePickerOptions): Promise { return } } diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 70805c37..eebc55bd 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -80,13 +80,10 @@ export class LaunchNavigator { successIndex: 2, errorIndex: 3 }) - static navigate(destination : any, start : any, options? : launchNavigatorOptions) : Promise { - // 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((res, rej) => {}); - } + static navigate( + destination: any, + start: any, + options?: launchNavigatorOptions + ): Promise { return } } diff --git a/src/plugins/push.ts b/src/plugins/push.ts index b55caa0c..920bf711 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -285,21 +285,13 @@ export class Push { @Cordova({ sync: true }) - static init(options: PushOptions){ - return new PushNotification(); - } + static init(options: PushOptions): PushNotification { return } /** * 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. */ @Cordova() - static hasPermission(){ - // 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) => {}); - } + static hasPermission(): Promise<{ isEnabled: boolean }> { return } + } diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index be15d57d..e33796ed 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -51,13 +51,10 @@ export class SMS { * @returns {Promise} */ @Cordova() - static send(number : any, message : string, options? : smsOptions) : Promise { - // 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((res, rej) => {}); - } + static send( + number: string | string[], + message: string, + options?: smsOptions + ): Promise { return } } diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index 36ac19f2..bb938ec4 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -102,7 +102,5 @@ export class StatusBar { * Whether the StatusBar is currently visible or not. */ @CordovaProperty - static get isVisible() { - return window.StatusBar.isVisible; - } + static get isVisible() { return window.StatusBar.isVisible; } } diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 92a8b8ad..a6444349 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -31,28 +31,18 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static show(message: string, duration: string, position: string){ - // 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(observer => {}); - } + static show( + message: string, + duration: string, + position: string + ): Observable { return } /** * Manually hide any currently visible toast. * @return {Promise} Returns a Promise that resolves on success. */ @Cordova() - static hide(){ - // 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((res, rej) => {}); - } + static hide(): Promise{ return } /** * Show a native toast with the given options. @@ -69,14 +59,7 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showWithOptions(options: ToastOptions){ - // 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(observer => {}); - } + static showWithOptions(options: ToastOptions): Observable { return } /** * Shorthand for `show(message, 'short', 'top')`. @@ -86,14 +69,7 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showShortTop(message: string){ - // 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(observer => {}); - } + static showShortTop(message: string): Observable { return } /** * Shorthand for `show(message, 'short', 'center')`. @@ -103,14 +79,8 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showShortCenter(message: string){ - // 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(observer => {}); - } + static showShortCenter(message: string): Observable { return } + /** * Shorthand for `show(message, 'short', 'bottom')`. @@ -120,14 +90,8 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showShortBottom(message: string){ - // 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(observer => {}); - } + static showShortBottom(message: string): Observable { return } + /** * Shorthand for `show(message, 'long', 'top')`. @@ -137,14 +101,8 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showLongTop(message: string){ - // 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(observer => {}); - } + static showLongTop(message: string): Observable { return } + /** * Shorthand for `show(message, 'long', 'center')`. @@ -154,14 +112,8 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showLongCenter(message: string){ - // 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(observer => {}); - } + static showLongCenter(message: string): Observable { return } + /** * Shorthand for `show(message, 'long', 'bottom')`. @@ -171,12 +123,6 @@ export class Toast { observable: true, clearFunction: 'hide' }) - static showLongBottom(message: string){ - // 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(observer => {}); - } + static showLongBottom(message: string): Observable { return } + } diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index bd50118e..fc7a20de 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -34,14 +34,7 @@ export class TouchID { * @return {Promise} Returns a Promise that resolves if yes, rejects if no. */ @Cordova() - isAvailable() { - // 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((res, rej) => {}); - }; + isAvailable(): Promise{ return } /** * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen. @@ -50,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). */ @Cordova() - static verifyFingerprint(message: string) { - // 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((res, rej) => {}); - } + static verifyFingerprint(message: string): Promise{ return } /** * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above). @@ -66,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). */ @Cordova() - static verifyFingerprintWithCustomPasswordFallback(message: string) { - // 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((res, rej) => {}); - } + static verifyFingerprintWithCustomPasswordFallback(message: string): Promise { return } /** * 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). @@ -83,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). */ @Cordova() - static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string) { - // 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((res, rej) => {}); - } + static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise { return } } From c6cbfb77d5aa6adae4e070174dcabb1dad589b74 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 15:51:27 -0600 Subject: [PATCH 071/112] chore(): update tsconfig --- tsconfig.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 30a693c8..faf694aa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,16 +9,15 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true }, - "exclude": [ - "node_modules" + "filesGlob": [ + "**/*.ts" ], - "files": [ - "src/index.ts", - "typings/es6-shim/es6-shim.d.ts" + "exclude": [ + "node_modules" ], "compileOnSave": false, "buildOnSave": false, "atom": { - "rewriteTsconfig": true + "rewriteTsconfig": false } } From 66df0a67a64cd23f051b8617b72e29d20c1de9cd Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 17:25:24 -0500 Subject: [PATCH 072/112] feat(plugin): add local notifications --- src/plugins/localnotifications.ts | 136 ++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 src/plugins/localnotifications.ts diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts new file mode 100644 index 00000000..068b8a64 --- /dev/null +++ b/src/plugins/localnotifications.ts @@ -0,0 +1,136 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name Local Notifications + * + * 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: 'cordova-plugin-local-notifications', + pluginRef: 'cordova.plugins.notification.local' +}) +export class LocalNotifications { + + @Cordova({ + sync: true + }) + static schedule(options? : ScheduleOptions) : void {} + + +} + +interface ScheduleOptions { + + /** + * 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 + + +} \ No newline at end of file From 5d5bae3b789f8d78270aa9e5c2089aa2fd4f70c1 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 17:47:16 -0500 Subject: [PATCH 073/112] feat(localnotification): complete functionality --- src/plugins/localnotifications.ts | 140 +++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 4 deletions(-) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 068b8a64..13643116 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -42,15 +42,149 @@ import {Plugin, Cordova} from './plugin'; }) export class LocalNotifications { + /** + * Schedules a single or multiple notifications + * @param options + */ @Cordova({ sync: true }) - static schedule(options? : ScheduleOptions) : void {} + 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 {return} + + /** + * Clears all notifications + */ + @Cordova({ + successIndex: 0, + errorIndex: 2 + }) + static clearAll() : Promise {return} + + /** + * Cancels single or multiple notifications + * @param notificationId A single notification id, or an array of notification ids. + */ + @Cordova() + static cancel(notificationId : any) : Promise {return} + + /** + * Cancels all notifications + */ + @Cordova({ + successIndex: 0, + errorIndex: 2 + }) + static cancelAll() : Promise {return} + + /** + * Checks presence of a notification + * @param notificationId + */ + @Cordova() + static isPresent (notificationId : number) : Promise {return} + + /** + * Checks is a notification is scheduled + * @param notificationId + */ + @Cordova() + static isScheduled (notificationId : number) : Promise {return} + + /** + * Checks if a notification is triggered + * @param notificationId + */ + @Cordova() + static isTriggered (notificationId : number) : Promise {return} + + /** + * Get all the notification ids + */ + @Cordova() + static getAllIds () : Promise> {return} + + /** + * Get the ids of triggered notifications + */ + @Cordova() + static getTriggeredIds () : Promise> {return} + + /** + * Get the ids of scheduled notifications + */ + @Cordova() + static getScheduledIds () : Promise> {return} + + /** + * Get a notification object + * @param notificationId The id of the notification to get + */ + @Cordova() + static get (notificationId : any) : Promise {return} + + /** + * Get a scheduled notification object + * @param notificationId The id of the notification to get + */ + @Cordova() + static getScheduled (notificationId : any) : Promise {return} + + /** + * Get a triggered notification object + * @param notificationId The id of the notification to get + */ + @Cordova() + static getTriggered (notificationId : any) : Promise {return} + + /** + * Get all notification objects + */ + @Cordova() + static getAll() : Promise> {return} + + /** + * Get all scheduled notification objects + */ + @Cordova() + static getAllScheduled() : Promise> {return} + + /** + * Get all triggered notification objects + */ + @Cordova() + static getAllTriggered() : Promise> {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 {} } -interface ScheduleOptions { +interface Notification { /** * A unique identifier required to clear, cancel, update or retrieve the local notification in the future @@ -131,6 +265,4 @@ interface ScheduleOptions { * Default: FFFFFF */ led : string - - } \ No newline at end of file From 3abdb444bc6359d52169fe33399aa77a32d3a449 Mon Sep 17 00:00:00 2001 From: Nick Gal Date: Thu, 10 Mar 2016 15:59:14 -0800 Subject: [PATCH 074/112] Update imagepicker.ts Fix typo --- src/plugins/imagepicker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index f6fb90b6..c7c10814 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -27,7 +27,7 @@ export interface ImagePickerOptions { * * @usage * ```js - * ImagePiker.getPictures(options).then((results) => { + * ImagePicker.getPictures(options).then((results) => { * for (var i = 0; i < results.length; i++) { * console.log('Image URI: ' + results[i]); * } From 787a027e3fb72cb4780bdb83e5e4eaaae0a9e236 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 19:29:05 -0600 Subject: [PATCH 075/112] Update DEVELOPER.md --- DEVELOPER.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index 9aede5f9..b96e5ad9 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -15,18 +15,14 @@ Let's take a look at the existing plugin wrapper for Geolocation to see what goe export class Geolocation { @Cordova() - static getCurrentPosition(options: GeolocationOptions){ - return new Promise((res, rej) => {}); - } + static getCurrentPosition(options?: GeolocationOptions): Promise { return } @Cordova({ callbackOrder: 'reverse', observable: true, clearFunction: 'clearWatch' }) - static watchPosition(options: GeolocationOptions){ - return new Observable(observer => {}); - } + static watchPosition(options?: GeolocationOptions): Observable { return } } ``` @@ -68,11 +64,11 @@ Let's take a look at `getCurrentPosition` first. ``` @Cordova() - static getCurrentPosition(options: GeolocationOptions){ - return new Promise((res, rej) => {}); - } + static getCurrentPosition(options: GeolocationOptions): Promise { return } ``` +It's just a stub. The `return` is only there to keep the TypeScript type-checker from complaining since we indicate the `getCurrentPosition` returns a `Promise`. + 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. @@ -85,9 +81,7 @@ Next, let's look at the `watchPosition` method. observable: true, clearFunction: 'clearWatch' }) - static watchPosition(options: GeolocationOptions){ - return new Observable(observer => {}); - } + static watchPosition(options: GeolocationOptions): Observable { return } ``` The `@Cordova` decorator has a few more options now. @@ -100,4 +94,4 @@ The `@Cordova` decorator has a few more options now. ### '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. \ No newline at end of file +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. From 99ddbe3b158dfb2e1ff206f320fabb1e1cb91caf Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 19:29:25 -0600 Subject: [PATCH 076/112] Update DEVELOPER.md --- DEVELOPER.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index b96e5ad9..84170d43 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -64,7 +64,7 @@ Let's take a look at `getCurrentPosition` first. ``` @Cordova() - static getCurrentPosition(options: GeolocationOptions): Promise { return } + static getCurrentPosition(options?: GeolocationOptions): Promise { return } ``` It's just a stub. The `return` is only there to keep the TypeScript type-checker from complaining since we indicate the `getCurrentPosition` returns a `Promise`. @@ -81,7 +81,7 @@ Next, let's look at the `watchPosition` method. observable: true, clearFunction: 'clearWatch' }) - static watchPosition(options: GeolocationOptions): Observable { return } + static watchPosition(options?: GeolocationOptions): Observable { return } ``` The `@Cordova` decorator has a few more options now. From ce133d153b1816d079d090a74b5d9e6297147917 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Mar 2016 19:33:43 -0600 Subject: [PATCH 077/112] Update DEVELOPER.md --- DEVELOPER.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index 84170d43..c1eb00e0 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -67,11 +67,11 @@ Let's take a look at `getCurrentPosition` first. static getCurrentPosition(options?: GeolocationOptions): Promise { return } ``` -It's just a stub. The `return` is only there to keep the TypeScript type-checker from complaining since we indicate the `getCurrentPosition` returns a `Promise`. +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`. 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. From 4d8dc1b9dc8e9191b32db17471dfc27932123aca Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:04:30 -0500 Subject: [PATCH 078/112] feat(plugins): add new plugins to index --- src/index.ts | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 62681d6c..346609a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,44 +3,65 @@ initAngular1(); const DEVICE_READY_TIMEOUT = 2000; - declare var window; import {ActionSheet} from './plugins/actionsheet'; +import {AppAvailability} from './plugins/appavailability'; import {AppRate} from './plugins/apprate'; import {AppVersion} from './plugins/appversion'; -import {BarcodeScanner} from './plugins/barcodescanner'; import {Badge} from './plugins/badge'; +import {BarcodeScanner} from './plugins/barcodescanner'; +import {BatteryStatus} from './plugins/batterystatus'; import {BLE} from './plugins/ble'; -import {Camera} from './plugins/camera'; import {Calendar} from './plugins/calendar'; +import {Camera} from './plugins/camera'; import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; import {DatePicker} from './plugins/datepicker'; 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 {File} from './plugins/file'; +import {Flashlight} from './plugins/flashlight'; import {Geolocation} from './plugins/geolocation'; +import {ImagePicker} from './plugins/imagepicker'; +import {LaunchNavigator} from './plugins/launchnavigator'; +import {LocalNotifications} from './plugins/localnotifications'; import {Push} from './plugins/push'; +import {SMS} from './plugins/sms'; import {StatusBar} from './plugins/statusbar'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; export { ActionSheet, + AppAvailability, AppRate, AppVersion, - BarcodeScanner, Badge, + BarcodeScanner, + BatteryStatus, BLE, - Camera, Calendar, + Camera, Clipboard, Contacts, DatePicker, Device, + DeviceMotion, + DeviceOrientation, + Dialogs, Facebook, + //File, + Flashlight, Geolocation, + ImagePicker, + LaunchNavigator, + LocalNotifications, Push, + SMS, StatusBar, Toast, TouchID @@ -51,20 +72,31 @@ export * from './plugins/plugin'; // Window export to use outside of a module loading system window['IonicNative'] = { ActionSheet: ActionSheet, + AppAvailability: AppAvailability, AppRate: AppRate, AppVersion: AppVersion, - BarcodeScanner: BarcodeScanner, Badge: Badge, + BarcodeScanner: BarcodeScanner, + BatteryStatus: BatteryStatus, BLE: BLE, - Camera: Camera, Calendar: Calendar, + Camera: Camera, Clipboard: Clipboard, Contacts: Contacts, DatePicker: DatePicker, Device: Device, + DeviceMotion: DeviceMotion, + DeviceOrientation: DeviceOrientation, + Dialogs: Dialogs, Facebook: Facebook, + //File: File, + Flashlight: Flashlight, Geolocation: Geolocation, + ImagePicker: ImagePicker, + LaunchNavigator: LaunchNavigator, + LocalNotifications: LocalNotifications, Push: Push, + SMS: SMS, StatusBar: StatusBar, Toast: Toast, TouchID: TouchID From a1bdff6b24624fb536a77767a51e409c58134084 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:30:16 -0500 Subject: [PATCH 079/112] docs(plugins): update docs and plugin params --- src/plugins/actionsheet.ts | 5 ++++- src/plugins/appavailability.ts | 6 ++++-- src/plugins/apprate.ts | 11 +++++++---- src/plugins/appversion.ts | 4 +++- src/plugins/badge.ts | 4 +++- src/plugins/barcodescanner.ts | 4 ++++ src/plugins/batterystatus.ts | 4 ++-- src/plugins/calendar.ts | 5 +++++ src/plugins/camera.ts | 4 ++++ src/plugins/clipboard.ts | 4 +++- src/plugins/datepicker.ts | 6 ++++-- src/plugins/device.ts | 4 ++++ src/plugins/devicemotion.ts | 9 ++++++--- src/plugins/deviceorientation.ts | 11 +++++++---- src/plugins/dialogs.ts | 10 ++++++++-- src/plugins/flashlight.ts | 9 +++++++-- src/plugins/geolocation.ts | 4 ++++ src/plugins/imagepicker.ts | 4 ++++ src/plugins/launchnavigator.ts | 12 +++++++----- src/plugins/localnotifications.ts | 8 +++++++- src/plugins/plugin.ts | 14 ++++++++++++++ src/plugins/push.ts | 3 +++ src/plugins/sms.ts | 9 ++++++--- src/plugins/statusbar.ts | 15 ++++++++++++++- src/plugins/toast.ts | 15 +++++++++++++++ 25 files changed, 149 insertions(+), 35 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index c9f64ffe..205db583 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -7,8 +7,11 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet). * - * @usage + * ```shell + * cordova plugin add cordova-plugin-actionsheet + * ``` * + * @usage * ```ts * import {ActionSheet} from 'ionic-native'; * diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index f8327796..453f8b8d 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -1,12 +1,14 @@ import {Plugin, Cordova} from './plugin'; /** + * @name AppAvailability + * @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). * * ``` - * cordova plugin add https://github.com/ohh2ahh/AppAvailability.git + * cordova plugin add cordova-plugin-appavailability * ``` * * @usage @@ -27,7 +29,7 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - plugin: 'https://github.com/ohh2ahh/AppAvailability.git', + plugin: 'cordova-plugin-appavailability', pluginRef: 'appAvailability' }) export class AppAvailability { diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index e82ff5e4..5b56fac7 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -3,12 +3,14 @@ import {Plugin, Cordova, CordovaProperty} from './plugin'; declare var window; /** + * @name AppRate + * @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). * - * ``` - * cordova plugin add https://github.com/pushandplay/cordova-plugin-apprate.git + * ```shell + * cordova plugin add cordova-plugin-apprate * ```` * * @usage @@ -21,8 +23,9 @@ declare var window; * ``` */ @Plugin({ - plugin: 'https://github.com/pushandplay/cordova-plugin-apprate.git', - pluginRef: 'AppRate' + plugin: 'cordova-plugin-apprate', + pluginRef: 'AppRate', + repo: 'https://github.com/pushandplay/cordova-plugin-apprate' }) export class AppRate { diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 829021d6..d7c09be6 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -1,11 +1,13 @@ import {Plugin, Cordova} from './plugin'; /** + * @name AppVersion + * @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). * - * ``` + * ```shell * cordova plugin add cordova-plugin-app-version * ```` * diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index de7f9fa7..010df3d2 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -1,11 +1,13 @@ 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 isn’t 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). * - * ``` + * ```shell * cordova plugin add cordova-plugin-badge * ``` * diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 63537300..e0585df4 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -7,6 +7,10 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * + * ```shell + * cordova plugin add phonegap-plugin-barcodescanner + * ``` + * * @usage * ```js * BarcodeScanner.scan().then((barcodeData) => { diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 510eed59..a8eb62fa 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -3,10 +3,10 @@ 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). * - * ``` + * ```shell * cordova plugin add cordova-plugin-batterystatus * ``` * diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index c581c963..e0a90669 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -23,6 +23,11 @@ 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). * + * ```shell + * cordova plugin add cordova-plugin-calendar + * ``` + * + * */ @Plugin({ plugin: 'cordova-plugin-calendar', diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 29dc1059..a6812c15 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -91,6 +91,10 @@ export interface CameraPopoverOptions { * * Requires Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera). * + * ```shell + * cordova plugin add cordova-plugin-camera + * ``` + * * @usage * ```js * Camera.getPicture(options).then((imageData) => { diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index a6690271..d52c5999 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -1,12 +1,14 @@ 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). * - * ``` + * ```shell * cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git * ``` * diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 3e9bd91e..51b883a9 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -64,6 +64,8 @@ export interface datePickerOptions { } /** + * @name DatePicker + * @description * The DatePicker plugin allows the user to fetch date or time using native dialogs. * * Platforms supported: iOS, Android, Windows @@ -72,7 +74,7 @@ export interface datePickerOptions { * * Install the plugin by running the following command: * ```shell - * cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git + * cordova plugin add cordova-plugin-datepicker * ``` * * @usage @@ -88,7 +90,7 @@ export interface datePickerOptions { * */ @Plugin({ - plugin: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git', + plugin: 'cordova-plugin-datepicker', pluginRef: 'datePicker' }) export class DatePicker { diff --git a/src/plugins/device.ts b/src/plugins/device.ts index c1b9f7a6..f83a48f1 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -31,6 +31,10 @@ export interface Device { * @description * Access information about the underlying device and platform. * + * ```shell + * cordova plugin add cordova-plugin-device + * ``` + * * @usage * ```js * let info = Device.getDevice(); diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 69795f42..ac117e76 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -35,10 +35,12 @@ export interface accelerometerOptions { } /** + * @name DeviceMotion + * @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). * * ```shell - * cordova plugin add https://github.com/apache/cordova-plugin-device-motion.git + * cordova plugin add cordova-plugin-device-motion * ```` * * @usage @@ -61,8 +63,9 @@ export interface accelerometerOptions { * ``` */ @Plugin({ - plugin: 'https://github.com/apache/cordova-plugin-device-motion.git', - pluginRef: 'navigator.accelerometer' + plugin: 'cordova-plugin-device-motion', + pluginRef: 'navigator.accelerometer', + repo: 'https://github.com/apache/cordova-plugin-device-motion' }) export class DeviceMotion { diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index c11d16ba..07226cb2 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -40,10 +40,12 @@ export interface CompassOptions { } /** + * @name DeviceOrientation + * @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). * - * ``` - * cordova plugin add https://github.com/apache/cordova-plugin-device-orientation.git + * ```shell + * cordova plugin add cordova-plugin-device-orientation * ```` * * @usage @@ -64,8 +66,9 @@ export interface CompassOptions { * ``` */ @Plugin({ - plugin: 'https://github.com/apache/cordova-plugin-device-orientation', - pluginRef: 'navigator.compass' + plugin: 'cordova-plugin-device-orientation', + pluginRef: 'navigator.compass', + repo: 'https://github.com/apache/cordova-plugin-device-orientation' }) export class DeviceOrientation { diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index 0395295a..b3674fa3 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -18,16 +18,22 @@ export interface promptCallback { /** * @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). * + * ```shell + * cordova plugin add cordova-plugin-dialogs + * ``` + * * @usage * ```js * ``` */ @Plugin({ - plugin: 'https://github.com/apache/cordova-plugin-dialogs.git', - pluginRef: 'navigator.notification' + plugin: 'cordova-plugin-dialogs', + pluginRef: 'navigator.notification', + repo: 'https://github.com/apache/cordova-plugin-dialogs.git' }) export class Dialogs { diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 9a0ffa3c..c2f925ac 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -6,13 +6,18 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin). * + * ```shell + * cordova plugin add cordova-plugin-flashlight + * ``` + * * @usage * ```js * ``` */ @Plugin({ - plugin: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git', - pluginRef: 'window.plugins.flashlight' + plugin: 'cordova-plugin-flashlight', + pluginRef: 'window.plugins.flashlight', + repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git' }) export class Flashlight { diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 1c8d02d9..1251a050 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -99,6 +99,10 @@ export interface GeolocationOptions { * * This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation. * + * ```shell + * cordova plugin add cordova-plugin-geolocation + * ``` + * * @usage * * ```ts diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index c7c10814..3fd2f352 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -25,6 +25,10 @@ export interface ImagePickerOptions { * Requires Cordova plugin: `cordova-plugin-image-picker`. * For more info, please see the https://github.com/wymsee/cordova-imagePicker * + * ```shell + * cordova plugin add cordova-plugin-image-picker + * ``` + * * @usage * ```js * ImagePicker.getPictures(options).then((results) => { diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index eebc55bd..0d2af1a3 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -47,11 +47,12 @@ export interface launchNavigatorOptions { } /** - * + * @name LaunchNavigator + * @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). * - * ``` - * cordova plugin add https://github.com/dpa99c/phonegap-launch-navigator.git + * ```shell + * cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator * ``` * * @usage @@ -64,8 +65,9 @@ export interface launchNavigatorOptions { * ``` */ @Plugin({ - plugin: 'https://github.com/dpa99c/phonegap-launch-navigator.git', - pluginRef: 'launchnavigator' + plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator', + pluginRef: 'launchnavigator', + repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git' }) export class LaunchNavigator { diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 13643116..3e269fef 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -1,8 +1,14 @@ import {Plugin, Cordova} from './plugin'; /** * @name Local Notifications + * @description + * This plugin allows you to display local notifications on the device * - * Usage: + * ```shell + * cordova plugin add cordova-plugin-local-notifications + * ``` + * + * @usage * ```ts * // Schedule a single notification * LocalNotifications.schedule({ diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 3459cdc6..6756e23d 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -134,6 +134,20 @@ export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) { /** * 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) { return function(cls) { diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 920bf711..29222a42 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -252,6 +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). * + * ```shell + * cordova plugin add 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). */ diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index e33796ed..c47332b4 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -21,17 +21,20 @@ export interface smsOptionsAndroid { } /** - * + * @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). * - * ``` + * ```shell * cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git * ``` * * @usage - * ```js + * ```ts * + * // Send a text message using default options + * SMS.send('6476245170','Hello world!'); * * ``` */ diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index bb938ec4..2dace01f 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -3,10 +3,23 @@ import {Plugin, Cordova, CordovaProperty} from './plugin'; declare var window; /** - * + * @name StatusBar + * @description * 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). + * + * ```shell + * cordova plugin add cordova-plugin-statusbar + * ``` + * + * @usage + * ```ts + * StatuBar.overlaysWebView(true); + * + * StatusBar.styleDefault(); + * ``` + * */ @Plugin({ plugin: 'cordova-plugin-statusbar', diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index a6444349..494e264d 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -8,9 +8,24 @@ export interface ToastOptions { 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. * * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin). + * + * ```shell + * cordova plugin add cordova-plugin-x-toast + * ``` + * + * @usage + * ```ts + * Toast.show("I'm a toast", 5000, "center").subscribe( + * toast => { + * console.log(toast); + * } + * ); + * ``` */ @Plugin({ plugin: 'cordova-plugin-x-toast', From 74573a366f47395b7d8c4ca9bc0fa3b67ef53c0a Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:33:10 -0500 Subject: [PATCH 080/112] refactor(plugin): change plugin params --- src/plugins/sms.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index c47332b4..9bc34bc6 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -27,20 +27,21 @@ export interface smsOptionsAndroid { * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). * * ```shell - * cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git + * cordova plugin add cordova-sms-plugin * ``` * * @usage * ```ts * * // Send a text message using default options - * SMS.send('6476245170','Hello world!'); + * SMS.send('416123456','Hello world!'); * * ``` */ @Plugin({ - plugin: 'https://github.com/cordova-sms/cordova-sms-plugin.git', - pluginRef: 'sms' + plugin: 'cordova-sms-plugin', + pluginRef: 'sms', + repo: 'https://github.com/cordova-sms/cordova-sms-plugin.git' }) export class SMS { From 1e259da375084b67b9295e070e0916d26e9789d0 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:35:58 -0500 Subject: [PATCH 081/112] fix(plugin): export interfaces --- src/plugins/batterystatus.ts | 2 +- src/plugins/localnotifications.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index a8eb62fa..278ccf0f 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -55,7 +55,7 @@ export class BatteryStatus { } -interface StatusObject { +export interface StatusObject { /** * The battery charge percentage */ diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 3e269fef..8b012d13 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -190,7 +190,7 @@ export class LocalNotifications { } -interface Notification { +export interface Notification { /** * A unique identifier required to clear, cancel, update or retrieve the local notification in the future From dd83e7405a22062f9a97ac8ee90eece7c693fb89 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:45:14 -0500 Subject: [PATCH 082/112] chore(docs): change ionic to cordova in commands --- scripts/docs/templates/common.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index b8da35c3..b40b7d2a 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -117,7 +117,7 @@ Improve this doc <@- if doc.decorators @> <@ for prop in doc.decorators[0].argumentInfo @> -
$ ionic plugin add <$ prop.plugin $>
+
$ cordova plugin add <$ prop.plugin $>

Repo: <$ prop.repo $> From 92936896498d400a39ff2e9a9907b788a1192068 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:52:25 -0500 Subject: [PATCH 083/112] docs(plugin): set docs to private to hide in ionic-site --- src/plugins/plugin.ts | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 6756e23d..d2ec8cc1 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -8,13 +8,29 @@ declare var $q; import {Observable} from 'rxjs/Observable'; - +/** + * @private + * @param pluginRef + * @returns {null|*} + */ export const getPlugin = function(pluginRef: string): any { return get(window, pluginRef); }; + +/** + * @private + * @param pluginRef + * @returns {boolean} + */ export const isInstalled = function(pluginRef: string): boolean { return !!getPlugin(pluginRef); }; + +/** + * @private + * @param pluginObj + * @param method + */ export const pluginWarn = function(pluginObj: any, method: string) { var pluginName = pluginObj.name; var plugin = pluginObj.plugin; @@ -25,6 +41,12 @@ export const pluginWarn = function(pluginObj: any, method: string) { } console.warn('Install the ' + pluginName + ' plugin: \'cordova plugin add ' + plugin + '\''); }; + +/** + * @private + * @param pluginName + * @param method + */ export const cordovaWarn = function(pluginName: string, method: string) { 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'); @@ -119,6 +141,13 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any = }); } +/** + * @private + * @param pluginObj + * @param methodName + * @param opts + * @returns {function(...[any]): (undefined|*|Observable|*|*)} + */ export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) { return (...args) => { @@ -133,6 +162,8 @@ export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) { }; /** + * @private + * * Class decorator specifying Plugin metadata. Required for all plugins. * * @usage @@ -166,6 +197,8 @@ export function Plugin(config) { } /** + * @private + * * Wrap a stub function in a call to a Cordova plugin, checking if both Cordova * and the required plugin are installed. */ @@ -182,6 +215,9 @@ export function Cordova(opts:any = {}) { } /** + * @private + * + * * Before calling the original method, ensure Cordova and the plugin are installed. */ export function CordovaProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor) { From e59371887f6e93683f509bb6b15f56c84e8a5b68 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 18:56:01 -0500 Subject: [PATCH 084/112] docs(plugins): remove install command --- src/plugins/actionsheet.ts | 4 ---- src/plugins/appavailability.ts | 4 ---- src/plugins/apprate.ts | 4 ---- src/plugins/appversion.ts | 4 ---- src/plugins/badge.ts | 4 ---- src/plugins/barcodescanner.ts | 4 ---- src/plugins/batterystatus.ts | 4 ---- src/plugins/calendar.ts | 7 ++----- src/plugins/camera.ts | 4 ---- src/plugins/clipboard.ts | 4 ---- src/plugins/datepicker.ts | 5 ----- src/plugins/device.ts | 4 ---- src/plugins/devicemotion.ts | 4 ---- src/plugins/deviceorientation.ts | 4 ---- src/plugins/dialogs.ts | 4 ---- src/plugins/flashlight.ts | 4 ---- src/plugins/geolocation.ts | 4 ---- src/plugins/imagepicker.ts | 4 ---- src/plugins/launchnavigator.ts | 4 ---- src/plugins/localnotifications.ts | 4 ---- src/plugins/push.ts | 4 ---- src/plugins/sms.ts | 4 ---- src/plugins/statusbar.ts | 6 +----- src/plugins/toast.ts | 4 ---- 24 files changed, 3 insertions(+), 99 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 205db583..d72e4e40 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -7,10 +7,6 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet). * - * ```shell - * cordova plugin add cordova-plugin-actionsheet - * ``` - * * @usage * ```ts * import {ActionSheet} from 'ionic-native'; diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 453f8b8d..325ead94 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -7,10 +7,6 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability). * - * ``` - * cordova plugin add cordova-plugin-appavailability - * ``` - * * @usage * ```js * var app; diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 5b56fac7..e558061f 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -9,10 +9,6 @@ declare var window; * * Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate). * - * ```shell - * cordova plugin add cordova-plugin-apprate - * ```` - * * @usage * ```js * AppRate.preferences.storeAppURL.ios = ''; diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index d7c09be6..71342255 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -7,10 +7,6 @@ import {Plugin, Cordova} from './plugin'; * * 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). * - * ```shell - * cordova plugin add cordova-plugin-app-version - * ```` - * * @usage * ```js * AppVersion.getAppName(); diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index 010df3d2..f90b576d 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -7,10 +7,6 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge). * - * ```shell - * cordova plugin add cordova-plugin-badge - * ``` - * * @usage * ```js * Badge.set(10); diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index e0585df4..63537300 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -7,10 +7,6 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * - * ```shell - * cordova plugin add phonegap-plugin-barcodescanner - * ``` - * * @usage * ```js * BarcodeScanner.scan().then((barcodeData) => { diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 278ccf0f..5e940464 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -6,10 +6,6 @@ import {Observable} from "rxjs/Observable"; * @description * Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status). * - * ```shell - * cordova plugin add cordova-plugin-batterystatus - * ``` - * * @usage * ```js * // watch change in battery status diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index e0a90669..93574fd6 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -23,11 +23,8 @@ 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). * - * ```shell - * cordova plugin add cordova-plugin-calendar - * ``` - * - * + * @usage + * */ @Plugin({ plugin: 'cordova-plugin-calendar', diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index a6812c15..29dc1059 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -91,10 +91,6 @@ export interface CameraPopoverOptions { * * Requires Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera). * - * ```shell - * cordova plugin add cordova-plugin-camera - * ``` - * * @usage * ```js * Camera.getPicture(options).then((imageData) => { diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index d52c5999..99f80b1c 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -8,10 +8,6 @@ import {Plugin, Cordova} from './plugin'; * Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard * For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git). * - * ```shell - * cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git - * ``` - * * @usage * ```js * Clipboard.copy("Hello world"); diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 51b883a9..60b1134e 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -72,11 +72,6 @@ export interface datePickerOptions { * * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). * - * Install the plugin by running the following command: - * ```shell - * cordova plugin add cordova-plugin-datepicker - * ``` - * * @usage * ```js * DatePicker.show({ diff --git a/src/plugins/device.ts b/src/plugins/device.ts index f83a48f1..c1b9f7a6 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -31,10 +31,6 @@ export interface Device { * @description * Access information about the underlying device and platform. * - * ```shell - * cordova plugin add cordova-plugin-device - * ``` - * * @usage * ```js * let info = Device.getDevice(); diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index ac117e76..a6669015 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -39,10 +39,6 @@ export interface accelerometerOptions { * @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). * - * ```shell - * cordova plugin add cordova-plugin-device-motion - * ```` - * * @usage * ```ts * diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 07226cb2..c4fe6c42 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -44,10 +44,6 @@ export interface CompassOptions { * @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). * - * ```shell - * cordova plugin add cordova-plugin-device-orientation - * ```` - * * @usage * ```ts * // Get the device current compass heading diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index b3674fa3..406b0c70 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -22,10 +22,6 @@ export interface promptCallback { * * Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs). * - * ```shell - * cordova plugin add cordova-plugin-dialogs - * ``` - * * @usage * ```js * ``` diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index c2f925ac..f94ef72a 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -6,10 +6,6 @@ import {Plugin, Cordova} from './plugin'; * * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin). * - * ```shell - * cordova plugin add cordova-plugin-flashlight - * ``` - * * @usage * ```js * ``` diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 1251a050..1c8d02d9 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -99,10 +99,6 @@ export interface GeolocationOptions { * * This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation. * - * ```shell - * cordova plugin add cordova-plugin-geolocation - * ``` - * * @usage * * ```ts diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 3fd2f352..c7c10814 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -25,10 +25,6 @@ export interface ImagePickerOptions { * Requires Cordova plugin: `cordova-plugin-image-picker`. * For more info, please see the https://github.com/wymsee/cordova-imagePicker * - * ```shell - * cordova plugin add cordova-plugin-image-picker - * ``` - * * @usage * ```js * ImagePicker.getPictures(options).then((results) => { diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 0d2af1a3..d6688b41 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -51,10 +51,6 @@ export interface launchNavigatorOptions { * @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). * - * ```shell - * cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator - * ``` - * * @usage * ```js * LaunchNavigator.navigate("Toronto, ON", "London, ON") diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 8b012d13..6847ff51 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -4,10 +4,6 @@ import {Plugin, Cordova} from './plugin'; * @description * This plugin allows you to display local notifications on the device * - * ```shell - * cordova plugin add cordova-plugin-local-notifications - * ``` - * * @usage * ```ts * // Schedule a single notification diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 29222a42..52392bda 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -252,10 +252,6 @@ 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). * - * ```shell - * cordova plugin add 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). */ @Plugin({ diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 9bc34bc6..a389c0dd 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -26,10 +26,6 @@ export interface smsOptionsAndroid { * * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). * - * ```shell - * cordova plugin add cordova-sms-plugin - * ``` - * * @usage * ```ts * diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index 2dace01f..63370e11 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -9,15 +9,11 @@ declare var window; * * Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar). * - * ```shell - * cordova plugin add cordova-plugin-statusbar - * ``` - * * @usage * ```ts * StatuBar.overlaysWebView(true); * - * StatusBar.styleDefault(); + * StatusBar. * ``` * */ diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 494e264d..263ee7a8 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -14,10 +14,6 @@ export interface ToastOptions { * * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin). * - * ```shell - * cordova plugin add cordova-plugin-x-toast - * ``` - * * @usage * ```ts * Toast.show("I'm a toast", 5000, "center").subscribe( From 959cf288e440eb3cc8a48d10201160bc5352bc94 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 19:08:47 -0500 Subject: [PATCH 085/112] docs(plugins): add missing repo urls --- src/plugins/appavailability.ts | 3 ++- src/plugins/appversion.ts | 3 ++- src/plugins/badge.ts | 3 ++- src/plugins/batterystatus.ts | 3 ++- src/plugins/clipboard.ts | 3 ++- src/plugins/datepicker.ts | 3 ++- src/plugins/device.ts | 1 - src/plugins/geolocation.ts | 3 ++- src/plugins/localnotifications.ts | 5 +++-- 9 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 325ead94..5e1a54e6 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -26,7 +26,8 @@ import {Plugin, Cordova} from './plugin'; */ @Plugin({ plugin: 'cordova-plugin-appavailability', - pluginRef: 'appAvailability' + pluginRef: 'appAvailability', + repo: 'https://github.com/ohh2ahh/AppAvailability' }) export class AppAvailability { diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 71342255..f8d8693e 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -17,7 +17,8 @@ import {Plugin, Cordova} from './plugin'; */ @Plugin({ plugin: 'cordova-plugin-app-version', - pluginRef: 'cordova.getAppVersion' + pluginRef: 'cordova.getAppVersion', + repo: 'https://github.com/whiteoctober/cordova-plugin-app-version' }) export class AppVersion { /** diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index f90b576d..fcaea1d5 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -16,7 +16,8 @@ import {Plugin, Cordova} from './plugin'; */ @Plugin({ plugin: 'cordova-plugin-badge', - pluginRef: 'cordova.plugins.notification.badge' + pluginRef: 'cordova.plugins.notification.badge', + repo: 'https://github.com/katzer/cordova-plugin-badge' }) export class Badge { diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 5e940464..7d922a7d 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -21,7 +21,8 @@ import {Observable} from "rxjs/Observable"; * ``` */ @Plugin({ - plugin: 'cordova-plugin-batterystatus' + plugin: 'cordova-plugin-batterystatus', + repo: 'https://github.com/apache/cordova-plugin-battery-status' }) export class BatteryStatus { diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 99f80b1c..6f4f2bcc 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -25,7 +25,8 @@ import {Plugin, Cordova} from './plugin'; */ @Plugin({ plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git', - pluginRef: 'cordova.plugins.clipboard' + pluginRef: 'cordova.plugins.clipboard', + repo: 'https://github.com/VersoSolutions/CordovaClipboard' }) export class Clipboard { diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 60b1134e..2326f814 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -86,7 +86,8 @@ export interface datePickerOptions { */ @Plugin({ plugin: 'cordova-plugin-datepicker', - pluginRef: 'datePicker' + pluginRef: 'datePicker', + repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker' }) export class DatePicker { diff --git a/src/plugins/device.ts b/src/plugins/device.ts index c1b9f7a6..fbadb1a9 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -37,7 +37,6 @@ export interface Device { * ``` */ @Plugin({ - name: 'Device', plugin: 'cordova-plugin-device', pluginRef: 'device', repo: 'https://github.com/apache/cordova-plugin-device' diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 1c8d02d9..054dc70c 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -116,7 +116,8 @@ export interface GeolocationOptions { */ @Plugin({ plugin: 'cordova-plugin-geolocation', - pluginRef: 'navigator.geolocation' + pluginRef: 'navigator.geolocation', + repo: 'https://github.com/apache/cordova-plugin-geolocation' }) export class Geolocation { /** diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 6847ff51..a4286fac 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -39,8 +39,9 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - plugin: 'cordova-plugin-local-notifications', - pluginRef: 'cordova.plugins.notification.local' + plugin: 'de.appplant.cordova.plugin.local-notification', + pluginRef: 'cordova.plugins.notification.local', + repo: 'https://github.com/katzer/cordova-plugin-local-notifications' }) export class LocalNotifications { From fbd484583a2556ebeae80b6350084928e23ab078 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 12 Mar 2016 19:18:08 -0500 Subject: [PATCH 086/112] docs(sms): update param types --- src/plugins/sms.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index a389c0dd..1877cde9 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -1,5 +1,8 @@ import {Plugin, Cordova} from './plugin'; +/** + * Options for sending an SMS + */ export interface smsOptions { /** @@ -43,12 +46,10 @@ export class SMS { /** * Sends sms to a number - * @param number [string or array of strings] Phone number - * @param message [string] Message - * @param options [object] Options - * @param options.replaceLineBreaks [boolean] Set to true to replace \n by a new line. Default: false - * @param options.android.intent [string] Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app. - * @returns {Promise} + * @param number {string|Array} Phone number + * @param message {string} Message + * @param options {smsOptions} Options + * @returns {Promise} Resolves promise when the SMS has been sent */ @Cordova() static send( From 90cc36b453f29f0f0960823155d2e3a8a44665bc Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 04:08:39 -0400 Subject: [PATCH 087/112] feat(plugin): add globalization --- src/index.ts | 3 + src/plugins/globalization.ts | 122 +++++++++++++++++++++++++++++++++++ src/plugins/sms.ts | 2 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 src/plugins/globalization.ts diff --git a/src/index.ts b/src/index.ts index 346609a1..3eabf008 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,6 +26,7 @@ import {Facebook} from './plugins/facebook'; //import {File} from './plugins/file'; import {Flashlight} from './plugins/flashlight'; import {Geolocation} from './plugins/geolocation'; +import {Globalization} from './plugins/globalization'; import {ImagePicker} from './plugins/imagepicker'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; @@ -57,6 +58,7 @@ export { //File, Flashlight, Geolocation, + Globalization, ImagePicker, LaunchNavigator, LocalNotifications, @@ -92,6 +94,7 @@ window['IonicNative'] = { //File: File, Flashlight: Flashlight, Geolocation: Geolocation, + Globalization: Globalization, ImagePicker: ImagePicker, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts new file mode 100644 index 00000000..1e48c1d5 --- /dev/null +++ b/src/plugins/globalization.ts @@ -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,item}) : Promise<{value:Array}> {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, code, fraction, rounding, decimal, grouping}> {return} + +} \ No newline at end of file diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 1877cde9..9879d7b8 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -40,7 +40,7 @@ export interface smsOptionsAndroid { @Plugin({ plugin: 'cordova-sms-plugin', pluginRef: 'sms', - repo: 'https://github.com/cordova-sms/cordova-sms-plugin.git' + repo: 'https://github.com/cordova-sms/cordova-sms-plugin' }) export class SMS { From 0f3c1886d33359f5085162c76721a583fe7d404c Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 13:18:00 -0400 Subject: [PATCH 088/112] feat(plugin): add splashscreen --- src/plugins/splashscreen.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/plugins/splashscreen.ts diff --git a/src/plugins/splashscreen.ts b/src/plugins/splashscreen.ts new file mode 100644 index 00000000..c7999781 --- /dev/null +++ b/src/plugins/splashscreen.ts @@ -0,0 +1,36 @@ +import {Plugin, Cordova} from './plugin' + +/** + * @name Splashscreen + * @description This plugin displays and hides a splash screen during application launch. + * @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 {} + +} \ No newline at end of file From 29bf01190fde45f2a166f300b719524e06fd468d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 13:18:54 -0400 Subject: [PATCH 089/112] docs(splashscreen): --- src/plugins/splashscreen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/splashscreen.ts b/src/plugins/splashscreen.ts index c7999781..0069d163 100644 --- a/src/plugins/splashscreen.ts +++ b/src/plugins/splashscreen.ts @@ -2,7 +2,7 @@ import {Plugin, Cordova} from './plugin' /** * @name Splashscreen - * @description This plugin displays and hides a splash screen during application launch. + * @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(); From e1dc6061bddca78ceb2220b6810db1a861fb7d5e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 13:29:59 -0400 Subject: [PATCH 090/112] feat(plugin): add android hotspot plugin --- src/plugins/hotspot.ts | 100 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/plugins/hotspot.ts diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts new file mode 100644 index 00000000..89106b1b --- /dev/null +++ b/src/plugins/hotspot.ts @@ -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 {return} + + @Cordova() + static toggleWifi() : Promise {return} + + @Cordova() + static createHotspot(ssid : string, mode : string, password : string) : Promise {return} + + @Cordova() + static startHotspot() : Promise {return} + + @Cordova() + static configureHotspot(ssid : string, mode : string, password : string) : Promise {return} + + @Cordova() + static stopHotspot() : Promise {return} + + @Cordova() + static isHotspotEnabled() : Promise {return} + + @Cordova() + static getAllHotspotDevices() : Promise {return} + + @Cordova() + static connectToHotspot(ssid, password) : Promise {return} + + @Cordova() + static connectToWifiAuthEncrypt(ssid, password, authentication, encryption) : Promise {return} + + @Cordova() + static addWifiNetwork(ssid, mode, password) : Promise {return} + + @Cordova() + static removeWifiNetwork(ssid) : Promise {return} + + @Cordova() + static isConnectedToInternet() : Promise {return} + + @Cordova() + static isConnectedToInternetViaWifi() : Promise {return} + + @Cordova() + static isWifiOn() : Promise {return} + + @Cordova() + static isWifiSupported() : Promise {return} + + @Cordova() + static isWifiDirectSupported() : Promise {return} + + @Cordova() + static scanWifi() : Promise {return} + + @Cordova() + static scanWifiByLevel() : Promise {return} + + @Cordova() + static startPeriodicallyScan(interval, duration) : Promise {return} + + @Cordova() + static stopPeriodicallyScan() : Promise {return} + + @Cordova() + static getNetConfig() : Promise {return} + + @Cordova() + static getConnectionInfo() : Promise {return} + + @Cordova() + static pingHost(ip) : Promise {return} + + @Cordova() + static getMacAddressOfHost(ip) : Promise {return} + + @Cordova() + static isDnsLive(ip) : Promise {return} + + @Cordova() + static isPortLife(ip) : Promise {return} + + @Cordova() + static isRooted() : Promise {return} + +} \ No newline at end of file From 22bb218e1054c220bcfa46a7ba8ec54a141de103 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 13:34:19 -0400 Subject: [PATCH 091/112] feat(plugin): add DB Meter --- src/plugins/dbmeter.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/plugins/dbmeter.ts diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts new file mode 100644 index 00000000..d5c32c86 --- /dev/null +++ b/src/plugins/dbmeter.ts @@ -0,0 +1,30 @@ +import {Plugin, Cordova} from './plugin' +// TODO docs +/** + * @name DB Meter + * @description + * @platforms Android, iOS + * @usage + */ +@Plugin({ + plugin: 'cordova-plugin-dbmeter', + pluginRef: 'DBMeter', + repo: 'https://github.com/akofman/cordova-plugin-dbmeter' +}) +export class DBMeter { + + + // TODO use observable instead + @Cordova() + static start () : Promise {return} + + @Cordova() + static stop () : Promise {return} + + @Cordova() + static isListening() : Promise {return} + + @Cordova() + static delete() : Promise {return} + +} \ No newline at end of file From 8c17a2a6c246cc0307cd3f1105aade0d4a1249e5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 13:39:29 -0400 Subject: [PATCH 092/112] feat(plugin): add base64 to gallery --- src/plugins/base64togallery.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/plugins/base64togallery.ts diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts new file mode 100644 index 00000000..0c48f1af --- /dev/null +++ b/src/plugins/base64togallery.ts @@ -0,0 +1,31 @@ +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' +}) +export class Base64ToGallery { + + /** + * + * @param data + * @param prefix + */ + @Cordova() + base64ToGallery(data : string , prefix? : string ) : Promise { + return + } + +} \ No newline at end of file From 765ef48a23e7c7e8cd91f53b941a480d3877f379 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:05:15 -0400 Subject: [PATCH 093/112] docs(dbmeter): complete docs --- src/plugins/dbmeter.ts | 49 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index d5c32c86..00fd2afd 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -1,10 +1,30 @@ import {Plugin, Cordova} from './plugin' -// TODO docs +import {Observable} from "rxjs/Observable"; /** * @name DB Meter - * @description + * @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', @@ -13,17 +33,34 @@ import {Plugin, Cordova} from './plugin' }) export class DBMeter { + /** + * Starts listening + * @return {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. + */ + @Cordova({ + observable: true, + clearFunction: 'stop' + }) + static start () : Observable {return} - // TODO use observable instead - @Cordova() - static start () : Promise {return} - + /** + * Stops listening + * @private + */ @Cordova() static stop () : Promise {return} + /** + * Check if the DB Meter is listening + * @return {Promise} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening + */ @Cordova() static isListening() : Promise {return} + /** + * Delete the DB Meter instance + * @return {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur. + */ @Cordova() static delete() : Promise {return} From a80c4ee2bf47feec4bd1e00c484350a5257cc107 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:19:21 -0400 Subject: [PATCH 094/112] feat(plugin): add keyboard --- src/plugins/keyboard.ts | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/plugins/keyboard.ts diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts new file mode 100644 index 00000000..d4491540 --- /dev/null +++ b/src/plugins/keyboard.ts @@ -0,0 +1,50 @@ +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 {} + + @Cordova({ + sync: true + }) + static close() : void {} + + //static onKeyboardShow() : Observable { + // return new Observable( + // observer => { + // + // } + // ); + //} +} \ No newline at end of file From 0d1bd1335f0009fc72cc4506cf3e3a2c01a4387f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:30:21 -0400 Subject: [PATCH 095/112] feat(plugin): add event wrapper --- npm-debug.log | 40 ++++++++++++++++++++++++++++++++++++++++ src/plugins/plugin.ts | 25 +++++++++++++++++++++---- 2 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 npm-debug.log diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 00000000..0ce51aab --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,40 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', +1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', +1 verbose cli 'run', +1 verbose cli 'build_bundle' ] +2 info using npm@2.14.12 +3 info using node@v4.2.4 +4 verbose run-script [ 'prebuild_bundle', 'build_bundle', 'postbuild_bundle' ] +5 info prebuild_bundle ionic-native@1.0.12 +6 info build_bundle ionic-native@1.0.12 +7 verbose unsafe-perm in lifecycle true +8 info ionic-native@1.0.12 Failed to exec build_bundle script +9 verbose stack Error: ionic-native@1.0.12 build_bundle: `npm run-script build && browserify dist/index.js > dist/ionic.native.js` +9 verbose stack Exit status 1 +9 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16) +9 verbose stack at emitTwo (events.js:87:13) +9 verbose stack at EventEmitter.emit (events.js:172:7) +9 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14) +9 verbose stack at emitTwo (events.js:87:13) +9 verbose stack at ChildProcess.emit (events.js:172:7) +9 verbose stack at maybeClose (internal/child_process.js:818:16) +9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) +10 verbose pkgid ionic-native@1.0.12 +11 verbose cwd C:\Users\Ibrahim\WebstormProjects\ionic-native +12 error Windows_NT 10.0.10586 +13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build_bundle" +14 error node v4.2.4 +15 error npm v2.14.12 +16 error code ELIFECYCLE +17 error ionic-native@1.0.12 build_bundle: `npm run-script build && browserify dist/index.js > dist/ionic.native.js` +17 error Exit status 1 +18 error Failed at the ionic-native@1.0.12 build_bundle script 'npm run-script build && browserify dist/index.js > dist/ionic.native.js'. +18 error This is most likely a problem with the ionic-native package, +18 error not with npm itself. +18 error Tell the author that this fails on your system: +18 error npm run-script build && browserify dist/index.js > dist/ionic.native.js +18 error You can get their info via: +18 error npm owner ls ionic-native +18 error There is likely additional logging output above. +19 verbose exit [ 1, true ] diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index d2ec8cc1..a06bb16d 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -141,6 +141,19 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any = }); } +/** + * Wrap the event with an observable + * @param event + * @returns {Observable} + */ +function wrapEventObservable (event : string) : Observable { + return new Observable(observer => { + let callback = (status : any) => observer.next(status); + window.addEventListener(event, callback, false); + return () => window.removeEventListener(event, callback, false); + }); +} + /** * @private * @param pluginObj @@ -151,13 +164,17 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any = export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) { return (...args) => { - if (opts.sync){ + if (opts.sync) return callCordovaPlugin(pluginObj, methodName, args, opts); - } else if (opts.observable) { + + else if (opts.observable) return wrapObservable(pluginObj, methodName, args, opts); - } else { + + else if (opts.eventObservable && opts.event) + return wrapEventObservable(opts.event); + + else return wrapPromise(pluginObj, methodName, args, opts); - } } }; From c86e135096ae10678a3e4c4c77530d89990c0746 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:34:30 -0400 Subject: [PATCH 096/112] fix(plugin): fix types --- src/plugins/globalization.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index 1e48c1d5..ea250b01 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -67,7 +67,7 @@ export class Globalization { @Cordova({ callbackOrder: 'reverse' }) - static getDateNames(options:{type,item}) : Promise<{value:Array}> {return} + static getDateNames(options:{type:string,item:string}) : Promise<{value:Array}> {return} /** * Check if day light saving is active @@ -117,6 +117,6 @@ export class Globalization { * @param currencyCode */ @Cordova() - static getCurrencyPattern(currencyCode:string) : Promise<{pattern, code, fraction, rounding, decimal, grouping}> {return} + static getCurrencyPattern(currencyCode:string) : Promise<{pattern:string, code:string, fraction:number, rounding:number, decimal:number, grouping:string}> {return} } \ No newline at end of file From 05ee1617fda31e7f5fe7ed283531328463d97475 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:36:31 -0400 Subject: [PATCH 097/112] test(tests): add build_bundle to tests this should help for now to ensure that we are able to build --- circle.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 868af9c4..3573bad2 100644 --- a/circle.yml +++ b/circle.yml @@ -5,7 +5,8 @@ machine: version: 2.1.2 test: 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: staging: From 786cd21de85d2ca730786842ec1a1422bb2cb3d8 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:45:07 -0400 Subject: [PATCH 098/112] docs(docs): update names --- src/plugins/actionsheet.ts | 2 +- src/plugins/appavailability.ts | 2 +- src/plugins/apprate.ts | 2 +- src/plugins/appversion.ts | 2 +- src/plugins/barcodescanner.ts | 2 +- src/plugins/datepicker.ts | 2 +- src/plugins/devicemotion.ts | 2 +- src/plugins/deviceorientation.ts | 2 +- src/plugins/imagepicker.ts | 2 +- src/plugins/launchnavigator.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index d72e4e40..6e2b275c 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -1,7 +1,7 @@ import {Plugin, Cordova} from './plugin'; /** - * @name ActionSheet + * @name Action Sheet * @description * The ActionSheet plugin shows a native list of options the user can choose from. * diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 5e1a54e6..94aa842e 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -1,7 +1,7 @@ import {Plugin, Cordova} from './plugin'; /** - * @name AppAvailability + * @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. * diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index e558061f..b2ce9f69 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -3,7 +3,7 @@ import {Plugin, Cordova, CordovaProperty} from './plugin'; declare var window; /** - * @name AppRate + * @name App Rate * @description * The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never. * diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index f8d8693e..5b62f3dc 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -1,7 +1,7 @@ import {Plugin, Cordova} from './plugin'; /** - * @name AppVersion + * @name App Version * @description * Reads the version of your app from the target build settings. * diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 63537300..df85bc6b 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -1,7 +1,7 @@ import {Plugin, Cordova} from './plugin'; /** - * @name BarcodeScanner + * @name Barcode Scanner * @description * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you. * diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 2326f814..0d955683 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -64,7 +64,7 @@ export interface datePickerOptions { } /** - * @name DatePicker + * @name Date Picker * @description * The DatePicker plugin allows the user to fetch date or time using native dialogs. * diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index a6669015..a4d0cf01 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -35,7 +35,7 @@ export interface accelerometerOptions { } /** - * @name DeviceMotion + * @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). * diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index c4fe6c42..016a9fa3 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -40,7 +40,7 @@ export interface CompassOptions { } /** - * @name DeviceOrientation + * @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). * diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index c7c10814..9da561eb 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -18,7 +18,7 @@ export interface ImagePickerOptions { } /** - * @name imagePicker + * @name Image Picker * @description * Cordova Plugin For Multiple Image Selection * diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index d6688b41..7a009e5e 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -47,7 +47,7 @@ export interface launchNavigatorOptions { } /** - * @name LaunchNavigator + * @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). * From 3cc4ee4196edbaaf8298719ffdda1d7ff0cd17b4 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 15:53:03 -0400 Subject: [PATCH 099/112] feat(plugin): add vibration --- src/plugins/vibration.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/plugins/vibration.ts diff --git a/src/plugins/vibration.ts b/src/plugins/vibration.ts new file mode 100644 index 00000000..cac11e08 --- /dev/null +++ b/src/plugins/vibration.ts @@ -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} 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) {} + +} \ No newline at end of file From 1771f7bfe1f13bab59f9bbb3064d85b8df5da516 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 16:08:15 -0400 Subject: [PATCH 100/112] fix(plugins): cleanup and add new plugins to index --- src/index.ts | 12 ++++++++++++ src/plugins/keyboard.ts | 12 +----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3eabf008..7632e598 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import {AppRate} from './plugins/apprate'; import {AppVersion} from './plugins/appversion'; import {Badge} from './plugins/badge'; import {BarcodeScanner} from './plugins/barcodescanner'; +import {Base64ToGallery} from './plugins/base64togallery'; import {BatteryStatus} from './plugins/batterystatus'; import {BLE} from './plugins/ble'; import {Calendar} from './plugins/calendar'; @@ -18,6 +19,7 @@ import {Camera} from './plugins/camera'; import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; import {DatePicker} from './plugins/datepicker'; +import {DBMeter} from './plugins/dbmeter'; import {Device} from './plugins/device'; import {DeviceMotion} from './plugins/devicemotion'; import {DeviceOrientation} from './plugins/deviceorientation'; @@ -28,10 +30,12 @@ import {Flashlight} from './plugins/flashlight'; import {Geolocation} from './plugins/geolocation'; import {Globalization} from './plugins/globalization'; 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 {SMS} from './plugins/sms'; +import {Splashscreen} from './plugins/splashscreen'; import {StatusBar} from './plugins/statusbar'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; @@ -43,6 +47,7 @@ export { AppVersion, Badge, BarcodeScanner, + Base64ToGallery, BatteryStatus, BLE, Calendar, @@ -50,6 +55,7 @@ export { Clipboard, Contacts, DatePicker, + DBMeter, Device, DeviceMotion, DeviceOrientation, @@ -60,10 +66,12 @@ export { Geolocation, Globalization, ImagePicker, + Keyboard, LaunchNavigator, LocalNotifications, Push, SMS, + Splashscreen, StatusBar, Toast, TouchID @@ -79,6 +87,7 @@ window['IonicNative'] = { AppVersion: AppVersion, Badge: Badge, BarcodeScanner: BarcodeScanner, + Base64ToGallery: Base64ToGallery, BatteryStatus: BatteryStatus, BLE: BLE, Calendar: Calendar, @@ -86,6 +95,7 @@ window['IonicNative'] = { Clipboard: Clipboard, Contacts: Contacts, DatePicker: DatePicker, + DBMeter: DBMeter, Device: Device, DeviceMotion: DeviceMotion, DeviceOrientation: DeviceOrientation, @@ -96,10 +106,12 @@ window['IonicNative'] = { Geolocation: Geolocation, Globalization: Globalization, ImagePicker: ImagePicker, + Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, Push: Push, SMS: SMS, + Splashscreen: Splashscreen, StatusBar: StatusBar, Toast: Toast, TouchID: TouchID diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index d4491540..5f196745 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -35,16 +35,6 @@ export class Keyboard { }) static show() : void {} - @Cordova({ - sync: true - }) - static close() : void {} + // TODO add event listener - //static onKeyboardShow() : Observable { - // return new Observable( - // observer => { - // - // } - // ); - //} } \ No newline at end of file From 43b7f12415bf0bd1494d04ac5c0aee11611545b0 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 17:23:24 -0400 Subject: [PATCH 101/112] docs(localnotifications): fix broken docs --- src/plugins/localnotifications.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index a4286fac..a16ac2f1 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -36,6 +36,7 @@ import {Plugin, Cordova} from './plugin'; * led: "FF0000", * sound: null * }); + * ``` * */ @Plugin({ From fb0cb19c003b0fa48e678978992d8ec21922ce5c Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 17:25:26 -0400 Subject: [PATCH 102/112] feat(index): add missing plugins --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7632e598..8ad5c793 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,6 +29,7 @@ import {Facebook} from './plugins/facebook'; import {Flashlight} from './plugins/flashlight'; 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'; @@ -39,6 +40,7 @@ import {Splashscreen} from './plugins/splashscreen'; import {StatusBar} from './plugins/statusbar'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; +import {Vibration} from './plugins/vibration'; export { ActionSheet, @@ -65,6 +67,7 @@ export { Flashlight, Geolocation, Globalization, + Hotspot, ImagePicker, Keyboard, LaunchNavigator, @@ -74,7 +77,8 @@ export { Splashscreen, StatusBar, Toast, - TouchID + TouchID, + Vibration } export * from './plugins/plugin'; @@ -105,6 +109,7 @@ window['IonicNative'] = { Flashlight: Flashlight, Geolocation: Geolocation, Globalization: Globalization, + Hotspot: Hotspot, ImagePicker: ImagePicker, Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, @@ -114,7 +119,8 @@ window['IonicNative'] = { Splashscreen: Splashscreen, StatusBar: StatusBar, Toast: Toast, - TouchID: TouchID + TouchID: TouchID, + Vibration: Vibration }; // To help developers using cordova, we listen for the device ready event and From 081de07a27637dd3068d073f9aaf4c1d63334ce7 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 17:42:35 -0400 Subject: [PATCH 103/112] chore(docs): add platforms decorator --- scripts/docs/templates/common.template.html | 193 +++++++++++--------- 1 file changed, 103 insertions(+), 90 deletions(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index b8da35c3..b1becc38 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -12,65 +12,65 @@ docType: "<$ doc.docType $>" --- <@ macro paramList(paramData) -@> - <@- if paramData -@>( +<@- if paramData -@>( <@- for param in paramData -@> <$ param | escape $><@ if not loop.last @>, <@ endif @> <@- endfor @>) - <@- endif @> +<@- endif @> <@- endmacro -@> <@ macro githubViewLink(doc) -@> - <$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>) +<$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>) <@- endmacro -@> <@ macro paramTable(params, isDirective) -@> - - - - - + + + + + - <@ for param in params @> - - - - - - <@ endfor @> + <@ for param in params @> + + + + + + <@ endfor @>
<@ if isDirective @>Attr<@ else @>Param<@ endif @>TypeDetails
<@ if isDirective @>Attr<@ else @>Param<@ endif @>TypeDetails
- <$ param.name $> - <@ if param.alias @>| <$ param.alias $><@ endif @> - <@ if param.type.optional @>
(optional)
<@ endif @> -
- <$ typeList(param.typeList) $> - - <$ param.description | marked $> - <@ if param.default @>

(default: <$ param.default $>)

<@ endif @> -
+ <$ param.name $> + <@ if param.alias @>| <$ param.alias $><@ endif @> + <@ if param.type.optional @>
(optional)
<@ endif @> +
+ <$ typeList(param.typeList) $> + + <$ param.description | marked $> + <@ if param.default @>

(default: <$ param.default $>)

<@ endif @> +
<@- endmacro -@> <@- macro functionSyntax(fn) @> - <@- set sep = joiner(', ') -@> - <$ fn.name $>(<@- for param in fn.params @><$ sep() $> +<@- set sep = joiner(', ') -@> +<$ fn.name $>(<@- for param in fn.params @><$ sep() $> <@- if param.type.optional @>[<@ endif -@> <$ param.name $> <@- if param.type.optional @>]<@ endif -@> <@ endfor @>) - <@ if fn.alias @>(alias: <$ fn.alias $>)<@ endif @> +<@ if fn.alias @>(alias: <$ fn.alias $>)<@ endif @> <@ endmacro -@> <@ macro typeList(types) -@> - <@ set separator = joiner("|") @> - <@ for type in types @><$ separator() $><$ type | code $><@ endfor @> +<@ set separator = joiner("|") @> +<@ for type in types @><$ separator() $><$ type | code $><@ endfor @> <@- endmacro -@> <@- macro typeInfo(fn) -@> - <$ typeList(fn.typeList) $> <$ fn.description $> +<$ typeList(fn.typeList) $> <$ fn.description $> <@- endmacro -@> <@ block body @> @@ -82,30 +82,30 @@ docType: "<$ doc.docType $>"

-<@ if doc.docType == "directive" @> -<$ doc.name | dashCase $> -<@ else @> -<$ doc.name $> -<@ endif @> + <@ if doc.docType == "directive" @> + <$ doc.name | dashCase $> + <@ else @> + <$ doc.name $> + <@ endif @> -<@ if doc.parent @> -
- -Child of <$ doc.parent $> - -<@ endif @> + <@ if doc.parent @> +
+ + Child of <$ doc.parent $> + + <@ endif @> -<@ if doc.delegate @> -
- -Delegate: <$ doc.delegate $> - -<@ endif @> + <@ if doc.delegate @> +
+ + Delegate: <$ doc.delegate $> + + <@ endif @>

-Improve this doc + Improve this doc <@ if doc.codepen @> @@ -119,9 +119,9 @@ Improve this doc <@ for prop in doc.decorators[0].argumentInfo @>
$ ionic plugin add <$ prop.plugin $>

Repo: - -<$ prop.repo $> - + + <$ prop.repo $> +

<@ endfor @> <@ endif -@> @@ -137,6 +137,14 @@ Improve this doc

<$ doc.directiveInfo.properties[0].name $>: <$ doc.directiveInfo.properties[0].values $>

<@ endif -@> + +<@ if doc.platforms @> +

Supported platforms

+<@ block platforms @> +<$ doc.platforms $> +<@ endblock @> +<@ endif @> + <@ if doc.usage @>

Usage

@@ -149,42 +157,42 @@ Improve this doc <@ if doc.properties @>

Attributes:

- - - + + + -<@ set hasTypes = false @> -<@ for prop in doc.properties @> -<@ if prop.type @> -<@ set hasTypes = true @> -<@ endif @> -<@ endfor @> -<@ if hasTypes @> - -<@ endif @> + <@ set hasTypes = false @> + <@ for prop in doc.properties @> + <@ if prop.type @> + <@ set hasTypes = true @> + <@ endif @> + <@ endfor @> + <@ if hasTypes @> + + <@ endif @> - - - - -<@ for prop in doc.properties @> - - + + + + + <@ for prop in doc.properties @> + + -<@ if hasTypes @> - -<@ endif @> + <@ if hasTypes @> + + <@ endif @> - - -<@ endfor @> - + + + <@ endfor @> +
Attribute
AttributeTypeTypeDescription
-<$ prop.name $> -Description
+ <$ prop.name $> + -<$ prop.type.name $> - + <$ prop.type.name $> + -<$ prop.description $> -
+ <$ prop.description $> +
<@ endif @> @@ -194,6 +202,11 @@ Improve this doc

<$ functionSyntax(method) $>

+<@ if method.platforms @> +

Platforms: <$ method.platforms $>

+ +<@ endif @> + <$ method.description $> <@ if method.params @> @@ -202,14 +215,14 @@ Improve this doc <@ if method.this @>

Method's `this` -<$ method.this $> + <$ method.this $>

<@ endif @> <@ if method.returns @>
- -Returns: <$ typeInfo(method.returns) $> + + Returns: <$ typeInfo(method.returns) $>
<@ endif @> <@ endif @> @@ -225,7 +238,7 @@ Improve this doc

-<$ functionSyntax(method) $> + <$ functionSyntax(method) $>

<$ method.description $> @@ -236,14 +249,14 @@ Improve this doc <@ if method.this @>

Method's `this` -<$ method.this $> + <$ method.this $>

<@ endif @> <@ if method.returns @>
- -Returns: <$ typeInfo(method.returns) $> + + Returns: <$ typeInfo(method.returns) $>
<@ endif @> From 5375a08bfd5973455dc8be8d65d73810cd330bf9 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 17:48:35 -0400 Subject: [PATCH 104/112] fix(remove npm debug log): --- npm-debug.log | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 npm-debug.log diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index 0ce51aab..00000000 --- a/npm-debug.log +++ /dev/null @@ -1,40 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', -1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', -1 verbose cli 'run', -1 verbose cli 'build_bundle' ] -2 info using npm@2.14.12 -3 info using node@v4.2.4 -4 verbose run-script [ 'prebuild_bundle', 'build_bundle', 'postbuild_bundle' ] -5 info prebuild_bundle ionic-native@1.0.12 -6 info build_bundle ionic-native@1.0.12 -7 verbose unsafe-perm in lifecycle true -8 info ionic-native@1.0.12 Failed to exec build_bundle script -9 verbose stack Error: ionic-native@1.0.12 build_bundle: `npm run-script build && browserify dist/index.js > dist/ionic.native.js` -9 verbose stack Exit status 1 -9 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16) -9 verbose stack at emitTwo (events.js:87:13) -9 verbose stack at EventEmitter.emit (events.js:172:7) -9 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14) -9 verbose stack at emitTwo (events.js:87:13) -9 verbose stack at ChildProcess.emit (events.js:172:7) -9 verbose stack at maybeClose (internal/child_process.js:818:16) -9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) -10 verbose pkgid ionic-native@1.0.12 -11 verbose cwd C:\Users\Ibrahim\WebstormProjects\ionic-native -12 error Windows_NT 10.0.10586 -13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build_bundle" -14 error node v4.2.4 -15 error npm v2.14.12 -16 error code ELIFECYCLE -17 error ionic-native@1.0.12 build_bundle: `npm run-script build && browserify dist/index.js > dist/ionic.native.js` -17 error Exit status 1 -18 error Failed at the ionic-native@1.0.12 build_bundle script 'npm run-script build && browserify dist/index.js > dist/ionic.native.js'. -18 error This is most likely a problem with the ionic-native package, -18 error not with npm itself. -18 error Tell the author that this fails on your system: -18 error npm run-script build && browserify dist/index.js > dist/ionic.native.js -18 error You can get their info via: -18 error npm owner ls ionic-native -18 error There is likely additional logging output above. -19 verbose exit [ 1, true ] From e708bc6be71a3d82f2395db63c728d7c9742a913 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 20:35:47 -0400 Subject: [PATCH 105/112] fix(interface): params are optional --- src/plugins/datepicker.ts | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 0d955683..47b89dda 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -20,47 +20,47 @@ export interface datePickerOptions { * Type: Date | empty String * Default: empty String */ - minDate: Date, + minDate?: Date, /** - * Platforms: iOS, Android, Windows + * Platforms?: iOS, Android, Windows * Maximum date - * Type: Date | empty String - * Default: empty String + * Type?: Date | empty String + * Default?: empty String */ - maxDate: Date, + maxDate?: Date, /** - * Platforms: Android + * Platforms?: Android * Label for the dialog title. If empty, uses android default (Set date/Set time). - * Type: String - * Default: empty String + * Type?: String + * Default?: empty String */ - titleText: string, + titleText?: string, /** - * Platforms: Android + * Platforms?: Android * Label of BUTTON_POSITIVE (done button) on Android */ - okText: string, + 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 + 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 } /** From 9ef850c66a1b7a54c6e5479910ecf8c74d9e2f50 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 20:39:40 -0400 Subject: [PATCH 106/112] fix(plugins): fix optional options --- src/plugins/deviceorientation.ts | 4 ++-- src/plugins/geolocation.ts | 6 +++--- src/plugins/launchnavigator.ts | 14 +++++++------- src/plugins/localnotifications.ts | 26 +++++++++++++------------- src/plugins/push.ts | 2 +- src/plugins/sms.ts | 6 +++--- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 016a9fa3..31a87dc7 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -30,12 +30,12 @@ export interface CompassOptions { /** * How often to retrieve the compass heading in milliseconds. (Number) (Default: 100) */ - frequency : number, + frequency? : number, /** * The change in degrees required to initiate a watchHeading success callback. When this value is set, frequency is ignored. (Number) */ - filter : number + filter? : number } diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 054dc70c..70214edd 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -69,7 +69,7 @@ export interface GeolocationOptions { * retrieve the real current position. If set to Infinity the device must * 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 @@ -77,7 +77,7 @@ export interface GeolocationOptions { * position. The default value is Infinity, meaning that getCurrentPosition() * won't return until the position is available. */ - timeout: number; + timeout?: number; /** * 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. * @type {boolean} */ - enableHighAccuracy: boolean; + enableHighAccuracy?: boolean; } diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 7a009e5e..359c6ef6 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -6,43 +6,43 @@ 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, + disableAutoGeolocation? : boolean, /** * iOS, Android, Windows * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. */ - transportMode : string, + 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, + 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, + 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, + backButtonText? : string, /** * iOS * If true, debug log output will be generated by the plugin. Defaults to false. */ - enableDebug : boolean, + 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, + navigationMode? : string, } diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index a16ac2f1..2b0d086f 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -194,64 +194,64 @@ export interface Notification { * A unique identifier required to clear, cancel, update or retrieve the local notification in the future * Default: 0 */ - id : number, + id? : number, /** * First row of the notification * Default: Empty string (iOS) or the app name (Android) */ - title : string, + title? : string, /** * Second row of the notification * Default: Empty string */ - text : 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, + 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, + 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, + badge? : number, /** * Uri of the file containing the sound to play when an alert is displayed * Default: res://platform_default */ - sound : string, + sound? : string, /** * Arbitrary data, objects will be encoded to JSON string * Default: null */ - data : any, + data? : any, /** * ANDROID ONLY * Uri of the icon that is shown in the ticker and notification * Default: res://icon */ - icon : string, + 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, + smallIcon? : string, /** @@ -261,12 +261,12 @@ export interface Notification { * - They do not have an 'X' close button, and are not affected by the "Clear all" button * Default: false */ - ongoing : boolean, + ongoing? : boolean, /** * ANDROID ONLY * ARGB value that you would like the LED on the device to blink * Default: FFFFFF */ - led : string + led? : string } \ No newline at end of file diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 52392bda..deb3e67a 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -232,7 +232,7 @@ export interface AndroidPushOptions { * If the array contains one or more strings each string will be used to * subscribe to a GcmPubSub topic. */ - topics: string[]; + topics?: string[]; } export interface PushOptions { diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 9879d7b8..8d1ec8e7 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -8,9 +8,9 @@ export interface smsOptions { /** * Set to true to replace \n by a new line. Default: false */ - replaceLineBreaks : boolean, + replaceLineBreaks? : boolean, - android : smsOptionsAndroid + android? : smsOptionsAndroid } @@ -19,7 +19,7 @@ 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 + intent? : string } From 23db55e7c169f1e81b78c07f552a6edbd3cde4b5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 14 Mar 2016 13:22:37 -0400 Subject: [PATCH 107/112] docs(docs): add platforms decorator output --- scripts/docs/templates/common.template.html | 35 ++++++++++++++------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index bbec1640..5b9a307d 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -123,6 +123,19 @@ docType: "<$ doc.docType $>" <$ prop.repo $>

+ +<@ if prop.platforms @> + +

Supported platforms

+<@ block platforms @> +
    + <@- for platform in prop.platforms @> +
  • <$ platform $>
  • + <@ endfor -@> +
+<@ endblock @> +<@ endif @> + <@ endfor @> <@ endif -@> @@ -137,14 +150,6 @@ docType: "<$ doc.docType $>"

<$ doc.directiveInfo.properties[0].name $>: <$ doc.directiveInfo.properties[0].values $>

<@ endif -@> - -<@ if doc.platforms @> -

Supported platforms

-<@ block platforms @> -<$ doc.platforms $> -<@ endblock @> -<@ endif @> - <@ if doc.usage @>

Usage

@@ -202,10 +207,18 @@ docType: "<$ doc.docType $>"

<$ functionSyntax(method) $>

-<@ if method.platforms @> -

Platforms: <$ method.platforms $>

- +<@- if method.decorators @> +<@ for prop in method.decorators[0].argumentInfo @> +<@ if prop.platforms @> +

Platforms:

+
    +<@- for platform in prop.platforms @> +
  • <$ platform $>
  • +<@ endfor -@> +
<@ endif @> +<@ endfor @> +<@ endif -@> <$ method.description $> From 9826dfd026bc48f95ef44ecc3c5f0dd9e982a467 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 14 Mar 2016 13:38:35 -0400 Subject: [PATCH 108/112] feat(plugins): add platforms info --- src/plugins/actionsheet.ts | 3 ++- src/plugins/appavailability.ts | 3 ++- src/plugins/apprate.ts | 3 ++- src/plugins/appversion.ts | 3 ++- src/plugins/badge.ts | 3 ++- src/plugins/barcodescanner.ts | 3 ++- src/plugins/base64togallery.ts | 3 ++- src/plugins/batterystatus.ts | 3 ++- src/plugins/ble.ts | 3 ++- src/plugins/calendar.ts | 3 ++- src/plugins/camera.ts | 4 +++- src/plugins/clipboard.ts | 3 ++- src/plugins/sms.ts | 3 ++- 13 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 6e2b275c..8c0189ff 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -26,7 +26,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-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 { diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 94aa842e..0794aace 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -27,7 +27,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-appavailability', pluginRef: 'appAvailability', - repo: 'https://github.com/ohh2ahh/AppAvailability' + repo: 'https://github.com/ohh2ahh/AppAvailability', + platforms: ['Android','iOS'] }) export class AppAvailability { diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index b2ce9f69..61f98c4c 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -21,7 +21,8 @@ declare var window; @Plugin({ plugin: 'cordova-plugin-apprate', pluginRef: 'AppRate', - repo: 'https://github.com/pushandplay/cordova-plugin-apprate' + repo: 'https://github.com/pushandplay/cordova-plugin-apprate', + platforms: ['Android','iOS'] }) export class AppRate { diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 5b62f3dc..0d3f80a3 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -18,7 +18,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-app-version', pluginRef: 'cordova.getAppVersion', - repo: 'https://github.com/whiteoctober/cordova-plugin-app-version' + repo: 'https://github.com/whiteoctober/cordova-plugin-app-version', + platforms: ['Android', 'iOS'] }) export class AppVersion { /** diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index fcaea1d5..0e1b2484 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -17,7 +17,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-badge', pluginRef: 'cordova.plugins.notification.badge', - repo: 'https://github.com/katzer/cordova-plugin-badge' + repo: 'https://github.com/katzer/cordova-plugin-badge', + platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8'] }) export class Badge { diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index df85bc6b..18965d04 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -19,7 +19,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'phonegap-plugin-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 { diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index 0c48f1af..5f996e0d 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -14,7 +14,8 @@ import {Plugin, Cordova} from './plugin' @Plugin({ plugin: 'cordova-base64-to-gallery', pluginRef: 'cordova', - repo: 'https://github.com/Nexxa/cordova-base64-to-gallery' + repo: 'https://github.com/Nexxa/cordova-base64-to-gallery', + platforms: ['Android' ,'iOS', 'Windows Phone 8'] }) export class Base64ToGallery { diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 7d922a7d..fcbab0fa 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -22,7 +22,8 @@ import {Observable} from "rxjs/Observable"; */ @Plugin({ plugin: 'cordova-plugin-batterystatus', - repo: 'https://github.com/apache/cordova-plugin-battery-status' + 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 { diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 3e986454..8dd07780 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -162,7 +162,8 @@ import {Observable} from 'rxjs/Observable'; @Plugin({ plugin: 'cordova-plugin-ble-central', 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 { /** diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 93574fd6..e92d65c4 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -29,7 +29,8 @@ export interface Calendar { @Plugin({ plugin: 'cordova-plugin-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 { /** diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 29dc1059..efd975fe 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -104,7 +104,8 @@ export interface CameraPopoverOptions { @Plugin({ plugin: 'cordova-plugin-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 { /** @@ -121,6 +122,7 @@ export class Camera { * 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 + * @platforms ['iOS'] */ @Cordova() static cleanup(){}; diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 6f4f2bcc..07559137 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -26,7 +26,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git', pluginRef: 'cordova.plugins.clipboard', - repo: 'https://github.com/VersoSolutions/CordovaClipboard' + 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 { diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 8d1ec8e7..a6bca8a0 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -40,7 +40,8 @@ export interface smsOptionsAndroid { @Plugin({ plugin: 'cordova-sms-plugin', pluginRef: 'sms', - repo: 'https://github.com/cordova-sms/cordova-sms-plugin' + repo: 'https://github.com/cordova-sms/cordova-sms-plugin', + platforms: ['Android', 'iOS', 'Windows Phone 8'] }) export class SMS { From 34e57839956c3fb21f2b0f56386640704a62ec20 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 14 Mar 2016 13:54:35 -0400 Subject: [PATCH 109/112] docs(platforms): fix platforms for a mothod --- src/plugins/camera.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index efd975fe..b07bc4e4 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -122,9 +122,10 @@ export class Camera { * 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 - * @platforms ['iOS'] */ - @Cordova() + @Cordova({ + platforms: ['iOS'] + }) static cleanup(){}; } From 9578c8739b91fee2db1212a5a60e34c5f93ccd3d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 14 Mar 2016 14:15:01 -0400 Subject: [PATCH 110/112] add shields --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6c717f44..c6e46911 100644 --- a/README.md +++ b/README.md @@ -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://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/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. From de53ef0c916301f7f4f5e6422c7f1445055c3d90 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 14 Mar 2016 14:18:46 -0400 Subject: [PATCH 111/112] add license shield --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6e46911..872e8140 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![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/) From 9a9678da514d7aec9e74ad69702cb364f75f9974 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Tue, 15 Mar 2016 14:12:21 -0500 Subject: [PATCH 112/112] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 872e8140..61f24d3b 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ Let us know or submit a PR! Take a look at [the Developer Guide](https://github. # Credits +Ibrahim Hadeed - [@ihadeed](http://github.com/ihadeed) + Tim Lancina - [@timlancina](http://twitter.com/timlancina) Max Lynch - [@maxlynch](http://twitter.com/maxlynch)