diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
similarity index 64%
rename from CONTRIBUTING.md
rename to .github/CONTRIBUTING.md
index 49b776d1e..8956e377b 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1,18 +1,19 @@
# Contributing to Ionic Native
-
-## Feature request?
-Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
-
-Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
-
## Have an issue?
#### There are no rules, but here are a few things to consider:
###### Before you submit an issue:
* Do a quick search to see if there are similar issues
-* Check that you are using the latest version of `ionic-native`
+* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/v2/api/platform/Platform/#ready).
+* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save ionic-native@latest`
###### Still having problems? submit an issue with the following details:
* Short description of the issue
* Steps to reproduce
* Stack trace (if available)
+
+
+## Feature request?
+Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
+
+Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index d2d968513..1e12dbb4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.DS_Store
node_modules/
.idea
dist/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8142e7df4..4b8e1e505 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,24 +1,442 @@
-
-## [1.3.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13)
+
+## [2.2.8](https://github.com/driftyco/ionic-native/compare/v2.2.7...v2.2.8) (2016-12-01)
### Bug Fixes
+* **card-io:** fix typo in options ([e6700a3](https://github.com/driftyco/ionic-native/commit/e6700a3))
+* **globalization:** add missing parameter to numberToString function ([1072ab1](https://github.com/driftyco/ionic-native/commit/1072ab1)), closes [#835](https://github.com/driftyco/ionic-native/issues/835)
+
+
+### Features
+
+* **card-io:** add typing for response ([2e82320](https://github.com/driftyco/ionic-native/commit/2e82320))
+
+
+
+
+## [2.2.7](https://github.com/driftyco/ionic-native/compare/v2.2.5...v2.2.7) (2016-11-24)
+
+
+### Bug Fixes
+
+* **3dTouch:** fixes onHomeIconPressed ([#813](https://github.com/driftyco/ionic-native/issues/813)) ([695099b](https://github.com/driftyco/ionic-native/commit/695099b))
+* **camera-preview:** formatting. Closes [#790](https://github.com/driftyco/ionic-native/issues/790) ([5577c51](https://github.com/driftyco/ionic-native/commit/5577c51))
+* **datepicker:** fix allowOldDates option ([#761](https://github.com/driftyco/ionic-native/issues/761)) ([fa03fa5](https://github.com/driftyco/ionic-native/commit/fa03fa5))
+* **diagnostics:** fix [#776](https://github.com/driftyco/ionic-native/issues/776) ([#777](https://github.com/driftyco/ionic-native/issues/777)) ([01b30c6](https://github.com/driftyco/ionic-native/commit/01b30c6))
+* **file:** correct writeFile flags ([9bd8997](https://github.com/driftyco/ionic-native/commit/9bd8997)), closes [#789](https://github.com/driftyco/ionic-native/issues/789)
+* **googlemap:** fix typoe googledesic to geodesic ([78b3ec5](https://github.com/driftyco/ionic-native/commit/78b3ec5)), closes [#765](https://github.com/driftyco/ionic-native/issues/765)
+* **native-audio:** completeCallback is optional on play method ([b719a03](https://github.com/driftyco/ionic-native/commit/b719a03)), closes [#792](https://github.com/driftyco/ionic-native/issues/792)
+* **nfc:** don't bind to name field, fix [#740](https://github.com/driftyco/ionic-native/issues/740) ([#749](https://github.com/driftyco/ionic-native/issues/749)) ([ca43394](https://github.com/driftyco/ionic-native/commit/ca43394))
+* **plugin:** don't bind to name field. Fixes [#740](https://github.com/driftyco/ionic-native/issues/740) ([71916a8](https://github.com/driftyco/ionic-native/commit/71916a8))
+* **video-player:** scalingMode is number ([f07431a](https://github.com/driftyco/ionic-native/commit/f07431a)), closes [#774](https://github.com/driftyco/ionic-native/issues/774)
+
+
+### Features
+
+* **camera-preview:** add disable method ([6ad54ec](https://github.com/driftyco/ionic-native/commit/6ad54ec))
+* **google-analytics:** new interval period parameter ([abd910d](https://github.com/driftyco/ionic-native/commit/abd910d)), closes [#816](https://github.com/driftyco/ionic-native/issues/816)
+* **google-map:** add get and set methods to Marker class ([51ab03d](https://github.com/driftyco/ionic-native/commit/51ab03d)), closes [#798](https://github.com/driftyco/ionic-native/issues/798)
+
+
+
+
+## [2.2.5](https://github.com/driftyco/ionic-native/compare/v2.2.4...v2.2.5) (2016-10-27)
+
+
+### Bug Fixes
+
+* **3dtouch:** add missing property ([#739](https://github.com/driftyco/ionic-native/issues/739)) ([757d096](https://github.com/driftyco/ionic-native/commit/757d096))
+* **geolocation:** fix watchPosition return type ([d5310b0](https://github.com/driftyco/ionic-native/commit/d5310b0)), closes [#741](https://github.com/driftyco/ionic-native/issues/741)
+* **nfc:** fix Ndef class ([ac181c5](https://github.com/driftyco/ionic-native/commit/ac181c5)), closes [#713](https://github.com/driftyco/ionic-native/issues/713)
+* **sqlite:** check if plugin exists before opening database ([6f47371](https://github.com/driftyco/ionic-native/commit/6f47371))
+* **sqlite:** check if plugin exists before opening database ([c98b4f4](https://github.com/driftyco/ionic-native/commit/c98b4f4))
+* **sqlite:** fix callback issue with transaction method ([a72cd59](https://github.com/driftyco/ionic-native/commit/a72cd59)), closes [#732](https://github.com/driftyco/ionic-native/issues/732)
+
+
+### Features
+
+* **diagnostic:** add missing functions ([eb03de9](https://github.com/driftyco/ionic-native/commit/eb03de9)), closes [#743](https://github.com/driftyco/ionic-native/issues/743)
+* **filepath:** add cordova-plugin-filepath ([#714](https://github.com/driftyco/ionic-native/issues/714)) ([0660a3b](https://github.com/driftyco/ionic-native/commit/0660a3b))
+* **plugins:** add name field ([9677656](https://github.com/driftyco/ionic-native/commit/9677656))
+* **sms:** add hasPermission method ([8fbf1f2](https://github.com/driftyco/ionic-native/commit/8fbf1f2)), closes [#721](https://github.com/driftyco/ionic-native/issues/721)
+
+
+
+
+## [2.2.4](https://github.com/driftyco/ionic-native/compare/v2.2.3...v2.2.4) (2016-10-15)
+
+
+### Bug Fixes
+
+* **sqlite:** fix callback order for transaction ([#700](https://github.com/driftyco/ionic-native/issues/700)) ([799e2f0](https://github.com/driftyco/ionic-native/commit/799e2f0))
+
+
+### Features
+
+* **device-feedback:** add DeviceFeedback plugin ([#696](https://github.com/driftyco/ionic-native/issues/696)) ([bbda6e2](https://github.com/driftyco/ionic-native/commit/bbda6e2))
+* **image-picker:** add new android methods ([3edfafb](https://github.com/driftyco/ionic-native/commit/3edfafb))
+* **mixpanel:** MixpanelPeople returns promises ([#681](https://github.com/driftyco/ionic-native/issues/681)) ([b95f88c](https://github.com/driftyco/ionic-native/commit/b95f88c)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
+
+
+
+
+## [2.2.3](https://github.com/driftyco/ionic-native/compare/v2.2.2...v2.2.3) (2016-10-14)
+
+
+### Bug Fixes
+
+* **googlemaps:** Expose 'type' property in GoogleMapsLatLngBounds [#693](https://github.com/driftyco/ionic-native/issues/693) ([#694](https://github.com/driftyco/ionic-native/issues/694)) ([74a252b](https://github.com/driftyco/ionic-native/commit/74a252b))
+* **onesignal:** update to match latest API version ([#691](https://github.com/driftyco/ionic-native/issues/691)) ([babfb0d](https://github.com/driftyco/ionic-native/commit/babfb0d))
+
+
+
+
+## [2.2.2](https://github.com/driftyco/ionic-native/compare/v2.2.1...v2.2.2) (2016-10-12)
+
+
+### Bug Fixes
+
+* **file:** getFreeDiskSpace now works ([d2f42ef](https://github.com/driftyco/ionic-native/commit/d2f42ef))
+* **file:** read methods can accept Blobs too ([276d61b](https://github.com/driftyco/ionic-native/commit/276d61b))
+
+
+### Features
+
+* **file:** getFile and getDirectory are now public ([5c92455](https://github.com/driftyco/ionic-native/commit/5c92455)), closes [#657](https://github.com/driftyco/ionic-native/issues/657)
+
+
+
+
+## [2.2.1](https://github.com/driftyco/ionic-native/compare/v2.2.0...v2.2.1) (2016-10-12)
+
+
+### Bug Fixes
+
+* **diagnostic:** misspelled getContactsAuthorizationStatus method ([#678](https://github.com/driftyco/ionic-native/issues/678)) ([bff4862](https://github.com/driftyco/ionic-native/commit/bff4862))
+* **file:** fix writeFile method ([842a80d](https://github.com/driftyco/ionic-native/commit/842a80d))
+* **file:** last parameter for writeFile now only accepts options ([5710eb7](https://github.com/driftyco/ionic-native/commit/5710eb7))
+* **http:** export via window.IonicNative ([#675](https://github.com/driftyco/ionic-native/issues/675)) ([cf7abe1](https://github.com/driftyco/ionic-native/commit/cf7abe1))
+* **location-accuracy:** accuracy param is number ([c2d4f1c](https://github.com/driftyco/ionic-native/commit/c2d4f1c)), closes [#676](https://github.com/driftyco/ionic-native/issues/676)
+* **themeablebrowser:** add missed options ([#680](https://github.com/driftyco/ionic-native/issues/680)) ([e28e5b0](https://github.com/driftyco/ionic-native/commit/e28e5b0))
+
+
+### Features
+
+* **file:** resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods ([542ff4c](https://github.com/driftyco/ionic-native/commit/542ff4c)), closes [#657](https://github.com/driftyco/ionic-native/issues/657)
+
+
+
+
+# [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11)
+
+
+### Bug Fixes
+
+* **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd))
+* **onesignal:** update to match latest api ([#671](https://github.com/driftyco/ionic-native/issues/671)) ([7c6e6d8](https://github.com/driftyco/ionic-native/commit/7c6e6d8)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
+
+
+### Features
+
+* **http:** add cordovaHTTP wrapper ([#674](https://github.com/driftyco/ionic-native/issues/674)) ([f0961c7](https://github.com/driftyco/ionic-native/commit/f0961c7))
+
+
+
+
+## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.9) (2016-10-09)
+
+
+### Bug Fixes
+
+* **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce))
+* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845))
+* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92))
+* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175))
+
+
+
+
+## [2.1.7](https://github.com/driftyco/ionic-native/compare/v2.1.6...v2.1.7) (2016-10-07)
+
+
+### Bug Fixes
+
+* **paypal:** fixed currency code not found issue ([#653](https://github.com/driftyco/ionic-native/issues/653)) ([598f8a9](https://github.com/driftyco/ionic-native/commit/598f8a9))
+
+
+
+
+## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.6) (2016-10-06)
+
+
+### Bug Fixes
+
+* **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef))
+* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657))
+
+
+
+
+## [2.1.3](https://github.com/driftyco/ionic-native/compare/v2.1.2...v2.1.3) (2016-10-06)
+
+
+### Bug Fixes
+
+* **google-analytics:** add missing methods, fix return types ([77b0277](https://github.com/driftyco/ionic-native/commit/77b0277))
+* **google-analytics:** add newSession param ([f62e108](https://github.com/driftyco/ionic-native/commit/f62e108))
+* **google-analytics:** fix depreciated plugin reference ([40325ca](https://github.com/driftyco/ionic-native/commit/40325ca))
+
+
+
+
+## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.0...v2.1.2) (2016-10-06)
+
+
+### Bug Fixes
+
+* **googlemaps:** add missing properties ([72a694a](https://github.com/driftyco/ionic-native/commit/72a694a)), closes [#642](https://github.com/driftyco/ionic-native/issues/642)
+
+
+### Features
+
+* **zBar:** add zBar barcode scanner plugin ([#634](https://github.com/driftyco/ionic-native/issues/634)) ([bbbbb3e](https://github.com/driftyco/ionic-native/commit/bbbbb3e))
+
+
+
+
+# [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03)
+
+
+### Bug Fixes
+
+* **calendar:** fixed modifyEventWithOptions and related interface ([80ff2f3](https://github.com/driftyco/ionic-native/commit/80ff2f3))
+* **googlemaps:** CameraPosition target can now be GoogleMapsLatLng[] ([#587](https://github.com/driftyco/ionic-native/issues/587)) ([8d21f5f](https://github.com/driftyco/ionic-native/commit/8d21f5f))
+* **googlemaps:** typo in GoogleMapsTileOverlayOptions ([#589](https://github.com/driftyco/ionic-native/issues/589)) ([be2c198](https://github.com/driftyco/ionic-native/commit/be2c198))
+* **isdebug:** export IsDebug class ([#578](https://github.com/driftyco/ionic-native/issues/578)) ([c573332](https://github.com/driftyco/ionic-native/commit/c573332))
+* **media:** add status as a parmeter instead of property of instance ([58a99a1](https://github.com/driftyco/ionic-native/commit/58a99a1))
+* **paypal:** fix typings, add PayPalItem and PayPalPaymentDetails ([5d13ba0](https://github.com/driftyco/ionic-native/commit/5d13ba0))
+* **power-management:** fix repo and pluginref ([#603](https://github.com/driftyco/ionic-native/issues/603)) ([d6060a9](https://github.com/driftyco/ionic-native/commit/d6060a9))
+* **push:** Add support for passing notification id into finish ([#600](https://github.com/driftyco/ionic-native/issues/600)) ([16f05c3](https://github.com/driftyco/ionic-native/commit/16f05c3))
+* **social-sharing:** shareWithOptions method signature ([#598](https://github.com/driftyco/ionic-native/issues/598)) ([2ed84b1](https://github.com/driftyco/ionic-native/commit/2ed84b1)), closes [/github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209](https://github.com//github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java/issues/L209)
+
+
+### Features
+
+* **ble:** add startScanWithOptions ([79f0a3f](https://github.com/driftyco/ionic-native/commit/79f0a3f)), closes [#539](https://github.com/driftyco/ionic-native/issues/539)
+* **googlemaps:** support bounds in Geocoder ([#599](https://github.com/driftyco/ionic-native/issues/599)) ([66e9e46](https://github.com/driftyco/ionic-native/commit/66e9e46))
+* **location-accuracy:** add location accuracy plugin ([#583](https://github.com/driftyco/ionic-native/issues/583)) ([60b7c74](https://github.com/driftyco/ionic-native/commit/60b7c74)), closes [#484](https://github.com/driftyco/ionic-native/issues/484)
+* **plugin:** add getPlugin to plugin interface. Fixes [#582](https://github.com/driftyco/ionic-native/issues/582) ([d45a2b5](https://github.com/driftyco/ionic-native/commit/d45a2b5))
+* **plugin:** checkInstall w/ warning msg ([47112c7](https://github.com/driftyco/ionic-native/commit/47112c7))
+* **stepcounter:** add stepcounter plugin ([#607](https://github.com/driftyco/ionic-native/issues/607)) ([a99b753](https://github.com/driftyco/ionic-native/commit/a99b753))
+* **themable-browser:** add ThemableBrowser plugin ([b9151bc](https://github.com/driftyco/ionic-native/commit/b9151bc)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
+* **themable-browser:** add ThemableBrowser plugin ([972d63b](https://github.com/driftyco/ionic-native/commit/972d63b)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
+
+
+
+
+## [2.0.3](https://github.com/driftyco/ionic-native/compare/v1.3.21...v2.0.3) (2016-09-24)
+
+
+### Bug Fixes
+
+* **call-number:** number should be a string ([763ad1b](https://github.com/driftyco/ionic-native/commit/763ad1b)), closes [#545](https://github.com/driftyco/ionic-native/issues/545)
+* **googlemaps:** CameraPosition target can now be LatLngBounds ([23fc908](https://github.com/driftyco/ionic-native/commit/23fc908)), closes [#547](https://github.com/driftyco/ionic-native/issues/547)
+* **npm:** duplicate typings ([e50b961](https://github.com/driftyco/ionic-native/commit/e50b961))
+* **plugins:** export VideoPlayer. Fixes [#563](https://github.com/driftyco/ionic-native/issues/563) ([4292959](https://github.com/driftyco/ionic-native/commit/4292959))
+* **ts:** use old ts version for 1.3.x [#567](https://github.com/driftyco/ionic-native/issues/567) ([6a19c8c](https://github.com/driftyco/ionic-native/commit/6a19c8c))
+* **webintent:** add type param. Fixes [#564](https://github.com/driftyco/ionic-native/issues/564) ([a0b6b10](https://github.com/driftyco/ionic-native/commit/a0b6b10))
+
+
+### Features
+
+* **background-geolocation:** add showAppSettings function ([281575b](https://github.com/driftyco/ionic-native/commit/281575b)), closes [#548](https://github.com/driftyco/ionic-native/issues/548)
+* **BackgroundGeolocation:** code cleanup ([3170686](https://github.com/driftyco/ionic-native/commit/3170686))
+* **BackgroundGeolocation:** Update to the latest version ([808a75e](https://github.com/driftyco/ionic-native/commit/808a75e))
+* **BackgroundGeolocation:** Update to the latest version ([919e8da](https://github.com/driftyco/ionic-native/commit/919e8da))
+* **build:** Support ES2015 modules ([4014972](https://github.com/driftyco/ionic-native/commit/4014972))
+* **emailcomposer:** use new supported plugin. [#568](https://github.com/driftyco/ionic-native/issues/568) ([a092a31](https://github.com/driftyco/ionic-native/commit/a092a31))
+* **localNotifications:** added register and has permission functions ([#536](https://github.com/driftyco/ionic-native/issues/536)) ([c83b043](https://github.com/driftyco/ionic-native/commit/c83b043))
+* **npm:** typescript 2.0.2 ([e7e45f6](https://github.com/driftyco/ionic-native/commit/e7e45f6))
+* **plugin:** cordova function override. fixes [#437](https://github.com/driftyco/ionic-native/issues/437) ([f60d08b](https://github.com/driftyco/ionic-native/commit/f60d08b))
+* **push:** add coldstart property. Fixes [#559](https://github.com/driftyco/ionic-native/issues/559) ([48196da](https://github.com/driftyco/ionic-native/commit/48196da))
+* **scripts:** publish script with npm and bower. Fixes [#448](https://github.com/driftyco/ionic-native/issues/448) ([3903fee](https://github.com/driftyco/ionic-native/commit/3903fee))
+
+
+
+
+## [1.3.21](https://github.com/driftyco/ionic-native/compare/v1.3.20...v1.3.21) (2016-09-07)
+
+
+### Bug Fixes
+
+* **base64togallery:** fixes callbacks ([#513](https://github.com/driftyco/ionic-native/issues/513)) ([1db1374](https://github.com/driftyco/ionic-native/commit/1db1374))
+* **diagnostic:** Add DENIED_ALWAYS to permissionStatus, also some code formatting ([9d573a9](https://github.com/driftyco/ionic-native/commit/9d573a9))
+* **diagnostic:** Fix diagnostic objects ([cb176aa](https://github.com/driftyco/ionic-native/commit/cb176aa))
+* **diagnostic:** Fix permissionStatus object ([8f3d36f](https://github.com/driftyco/ionic-native/commit/8f3d36f))
+* **diagnostic:** Fix typo ([f93f958](https://github.com/driftyco/ionic-native/commit/f93f958))
+* **file:** set exclusive to true when replace is false ([7910493](https://github.com/driftyco/ionic-native/commit/7910493)), closes [#516](https://github.com/driftyco/ionic-native/issues/516)
+* **geolocation:** retain Observable even during an error condition ([#532](https://github.com/driftyco/ionic-native/issues/532)) ([26dead9](https://github.com/driftyco/ionic-native/commit/26dead9))
+* **googlemaps:** moveCamera and animateCamera now return a Promise ([d03d70f](https://github.com/driftyco/ionic-native/commit/d03d70f)), closes [#511](https://github.com/driftyco/ionic-native/issues/511)
+* **install-instructions:** This fixes install instructions for deeplinks, facebook and googlemaps ([#499](https://github.com/driftyco/ionic-native/issues/499)) ([877ac27](https://github.com/driftyco/ionic-native/commit/877ac27))
+* **media:** nest the constructor logic ([a566240](https://github.com/driftyco/ionic-native/commit/a566240))
+* **mixpanel:** Make eventProperties optional ([#501](https://github.com/driftyco/ionic-native/issues/501)) ([51364f8](https://github.com/driftyco/ionic-native/commit/51364f8))
+* **ng1:** fail gracefully when angular 1 promises can't be retrieved ([d135dc2](https://github.com/driftyco/ionic-native/commit/d135dc2))
+* **ng1:** grab injector from app. [#451](https://github.com/driftyco/ionic-native/issues/451) ([2dc68a4](https://github.com/driftyco/ionic-native/commit/2dc68a4))
+* remove CanvasCamera plugin ([c75f898](https://github.com/driftyco/ionic-native/commit/c75f898))
+* **social-sharing:** shareViaEmail now resolves/rejects when not providing optional args ([c76de34](https://github.com/driftyco/ionic-native/commit/c76de34))
+* **social-sharing:** various fixes ([#520](https://github.com/driftyco/ionic-native/issues/520)) ([4f97164](https://github.com/driftyco/ionic-native/commit/4f97164))
+
+
+### Features
+
+* **file:** adds chunked blob writing ([#529](https://github.com/driftyco/ionic-native/issues/529)) ([bbbd0d5](https://github.com/driftyco/ionic-native/commit/bbbd0d5))
+* **file:** allows writeFile and writeExistingFile to accept Blob ([#527](https://github.com/driftyco/ionic-native/issues/527)) ([393e9d0](https://github.com/driftyco/ionic-native/commit/393e9d0))
+* **googlemaps:** can pass HTMLElement to constructor ([dff034a](https://github.com/driftyco/ionic-native/commit/dff034a))
+
+
+
+
+## [1.3.20](https://github.com/driftyco/ionic-native/compare/v1.3.19...v1.3.20) (2016-08-27)
+
+
+### Bug Fixes
+
+* **GoogleMaps:** Fixes [#452](https://github.com/driftyco/ionic-native/issues/452) ([#498](https://github.com/driftyco/ionic-native/issues/498)) ([f6d5ac4](https://github.com/driftyco/ionic-native/commit/f6d5ac4))
+
+
+### Features
+
+* **canvas-camera:** add CanvasCamera support ([ad57733](https://github.com/driftyco/ionic-native/commit/ad57733))
+* **file-chooser:** add file chooser plugin support ([#495](https://github.com/driftyco/ionic-native/issues/495)) ([94a7dae](https://github.com/driftyco/ionic-native/commit/94a7dae))
+* **file-opener:** add file opener support ([#497](https://github.com/driftyco/ionic-native/issues/497)) ([21d8122](https://github.com/driftyco/ionic-native/commit/21d8122)), closes [#295](https://github.com/driftyco/ionic-native/issues/295)
+* **music-controls:** add music controls plugin support ([#494](https://github.com/driftyco/ionic-native/issues/494)) ([4e9bc95](https://github.com/driftyco/ionic-native/commit/4e9bc95))
+* **youtube:** add Youtube video player plugin support ([#496](https://github.com/driftyco/ionic-native/issues/496)) ([0cf7d6a](https://github.com/driftyco/ionic-native/commit/0cf7d6a))
+
+
+
+
+## [1.3.19](https://github.com/driftyco/ionic-native/compare/v1.3.18...v1.3.19) (2016-08-27)
+
+
+### Bug Fixes
+
+* **mixpanel:** implement CordovaProperty correctly ([dd0c9ba](https://github.com/driftyco/ionic-native/commit/dd0c9ba))
+
+
+### Features
+
+* **call-number:** add support for CallNumber plugin ([#487](https://github.com/driftyco/ionic-native/issues/487)) ([759f8ef](https://github.com/driftyco/ionic-native/commit/759f8ef))
+* **market:** add Market plugin support ([#490](https://github.com/driftyco/ionic-native/issues/490)) ([9bcc4ed](https://github.com/driftyco/ionic-native/commit/9bcc4ed))
+* **mixpanel:** add mixpanel support ([#492](https://github.com/driftyco/ionic-native/issues/492)) ([cf8e342](https://github.com/driftyco/ionic-native/commit/cf8e342))
+* **native-page-transitions:** add support for Native Page Transitions plugin ([#488](https://github.com/driftyco/ionic-native/issues/488)) ([00d87db](https://github.com/driftyco/ionic-native/commit/00d87db))
+* **nfc:** add nfc support ([#493](https://github.com/driftyco/ionic-native/issues/493)) ([76aa8a6](https://github.com/driftyco/ionic-native/commit/76aa8a6))
+* **paypal:** add PayPal support ([#491](https://github.com/driftyco/ionic-native/issues/491)) ([9fe5c19](https://github.com/driftyco/ionic-native/commit/9fe5c19))
+* **power-management:** add power management support ([#489](https://github.com/driftyco/ionic-native/issues/489)) ([cd82a53](https://github.com/driftyco/ionic-native/commit/cd82a53))
+* **streaming-media:** add streaming media support ([#486](https://github.com/driftyco/ionic-native/issues/486)) ([841b242](https://github.com/driftyco/ionic-native/commit/841b242))
+
+
+
+
+## [1.3.18](https://github.com/driftyco/ionic-native/compare/v1.3.17...v1.3.18) (2016-08-26)
+
+
+### Bug Fixes
+
+* **facebook:** export interfaces ([c4110ee](https://github.com/driftyco/ionic-native/commit/c4110ee))
+* **File:** fixed readFileAs ([#479](https://github.com/driftyco/ionic-native/issues/479)) ([eff7841](https://github.com/driftyco/ionic-native/commit/eff7841))
+* **geofence:** fix event listeners ([efa222f](https://github.com/driftyco/ionic-native/commit/efa222f))
+
+
+### Features
+
+* **code-push:** add wrapper for cordova-plugin-code-push ([#420](https://github.com/driftyco/ionic-native/issues/420)) ([905f988](https://github.com/driftyco/ionic-native/commit/905f988))
+* **diagnostic:** add full plugin functionality ([#424](https://github.com/driftyco/ionic-native/issues/424)) ([47a9b34](https://github.com/driftyco/ionic-native/commit/47a9b34)), closes [#224](https://github.com/driftyco/ionic-native/issues/224)
+* **geofence:** Adds geofence plugin ([#442](https://github.com/driftyco/ionic-native/issues/442)) ([a438967](https://github.com/driftyco/ionic-native/commit/a438967))
+* **inAppPurchase:** add inAppPurhcase plugin ([#423](https://github.com/driftyco/ionic-native/issues/423)) ([8526e89](https://github.com/driftyco/ionic-native/commit/8526e89))
+* **IsDebug:** add the IsDebug plugin ([#475](https://github.com/driftyco/ionic-native/issues/475)) ([dd39ba8](https://github.com/driftyco/ionic-native/commit/dd39ba8))
+
+
+
+
+## [1.3.17](https://github.com/driftyco/ionic-native/compare/v1.3.16...v1.3.17) (2016-08-23)
+
+
+### Bug Fixes
+
+* add the reject function at the expected errorIndex position in the args array ([#436](https://github.com/driftyco/ionic-native/issues/436)) ([4e87ac7](https://github.com/driftyco/ionic-native/commit/4e87ac7))
+* **camera-preview:** changes implementation to match Cordova plugin ([#441](https://github.com/driftyco/ionic-native/issues/441)) ([55ba65a](https://github.com/driftyco/ionic-native/commit/55ba65a))
+* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3))
+* **file:** initialize writeFile options ([#468](https://github.com/driftyco/ionic-native/issues/468)) ([16628a4](https://github.com/driftyco/ionic-native/commit/16628a4))
+* **nativeaudio:** fix plugin reference ([2510c5f](https://github.com/driftyco/ionic-native/commit/2510c5f))
+
+
+### Features
+
+* **instagram:** add instagram sharing plugin ([#453](https://github.com/driftyco/ionic-native/issues/453)) ([f3e698f](https://github.com/driftyco/ionic-native/commit/f3e698f)), closes [#307](https://github.com/driftyco/ionic-native/issues/307)
+* **VideoEditor:** add video editor plugin. ([#457](https://github.com/driftyco/ionic-native/issues/457)) ([7a53013](https://github.com/driftyco/ionic-native/commit/7a53013)), closes [#316](https://github.com/driftyco/ionic-native/issues/316)
+
+
+
+
+## [1.3.16](https://github.com/driftyco/ionic-native/compare/v1.3.15...v1.3.16) (2016-08-15)
+
+
+### Bug Fixes
+
+* **photo-viewer:** method is static ([8bc499f](https://github.com/driftyco/ionic-native/commit/8bc499f))
+
+
+
+
+## [1.3.15](https://github.com/driftyco/ionic-native/compare/v1.3.14...v1.3.15) (2016-08-15)
+
+
+### Features
+
+* **google-analytics:** add missing functions ([689bfd9](https://github.com/driftyco/ionic-native/commit/689bfd9))
+* **TTS:** add tts plugin ([#431](https://github.com/driftyco/ionic-native/issues/431)) ([dcf3ab2](https://github.com/driftyco/ionic-native/commit/dcf3ab2)), closes [#311](https://github.com/driftyco/ionic-native/issues/311)
+
+
+
+
+## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.14) (2016-08-15)
+
+
+### Bug Fixes
+
+* **datepicker:** date now accepts Date, string, or number ([#428](https://github.com/driftyco/ionic-native/issues/428)) ([aaddd9e](https://github.com/driftyco/ionic-native/commit/aaddd9e)), closes [#354](https://github.com/driftyco/ionic-native/issues/354)
* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
+### Features
+
+* **native-audio:** Add native audio plugin ([#427](https://github.com/driftyco/ionic-native/issues/427)) ([8cd6686](https://github.com/driftyco/ionic-native/commit/8cd6686)), closes [#315](https://github.com/driftyco/ionic-native/issues/315)
+* **shake:** add Shake plugin ([#426](https://github.com/driftyco/ionic-native/issues/426)) ([203d4c7](https://github.com/driftyco/ionic-native/commit/203d4c7)), closes [#313](https://github.com/driftyco/ionic-native/issues/313)
+* **zip:** add zip plugin ([#430](https://github.com/driftyco/ionic-native/issues/430)) ([e34f94e](https://github.com/driftyco/ionic-native/commit/e34f94e)), closes [#421](https://github.com/driftyco/ionic-native/issues/421)
+
+
-## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13)
+## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.11...v1.3.12) (2016-08-13)
### Bug Fixes
-* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)), closes [#331](https://github.com/driftyco/ionic-native/issues/331)
-* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)), closes [#413](https://github.com/driftyco/ionic-native/issues/413) [#417](https://github.com/driftyco/ionic-native/issues/417)
* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866))
+
+
+
+
+## [1.3.11](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.11) (2016-08-11)
+
+
+### Bug Fixes
+
+* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681))
+* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7))
* **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0))
-* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)), closes [#357](https://github.com/driftyco/ionic-native/issues/357)
+* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd))
### Features
@@ -49,7 +467,7 @@
### Features
* **crop:** add crop plugin ([#284](https://github.com/driftyco/ionic-native/issues/284)) ([41c9adf](https://github.com/driftyco/ionic-native/commit/41c9adf))
-* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
+* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b))
@@ -76,7 +494,7 @@
### Bug Fixes
* **base64togallery:** update plugin wrapper to match latest version ([d4bee49](https://github.com/driftyco/ionic-native/commit/d4bee49)), closes [#335](https://github.com/driftyco/ionic-native/issues/335)
-* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70)), closes [#324](https://github.com/driftyco/ionic-native/issues/324)
+* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70))
### Features
@@ -134,6 +552,7 @@
### Features
* **googlemaps:** add Geocoder class ([#292](https://github.com/driftyco/ionic-native/issues/292)) ([2996da6](https://github.com/driftyco/ionic-native/commit/2996da6)), closes [#280](https://github.com/driftyco/ionic-native/issues/280)
+* **inAppPurchase:** add inAppPurchase ([f1988f6](https://github.com/driftyco/ionic-native/commit/f1988f6))
* **media-capture:** add media capture plugin ([#293](https://github.com/driftyco/ionic-native/issues/293)) ([daa6d4c](https://github.com/driftyco/ionic-native/commit/daa6d4c)), closes [#272](https://github.com/driftyco/ionic-native/issues/272)
* **nativestorage:** add NativeStorage plugin wrapper ([af5d4ad](https://github.com/driftyco/ionic-native/commit/af5d4ad))
* **pin-dialog:** add pin dialog plugin ([#291](https://github.com/driftyco/ionic-native/issues/291)) ([2fe37c4](https://github.com/driftyco/ionic-native/commit/2fe37c4))
@@ -188,12 +607,28 @@
-## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26)
+## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.1) (2016-06-26)
### Bug Fixes
* **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232)
+* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3))
+
+
+### Features
+
+* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
+* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
+
+
+
+
+# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.3.0) (2016-06-13)
+
+
+### Bug Fixes
+
* **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180)
* **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212)
* **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6))
@@ -202,7 +637,6 @@
* **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e))
* **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164)
* **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f))
-* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
### Features
@@ -210,13 +644,6 @@
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
* **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115)
* **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed))
-* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
-* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
-
-
-
-
-## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01)
diff --git a/DEVELOPER.md b/DEVELOPER.md
index 888361a5b..e52ff352b 100644
--- a/DEVELOPER.md
+++ b/DEVELOPER.md
@@ -5,6 +5,16 @@ This is a short guide on creating new plugin wrappers for Ionic Native.
## Creating Plugin Wrappers
+First, let's start by creating a new plugin wrapper from template.
+
+```
+// Call this command, and replace PluginName with the name of the plugin you wish to add
+// Make sure to capitalize the first letter, or use CamelCase if necessary.
+
+gulp plugin:create -n PluginName
+```
+
+
Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity):
```
@@ -92,6 +102,58 @@ The `@Cordova` decorator has a few more options now.
`clearFunction` is used in conjunction with the `observable` option and indicates the function to be called when the Observable is disposed.
+### Updating index.ts
+
+For new plugins, you will need to update `/src/index.ts` to properly export your plugin and make it available for use.
+
+1. Import the plugin class into `index.ts`:
+
+`import {PluginClassName} from ./plugins/filenameForPlugin`
+
+No need to put the `.ts` extension on the filename.
+
+2. Add the plugin class name to the list in the `export` object:
+
+```
+export {
+ ActionSheet,
+ AdMob,
+ AndroidFingerprintAuth,
+ YourPluginClassName,
+ ...
+}
+```
+
+3. Add the plugin class name to the `window['IonicNative']` object:
+
+```
+window['IonicNative'] = {
+ ActionSheet: ActionSheet,
+ AdMob: AdMob,
+ AndroidFingerprintAuth: AndroidFingerprintAuth,
+ YourPluginClassName: YourPluginClassName,
+ ...
+```
+
+4. If your plugin exports any other objects outside of the plugin class, add an export statement for the file:
+
+`export * from './plugins/filenameForPlugin';`
+
+No need to put the `.ts` extension on the filename.
+
+For example, `googlemaps.ts` exports a const outside of the plugin's main `GoogleMap` class:
+
+```
+export const GoogleMapsAnimation = {
+ BOUNCE: 'BOUNCE',
+ DROP: 'DROP'
+};
+```
+
+To properly export `GoogleMapsAnimation`, `index.ts` is updated with:
+
+`export * from './plugins/googlemaps';`
+
### Testing your changes
You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
@@ -103,3 +165,32 @@ You need to run `npm run lint` to analyze the code and ensure it's consistency w
### '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.
+
+## Commit Message Format
+
+We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the our change log. (Ok you got us, it's basically Angular's commit message format).
+
+`type(scope): subject`
+
+#### Type
+Must be one of the following:
+
+* **fix**: A bug fix
+* **feat**: A new feature
+* **docs**: Documentation only changes
+* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
+* **refactor**: A code change that neither fixes a bug nor adds a feature
+* **perf**: A code change that improves performance
+* **test**: Adding missing tests
+* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
+
+#### Scope
+The scope could be anything specifying place of the commit change. For example, the name of the plugin being changed
+
+#### Subject
+The subject contains succinct description of the change:
+
+* use the imperative, present tense: "change" not "changed" nor "changes"
+* do not capitalize first letter
+* do not place a period (.) at the end
+* entire length of the commit message must not go over 50 characters
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..623c70a83
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2015-present Drifty Co.
+http://drifty.com/
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index e1be9d43d..5a5e39235 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
[](https://circleci.com/gh/driftyco/ionic-native) [](http://commitizen.github.io/cz-cli/)
-[](https://www.npmjs.com/package/ionic-native-playground)
+[](https://www.npmjs.com/package/ionic-native)
[](https://nodei.co/npm/ionic-native/)
-
+[](https://nodei.co/npm/ionic-native/)
# Ionic Native
diff --git a/circle.yml b/circle.yml
index 599249d25..331652216 100644
--- a/circle.yml
+++ b/circle.yml
@@ -17,7 +17,7 @@ dependencies:
test:
override:
- - echo "No tests are written at the moment. But we will attempt to build the library with the latest changes."
+ - npm test
- npm run build
deployment:
diff --git a/gulpfile.js b/gulpfile.js
index 308983416..93d75ac45 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -2,7 +2,9 @@ var gulp = require('gulp');
var minimist = require('minimist');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
-var tslint = require('ionic-gulp-tslint');
+var tslint = require('gulp-tslint');
+var decamelize = require('decamelize');
+var replace = require('gulp-replace');
var flagConfig = {
string: ['port', 'version', 'ngVersion', 'animations'],
@@ -25,4 +27,23 @@ gulp.task("minify:dist", function(){
.pipe(gulp.dest('./dist'));
});
-gulp.task('lint', tslint);
+gulp.task('lint', function() {
+ gulp.src('src/**/*.ts')
+ .pipe(tslint({
+ formatter: "verbose",
+ configuration: 'tslint.json'
+ }))
+ .pipe(tslint.report())
+});
+
+gulp.task('plugin:create', function(){
+ if(flags.n && flags.n !== ''){
+ var src = flags.m?'./scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl';
+ return gulp.src(src)
+ .pipe(replace('PluginName', flags.n))
+ .pipe(rename(decamelize(flags.n, '-') + '.ts'))
+ .pipe(gulp.dest('./src/plugins/'));
+ } else {
+ console.log("Usage is: gulp plugin:create -n PluginName");
+ }
+});
diff --git a/karma.conf.ts b/karma.conf.ts
new file mode 100644
index 000000000..5b3106254
--- /dev/null
+++ b/karma.conf.ts
@@ -0,0 +1,61 @@
+const WATCH = process.argv.indexOf('--watch') > -1;
+
+module.exports = config => {
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: './',
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine', 'browserify'],
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'test/**/*.spec.ts'
+ ],
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ 'test/**/*.spec.ts': ['browserify']
+ },
+
+ browserify: {
+ debug: true,
+ plugin: [ 'tsify' ],
+ extensions: ['.js', '.ts']
+ },
+
+ phantomjsLauncher: {
+ // Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
+ exitOnResourceError: true
+ },
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['dots'],
+
+ // web server port
+ port: 9876,
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: WATCH,
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['PhantomJS'],
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: !WATCH
+ });
+};
diff --git a/package.json b/package.json
index 2da5c4698..c4cad5408 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,10 @@
{
"name": "ionic-native",
- "version": "1.3.13",
+ "version": "2.2.9",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
- "main": "dist/index.js",
+ "main": "dist/es5/index.js",
+ "module": "dist/esm/index.js",
+ "typings": "dist/es5/index.d.ts",
"files": [
"dist"
],
@@ -16,33 +18,47 @@
"conventional-github-releaser": "^1.1.3",
"cpr": "^1.0.0",
"cz-conventional-changelog": "^1.1.6",
+ "decamelize": "^1.2.0",
"dgeni": "^0.4.2",
"dgeni-packages": "^0.10.18",
+ "es6-shim": "~0.35.1",
"glob": "^6.0.4",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
- "gulp-tslint": "^5.0.0",
+ "gulp-replace": "^0.5.4",
+ "gulp-tslint": "^6.1.2",
"gulp-uglify": "^1.5.4",
- "ionic-gulp-tslint": "^1.0.0",
+ "jasmine-core": "~2.5.0",
+ "karma": "~1.2.0",
+ "karma-browserify": "~5.1.0",
+ "karma-jasmine": "~1.0.2",
+ "karma-phantomjs-launcher": "~1.0.2",
"lodash": "3.10.1",
"minimist": "^1.1.3",
"mkdirp": "^0.5.1",
"node-html-encoder": "0.0.2",
"q": "1.4.1",
"semver": "^5.0.1",
- "tslint": "^3.8.1",
- "tslint-ionic-rules": "0.0.3",
- "typescript": "^1.8.10"
+ "tsify": "~1.0.4",
+ "tslint": "^3.15.1",
+ "tslint-ionic-rules": "0.0.5",
+ "typescript": "^2.0.1",
+ "watchify": "~3.7.0"
},
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1",
- "lint": "./node_modules/.bin/gulp lint",
- "watch": "./node_modules/.bin/tsc -w",
- "build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify",
- "build:js": "./node_modules/.bin/tsc",
- "build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
- "build:minify": "./node_modules/.bin/gulp minify:dist",
- "changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
+ "test": "karma start",
+ "test:watch": "npm test -- --watch",
+ "start": "npm run test:watch",
+ "lint": "gulp lint",
+ "watch": "tsc -w",
+ "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify",
+ "build:js": "tsc -p tsconfig-es5.json",
+ "build:esm": "tsc -p tsconfig-esm.json",
+ "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js",
+ "build:minify": "gulp minify:dist",
+ "shipit": "npm run build && npm publish && bash ./scripts/bower.sh",
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
+ "plugin:create": "gulp plugin:create"
},
"repository": {
"type": "git",
@@ -53,7 +69,6 @@
"url": "https://github.com/driftyco/ionic-native/issues"
},
"homepage": "https://github.com/driftyco/ionic-native",
- "typings": "./dist/index.d.ts",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
diff --git a/scripts/docs/dgeni-config.js b/scripts/docs/dgeni-config.js
index a0cf4217c..49c3a108a 100644
--- a/scripts/docs/dgeni-config.js
+++ b/scripts/docs/dgeni-config.js
@@ -31,12 +31,37 @@ module.exports = function(currentVersion) {
// $runBefore: ['rendering-docs'],
// $process: function(docs){
// docs.forEach(function(doc){
-// if (doc.members && doc.name == "IonicApp"){
-// doc.members.forEach(function(method){
-// if (method.name === "load") {
-// console.log(method);
-// }
-// })
+// if (doc.name == "Camera"){
+//
+// // console.log(doc.tags);
+// // doc.tags.forEach(function(tag){
+// // if(tag.tagName == 'classes'){
+// //
+// // }
+// // });
+//
+// // doc.moduleDoc.exports.forEach(function(d,i){
+// // if(d.name === 'CameraOptions') {
+// // console.log('Name: ' + d.name);
+// // console.log('Type: ' + d.docType);
+// // console.log('First member: ', d.members[0]);
+// // }
+// // });
+//
+//
+// // var exports = doc.exportSymbol.parent.exports;
+// // for(var p in exports) {
+// // if(p == 'CameraOptions')
+// // {
+// // var x = exports[p];
+// // console.log(x.members.quality);
+// // }
+// // }
+// // doc.members.forEach(function(method){
+// // if (method.name === "getPicture") {
+// // console.log(method);
+// // }
+// // })
// }
// })
// }
diff --git a/scripts/docs/prepare.sh b/scripts/docs/prepare.sh
index 03a25083f..ee1dd0f95 100755
--- a/scripts/docs/prepare.sh
+++ b/scripts/docs/prepare.sh
@@ -21,13 +21,17 @@ function run {
./git/clone.sh --repository="ionic-site" \
--directory="$SITE_DIR" \
--branch="master"
- ls -al $SITE_DIR
+ cd $SITE_DIR
+ ls -al
else
echo "using existing"
cd $SITE_DIR
git reset --hard
git pull origin master
fi
+
+ git rm -rf docs/v2/native/*/
+
}
source $(dirname $0)/../utils.inc.sh
diff --git a/scripts/docs/tag-defs/tag-defs.js b/scripts/docs/tag-defs/tag-defs.js
index 5c0803ccd..f4a8afad2 100644
--- a/scripts/docs/tag-defs/tag-defs.js
+++ b/scripts/docs/tag-defs/tag-defs.js
@@ -1,5 +1,7 @@
module.exports = [
{'name': 'advanced'},
{'name': 'demo'},
- {'name': 'usage'}
+ {'name': 'usage'},
+ {'name': 'classes'}, // related classes
+ {'name': 'interfaces'} // related interfaces
];
diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html
index 252bc5c9b..124490cde 100644
--- a/scripts/docs/templates/common.template.html
+++ b/scripts/docs/templates/common.template.html
@@ -11,6 +11,39 @@ doc: "<$ doc.name $>"
docType: "<$ doc.docType $>"
---
+<@ macro interfaceTable(interface) @>
+<@ for export in doc.moduleDoc.exports -@>
+<@ if export.name == interface @>
+
+
+
+ | Param |
+ Type |
+ Details |
+
+
+
+ <@ for param in export.members @>
+
+ |
+ <$ param.name $>
+ <@ if param.optional @> (optional) <@ endif @>
+ |
+
+ <$ param.returnType | escape $>
+ |
+
+ <$ param.description | marked $>
+ |
+
+ <@ endfor @>
+
+
+
+<@ endif @>
+<@- endfor @>
+<@ endmacro @>
+
<@ macro paramList(paramData) -@>
<@- if paramData -@>(
<@- for param in paramData -@>
@@ -73,15 +106,81 @@ docType: "<$ doc.docType $>"
<$ typeList(fn.typeList) $> <$ fn.description $>
<@- endmacro -@>
+
+
+<@ macro documentClass(doc) @>
+<@- if doc.statics.length -@>
+Static Members
+<@ for method in doc.statics -@>
+<@ if not method.internal @>
+
+<$ functionSyntax(method) $>
+<@- 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 $>
+
+<@ if method.params @>
+<$ paramTable(method.params) $>
+<@ endif @>
+
+<@ if method.this -@>
+ Method's `this`
+ <$ method.this $>
+
+<@- endif @>
+
+<@ if method.returns @>
+
+
+ Returns: <$ typeInfo(method.returns) $>
+
+<@ endif @>
+<@ endif @>
+<@ endfor -@>
+<@ endif @>
+
+
+<@- if doc.members and doc.members.length @>
+
+Instance Members
+<@ for method in doc.members -@>
+
+
+ <$ functionSyntax(method) $>
+
+<$ method.description $>
+<@ if method.params -@>
+<$ paramTable(method.params) $>
+<@- endif @>
+<@ if method.this -@>
+ Method's `this`
+ <$ method.this $>
+
+<@- endif @>
+<@ if method.returns -@>
+
+
+ Returns: <$ typeInfo(method.returns) $>
+
+<@- endif @>
+<@- endfor @>
+<@- endif -@>
+<@ endmacro @>
<@ block body @>
-
-
<@ block content @>
-
<@ block header @>
-
-
<@ if doc.docType == "directive" @>
<$ doc.name | dashCase $>
<@ else @>
@@ -108,10 +207,6 @@ docType: "<$ doc.docType $>"
Improve this doc
-<@ if doc.codepen @>
-{% include codepen.html id="<$ doc.codepen $>" %}
-<@ endif @>
-
<@ endblock @>
@@ -141,9 +236,9 @@ docType: "<$ doc.docType $>"
Supported platforms
<@ block platforms @>
- <@- for platform in prop.platforms @>
+ <@ for platform in prop.platforms -@>
- <$ platform $>
- <@ endfor -@>
+ <@- endfor @>
<@ endblock @>
@@ -181,12 +276,11 @@ docType: "<$ doc.docType $>"
- <@ for prop in doc.properties @>
+ <@ for prop in doc.properties -@>
|
<$ prop.name $>
|
-
<@ if hasTypes @>
<$ prop.type.name $>
@@ -197,86 +291,12 @@ docType: "<$ doc.docType $>"
<$ prop.description $>
|
- <@ endfor @>
+ <@- endfor @>
<@ endif @>
-<@- if doc.statics.length -@>
-Static Members
-<@- for method in doc.statics @><@ if not method.internal @>
-
-<$ functionSyntax(method) $>
-
-<@- 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 $>
-
-<@ if method.params @>
-<$ paramTable(method.params) $>
-<@ endif @>
-
-<@ if method.this @>
- Method's `this`
- <$ method.this $>
-
-<@ endif @>
-
-<@ if method.returns @>
-
-
- Returns: <$ typeInfo(method.returns) $>
-
-<@ endif @>
-<@ endif @>
-<@ endfor -@>
-<@ endif @>
-
-
-<@- if doc.members and doc.members.length @>
-
-Instance Members
-<@- for method in doc.members @>
-
-
-
-
- <$ functionSyntax(method) $>
-
-
-<$ method.description $>
-
-<@ if method.params @>
-<$ paramTable(method.params) $>
-<@ endif @>
-
-<@ if method.this @>
- Method's `this`
- <$ method.this $>
-
-<@ endif @>
-
-<@ if method.returns @>
-
-
- Returns: <$ typeInfo(method.returns) $>
-
-<@ endif @>
-
-<@ endfor -@>
-
-<@- endif -@>
+<$ documentClass(doc) $>
<@ block advanced @>
<@- if doc.advanced -@>
@@ -285,6 +305,40 @@ docType: "<$ doc.docType $>"
<@- endif -@>
<@ endblock @>
+
+<@ for tag in doc.tags.tags -@>
+<@ if tag.tagName == 'classes' -@>
+Related Classes
+<@ set classes = tag.description.split('\n') @>
+<@ for item in classes -@>
+<@ if item.length > 1 @>
+<@ for export in doc.moduleDoc.exports -@>
+<@ if export.name == item @>
+<$ item $>
+<$ documentClass(export) $>
+<@ endif @>
+<@- endfor @>
+<@ endif @>
+<@- endfor @>
+<@- endif @>
+<@- endfor @>
+
+
+
+<@ for tag in doc.tags.tags -@>
+<@ if tag.tagName == 'interfaces' @>
+Interfaces
+<@ set interfaces = tag.description.split('\n') @>
+<@ for item in interfaces -@>
+<@ if item.length > 1 @>
+<$ item $>
+<$ interfaceTable(item) $>
+<@ endif @>
+<@- endfor @>
+<@ endif @>
+<@- endfor @>
+
+
<@- if doc.see @>
diff --git a/scripts/docs/update_docs.sh b/scripts/docs/update_docs.sh
index b63af8472..a6e4a84c0 100755
--- a/scripts/docs/update_docs.sh
+++ b/scripts/docs/update_docs.sh
@@ -23,10 +23,8 @@ function run {
# CD in to the site dir to commit updated docs
cd $SITE_DIR
- CHANGES=$(git status --porcelain)
-
# if no changes, don't commit
- if [[ "$CHANGES" == "" ]]; then
+ if [[ `git status --porcelain` ]]; then
echo "-- No changes detected for the following commit, docs not updated."
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
else
diff --git a/scripts/templates/wrap-min.tmpl b/scripts/templates/wrap-min.tmpl
new file mode 100644
index 000000000..0a947901d
--- /dev/null
+++ b/scripts/templates/wrap-min.tmpl
@@ -0,0 +1,20 @@
+import { Plugin } from './plugin';
+/**
+ * @name PluginName
+ * @description
+ *
+ * @usage
+ * ```
+ * import { PluginName } from 'ionic-native';
+ *
+ *
+ * ```
+ */
+@Plugin({
+ pluginName: 'PluginName',
+ plugin: '',
+ pluginRef: '',
+ repo: ''
+})
+export class PluginName {
+}
diff --git a/scripts/templates/wrap.tmpl b/scripts/templates/wrap.tmpl
new file mode 100644
index 000000000..7bf61ae18
--- /dev/null
+++ b/scripts/templates/wrap.tmpl
@@ -0,0 +1,51 @@
+/**
+ * This is a template for new plugin wrappers
+ *
+ * TODO:
+ * - Add/Change information below
+ * - Document usage (importing, executing main functionality)
+ * - Remove any imports that you are not using
+ * - Add this file to /src/index.ts (follow style of other plugins)
+ * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
+ * - Remove this note
+ *
+ */
+import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
+/**
+ * @name PluginName
+ * @description
+ * This plugin does something
+ *
+ * @usage
+ * ```
+ * import { PluginName } from 'ionic-native';
+ *
+ * PluginName.functionName('Hello', 123)
+ * .then((something: any) => doSomething(something))
+ * .catch((error: any) => console.log(error));
+ *
+ * ```
+ */
+@Plugin({
+ pluginName: 'PluginName',
+ plugin: '', // npm package name, example: cordova-plugin-camera
+ pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
+ repo: '', // the github repository URL for the plugin
+ install: '' // OPTIONAL install command, in case the plugin requires variables
+})
+export class PluginName {
+
+ /**
+ * This function does something
+ * @param arg1 {string} Some param to configure something
+ * @param arg2 {number} Another param to configure something
+ * @return {Promise} Returns a promise that resolves when something happens
+ */
+ @Cordova()
+ static functionName(arg1: string, arg2: number): Promise {
+ return; // We add return; here to avoid any IDE / Compiler errors
+ }
+
+}
diff --git a/src/index.ts b/src/index.ts
index c53bb8872..8b8d55f6c 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,121 +1,229 @@
-import {initAngular1} from './ng1';
+import { initAngular1 } from './ng1';
const DEVICE_READY_TIMEOUT = 2000;
declare var window;
-import {ActionSheet} from './plugins/actionsheet';
-import {AdMob} from './plugins/admob';
+import { ActionSheet } from './plugins/actionsheet';
+import { AdMob } from './plugins/admob';
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
-import {AppAvailability} from './plugins/appavailability';
-import {AppRate} from './plugins/apprate';
-import {AppVersion} from './plugins/appversion';
-import {Badge} from './plugins/badge';
-import {BackgroundGeolocation} from './plugins/background-geolocation';
-import {BackgroundMode} from './plugins/backgroundmode';
-import {BarcodeScanner} from './plugins/barcodescanner';
-import {Base64ToGallery} from './plugins/base64togallery';
-import {BatteryStatus} from './plugins/batterystatus';
-import {Brightness} from './plugins/brightness';
-import {BLE} from './plugins/ble';
-import {BluetoothSerial} from './plugins/bluetoothserial';
-import {Calendar} from './plugins/calendar';
-import {Camera} from './plugins/camera';
-import {CameraPreview} from './plugins/camera-preview';
-import {CardIO} from './plugins/card-io';
-import {Clipboard} from './plugins/clipboard';
-import {Contacts} from './plugins/contacts';
-import {Crop} from './plugins/crop';
-import {DatePicker} from './plugins/datepicker';
-import {DBMeter} from './plugins/dbmeter';
-import {Deeplinks} from './plugins/deeplinks';
-import {Device} from './plugins/device';
-import {DeviceAccounts} from './plugins/deviceaccounts';
-import {DeviceMotion} from './plugins/devicemotion';
-import {DeviceOrientation} from './plugins/deviceorientation';
-import {Diagnostic} from './plugins/diagnostic';
-import {Dialogs} from './plugins/dialogs';
-import {EmailComposer} from './plugins/emailcomposer';
-import {Facebook} from './plugins/facebook';
-import {File} from './plugins/file';
-import {Transfer} from './plugins/filetransfer';
-import {Flashlight} from './plugins/flashlight';
-import {Geolocation} from './plugins/geolocation';
-import {Globalization} from './plugins/globalization';
-import {GooglePlus} from './plugins/google-plus';
-import {GoogleMap} from './plugins/googlemaps';
-import {GoogleAnalytics} from './plugins/googleanalytics';
-import {Hotspot} from './plugins/hotspot';
-import {Httpd} from './plugins/httpd';
-import {IBeacon} from './plugins/ibeacon';
-import {ImagePicker} from './plugins/imagepicker';
-import {ImageResizer} from './plugins/imageresizer';
-import {InAppBrowser} from './plugins/inappbrowser';
-import {Insomnia} from './plugins/insomnia';
-import {Keyboard} from './plugins/keyboard';
-import {LaunchNavigator} from './plugins/launchnavigator';
-import {LocalNotifications} from './plugins/localnotifications';
-import {MediaCapture} from './plugins/media-capture';
-import {NativeStorage} from './plugins/nativestorage';
-import {MediaPlugin} from './plugins/media';
-import {Network} from './plugins/network';
-import {OneSignal} from './plugins/onesignal';
+import { AppAvailability } from './plugins/appavailability';
+import { AppRate } from './plugins/apprate';
+import { AppVersion } from './plugins/appversion';
+import { Badge } from './plugins/badge';
+import { BackgroundGeolocation } from './plugins/background-geolocation';
+import { BackgroundMode } from './plugins/backgroundmode';
+import { BarcodeScanner } from './plugins/barcodescanner';
+import { Base64ToGallery } from './plugins/base64togallery';
+import { BatteryStatus } from './plugins/batterystatus';
+import { Brightness } from './plugins/brightness';
+import { BLE } from './plugins/ble';
+import { BluetoothSerial } from './plugins/bluetoothserial';
+import { Calendar } from './plugins/calendar';
+import { CallNumber } from './plugins/call-number';
+import { Camera } from './plugins/camera';
+import { CameraPreview } from './plugins/camera-preview';
+import { CardIO } from './plugins/card-io';
+import { Clipboard } from './plugins/clipboard';
+import { CodePush } from './plugins/code-push';
+import { Contacts } from './plugins/contacts';
+import { Crop } from './plugins/crop';
+import { DatePicker } from './plugins/datepicker';
+import { DBMeter } from './plugins/dbmeter';
+import { Deeplinks } from './plugins/deeplinks';
+import { Device } from './plugins/device';
+import { DeviceFeedback } from './plugins/device-feedback';
+import { DeviceAccounts } from './plugins/deviceaccounts';
+import { DeviceMotion } from './plugins/devicemotion';
+import { DeviceOrientation } from './plugins/deviceorientation';
+import { Diagnostic } from './plugins/diagnostic';
+import { Dialogs } from './plugins/dialogs';
+import { EmailComposer } from './plugins/emailcomposer';
+import { EstimoteBeacons } from './plugins/estimote-beacons';
+import { Facebook } from './plugins/facebook';
+import { File } from './plugins/file';
+import { FileChooser } from './plugins/file-chooser';
+import { FileOpener } from './plugins/file-opener';
+import { FilePath } from './plugins/filepath';
+import { Transfer } from './plugins/filetransfer';
+import { Flashlight } from './plugins/flashlight';
+import { Geofence } from './plugins/geofence';
+import { Geolocation } from './plugins/geolocation';
+import { Globalization } from './plugins/globalization';
+import { GooglePlus } from './plugins/google-plus';
+import { GoogleMap } from './plugins/googlemap';
+import { GoogleAnalytics } from './plugins/googleanalytics';
+import { Hotspot } from './plugins/hotspot';
+import { HTTP } from './plugins/http';
+import { Httpd } from './plugins/httpd';
+import { IBeacon } from './plugins/ibeacon';
+import { ImagePicker } from './plugins/imagepicker';
+import { ImageResizer } from './plugins/imageresizer';
+import { InAppBrowser } from './plugins/inappbrowser';
+import { InAppPurchase } from './plugins/inapppurchase';
+import { Insomnia } from './plugins/insomnia';
+import { Instagram } from './plugins/instagram';
+import { IsDebug } from './plugins/is-debug';
+import { Keyboard } from './plugins/keyboard';
+import { LaunchNavigator } from './plugins/launchnavigator';
+import { LocalNotifications } from './plugins/localnotifications';
+import { LocationAccuracy } from './plugins/location-accuracy';
+import { MediaCapture } from './plugins/media-capture';
+import { NativeAudio } from './plugins/native-audio';
+import { NativePageTransitions } from './plugins/native-page-transitions';
+import { NativeStorage } from './plugins/nativestorage';
+import { Market } from './plugins/market';
+import { MediaPlugin } from './plugins/media';
+import { Mixpanel } from './plugins/mixpanel';
+import { MusicControls } from './plugins/music-controls';
+import { Network } from './plugins/network';
+import { NFC } from './plugins/nfc';
+import { OneSignal } from './plugins/onesignal';
import { PhotoViewer } from './plugins/photo-viewer';
-import {ScreenOrientation} from './plugins/screen-orientation';
-import {PinDialog} from './plugins/pin-dialog';
-import {Printer} from './plugins/printer';
-import {Push} from './plugins/push';
-import {SafariViewController} from './plugins/safari-view-controller';
-import {Screenshot} from './plugins/screenshot';
-import {SecureStorage} from './plugins/securestorage';
-import {Sim} from './plugins/sim';
-import {SMS} from './plugins/sms';
-import {SocialSharing} from './plugins/socialsharing';
-import {SpinnerDialog} from './plugins/spinnerdialog';
-import {Splashscreen} from './plugins/splashscreen';
-import {SQLite} from './plugins/sqlite';
-import {StatusBar} from './plugins/statusbar';
-import {ThreeDeeTouch} from './plugins/3dtouch';
-import {Toast} from './plugins/toast';
-import {TouchID} from './plugins/touchid';
-import {TwitterConnect} from './plugins/twitter-connect';
-import {Vibration} from './plugins/vibration';
-import {VideoPlayer} from './plugins/video-player';
-import {WebIntent} from './plugins/webintent';
+import { ScreenOrientation } from './plugins/screen-orientation';
+import { PayPal } from './plugins/pay-pal';
+import { PinDialog } from './plugins/pin-dialog';
+import { PowerManagement } from './plugins/power-management';
+import { Printer } from './plugins/printer';
+import { Push } from './plugins/push';
+import { SafariViewController } from './plugins/safari-view-controller';
+import { Screenshot } from './plugins/screenshot';
+import { SecureStorage } from './plugins/securestorage';
+import { Shake } from './plugins/shake';
+import { Sim } from './plugins/sim';
+import { SMS } from './plugins/sms';
+import { SocialSharing } from './plugins/socialsharing';
+import { SpinnerDialog } from './plugins/spinnerdialog';
+import { Splashscreen } from './plugins/splashscreen';
+import { SQLite } from './plugins/sqlite';
+import { StatusBar } from './plugins/statusbar';
+import { Stepcounter } from './plugins/stepcounter';
+import { StreamingMedia } from './plugins/streaming-media';
+import { ThreeDeeTouch } from './plugins/3dtouch';
+import { Toast } from './plugins/toast';
+import { TouchID } from './plugins/touchid';
+import { TextToSpeech } from './plugins/text-to-speech';
+import { ThemeableBrowser } from './plugins/themeable-browser';
+import { TwitterConnect } from './plugins/twitter-connect';
+import { Vibration } from './plugins/vibration';
+import { VideoEditor } from './plugins/video-editor';
+import { VideoPlayer } from './plugins/video-player';
+import { WebIntent } from './plugins/webintent';
+import { YoutubeVideoPlayer } from './plugins/youtube-video-player';
+import { ZBar } from './plugins/z-bar';
+import { Zip } from './plugins/zip';
export * from './plugins/3dtouch';
+export * from './plugins/actionsheet';
+export * from './plugins/admob';
+export * from './plugins/android-fingerprint-auth';
+export * from './plugins/appavailability';
+export * from './plugins/apprate';
+export * from './plugins/appversion';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
+export * from './plugins/badge';
+export * from './plugins/barcodescanner';
+export * from './plugins/base64togallery';
export * from './plugins/batterystatus';
+export * from './plugins/ble';
+export * from './plugins/bluetoothserial';
+export * from './plugins/brightness';
export * from './plugins/calendar';
+export * from './plugins/call-number';
export * from './plugins/camera';
+export * from './plugins/camera-preview';
export * from './plugins/card-io';
+export * from './plugins/clipboard';
+export * from './plugins/code-push';
export * from './plugins/contacts';
+export * from './plugins/crop';
export * from './plugins/datepicker';
+export * from './plugins/dbmeter';
+export * from './plugins/deeplinks';
export * from './plugins/device';
+export * from './plugins/device-feedback';
+export * from './plugins/deviceaccounts';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
+export * from './plugins/diagnostic';
+export * from './plugins/dialogs';
+export * from './plugins/emailcomposer';
+export * from './plugins/estimote-beacons';
+export * from './plugins/facebook';
export * from './plugins/file';
+export * from './plugins/file-chooser';
+export * from './plugins/file-opener';
export * from './plugins/filetransfer';
+export * from './plugins/filepath';
+export * from './plugins/flashlight';
+export * from './plugins/geofence';
export * from './plugins/geolocation';
-export * from './plugins/googlemaps';
+export * from './plugins/globalization';
+export * from './plugins/google-plus';
+export * from './plugins/googleanalytics';
+export * from './plugins/googlemap';
+export * from './plugins/hotspot';
+export * from './plugins/http';
export * from './plugins/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
export * from './plugins/imageresizer';
export * from './plugins/inappbrowser';
+export * from './plugins/inapppurchase';
+export * from './plugins/insomnia';
+export * from './plugins/instagram';
+export * from './plugins/is-debug';
+export * from './plugins/keyboard';
export * from './plugins/launchnavigator';
export * from './plugins/localnotifications';
+export * from './plugins/location-accuracy';
+export * from './plugins/market';
export * from './plugins/media';
export * from './plugins/media-capture';
+export * from './plugins/mixpanel';
+export * from './plugins/music-controls';
+export * from './plugins/native-audio';
+export * from './plugins/native-page-transitions';
+export * from './plugins/nativestorage';
+export * from './plugins/network';
+export * from './plugins/nfc';
+export * from './plugins/onesignal';
+export * from './plugins/pay-pal';
+export * from './plugins/photo-viewer';
+export * from './plugins/pin-dialog';
+export * from './plugins/plugin';
+export * from './plugins/power-management';
export * from './plugins/printer';
export * from './plugins/push';
export * from './plugins/safari-view-controller';
+export * from './plugins/screen-orientation';
+export * from './plugins/screenshot';
+export * from './plugins/securestorage';
+export * from './plugins/shake';
+export * from './plugins/sim';
export * from './plugins/sms';
+export * from './plugins/socialsharing';
export * from './plugins/spinnerdialog';
+export * from './plugins/splashscreen';
+export * from './plugins/sqlite';
+export * from './plugins/statusbar';
+export * from './plugins/stepcounter';
+export * from './plugins/streaming-media';
+export * from './plugins/text-to-speech';
+export * from './plugins/themeable-browser';
export * from './plugins/toast';
+export * from './plugins/touchid';
export * from './plugins/twitter-connect';
+export * from './plugins/vibration';
+export * from './plugins/video-editor';
export * from './plugins/video-player';
-export {
+export * from './plugins/webintent';
+export * from './plugins/youtube-video-player';
+export * from './plugins/z-bar';
+export * from './plugins/zip';
+
+// Window export to use outside of a module loading system
+window['IonicNative'] = {
ActionSheet,
AdMob,
AndroidFingerprintAuth,
@@ -123,129 +231,107 @@ export {
AppRate,
AppVersion,
Badge,
+ BackgroundGeolocation,
+ BackgroundMode,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
+ Calendar,
+ CallNumber,
+ Camera,
CameraPreview,
+ CardIO,
Clipboard,
+ CodePush,
+ Contacts,
Crop,
+ DatePicker,
DBMeter,
Deeplinks,
+ Device,
+ DeviceFeedback,
DeviceAccounts,
+ DeviceMotion,
+ DeviceOrientation,
Dialogs,
Diagnostic,
EmailComposer,
+ EstimoteBeacons,
Facebook,
+ File,
+ FileChooser,
+ FileOpener,
+ FilePath,
Flashlight,
+ Geofence,
+ Geolocation,
Globalization,
GooglePlus,
+ GoogleMap,
GoogleAnalytics,
Hotspot,
+ HTTP,
+ Httpd,
+ IBeacon,
+ ImagePicker,
+ ImageResizer,
+ InAppBrowser,
+ InAppPurchase,
Insomnia,
+ Instagram,
+ IsDebug,
Keyboard,
+ LaunchNavigator,
+ LocalNotifications,
+ LocationAccuracy,
+ Market,
+ MediaCapture,
+ MediaPlugin,
+ Mixpanel,
+ MusicControls,
+ NativeAudio,
+ NativePageTransitions,
NativeStorage,
Network,
+ PayPal,
+ NFC,
+ Printer,
+ Push,
OneSignal,
PhotoViewer,
ScreenOrientation,
PinDialog,
+ PowerManagement,
+ SafariViewController,
Screenshot,
SecureStorage,
- SocialSharing,
+ Shake,
Sim,
+ SMS,
+ SocialSharing,
+ SpinnerDialog,
Splashscreen,
SQLite,
StatusBar,
+ Stepcounter,
+ StreamingMedia,
+ ThreeDeeTouch,
+ Toast,
TouchID,
Transfer,
+ TextToSpeech,
+ ThemeableBrowser,
+ TwitterConnect,
+ VideoEditor,
+ VideoPlayer,
Vibration,
- WebIntent
-}
-
-export * from './plugins/plugin';
-
-// Window export to use outside of a module loading system
-window['IonicNative'] = {
- ActionSheet: ActionSheet,
- AdMob: AdMob,
- AndroidFingerprintAuth: AndroidFingerprintAuth,
- AppAvailability: AppAvailability,
- AppRate: AppRate,
- AppVersion: AppVersion,
- Badge: Badge,
- BackgroundGeolocation: BackgroundGeolocation,
- BackgroundMode: BackgroundMode,
- BarcodeScanner: BarcodeScanner,
- Base64ToGallery: Base64ToGallery,
- BatteryStatus: BatteryStatus,
- Brightness: Brightness,
- BLE: BLE,
- BluetoothSerial: BluetoothSerial,
- Calendar: Calendar,
- Camera: Camera,
- CameraPreview: CameraPreview,
- CardIO: CardIO,
- Clipboard: Clipboard,
- Contacts: Contacts,
- Crop: Crop,
- DatePicker: DatePicker,
- DBMeter: DBMeter,
- Deeplinks: Deeplinks,
- Device: Device,
- DeviceAccounts: DeviceAccounts,
- DeviceMotion: DeviceMotion,
- DeviceOrientation: DeviceOrientation,
- Dialogs: Dialogs,
- Diagnostic: Diagnostic,
- EmailComposer: EmailComposer,
- Facebook: Facebook,
- File: File,
- Flashlight: Flashlight,
- Geolocation: Geolocation,
- Globalization: Globalization,
- GooglePlus: GooglePlus,
- GoogleMap : GoogleMap,
- GoogleAnalytics: GoogleAnalytics,
- Hotspot: Hotspot,
- Httpd: Httpd,
- IBeacon: IBeacon,
- ImagePicker: ImagePicker,
- ImageResizer: ImageResizer,
- InAppBrowser: InAppBrowser,
- Keyboard: Keyboard,
- LaunchNavigator: LaunchNavigator,
- LocalNotifications: LocalNotifications,
- MediaCapture: MediaCapture,
- MediaPlugin: MediaPlugin,
- NativeStorage: NativeStorage,
- Network: Network,
- Printer: Printer,
- Push: Push,
- OneSignal: OneSignal,
- PhotoViewer: PhotoViewer,
- ScreenOrientation: ScreenOrientation,
- PinDialog: PinDialog,
- SafariViewController: SafariViewController,
- Screenshot: Screenshot,
- SecureStorage: SecureStorage,
- Sim: Sim,
- SMS: SMS,
- SocialSharing: SocialSharing,
- SpinnerDialog: SpinnerDialog,
- Splashscreen: Splashscreen,
- SQLite: SQLite,
- StatusBar: StatusBar,
- ThreeDeeTouch: ThreeDeeTouch,
- Toast: Toast,
- TouchID: TouchID,
- Transfer: Transfer,
- TwitterConnect: TwitterConnect,
- VideoPlayer: VideoPlayer,
- Vibration: Vibration,
- WebIntent: WebIntent
+ WebIntent,
+ YoutubeVideoPlayer,
+ ZBar,
+ Zip
};
initAngular1(window['IonicNative']);
@@ -254,16 +340,16 @@ initAngular1(window['IonicNative']);
// 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.
-let before = +new Date;
+const before = Date.now();
let didFireReady = false;
-document.addEventListener('deviceready', function() {
- console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
+document.addEventListener('deviceready', () => {
+ console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
didFireReady = true;
});
-setTimeout(function() {
+setTimeout(() => {
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.');
+ 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);
diff --git a/src/ng1.ts b/src/ng1.ts
index 5f56f3dbf..615b3f6ae 100644
--- a/src/ng1.ts
+++ b/src/ng1.ts
@@ -3,18 +3,19 @@ declare var window;
/**
* Initialize the ionic.native Angular module if we're running in ng1.
* This iterates through the list of registered plugins and dynamically
- * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovStatusBar.
+ * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
*/
export function initAngular1(plugins) {
if (window.angular) {
- window.angular.module('ionic.native', []);
+
+ const ngModule = window.angular.module('ionic.native', []);
for (var name in plugins) {
let serviceName = '$cordova' + name;
let cls = plugins[name];
(function(serviceName, cls, name) {
- window.angular.module('ionic.native').service(serviceName, [function() {
+ ngModule.service(serviceName, [function() {
var funcs = window.angular.copy(cls);
funcs.prototype['name'] = name;
return funcs;
diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts
index bbbc9d226..52526839c 100644
--- a/src/plugins/3dtouch.ts
+++ b/src/plugins/3dtouch.ts
@@ -54,7 +54,7 @@ declare var window: any;
* ];
* ThreeDeeTouch.configureQuickActions(actions);
*
- * ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
+ * ThreeDeeTouch.onHomeIconPressed().subscribe(
* (payload) => {
* // returns an object that is the button you presed
* console.log('Pressed the ${payload.title} button')
@@ -65,6 +65,7 @@ declare var window: any;
* ```
*/
@Plugin({
+ pluginName: 'ThreeDeeTouch',
plugin: 'cordova-plugin-3dtouch',
pluginRef: 'ThreeDeeTouch',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
@@ -94,6 +95,7 @@ export class ThreeDeeTouch {
* @param {string} title Title for your action
* @param {string} subtitle (optional) A short description for your action
* @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update
+ * @param {string} iconTemplate (optional) Can be used to provide your own icon
*/
@Cordova({
sync: true
@@ -106,8 +108,9 @@ export class ThreeDeeTouch {
*/
static onHomeIconPressed(): Observable {
return new Observable(observer => {
- if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
- else {
+ if (window.ThreeDeeTouch) {
+ window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
+ } else {
observer.error('3dTouch plugin is not available.');
observer.complete();
}
@@ -138,6 +141,7 @@ export interface ThreeDeeTouchQuickAction {
title: string;
subtitle?: string;
iconType?: string;
+ iconTemplate?: string;
}
export interface ThreeDeeTouchForceTouch {
diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts
index c5f457868..6c5ef6fc5 100644
--- a/src/plugins/actionsheet.ts
+++ b/src/plugins/actionsheet.ts
@@ -41,6 +41,7 @@ import { Cordova, Plugin } from './plugin';
*
*/
@Plugin({
+ pluginName: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
@@ -51,7 +52,7 @@ export class ActionSheet {
/**
* Show a native ActionSheet component. See below for options.
* @param {options} Options See table below
- * @returns {Promise} Returns a Promise that resolves with the index of the
+ * @returns {Promise} Returns a Promise that resolves with the index of the
* button pressed (1 based, so 1, 2, 3, etc.)
*/
@Cordova()
@@ -69,7 +70,7 @@ export class ActionSheet {
/**
* Progamtically hide the native ActionSheet
- * @returns {Promise} Returns a Promise that resolves when the actionsheet is closed
+ * @returns {Promise} Returns a Promise that resolves when the actionsheet is closed
*/
@Cordova()
static hide(options?: any): Promise { return; }
diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts
index 1c825b305..9527db075 100644
--- a/src/plugins/admob.ts
+++ b/src/plugins/admob.ts
@@ -5,9 +5,24 @@ import { Observable } from 'rxjs/Observable';
* @name AdMob
* @description Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
* @usage
+ * ```typescript
+ * import { AdMob } from 'ionic-native';
+ *
+ * ionViewDidLoad() {
+ * AdMob.onBannerDismiss()
+ * .subscribe(() => { console.log('User returned from interstitial'); });
+ * }
+ *
+ * public onClick() {
+ * AdMob.prepareInterstitial('YOUR_ADID')
+ * .then(() => { AdMob.showInterstitial(); });
+ * }
+ *
+ * ```
* Please refer the the plugin's original repository for detailed usage.
*/
@Plugin({
+ pluginName: 'AdMob',
plugin: 'cordova-plugin-admobpro',
pluginRef: 'AdMob',
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
@@ -20,6 +35,7 @@ export class AdMob {
/**
*
* @param adIdOrOptions
+ * @returns {Promise} Returns a Promise that resolves when the banner is created
*/
@Cordova()
static createBanner(adIdOrOptions: any): Promise { return; }
@@ -62,6 +78,7 @@ export class AdMob {
/**
*
* @param adIdOrOptions
+ * @returns {Promise} Returns a Promise that resolves when interstitial is prepared
*/
@Cordova()
static prepareInterstitial(adIdOrOptions: any): Promise { return; }
@@ -76,6 +93,7 @@ export class AdMob {
/**
*
+ * @returns {Promise} Returns a Promise that resolves when the interstitial is ready
*/
@Cordova()
static isInterstitialReady(): Promise { return; }
@@ -83,6 +101,7 @@ export class AdMob {
/**
* Prepare a reward video ad
* @param adIdOrOptions
+ * @returns {Promise} Returns a Promise that resolves when the ad is prepared
*/
@Cordova()
static prepareRewardVideoAd(adIdOrOptions: any): Promise { return; }
@@ -98,6 +117,7 @@ export class AdMob {
/**
* Sets the values for configuration and targeting
* @param options Returns a promise that resolves if the options are set successfully
+ * @returns {Promise} Returns a Promise that resolves when the options have been set
*/
@Cordova()
static setOptions(options: any): Promise { return; }
diff --git a/src/plugins/android-fingerprint-auth.ts b/src/plugins/android-fingerprint-auth.ts
index d75713ac7..f06634da1 100644
--- a/src/plugins/android-fingerprint-auth.ts
+++ b/src/plugins/android-fingerprint-auth.ts
@@ -30,6 +30,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'AndroidFingerprintAuth',
plugin: 'cordova-plugin-android-fingerprint-auth',
pluginRef: 'FingerprintAuth',
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
@@ -70,6 +71,7 @@ export class AndroidFingerprintAuth {
/**
* Check if service is available
+ * @returns {Promise} Returns a Promise that resolves if fingerprint auth is available on the device
*/
@Cordova()
static isAvailable(): Promise<{isAvailable: boolean}> {return; }
diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts
index 58232e203..39c5e196b 100644
--- a/src/plugins/appavailability.ts
+++ b/src/plugins/appavailability.ts
@@ -28,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'AppAvailability',
plugin: 'cordova-plugin-appavailability',
pluginRef: 'appAvailability',
repo: 'https://github.com/ohh2ahh/AppAvailability',
diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts
index 91cd59f79..da0b56227 100644
--- a/src/plugins/apprate.ts
+++ b/src/plugins/apprate.ts
@@ -19,7 +19,7 @@ declare var window;
* android: 'market://details?id=',
* };
*
- * AppRate.promptForRating();
+ * AppRate.promptForRating(false);
* ```
*
* @advanced
@@ -44,6 +44,7 @@ declare var window;
*/
@Plugin({
+ pluginName: 'AppRate',
plugin: 'cordova-plugin-apprate',
pluginRef: 'AppRate',
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts
index 644f9657b..e299b35fa 100644
--- a/src/plugins/appversion.ts
+++ b/src/plugins/appversion.ts
@@ -19,6 +19,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'AppVersion',
plugin: 'cordova-plugin-app-version',
pluginRef: 'cordova.getAppVersion',
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
@@ -27,28 +28,28 @@ import { Cordova, Plugin } from './plugin';
export class AppVersion {
/**
* Returns the name of the app
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static getAppName(): Promise { return; }
/**
* Returns the package name of the app
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static getPackageName(): Promise { return; }
/**
* Returns the build identifier of the app
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static getVersionCode(): Promise { return; }
/**
* Returns the version of the app
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static getVersionNumber(): Promise { return; }
diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts
index dc452efd2..f9d91c420 100644
--- a/src/plugins/background-geolocation.ts
+++ b/src/plugins/background-geolocation.ts
@@ -1,10 +1,7 @@
-import { Cordova, Plugin } from './plugin';
-import { Observable } from 'rxjs/Observable';
-
+import {Cordova, Plugin} from './plugin';
declare var window;
-
export interface Location {
/**
@@ -106,6 +103,22 @@ export interface Config {
*/
stopOnTerminate?: boolean;
+ /**

+ * ANDROID ONLY

+ * Start background service on device boot.

+ *
+ * Defaults to false

+ */
+ startOnBoot?: boolean;
+
+ /**

+ * ANDROID ONLY

+ * If false location service will not be started in foreground and no notification will be shown.
+ *
+ * Defaults to true

+ */
+ startForeground?: boolean;
+
/**
* ANDROID, WP8 ONLY
* The minimum time interval between location updates in seconds.
@@ -133,12 +146,19 @@ export interface Config {
*/
notificationIconColor?: string;
- /**
- * ANDROID ONLY
- * The filename of a custom notification icon. See android quirks.
- * NOTE: Only available for API Level >=21.
+ /**

+ * ANDROID ONLY

+ * The filename of a custom notification icon. See android quirks.

+ * NOTE: Only available for API Level >=21.

*/
- notificationIcon?: string;
+ notificationIconLarge?: string;
+
+ /**

+ * ANDROID ONLY

+ * The filename of a custom notification icon. See android quirks.

+ * NOTE: Only available for API Level >=21.

+ */
+ notificationIconSmall?: string;
/**
* ANDROID ONLY
@@ -154,6 +174,52 @@ export interface Config {
*/
activityType?: string;
+ /**

+ * IOS ONLY

+ * Pauses location updates when app is paused

+ *
+ * Defaults to true

+ */
+ pauseLocationUpdates?: boolean;
+
+ /**

+ * Server url where to send HTTP POST with recorded locations

+ * @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting

+ */
+ url?: string;
+
+ /**

+ * Server url where to send fail to post locations

+ * @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting

+ */
+ syncUrl?: string;
+
+ /**
+ * Specifies how many previously failed locations will be sent to server at once

+ *
+ * Defaults to 100

+ */
+ syncThreshold?: number;
+
+ /**

+ * Optional HTTP headers sent along in HTTP request

+ */
+ httpHeaders?: any;
+
+ /**
+ * IOS ONLY

+ * Switch to less accurate significant changes and region monitory when in background (default)
+ *
+ * Defaults to 100

+ */
+ saveBatteryOnBackground?: boolean;
+
+ /**

+ * Limit maximum number of locations stored into db

+ *
+ * Defaults to 10000

+ */
+ maxLocations?: number;
}
/**
@@ -170,6 +236,7 @@ export interface Config {
*
* // When device is ready :
* platform.ready().then(() => {
+ * // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
*
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
* let config = {
@@ -190,20 +257,22 @@ export interface Config {
* }, (error) => {
* console.log('BackgroundGeolocation error');
- * }, {
- * //options
- * });
+ * }, config);
*
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
* BackgroundGeolocation.start();
- * }
+ * })
*
* // If you wish to turn OFF background-tracking, call the #stop method.
* BackgroundGeolocation.stop();
*
* ```
+ * @interfaces
+ * Location
+ * Config
*/
@Plugin({
+ pluginName: 'BackgroundGeolocation',
plugin: 'cordova-plugin-mauron85-background-geolocation',
pluginRef: 'backgroundGeolocation',
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
@@ -211,37 +280,84 @@ export interface Config {
})
export class BackgroundGeolocation {
+ /**

+ * Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers

+ *
+ * Possible values:
+ * ANDROID_DISTANCE_FILTER_PROVIDER: 0,

+ * ANDROID_ACTIVITY_PROVIDER: 1

+ *
+ * @enum {number}

+ */
+ static LocationProvider: any = {
+ ANDROID_DISTANCE_FILTER_PROVIDER: 0,
+ ANDROID_ACTIVITY_PROVIDER: 1
+ };
+
+ /**
+ * Desired accuracy in meters. Possible values [0, 10, 100, 1000].

+ * The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.

+ * 1000 results in lowest power drain and least accurate readings.

+ *
+ * Possible values:
+ * HIGH: 0

+ * MEDIUM: 10

+ * LOW: 100

+ * PASSIVE: 1000
+ *
+ * enum {number}

+ */
+ static Accuracy: any = {
+ HIGH: 0,
+ MEDIUM: 10,
+ LOW: 100,
+ PASSIVE: 1000
+ };
+
+ /**

+ * Used in the switchMode function

+ *
+ * Possible values:
+ * BACKGROUND: 0
+ * FOREGROUND: 1

+ *
+ * @enum {number}

+ */
+ static Mode: any = {
+ BACKGROUND: 0,
+ FOREGROUND: 1
+ };
+
/**
* Configure the plugin.
- * Success callback will be called with one argument - Location object, which tries to mimic w3c Coordinates interface.
+ *
+ * @param {Function} callback callback will be called when background location is determined.
+ * @param {Function} errorCallback callback to be executed every time a geolocation error occurs.
+ * @param {Config} options An object of type Config
+ * @return Location object, which tries to mimic w3c Coordinates interface.
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
* Callback to be executed every time a geolocation is recorded in the background.
- *
- * Fail callback to be executed every time a geolocation error occurs.
- *
- * Options a json object of type Config
*/
@Cordova({
sync: true
})
- static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
-
+ static configure(callback: Function, errorCallback: Function, options: Config): any { return; }
/**
* Turn ON the background-geolocation system.
* The user will be tracked whenever they suspend the app.
+ * @returns {Promise}
*/
@Cordova()
static start(): Promise { return; }
-
/**
* Turn OFF background-tracking
+ * @returns {Promise}
*/
@Cordova()
static stop(): Promise { return; }
-
/**
* Inform the native plugin that you're finished, the background-task may be completed
* NOTE: IOS, WP only
@@ -249,7 +365,6 @@ export class BackgroundGeolocation {
@Cordova()
static finish() { }
-
/**
* Force the plugin to enter "moving" or "stationary" state
* NOTE: IOS, WP only
@@ -257,9 +372,9 @@ export class BackgroundGeolocation {
@Cordova()
static changePace(isMoving: boolean) { }
-
/**
* Setup configuration
+ * @returns {Promise}
*/
@Cordova({
callbackOrder: 'reverse'
@@ -269,6 +384,7 @@ export class BackgroundGeolocation {
/**
* Returns current stationaryLocation if available. null if not
* NOTE: IOS, WP only
+ * @returns {Promise}
*/
@Cordova()
static getStationaryLocation(): Promise { return; }
@@ -277,6 +393,7 @@ export class BackgroundGeolocation {
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
* your #success callback will be executed with #location param containing #radius of region
* NOTE: IOS, WP only
+ * @returns {Promise}
*/
@Cordova()
static onStationary(): Promise { return; }
@@ -289,17 +406,24 @@ export class BackgroundGeolocation {
@Cordova()
static isLocationEnabled(): Promise { return; }
+ /**
+ * Display app settings to change permissions
+ */
+ @Cordova({sync: true})
+ static showAppSettings(): void { }
+
/**
* Display device location settings
*/
- @Cordova()
- static showLocationSettings() { }
+ @Cordova({sync: true})
+ static showLocationSettings(): void { }
/**
* Method can be used to detect user changes in location services settings.
* If user enable or disable location services then success callback will be executed.
* In case or error (SettingNotFoundException) fail callback will be executed.
* NOTE: ANDROID only
+ * @returns {Promise}
*/
@Cordova()
static watchLocationMode(): Promise { return; }
@@ -319,13 +443,22 @@ export class BackgroundGeolocation {
* or
* - option.debug is true
* NOTE: ANDROID only
+ * @returns {Promise}
*/
@Cordova()
static getLocations(): Promise { return; }
+ /**

+ * Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.

+ * @returns {Promise}
+ */
+ @Cordova()
+ static getValidLocations(): Promise { return; }
+
/**
* Delete stored location by given locationId.
* NOTE: ANDROID only
+ * @returns {Promise}
*/
@Cordova()
static deleteLocation(locationId: number): Promise { return; }
@@ -333,8 +466,36 @@ export class BackgroundGeolocation {
/**
* Delete all stored locations.
* NOTE: ANDROID only
+ * @returns {Promise}
*/
@Cordova()
static deleteAllLocations(): Promise { return; }
+ /**
+ * Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself.
+ * Calling switchMode you can override plugin behavior and force plugin to switch into other mode.
+ *
+ * In FOREGROUND mode plugin uses iOS local manager to receive locations and behavior is affected by option.desiredAccuracy and option.distanceFilter.
+ * In BACKGROUND mode plugin uses significant changes and region monitoring to receive locations and uses option.stationaryRadius only.

+ *
+ * BackgroundGeolocation.Mode.FOREGROUND
+ * BackgroundGeolocation.Mode.BACKGROUND

+ *
+ * NOTE: iOS only
+ *
+ * @param {number} See above.

+ * @returns {Promise}
+ */
+ @Cordova()
+ static switchMode(modeId: number): Promise { return; }
+
+ /**

+ * Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.

+ * @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.

+ *
+ * @param {number} Limits the number of entries

+ * @returns {Promise}
+ */
+ @Cordova()
+ static getLogEntries(limit: number): Promise { return; }
}
diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts
index 309509a35..a76e7fd57 100644
--- a/src/plugins/backgroundmode.ts
+++ b/src/plugins/backgroundmode.ts
@@ -1,10 +1,12 @@
-import { Cordova, Plugin } from './plugin';
+import { Cordova, CordovaFunctionOverride, Plugin } from './plugin';
+
+import { Observable } from 'rxjs/Observable';
/**
* @name Background Mode
* @description
* Cordova plugin to prevent the app from going to sleep while in background.
-* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
+* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
*@usage
* ```typescript
* import { BackgroundMode } from 'ionic-native';
@@ -26,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
*
*/
@Plugin({
+ pluginName: 'BackgroundMode',
plugin: 'cordova-plugin-background-mode',
pluginRef: 'cordova.plugins.backgroundMode',
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
@@ -46,18 +49,18 @@ export class BackgroundMode {
* Once the background mode has been disabled, the app will be paused when in background.
*/
@Cordova()
- static disable(): void { }
+ static disable(): Promise { return; }
/**
* Checks if background mode is enabled or not.
- * @returns {boolean} returns a true of false if the background mode is enabled.
+ * @returns {Promise} returns a promise that resolves with boolean that indicates if the background mode is enabled.
*/
@Cordova()
static isEnabled(): Promise { return; }
/**
* Can be used to get the information if the background mode is active.
- * @returns {boolean} returns tru or flase if the background mode is active.
+ * @returns {Promise} returns a promise that resolves with boolean that indicates if the background mode is active.
*/
@Cordova()
static isActive(): Promise { return; }
@@ -70,7 +73,7 @@ export class BackgroundMode {
@Cordova({
platforms: ['Android']
})
- static setDefaults(options?: Configure): void { }
+ static setDefaults(options?: Configure): Promise { return; }
/**
* Modify the displayed information.
@@ -80,17 +83,28 @@ export class BackgroundMode {
@Cordova({
platforms: ['Android']
})
- static update(options?: Configure): void { }
+ static configure(options?: Configure): Promise { return; }
/**
- * Sets a callback for a specific event
- * Can be used to get notified or run function when the background mode has been activated, deactivated or failed.
- * @param eventName The name of the event. Available events: activate, deactivate, failure
+ * Called when background mode is activated.
+ * @returns {Observable} returns an observable that emits when background mode is activated
*/
- @Cordova({
- sync: true
- })
- static on(eventName: string, callback: any): void { }
+ @CordovaFunctionOverride()
+ static onactivate(): Observable { return; };
+
+ /**
+ * Called when background mode is deactivated.
+ * @returns {Observable} returns an observable that emits when background mode is deactivated
+ */
+ @CordovaFunctionOverride()
+ static ondeactivate(): Observable { return; };
+
+ /**
+ * Called when background mode fails
+ * @returns {Observable} returns an observable that emits when background mode fails
+ */
+ @CordovaFunctionOverride()
+ static onfailure(): Observable { return; };
}
diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts
index c188d273e..413940a27 100644
--- a/src/plugins/badge.ts
+++ b/src/plugins/badge.ts
@@ -18,6 +18,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'Badge',
plugin: 'cordova-plugin-badge',
pluginRef: 'cordova.plugins.notification.badge',
repo: 'https://github.com/katzer/cordova-plugin-badge',
@@ -27,6 +28,7 @@ export class Badge {
/**
* Clear the badge of the app icon.
+ * @returns {Promise}
*/
@Cordova()
static clear(): Promise { return; }
@@ -34,14 +36,14 @@ export class Badge {
/**
* Set the badge of the app icon.
* @param {number} badgeNumber The new badge number.
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static set(badgeNumber: number): Promise { return; }
/**
* Get the badge of the app icon.
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static get(): Promise { return; }
@@ -49,7 +51,7 @@ export class Badge {
/**
* Increase the badge number.
* @param {number} increaseBy Count to add to the current badge number
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static increase(increaseBy: number): Promise { return; }
@@ -57,20 +59,21 @@ export class Badge {
/**
* Decrease the badge number.
* @param {number} decreaseBy Count to subtract from the current badge number
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static decrease(decreaseBy: number): Promise { return; }
/**
* Determine if the app has permission to show badges.
+ * @returns {Promise}
*/
@Cordova()
static hasPermission(): Promise { return; }
/**
* Register permission to set badge notifications
- * @returns {Promise}
+ * @returns {Promise}
*/
@Cordova()
static registerPermission(): Promise { return; }
diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts
index b6bb0e07e..a88e0dea4 100644
--- a/src/plugins/barcodescanner.ts
+++ b/src/plugins/barcodescanner.ts
@@ -20,6 +20,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'BarcodeScanner',
plugin: 'phonegap-plugin-barcodescanner',
pluginRef: 'cordova.plugins.barcodeScanner',
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
@@ -38,7 +39,8 @@ export class BarcodeScanner {
};
/**
* Open the barcode scanner.
- * @return Returns a Promise that resolves with scanner data, or rejects with an error.
+ * @param options {Object} Optional options to pass to the scanner
+ * @returns {Promise} Returns a Promise that resolves with scanner data, or rejects with an error.
*/
@Cordova({
callbackOrder: 'reverse'
@@ -48,8 +50,9 @@ export class BarcodeScanner {
/**
* Encodes data into a barcode.
* NOTE: not well supported on Android
- * @param type
- * @param data
+ * @param type {string} Type of encoding
+ * @param data {any} Data to encode
+ * @returns {Promise}
*/
@Cordova()
static encode(type: string, data: any): Promise { return; }
diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts
index 6e5f63365..324848ac1 100644
--- a/src/plugins/base64togallery.ts
+++ b/src/plugins/base64togallery.ts
@@ -14,6 +14,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'Base64ToGallery',
plugin: 'cordova-base64-to-gallery',
pluginRef: 'cordova',
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
@@ -24,10 +25,13 @@ export class Base64ToGallery {
/**
* Converts a base64 string to an image file in the device gallery
* @param {string} data The actual base64 string that you want to save
- * @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
- * @returns {Promise} returns a promise that resolves when the image is saved.
+ * @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
+ * @returns {Promise} returns a promise that resolves when the image is saved.
*/
- @Cordova()
+ @Cordova({
+ successIndex: 2,
+ errorIndex: 3
+ })
static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise {
return;
}
diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts
index c70beae60..eda912031 100644
--- a/src/plugins/batterystatus.ts
+++ b/src/plugins/batterystatus.ts
@@ -24,6 +24,7 @@ import { Observable } from 'rxjs/Observable';
* ```
*/
@Plugin({
+ pluginName: 'BatteryStatus',
plugin: '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']
@@ -32,7 +33,7 @@ export class BatteryStatus {
/**
* Watch the change in battery level
- * @returns {Observable} Returns an observable that pushes a status object
+ * @returns {Observable} Returns an observable that pushes a status object
*/
@Cordova({
eventObservable: true,
diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts
index 6df9f2f6d..011a22619 100644
--- a/src/plugins/ble.ts
+++ b/src/plugins/ble.ts
@@ -160,6 +160,7 @@ import { Observable } from 'rxjs/Observable';
*
*/
@Plugin({
+ pluginName: 'BLE',
plugin: 'cordova-plugin-ble-central',
pluginRef: 'ble',
repo: 'https://github.com/don/cordova-plugin-ble-central',
@@ -177,7 +178,7 @@ export class BLE {
* ```
* @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.
+ * @returns {Observable} Returns an Observable that notifies of each peripheral that is discovered during the specified time.
*/
@Cordova({
observable: true
@@ -198,7 +199,7 @@ export class BLE {
* }, 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.
+ * @returns {Observable} Returns an Observable that notifies of each peripheral discovered.
*/
@Cordova({
observable: true,
@@ -207,6 +208,19 @@ export class BLE {
})
static startScan(services: string[]): Observable { return; }
+ /**
+ * Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
+ * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
+ * @param options {any}
+ * @returns {Observable} Returns an Observable that notifies of each peripheral discovered.
+ */
+ @Cordova({
+ observable: true,
+ clearFunction: 'stopScan',
+ clearWithArgs: true
+ })
+ static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable { return; }
+
/**
* Stop a scan started by `startScan`.
*
@@ -359,7 +373,7 @@ export class BLE {
* @param {string} deviceId UUID or MAC address of the peripheral
* @param {string} serviceUUID UUID of the BLE service
* @param {string} characteristicUUID UUID of the BLE characteristic
- * @return Returns a Promise.
+ * @returns {Promise}
*/
@Cordova()
static stopNotification(
@@ -379,7 +393,7 @@ export class BLE {
* );
* ```
* @param {string} deviceId UUID or MAC address of the peripheral
- * @return Returns a Promise.
+ * @returns {Promise}
*/
@Cordova()
static isConnected(deviceId: string): Promise { return; }
@@ -387,22 +401,15 @@ export class BLE {
/**
* Report if bluetooth is enabled.
*
- * @usage
- * ```
- * BLE.isEnabled().then(
- * () => { console.log('enabled'); },
- * () => { console.log('not enabled'); }
- * );
- * ```
- * @return Returns a Promise.
+ * @returns {Promise} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled.
*/
@Cordova()
- static isEnabled(): Promise { return; }
+ static isEnabled(): Promise { return; }
/**
* Open System Bluetooth settings (Android only).
*
- * @return Returns a Promise.
+ * @returns {Promise}
*/
@Cordova()
static showBluetoothSettings(): Promise { return; }
@@ -410,7 +417,7 @@ export class BLE {
/**
* Enable Bluetooth on the device (Android only).
*
- * @return Returns a Promise.
+ * @returns {Promise}
*/
@Cordova()
static enable(): Promise { return; }
diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts
index 069fed3f3..2a0c67d84 100644
--- a/src/plugins/bluetoothserial.ts
+++ b/src/plugins/bluetoothserial.ts
@@ -28,6 +28,7 @@ import { Observable } from 'rxjs/Observable';
* ```
*/
@Plugin({
+ pluginName: 'BluetoothSerial',
repo: 'https://github.com/don/BluetoothSerial',
plugin: 'cordova-plugin-bluetooth-serial',
pluginRef: 'bluetoothSerial',
@@ -38,7 +39,7 @@ export class BluetoothSerial {
/**
* Connect to a Bluetooth device
* @param {string} macAddress_or_uuid Identifier of the remote device
- * @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
+ * @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -50,7 +51,7 @@ export class BluetoothSerial {
/**
* Connect insecurely to a Bluetooth device
* @param {string} macAddress Identifier of the remote device
- * @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
+ * @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
*/
@Cordova({
platforms: ['Android'],
@@ -62,7 +63,7 @@ export class BluetoothSerial {
/**
* Writes data to the serial port
* @param {any} data ArrayBuffer of data
- * @returns {Promise} returns a promise when data has been written
+ * @returns {Promise} returns a promise when data has been written
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -71,7 +72,7 @@ export class BluetoothSerial {
/**
* Gets the number of bytes of data available
- * @returns {Promise} returns a promise that contains the available bytes
+ * @returns {Promise} returns a promise that contains the available bytes
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -79,7 +80,7 @@ export class BluetoothSerial {
/**
* Reads data from the buffer
- * @returns {Promise} returns a promise with data from the buffer
+ * @returns {Promise} returns a promise with data from the buffer
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -89,7 +90,7 @@ export class BluetoothSerial {
/**
* Reads data from the buffer until it reaches a delimiter
* @param {string} delimiter string that you want to search until
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -99,7 +100,7 @@ export class BluetoothSerial {
/**
* Subscribe to be notified when data is received
* @param {string} delimiter the string you want to watch for
- * @returns {Observable} returns an observable.
+ * @returns {Observable} returns an observable.
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -110,7 +111,7 @@ export class BluetoothSerial {
/**
* Subscribe to be notified when data is received
- * @returns {Observable} returns an observable
+ * @returns {Observable} returns an observable
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -121,7 +122,7 @@ export class BluetoothSerial {
/**
* Clears data in buffer
- * @returns {Promise} returns a promise when completed
+ * @returns {Promise} returns a promise when completed
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -130,7 +131,7 @@ export class BluetoothSerial {
/**
* Lists bonded devices
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -139,7 +140,7 @@ export class BluetoothSerial {
/**
* Reports if bluetooth is enabled
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -148,7 +149,7 @@ export class BluetoothSerial {
/**
* Reports the connection status
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -157,7 +158,7 @@ export class BluetoothSerial {
/**
* Reads the RSSI from the connected peripheral
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -166,7 +167,7 @@ export class BluetoothSerial {
/**
* Show the Bluetooth settings on the device
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -175,7 +176,7 @@ export class BluetoothSerial {
/**
* Enable Bluetooth on the device
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -184,7 +185,7 @@ export class BluetoothSerial {
/**
* Discover unpaired devices
- * @returns {Promise} returns a promise
+ * @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -193,7 +194,7 @@ export class BluetoothSerial {
/**
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
- * @returns {Observable} Returns an observable
+ * @returns {Observable} Returns an observable
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts
index f23161890..cc323dc49 100644
--- a/src/plugins/brightness.ts
+++ b/src/plugins/brightness.ts
@@ -18,6 +18,7 @@ import { Cordova, Plugin } from './plugin';
*
*/
@Plugin({
+ pluginName: 'Brightness',
plugin: 'cordova-plugin-brightness',
pluginRef: 'cordova.plugins.brightness',
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
@@ -29,7 +30,7 @@ export class Brightness {
* Sets the brightness of the display.
*
* @param {value} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
- * @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
+ * @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
*/
@Cordova()
static setBrightness(value: number): Promise { return; }
@@ -37,7 +38,7 @@ export class Brightness {
/**
* Reads the current brightness of the device display.
*
- * @returns {Promise} Returns a Promise that resolves with the
+ * @returns {Promise} Returns a Promise that resolves with the
* brightness value of the device display (floating number between 0 and 1).
*/
@Cordova()
diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts
index 0f09902b9..e6461b0eb 100644
--- a/src/plugins/calendar.ts
+++ b/src/plugins/calendar.ts
@@ -5,6 +5,7 @@ import { Cordova, Plugin } from './plugin';
* @private
*/
export interface CalendarOptions {
+ id?: string;
firstReminderMinutes?: number;
secondReminderMinutes?: number;
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly'
@@ -37,6 +38,7 @@ export interface CalendarOptions {
*
*/
@Plugin({
+ pluginName: 'Calendar',
plugin: 'cordova-plugin-calendar',
pluginRef: 'plugins.calendar',
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
@@ -52,7 +54,7 @@ export class Calendar {
* - You're using Android < 6, or
* - You've already granted permission
*
- * If this returns false, you should call `requestReadWritePermissions` function
+ * If this returns false, you should call the `requestReadWritePermission` function
* @returns {Promise}
*/
@Cordova()
@@ -97,7 +99,7 @@ export class Calendar {
* Create a calendar. (iOS only)
*
* @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
- * @return {Promise} Returns a Promise
+ * @returns {Promise} Returns a Promise
*/
@Cordova()
static createCalendar(
@@ -107,7 +109,7 @@ export class Calendar {
/**
* Delete a calendar. (iOS only)
* @param {string} name Name of the calendar to delete.
- * @return Returns a Promise
+ * @returns {Promise} Returns a Promise
*/
@Cordova()
static deleteCalendar(name: string): Promise { return; }
@@ -148,7 +150,7 @@ export class Calendar {
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
- * @return Returns a Promise
+ * @returns {Promise} Returns a Promise
*/
@Cordova()
static createEvent(
@@ -168,7 +170,7 @@ export class Calendar {
* @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
+ * @returns {Promise} Returns a Promise
*/
@Cordova()
static createEventWithOptions(
@@ -188,7 +190,7 @@ export class Calendar {
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
- * @return Returns a Promise
+ * @returns {Promise} Returns a Promise
*/
@Cordova()
static createEventInteractively(
@@ -208,7 +210,7 @@ export class Calendar {
* @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
+ * @returns {Promise}
*/
@Cordova()
static createEventInteractivelyWithOptions(
@@ -239,7 +241,7 @@ export class Calendar {
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
- * @return Returns a Promise
+ * @returns {Promise}
*/
@Cordova()
static findEvent(
@@ -258,7 +260,7 @@ export class Calendar {
* @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.
+ * @returns {Promise} Returns a Promise that resolves with the event, or rejects with an error.
*/
@Cordova()
static findEventWithOptions(
@@ -275,21 +277,21 @@ export class Calendar {
*
* @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.
+ * @returns {Promise} Returns a Promise that resolves with the list of events, or rejects with an error.
*/
@Cordova()
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.
+ * @returns {Promise} A Promise that resolves with the list of calendars, or rejects with an error.
*/
@Cordova()
static listCalendars(): Promise { 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.
+ * @returns {Promise} Returns a Promise that resolves with the list of events, or rejects with an error.
*/
@Cordova()
static findAllEventsInNamedCalendar(calendarName: string): Promise { return; }
@@ -336,7 +338,8 @@ export class Calendar {
* @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`
+ * @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions`
+ * @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
* @return Returns a Promise
*/
@Cordova()
@@ -351,8 +354,9 @@ export class Calendar {
newNotes?: string,
newStartDate?: Date,
newEndDate?: Date,
- options?: CalendarOptions
- ) { return; }
+ filterOptions?: CalendarOptions,
+ newOptions?: CalendarOptions
+ ): Promise { return; }
/**
* Delete an event.
diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts
new file mode 100644
index 000000000..e69c297ad
--- /dev/null
+++ b/src/plugins/call-number.ts
@@ -0,0 +1,38 @@
+import { Plugin, Cordova } from './plugin';
+
+/**
+ * @name CallNumber
+ * @description
+ * Call a number directly from your Cordova/Ionic application.
+ *
+ * @usage
+ * ```
+ * import {CallNumber} from 'ionic-native';
+ *
+ * CallNumber.callNumber(18001010101, true)
+ * .then(() => console.log('Launched dialer!'))
+ * .catch(() => console.log('Error launching dialer'));
+ *
+ * ```
+ */
+@Plugin({
+ pluginName: 'CallNumber',
+ plugin: 'call-number',
+ pluginRef: 'plugins.CallNumber',
+ repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin',
+ platforms: ['iOS', 'Android']
+})
+export class CallNumber {
+ /**
+ * Calls a phone number
+ * @param numberToCall {string} The phone number to call as a string
+ * @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer
+ * @return {Promise}
+ */
+ @Cordova({
+ callbackOrder: 'reverse'
+ })
+ static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise {
+ return;
+ }
+}
diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts
index 57f16f9ae..bd38e15f5 100644
--- a/src/plugins/camera-preview.ts
+++ b/src/plugins/camera-preview.ts
@@ -2,25 +2,11 @@ import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
-export interface CameraPreviewOptions {
+export interface CameraPreviewRect {
x: number;
y: number;
width: number;
height: number;
- /**
- * Choose the camera to use (front- or back-facing).
- * 'front' for front camera
- * 'rear' for rear camera
- */
- camera: string;
- /** Take photo on tap */
- tapPhoto: boolean;
- /** */
- previewDrag: boolean;
- /** */
- toBack: boolean;
- /** Alpha use when toBack is set to true */
- alpha: number;
}
export interface CameraPreviewSize {
@@ -35,8 +21,56 @@ export interface CameraPreviewSize {
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
+ * @usage
+ * ```
+ * import { CameraPreview, CameraPreviewRect } from 'ionic-native';
+ *
+ * // camera options (Size and location)
+ * let cameraRect: CameraPreviewRect = {
+ * x: 100,
+ * y: 100,
+ * width: 200,
+ * height: 200
+ * };
+ *
+ *
+ * // start camera
+ * CameraPreview.startCamera(
+ * cameraRect, // position and size of preview
+ * 'front', // default camera
+ * true, // tap to take picture
+ * false, // disable drag
+ * false, // keep preview in front. Set to true (back of the screen) to apply overlaying elements
+ * 1 // set the preview alpha
+ * );
+ *
+ * // Set the handler to run every time we take a picture
+ * CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
+ * console.log(result);
+ * // do something with the result
+ * });
+ *
+ *
+ * // take a picture
+ * CameraPreview.takePicture({
+ * maxWidth: 640,
+ * maxHeight: 640
+ * });
+ *
+ * // Switch camera
+ * CameraPreview.switchCamera();
+ *
+ * // set color effect to negative
+ * CameraPreview.setColorEffect('negative');
+ *
+ * // Stop the camera preview
+ * CameraPreview.stopCamera();
+ *
+ * ```
+ *
*/
@Plugin({
+ pluginName: 'CameraPreview',
plugin: 'cordova-plugin-camera-preview',
pluginRef: 'cordova.plugins.camerapreview',
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
@@ -46,12 +80,17 @@ export class CameraPreview {
/**
* Starts the camera preview instance.
- * @param {CameraPreviewOptions} options for the preview
+ * @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number}
+ * @param {string} which camera to use - 'front' | 'back'
+ * @param {boolean} enable tap to take picture
+ * @param {boolean} enable preview box drag across the screen
+ * @param {boolean} send preview box to the back of the webview
+ * @param {number} alpha of the preview box
*/
@Cordova({
sync: true
})
- static startCamera(options: CameraPreviewOptions): void { };
+ static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }
/**
* Stops the camera preview instance.
@@ -59,23 +98,25 @@ export class CameraPreview {
@Cordova({
sync: true
})
- static stopCamera(): void { };
+ static stopCamera(): void { }
/**
* Take the picture, the parameter size is optional
+ * @param {CameraPreviewSize} optional - size of the picture to take
*/
@Cordova({
sync: true
})
- static takePicture(size: CameraPreviewSize): void { };
+ static takePicture(size: CameraPreviewSize): void { }
/**
* Register a callback function that receives the original picture and the image captured from the preview box.
+ * @returns {Observable}
*/
@Cordova({
observable: true
})
- static setOnPictureTakenHandler(): Observable { return; };
+ static setOnPictureTakenHandler(): Observable { return; }
/**
* Switch from the rear camera and front camera, if available.
@@ -83,7 +124,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
- static switchCamera(): void { };
+ static switchCamera(): void { }
/**
* Show the camera preview box.
@@ -91,7 +132,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
- static show(): void { };
+ static show(): void { }
/**
* Hide the camera preview box.
@@ -99,15 +140,15 @@ export class CameraPreview {
@Cordova({
sync: true
})
- static hide(): void { };
+ static hide(): void { }
/**
- * Set the default mode for the Flash.
+ * Disables the camera preview
*/
- // @Cordova({
- // sync: true
- // })
- // static setFlashMode(mode: number): void { };
+ @Cordova({
+ sync: true
+ })
+ static disable(): void { }
/**
* Set camera color effect.
@@ -115,16 +156,5 @@ export class CameraPreview {
@Cordova({
sync: true
})
- static setColorEffect(effect: string): void { };
-
- /**
- * @private
- * @enum {number}
- */
- static FlashMode = {
- OFF: 0,
- ON: 1,
- AUTO: 2
- };
-
+ static setColorEffect(effect: string): void { }
}
diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts
index 9f94df66c..ee9f654e7 100644
--- a/src/plugins/camera.ts
+++ b/src/plugins/camera.ts
@@ -6,16 +6,16 @@ export interface CameraOptions {
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
+ * Defined in 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.
+ * Defined in Camera.PictureSourceType. Default is CAMERA.
* PHOTOLIBRARY : 0,
* CAMERA : 1,
* SAVEDPHOTOALBUM : 2
@@ -25,7 +25,7 @@ export interface CameraOptions {
allowEdit?: boolean;
/**
* Choose the returned image file's encoding.
- * Defined in navigator.camera.EncodingType. Default is JPEG
+ * Defined in Camera.EncodingType. Default is JPEG
* JPEG : 0 Return JPEG encoded image
* PNG : 1 Return PNG encoded image
*/
@@ -42,7 +42,7 @@ export interface CameraOptions {
targetHeight?: number;
/**
* Set the type of media to select from. Only works when PictureSourceType
- * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
+ * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in 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
@@ -55,9 +55,9 @@ export interface CameraOptions {
saveToPhotoAlbum?: boolean;
/**
* Choose the camera to use (front- or back-facing).
- * Defined in navigator.camera.Direction. Default is BACK.
- * FRONT: 0
- * BACK: 1
+ * Defined in Camera.Direction. Default is BACK.
+ * BACK: 0
+ * FRONT: 1
*/
cameraDirection?: number;
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
@@ -105,8 +105,12 @@ export interface CameraPopoverOptions {
* // Handle error
* });
* ```
+ * @interfaces
+ * CameraOptions
+ * CameraPopoverOptions
*/
@Plugin({
+ pluginName: 'Camera',
plugin: 'cordova-plugin-camera',
pluginRef: 'navigator.camera',
repo: 'https://github.com/apache/cordova-plugin-camera',
@@ -117,7 +121,7 @@ export class Camera {
* @private
* @enum {number}
*/
- public static DestinationType = {
+ static DestinationType = {
/** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
DATA_URL: 0,
/** Return file uri (content://media/external/images/media/2 for Android) */
@@ -130,7 +134,7 @@ export class Camera {
* @private
* @enum {number}
*/
- public static EncodingType = {
+ static EncodingType = {
/** Return JPEG encoded image */
JPEG: 0,
/** Return PNG encoded image */
@@ -140,7 +144,7 @@ export class Camera {
* @private
* @enum {number}
*/
- public static MediaType = {
+ static MediaType = {
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
PICTURE: 0,
/** Allow selection of video only, ONLY RETURNS URL */
@@ -153,7 +157,7 @@ export class Camera {
* @private
* @enum {number}
*/
- public static PictureSourceType = {
+ static PictureSourceType = {
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
PHOTOLIBRARY: 0,
/** Take picture from camera */
@@ -167,7 +171,7 @@ export class Camera {
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
* @enum {number}
*/
- public static PopoverArrowDirection = {
+ static PopoverArrowDirection = {
ARROW_UP: 1,
ARROW_DOWN: 2,
ARROW_LEFT: 4,
@@ -179,7 +183,7 @@ export class Camera {
* @private
* @enum {number}
*/
- public static Direction = {
+ static Direction = {
/** Use the back-facing camera */
BACK: 0,
/** Use the front-facing camera */
@@ -188,8 +192,8 @@ export class Camera {
/**
* Take a picture or video, or load one from the library.
- * @param {CameraOptions?} options Options that you want to pass to the camera. Encoding type, quality, etc. Optional
- * @return {Promise} 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.
+ * @param {CameraOptions?} options optional. Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-).
+ * @returns {Promise} 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.
*/
@Cordova({
callbackOrder: 'reverse'
@@ -199,11 +203,11 @@ 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
+ * @returns {Promise}
*/
@Cordova({
platforms: ['iOS']
})
- static cleanup() { };
+ static cleanup(): Promise { return; };
}
diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts
index ef6952782..a5023cf32 100644
--- a/src/plugins/card-io.ts
+++ b/src/plugins/card-io.ts
@@ -25,6 +25,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'CardIO',
plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
pluginRef: 'CardIO',
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
@@ -35,6 +36,7 @@ export class CardIO {
* Check whether card scanning is currently available. (May vary by
* device, OS version, network connectivity, etc.)
*
+ * @returns {Promise}
*/
@Cordova()
static canScan(): Promise { return; }
@@ -42,12 +44,14 @@ export class CardIO {
/**
* Scan a credit card with card.io.
* @param {CardIOOptions} options Options for configuring the plugin
+ * @returns {Promise}
*/
@Cordova()
- static scan(options?: CardIOOptions): Promise { return; }
+ static scan(options?: CardIOOptions): Promise { return; }
/**
* Retrieve the version of the card.io library. Useful when contacting support.
+ * @returns {Promise}
*/
@Cordova()
static version(): Promise { return; }
@@ -56,7 +60,7 @@ export class CardIO {
export interface CardIOOptions {
requireExpiry?: boolean;
- requireCCV?: boolean;
+ requireCVV?: boolean;
requirePostalCode?: boolean;
supressManual?: boolean;
restrictPostalCodeToNumericOnly?: boolean;
@@ -72,3 +76,14 @@ export interface CardIOOptions {
useCardIOLogo?: boolean;
supressScan?: boolean;
}
+
+export interface CardIOResponse {
+ cardType: string;
+ redactedCardNumber: string;
+ cardNumber: string;
+ expiryMonth: number;
+ expiryYear: number;
+ cvv: string;
+ postalCode: string;
+ cardholderName: string;
+}
diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts
index 77e502190..f4d855d96 100644
--- a/src/plugins/clipboard.ts
+++ b/src/plugins/clipboard.ts
@@ -28,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'Clipboard',
plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
pluginRef: 'cordova.plugins.clipboard',
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
@@ -38,14 +39,14 @@ export class Clipboard {
/**
* Copies the given text
* @param {string} text Text that gets copied on the system clipboard
- * @returns {Promise} Returns a promise after the text has been copied
+ * @returns {Promise} Returns a promise after the text has been copied
*/
@Cordova()
static copy(text: string): Promise { return; }
/**
* Pastes the text stored in clipboard
- * @returns {Promise} Returns a promise after the text has been pasted
+ * @returns {Promise} Returns a promise after the text has been pasted
*/
@Cordova()
static paste(): Promise { return; }
diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts
new file mode 100644
index 000000000..23cf9af34
--- /dev/null
+++ b/src/plugins/code-push.ts
@@ -0,0 +1,524 @@
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
+// below are taken from
+// https://raw.githubusercontent.com/Microsoft/cordova-plugin-code-push/master/typings/codePush.d.ts
+// and adjusted to remove warnings and access control
+
+namespace Http {
+ export const enum Verb {
+ GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
+ }
+
+ export interface Response {
+ statusCode: number;
+ body?: string;
+ }
+
+ export interface Requester {
+ request(verb: Verb, url: string, callback: Callback): void;
+ request(verb: Verb, url: string, requestBody: string, callback: Callback): void;
+ }
+}
+
+/**
+ * Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app,
+ * in which case only the appVersion is compulsory.
+ *
+ * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
+ */
+export interface IPackage {
+ deploymentKey: string;
+ description: string;
+ label: string;
+ appVersion: string;
+ isMandatory: boolean;
+ packageHash: string;
+ packageSize: number;
+ failedInstall: boolean;
+}
+
+/**
+ * Defines a remote package, which represents an update package available for download.
+ */
+export interface IRemotePackage extends IPackage {
+ /**
+ * The URL at which the package is available for download.
+ */
+ downloadUrl: string;
+
+ /**
+ * Downloads the package update from the CodePush service.
+ *
+ * @param downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully.
+ * @param downloadError Optional callback invoked in case of an error.
+ * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
+ */
+ download(downloadSuccess: SuccessCallback, downloadError?: ErrorCallback, downloadProgress?: SuccessCallback): void;
+
+ /**
+ * Aborts the current download session, previously started with download().
+ *
+ * @param abortSuccess Optional callback invoked if the abort operation succeeded.
+ * @param abortError Optional callback invoked in case of an error.
+ */
+ abortDownload(abortSuccess?: SuccessCallback, abortError?: ErrorCallback): void;
+}
+
+/**
+ * Defines a local package.
+ *
+ * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
+ */
+export interface ILocalPackage extends IPackage {
+ /**
+ * The local storage path where this package is located.
+ */
+ localPath: string;
+
+ /**
+ * Indicates if the current application run is the first one after the package was applied.
+ */
+ isFirstRun: boolean;
+
+ /**
+ * Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded.
+ * On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success.
+ * Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run.
+ *
+ * @param installSuccess Callback invoked if the install operation succeeded.
+ * @param installError Optional callback inovoked in case of an error.
+ * @param installOptions Optional parameter used for customizing the installation behavior.
+ */
+ install(installSuccess: SuccessCallback, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void;
+}
+
+/**
+ * Decomposed static side of RemotePackage.
+ * For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
+ */
+/* tslint:disable */
+interface RemotePackage_Static {
+ new (): IRemotePackage;
+}
+/* tslint:enable */
+
+/**
+ * Decomposed static side of LocalPackage.
+ * For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
+ */
+/* tslint:disable */
+interface LocalPackage_Static {
+ new (): ILocalPackage;
+}
+/* tslint:enable */
+
+declare var RemotePackage: RemotePackage_Static;
+declare var LocalPackage: LocalPackage_Static;
+
+/**
+ * Defines the JSON format of the current package information file.
+ * This file is stored in the local storage of the device and persists between store updates and code-push updates.
+ *
+ * !! THIS FILE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
+ */
+interface IPackageInfoMetadata extends ILocalPackage {
+ nativeBuildTime: string;
+}
+
+interface NativeUpdateNotification {
+ updateAppVersion: boolean; // Always true
+ appVersion: string;
+}
+
+export interface Callback { (error: Error, parameter: T): void; }
+export interface SuccessCallback { (result?: T): void; }
+export interface ErrorCallback { (error?: Error): void; }
+
+interface Configuration {
+ appVersion: string;
+ clientUniqueId: string;
+ deploymentKey: string;
+ serverUrl: string;
+ ignoreAppVersion?: boolean;
+}
+
+declare class AcquisitionStatus {
+ static DeploymentSucceeded: string;
+ static DeploymentFailed: string;
+}
+
+declare class AcquisitionManager {
+ constructor(httpRequester: Http.Requester, configuration: Configuration);
+ public queryUpdateWithCurrentPackage(currentPackage: IPackage, callback?: Callback): void;
+ public reportStatusDeploy(pkg?: IPackage, status?: string, previousLabelOrAppVersion?: string, previousDeploymentKey?: string, callback?: Callback): void;
+ public reportStatusDownload(pkg: IPackage, callback?: Callback): void;
+}
+
+interface CodePushCordovaPlugin {
+
+ /**
+ * Get the current package information.
+ *
+ * @param packageSuccess Callback invoked with the currently deployed package information.
+ * @param packageError Optional callback invoked in case of an error.
+ */
+ getCurrentPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void;
+
+ /**
+ * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
+ * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
+ */
+ getPendingPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void;
+
+ /**
+ * Checks with the CodePush server if an update package is available for download.
+ *
+ * @param querySuccess Callback invoked in case of a successful response from the server.
+ * The callback takes one RemotePackage parameter. A non-null package is a valid update.
+ * A null package means the application is up to date for the current native application version.
+ * @param queryError Optional callback invoked in case of an error.
+ * @param deploymentKey Optional deployment key that overrides the config.xml setting.
+ */
+ checkForUpdate(querySuccess: SuccessCallback, queryError?: ErrorCallback, deploymentKey?: string): void;
+
+ /**
+ * Notifies the plugin that the update operation succeeded and that the application is ready.
+ * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
+ * If using sync API, calling this function is not required since sync calls it internally.
+ *
+ * @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
+ * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
+ */
+ notifyApplicationReady(notifySucceeded?: SuccessCallback, notifyFailed?: ErrorCallback): void;
+
+ /**
+ * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
+ * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
+ */
+ restartApplication(installSuccess: SuccessCallback, errorCallback?: ErrorCallback): void;
+
+ /**
+ * Convenience method for installing updates in one method call.
+ * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
+ *
+ * The algorithm of this method is the following:
+ * - Checks for an update on the CodePush server.
+ * - If an update is available
+ * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
+ * The update package will then be downloaded and applied.
+ * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
+ * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
+ * - Otherwise, the update package will be downloaded and applied with no user interaction.
+ * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
+ * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
+ *
+ * @param syncCallback Optional callback to be called with the status of the sync operation.
+ * The callback will be called only once, and the possible statuses are defined by the SyncStatus enum.
+ * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
+ * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
+ *
+ */
+ sync(syncCallback?: SuccessCallback, syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): void;
+}
+
+/**
+ * Defines the possible result statuses of the window.codePush.sync operation.
+ */
+export enum SyncStatus {
+ /**
+ * The application is up to date.
+ */
+ UP_TO_DATE,
+
+ /**
+ * An update is available, it has been downloaded, unzipped and copied to the deployment folder.
+ * After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources.
+ */
+ UPDATE_INSTALLED,
+
+ /**
+ * An optional update is available, but the user declined to install it. The update was not downloaded.
+ */
+ UPDATE_IGNORED,
+
+ /**
+ * An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update.
+ * The console logs should contain more information about what happened. No update has been applied in this case.
+ */
+ ERROR,
+
+ /**
+ * There is an ongoing sync in progress, so this attempt to sync has been aborted.
+ */
+ IN_PROGRESS,
+
+ /**
+ * Intermediate status - the plugin is about to check for updates.
+ */
+ CHECKING_FOR_UPDATE,
+
+ /**
+ * Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled.
+ */
+ AWAITING_USER_ACTION,
+
+ /**
+ * Intermediate status - the update package is about to be downloaded.
+ */
+ DOWNLOADING_PACKAGE,
+
+ /**
+ * Intermediate status - the update package is about to be installed.
+ */
+ INSTALLING_UPDATE
+}
+
+/**
+ * Defines the available install modes for updates.
+ */
+export enum InstallMode {
+ /**
+ * The update will be applied to the running application immediately. The application will be reloaded with the new content immediately.
+ */
+ IMMEDIATE,
+
+ /**
+ * The update is downloaded but not installed immediately. The new content will be available the next time the application is started.
+ */
+ ON_NEXT_RESTART,
+
+ /**
+ * The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first.
+ */
+ ON_NEXT_RESUME
+}
+
+/**
+ * Defines the install operation options.
+ */
+export interface InstallOptions {
+ /**
+ * Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART.
+ */
+ installMode?: InstallMode;
+
+ /**
+ * If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed.
+ */
+ minimumBackgroundDuration?: number;
+
+ /**
+ * Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE.
+ */
+ mandatoryInstallMode?: InstallMode;
+}
+
+/**
+ * Defines the sync operation options.
+ */
+export interface SyncOptions extends InstallOptions {
+ /**
+ * Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true.
+ */
+ ignoreFailedUpdates?: boolean;
+
+ /**
+ * Used to enable, disable or customize the user interaction during sync.
+ * If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory.
+ * To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance.
+ */
+ updateDialog?: boolean | UpdateDialogOptions;
+
+ /**
+ * Overrides the config.xml deployment key when checking for updates.
+ */
+ deploymentKey?: string;
+}
+
+/**
+ * Defines the configuration options for the alert or confirmation dialog
+ */
+export interface UpdateDialogOptions {
+ /**
+ * If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update.
+ * The user will not be able to cancel the operation, since the update is mandatory.
+ */
+ mandatoryUpdateMessage?: string;
+
+ /**
+ * If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog.
+ * If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded.
+ */
+ optionalUpdateMessage?: string;
+
+ /**
+ * The title of the dialog box used for interacting with the user in case of a mandatory or optional update.
+ * This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set.
+ */
+ updateTitle?: string;
+
+ /**
+ * The label of the confirmation button in case of an optional update.
+ */
+ optionalInstallButtonLabel?: string;
+
+ /**
+ * The label of the cancel button in case of an optional update.
+ */
+ optionalIgnoreButtonLabel?: string;
+
+ /**
+ * The label of the continue button in case of a mandatory update.
+ */
+ mandatoryContinueButtonLabel?: string;
+
+ /**
+ * Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message.
+ */
+ appendReleaseDescription?: boolean;
+
+ /**
+ * Optional prefix to add to the release description.
+ */
+ descriptionPrefix?: string;
+}
+
+/**
+ * Defines the JSON format of the package diff manifest file.
+ */
+interface IDiffManifest {
+ deletedFiles: string[];
+}
+
+/**
+ * Defines the format of the DownloadProgress object, used to send periodical update notifications on the progress of the update download.
+ */
+export interface DownloadProgress {
+ totalBytes: number;
+ receivedBytes: number;
+}
+
+/**
+ * @name CodePush
+ * @description
+ * CodePush plugin for Cordova by Microsoft that supports iOS and Android.
+ *
+ * For more info, please see https://github.com/ksachdeva/ionic2-code-push-example
+ *
+ * @usage
+ * ```typescript
+ * import { CodePush } from 'ionic-native';
+ *
+ * // note - mostly error & completed methods of observable will not fire
+ * // as syncStatus will contain the current state of the update
+ * CodePush.sync().subscribe((syncStatus) => console.log(syncStatus));
+ *
+ * const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); }
+ * CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
+ *
+ * ```
+ */
+@Plugin({
+ pluginName: 'CodePush',
+ plugin: 'cordova-plugin-code-push',
+ pluginRef: 'codePush',
+ repo: 'https://github.com/Microsoft/cordova-plugin-code-push',
+ platforms: ['Android', 'iOS']
+})
+export class CodePush {
+
+ /**
+ * Get the current package information.
+ *
+ * @param packageSuccess Callback invoked with the currently deployed package information.
+ * @param packageError Optional callback invoked in case of an error.
+ * @returns {Promise}
+ */
+ @Cordova()
+ static getCurrentPackage(): Promise {
+ return;
+ }
+
+ /**
+ * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
+ * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
+ * @returns {Promise}
+ */
+ @Cordova()
+ static getPendingPackage(): Promise {
+ return;
+ }
+
+ /**
+ * Checks with the CodePush server if an update package is available for download.
+ *
+ * @param querySuccess Callback invoked in case of a successful response from the server.
+ * The callback takes one RemotePackage parameter. A non-null package is a valid update.
+ * A null package means the application is up to date for the current native application version.
+ * @param queryError Optional callback invoked in case of an error.
+ * @param deploymentKey Optional deployment key that overrides the config.xml setting.
+ * @returns {Promise}
+ */
+ @Cordova({
+ callbackOrder: 'reverse'
+ })
+ static checkForUpdate(deploymentKey?: string): Promise {
+ return;
+ }
+
+ /**
+ * Notifies the plugin that the update operation succeeded and that the application is ready.
+ * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
+ * If using sync API, calling this function is not required since sync calls it internally.
+ *
+ * @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
+ * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
+ * @returns {Promise}
+ */
+ @Cordova()
+ static notifyApplicationReady(): Promise {
+ return;
+ }
+
+ /**
+ * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
+ * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
+ * @returns {Promise}
+ */
+ @Cordova()
+ static restartApplication(): Promise {
+ return;
+ }
+
+ /**
+ * Convenience method for installing updates in one method call.
+ * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
+ *
+ * The algorithm of this method is the following:
+ * - Checks for an update on the CodePush server.
+ * - If an update is available
+ * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
+ * The update package will then be downloaded and applied.
+ * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
+ * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
+ * - Otherwise, the update package will be downloaded and applied with no user interaction.
+ * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
+ * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
+ *
+ * @param syncCallback Optional callback to be called with the status of the sync operation.
+ * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
+ * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
+ * @returns {Observable}
+ *
+ */
+ @Cordova({
+ observable: true,
+ successIndex: 0,
+ errorIndex: 3 // we don't need this, so we set it to a value higher than # of args
+ })
+ static sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): Observable {
+ return;
+ }
+
+}
diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts
index ee5335c4d..c0c28d73d 100644
--- a/src/plugins/contacts.ts
+++ b/src/plugins/contacts.ts
@@ -1,9 +1,11 @@
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
-
declare var window: any,
navigator: any;
+/**
+ * @private
+ */
export interface IContactProperties {
/** A globally unique identifier. */
id?: string;
@@ -75,14 +77,20 @@ export class Contact implements IContactProperties {
save(): Promise { return; }
}
-interface IContactError {
+/**
+ * @private
+ */
+export interface IContactError {
/** Error code */
code: number;
/** Error message */
message: string;
}
-declare var ContactError: {
+/**
+ * @private
+ */
+export declare var ContactError: {
new (code: number): IContactError;
UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number;
@@ -186,13 +194,21 @@ export class ContactAddress implements IContactAddress {
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
}
+ /** Set to true if this ContactAddress contains the user's preferred value. */
@InstanceProperty get pref(): boolean { return; }
+ /** A string indicating what type of field this is, home for example. */
@InstanceProperty get type(): string { return; }
+ /** The full address formatted for display. */
@InstanceProperty get formatted(): string { return; }
+ /** The full street address. */
@InstanceProperty get streetAddress(): string { return; }
+ /** The city or locality. */
@InstanceProperty get locality(): string { return; }
+ /** The state or region. */
@InstanceProperty get region(): string { return; }
+ /** The zip code or postal code. */
@InstanceProperty get postalCode(): string { return; }
+ /** The country name. */
@InstanceProperty get country(): string { return; }
}
@@ -217,10 +233,15 @@ export class ContactOrganization implements IContactOrganization {
constructor() {
this._objectInstance = new window.ContactOrganization();
}
+ /** Set to true if this ContactOrganization contains the user's preferred value. */
@InstanceProperty get pref(): boolean { return; }
+ /** A string that indicates what type of field this is, home for example. */
@InstanceProperty get type(): string { return; }
+ /** The name of the organization. */
@InstanceProperty get name(): string { return; }
+ /** The department the contract works for. */
@InstanceProperty get department(): string { return; }
+ /** The contact's title at the organization. */
@InstanceProperty get title(): string { return; }
}
@@ -232,6 +253,10 @@ export interface IContactFindOptions {
multiple?: boolean;
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
desiredFields?: string[];
+ /**
+ * (Android only): Filters the search to only return contacts with a phone number informed.
+ */
+ hasPhoneNumber?: boolean;
}
/**
@@ -244,9 +269,24 @@ export class ContactFindOptions implements IContactFindOptions {
this._objectInstance = new window.ContactFindOptions();
}
+ /**
+ * The search string used to find navigator.contacts. (Default: "")
+ */
@InstanceProperty get filter(): string { return; }
+
+ /**
+ * Determines if the find operation returns multiple navigator.contacts. (Default: false)
+ */
@InstanceProperty get multiple(): boolean { return; }
+
+ /**
+ * Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields.
+ */
@InstanceProperty get desiredFields(): any { return; }
+
+ /**
+ * (Android only): Filters the search to only return contacts with a phone number informed.
+ */
@InstanceProperty get hasPhoneNumber(): boolean { return; }
}
@@ -268,15 +308,24 @@ export class ContactFindOptions implements IContactFindOptions {
* (error: any) => console.error('Error saving contact.', error)
* );
* ```
- *
- *
+ * @interfaces
+ * IContactProperties
+ * @classes
+ * ContactFindOptions
+ * ContactOrganization
+ * ContactAddress
*/
@Plugin({
+ pluginName: 'Contacts',
plugin: 'cordova-plugin-contacts',
pluginRef: 'navigator.contacts',
repo: 'https://github.com/apache/cordova-plugin-contacts'
})
export class Contacts {
+ /**
+ * Create a single contact.
+ * @returns {Contact} Returns a Contact object
+ */
static create(): Contact {
return new Contact();
}
@@ -293,7 +342,7 @@ export class Contacts {
* 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)
+ * @returns {Promise} Returns a Promise that resolves with the search results (an array of Contact objects)
*/
@Cordova({
successIndex: 1,
@@ -303,7 +352,7 @@ export class Contacts {
/**
* Select a single Contact.
- * @return Returns a Promise that resolves with the selected Contact
+ * @returns {Promise} Returns a Promise that resolves with the selected Contact
*/
@Cordova()
static pickContact(): Promise { return; }
diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts
index 86dc91294..939f82334 100644
--- a/src/plugins/crop.ts
+++ b/src/plugins/crop.ts
@@ -1,4 +1,4 @@
-import {Cordova, Plugin} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name Crop
* @description Crops images
@@ -16,6 +16,7 @@ import {Cordova, Plugin} from './plugin';
* ```
*/
@Plugin({
+ pluginName: 'Crop',
plugin: 'cordova-plugin-crop',
pluginRef: 'plugins',
repo: 'https://github.com/jeduan/cordova-plugin-crop'
@@ -25,10 +26,10 @@ export class Crop {
* Crops an image
* @param pathToImage
* @param options
- * @return {Promise} Returns a promise that resolves with the new image path, or rejects if failed to crop.
+ * @returns {Promise} Returns a promise that resolves with the new image path, or rejects if failed to crop.
*/
@Cordova({
callbackOrder: 'reverse'
})
- static crop(pathToImage: string, options?: {quality: number}): Promise {return; }
-}
\ No newline at end of file
+ static crop(pathToImage: string, options?: {quality: number}): Promise { return; }
+}
diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts
index 71fc988d1..ede2450cc 100644
--- a/src/plugins/datepicker.ts
+++ b/src/plugins/datepicker.ts
@@ -1,66 +1,104 @@
-import { Cordova, Plugin } from './plugin';
+import {Cordova, Plugin} from './plugin';
export interface DatePickerOptions {
/**
- * Platforms: iOS, Android, Windows
* The mode of the date picker
* Values: date | time | datetime
*/
mode: string;
/**
- * Platforms: iOS, Android, Windows
* Selected date
*/
- date: Date;
+ date: Date | string | number;
/**
- * Platforms: iOS, Android, Windows
* Minimum date
- * Type: Date | empty String
* Default: empty String
*/
- minDate?: Date;
+ minDate?: Date | string | number;
/**
- * Platforms?: iOS, Android, Windows
* Maximum date
- * Type?: Date | empty String
* Default?: empty String
*/
- maxDate?: Date;
+ maxDate?: Date | string | number;
/**
- * 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
+ /**
+ * Label of BUTTON_NEGATIVE (cancel button). If empty, uses android.R.string.cancel.
+ */
cancelText?: string;
+ /**
+ * Label of today button. If empty, doesn't show the option to select current date.
+ */
todayText?: string;
+ /**
+ * Label of now button. If empty, doesn't show the option to select current time.
+ */
nowText?: string;
+ /**
+ * Shows time dialog in 24 hours format.
+ */
is24Hour?: boolean;
+ /**
+ * Choose the Android theme for the picker. You can use the DatePicker.ANDROID_THEMES property.
+ * Values: 1: THEME_TRADITIONAL | 2: THEME_HOLO_DARK | 3: THEME_HOLO_LIGHT | 4: THEME_DEVICE_DEFAULT_DARK | 5: THEME_DEVICE_DEFAULT_LIGHT
+ */
androidTheme?: number;
- allowOldDate?: boolean;
+ /**
+ * Shows or hide dates earlier then selected date.
+ */
+ allowOldDates?: boolean;
+ /**
+ * Shows or hide dates after selected date.
+ */
allowFutureDates?: boolean;
+ /**
+ * Label of done button.
+ */
doneButtonLabel?: string;
+ /**
+ * Hex color of done button.
+ */
doneButtonColor?: string;
+ /**
+ * Label of cancel button.
+ */
cancelButtonLabel?: string;
+ /**
+ * Hex color of cancel button.
+ */
cancelButtonColor?: string;
+ /**
+ * X position of date picker. The position is absolute to the root view of the application.
+ */
x?: number;
+ /**
+ * Y position of date picker. The position is absolute to the root view of the application.
+ */
y?: number;
+ /**
+ * Interval between options in the minute section of the date picker.
+ */
minuteInterval?: number;
+ /**
+ * Force the UIPopoverArrowDirection enum. The value any will revert to default UIPopoverArrowDirectionAny and let the app choose the proper direction itself.
+ */
popoverArrowDirection?: string;
+ /**
+ * Force locale for datePicker.
+ */
locale?: string;
}
@@ -69,10 +107,6 @@ export interface DatePickerOptions {
* @description
* The DatePicker plugin allows the user to fetch date or time using native dialogs.
*
- * Platforms supported: iOS, Android, Windows
- *
- * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
- *
* @usage
* ```typescript
* import { DatePicker } from 'ionic-native';
@@ -86,21 +120,37 @@ export interface DatePickerOptions {
* err => console.log('Error occurred while getting date: ', err)
* );
* ```
- *
+ * @interfaces
+ * DatePickerOptions
*/
@Plugin({
+ pluginName: 'DatePicker',
plugin: 'cordova-plugin-datepicker',
pluginRef: 'datePicker',
- repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker'
+ repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker',
+ platforms: ['Android', 'iOS', 'Windows']
})
export class DatePicker {
+ /**
+ * @private
+ */
+ static ANDROID_THEMES = {
+ THEME_TRADITIONAL: 1,
+ THEME_HOLO_DARK: 2,
+ THEME_HOLO_LIGHT: 3,
+ THEME_DEVICE_DEFAULT_DARK: 4,
+ THEME_DEVICE_DEFAULT_LIGHT: 5
+ };
+
/**
* Shows the date and/or time picker dialog(s)
* @param {DatePickerOptions} options Options for the date picker.
* @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 { return; }
+ static show(options: DatePickerOptions): Promise {
+ return;
+ }
}
diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts
index 138ee643a..b96a5057c 100644
--- a/src/plugins/dbmeter.ts
+++ b/src/plugins/dbmeter.ts
@@ -31,6 +31,7 @@ import { Observable } from 'rxjs/Observable';
* ```
*/
@Plugin({
+ pluginName: 'DBMeter',
plugin: 'cordova-plugin-dbmeter',
pluginRef: 'DBMeter',
repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
@@ -40,7 +41,7 @@ export class DBMeter {
/**
* Starts listening
- * @return {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
+ * @returns {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
*/
@Cordova({
observable: true,
@@ -57,14 +58,14 @@ export class DBMeter {
/**
* 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
+ * @returns {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.
+ * @returns {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/
@Cordova()
static delete(): Promise { return; }
diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts
index c394150ba..ecd44ce53 100644
--- a/src/plugins/deeplinks.ts
+++ b/src/plugins/deeplinks.ts
@@ -28,15 +28,43 @@ export interface DeeplinkMatch {
*
* @usage
* ```typescript
- * import { IonicDeeplinks } from 'ionic-native';
+ * import { Deeplinks } from 'ionic-native';
*
+ * Deeplinks.route({
+ '/about-us': AboutPage,
+ '/universal-links-test': AboutPage,
+ '/products/:productId': ProductPage
+ }).subscribe((match) => {
+ // match.$route - the route we matched, which is the matched entry from the arguments to route()
+ // match.$args - the args passed in the link
+ // match.$link - the full link data
+ console.log('Successfully matched route', match);
+ }, (nomatch) => {
+ // nomatch.$link - the full link data
+ console.error('Got a deeplink that didn\'t match', nomatch);
+ });
* ```
+ *
+ * Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
+ * the actual navigation for you:
+ *
+ * ```typescript
+ * Deeplinks.routeWithNavController(this.navController, {
+ '/about-us': AboutPage,
+ '/products/:productId': ProductPage
+ });
+ * ```
+ *
+ * See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
+ * retrieve the `NavController` reference at runtime.
*/
@Plugin({
+ pluginName: 'Deeplinks',
plugin: 'ionic-plugin-deeplinks',
pluginRef: 'IonicDeeplink',
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
- platforms: ['iOS', 'Android']
+ platforms: ['iOS', 'Android'],
+ install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
})
export class Deeplinks {
@@ -47,8 +75,8 @@ export class Deeplinks {
* paths takes an object of the form { 'path': data }. If a deeplink
* matches the path, the resulting path-data pair will be returned in the
* promise result which you can then use to navigate in the app as you see fit.
- * @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
- * is rejected if a deeplink comes through that does not match a given path.
+ * @returns {Observable} Returns an Observable that is called each time a deeplink comes through, and
+ * errors if a deeplink comes through that does not match a given path.
*/
@Cordova({
observable: true
@@ -70,8 +98,8 @@ export class Deeplinks {
* matches the path, the resulting path-data pair will be returned in the
* promise result which you can then use to navigate in the app as you see fit.
*
- * @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
- * is rejected if a deeplink comes through that does not match a given path.
+ * @returns {Observable} Returns an Observable that resolves each time a deeplink comes through, and
+ * errors if a deeplink comes through that does not match a given path.
*/
@Cordova({
observable: true
diff --git a/src/plugins/device-feedback.ts b/src/plugins/device-feedback.ts
new file mode 100644
index 000000000..cf15b1380
--- /dev/null
+++ b/src/plugins/device-feedback.ts
@@ -0,0 +1,56 @@
+import { Plugin, Cordova } from './plugin';
+/**
+ * @name DeviceFeedback
+ * @description
+ *
+ * Plugin that lets you provide haptic or acoustic feedback on Android devices.
+ *
+ * @usage
+ * ```
+ * import { DeviceFeedback } from 'ionic-native';
+ *
+ * DeviceFeedback.acoustic();
+ *
+ * DeviceFeedback.haptic(0);
+ *
+ * DeviceFeedback.isFeedbackEnabled()
+ * .then((feedback) => {
+ * console.log(feedback);
+ * // {
+ * // acoustic: true,
+ * // haptic: true
+ * // }
+ * });
+ *
+ * ```
+ */
+@Plugin({
+ pluginName: 'DeviceFeedback',
+ plugin: 'cordova-plugin-velda-devicefeedback',
+ pluginRef: 'plugins.deviceFeedback',
+ repo: 'https://github.com/VVelda/device-feedback',
+ platforms: ['Android']
+})
+export class DeviceFeedback {
+
+ /**
+ * Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do.
+ */
+ @Cordova({ sync: true })
+ static acoustic(): void { }
+
+ /**
+ * Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
+ * @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
+ */
+ @Cordova({ sync: true })
+ static haptic(type: number): void { }
+
+ /**
+ * Check if haptic and acoustic feedback is enabled by user settings.
+ * @returns {Promise}
+ */
+ @Cordova()
+ static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
+
+}
diff --git a/src/plugins/device.ts b/src/plugins/device.ts
index 6dd106936..d3b908174 100644
--- a/src/plugins/device.ts
+++ b/src/plugins/device.ts
@@ -41,6 +41,7 @@ export interface Device {
* ```
*/
@Plugin({
+ pluginName: 'Device',
plugin: 'cordova-plugin-device',
pluginRef: 'device',
repo: 'https://github.com/apache/cordova-plugin-device'
@@ -50,9 +51,9 @@ export class Device {
/**
* Returns the whole device object.
*
- * @returns {Object} The device object.
+ * @returns {Device} The device object.
*/
@CordovaProperty
- static get device() { return window.device; }
+ static get device(): Device { return window.device; }
}
diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts
index 1b1a7a11f..8ea888098 100644
--- a/src/plugins/deviceaccounts.ts
+++ b/src/plugins/deviceaccounts.ts
@@ -2,6 +2,7 @@ import { Cordova, Plugin } from './plugin';
@Plugin({
+ pluginName: 'DeviceAccounts',
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
pluginRef: 'plugins.DeviceAccounts',
repo: 'https://github.com/loicknuchel/cordova-device-accounts',
@@ -11,24 +12,28 @@ export class DeviceAccounts {
/**
* Gets all accounts registered on the Android Device
+ * @returns {Promise}
*/
@Cordova()
static get(): Promise { return; }
/**
* Get all accounts registered on Android device for requested type
+ * @returns {Promise}
*/
@Cordova()
static getByType(type: string): Promise { return; }
/**
* Get all emails registered on Android device (accounts with 'com.google' type)
+ * @returns {Promise}
*/
@Cordova()
static getEmails(): Promise { return; }
/**
* Get the first email registered on Android device
+ * @returns {Promise}
*/
@Cordova()
static getEmail(): Promise { return; }
diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts
index b3a67bcfd..486aa28dd 100644
--- a/src/plugins/devicemotion.ts
+++ b/src/plugins/devicemotion.ts
@@ -62,6 +62,7 @@ export interface AccelerometerOptions {
* ```
*/
@Plugin({
+ pluginName: 'DeviceMotion',
plugin: 'cordova-plugin-device-motion',
pluginRef: 'navigator.accelerometer',
repo: 'https://github.com/apache/cordova-plugin-device-motion'
@@ -70,7 +71,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
+ * @returns {Promise} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
static getCurrentAcceleration(): Promise { return; }
diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts
index 431b9aa20..8bae29652 100644
--- a/src/plugins/deviceorientation.ts
+++ b/src/plugins/deviceorientation.ts
@@ -67,6 +67,7 @@ export interface CompassOptions {
* ```
*/
@Plugin({
+ pluginName: 'DeviceOrientation',
plugin: 'cordova-plugin-device-orientation',
pluginRef: 'navigator.compass',
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts
index 1c68370dd..a1080743c 100644
--- a/src/plugins/diagnostic.ts
+++ b/src/plugins/diagnostic.ts
@@ -8,16 +8,109 @@ import { Cordova, Plugin } from './plugin';
* @usage
* ```typescript
* import { Diagnostic } from 'ionic-native';
+ *
+ * let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
+ * let errorCallback = (e) => console.error(e);
+ *
+ * Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
+ *
+ * Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
+ *
+ *
+ * Diagnostic.getBluetoothState()
+ * .then((state) => {
+ * if (state == Diagnostic.bluetoothStates.POWERED_ON){
+ * // do something
+ * } else {
+ * // do something else
+ * }
+ * }).catch(e => console.error(e));
+ *
* ```
*/
@Plugin({
+ pluginName: 'Diagnostic',
plugin: 'cordova.plugins.diagnostic',
pluginRef: 'cordova.plugins.diagnostic',
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
})
export class Diagnostic {
+
+ static permission = {
+ READ_CALENDAR: 'READ_CALENDAR',
+ WRITE_CALENDAR: 'WRITE_CALENDAR',
+ CAMERA: 'CAMERA',
+ READ_CONTACTS: 'READ_CONTACTS',
+ WRITE_CONTACTS: 'WRITE_CONTACTS',
+ GET_ACCOUNTS: 'GET_ACCOUNTS',
+ ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION',
+ ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION',
+ RECORD_AUDIO: 'RECORD_AUDIO',
+ READ_PHONE_STATE: 'READ_PHONE_STATE',
+ CALL_PHONE: 'CALL_PHONE',
+ ADD_VOICEMAIL: 'ADD_VOICEMAIL',
+ USE_SIP: 'USE_SIP',
+ PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS',
+ READ_CALL_LOG: 'READ_CALL_LOG',
+ WRITE_CALL_LOG: 'WRITE_CALL_LOG',
+ SEND_SMS: 'SEND_SMS',
+ RECEIVE_SMS: 'RECEIVE_SMS',
+ READ_SMS: 'READ_SMS',
+ RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH',
+ RECEIVE_MMS: 'RECEIVE_MMS',
+ WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE',
+ READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE',
+ BODY_SENSORS: 'BODY_SENSORS'
+ };
+
+ static permissionStatus = {
+ GRANTED: 'GRANTED',
+ GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS
+ RESTRICTED: 'RESTRICTED', // iOS
+ DENIED: 'DENIED',
+ DENIED_ALWAYS: 'DENIED_ALWAYS', // android
+ NOT_REQUESTED: 'NOT_REQUESTED'
+ };
+
+ static locationAuthorizationMode = {
+ ALWAYS: 'ALWAYS',
+ WHEN_IN_USE: 'WHEN_IN_USE'
+ };
+
+ static permissionGroups = {
+ CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
+ CAMERA: ['CAMERA'],
+ CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
+ LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
+ MICROPHONE: ['RECORD_AUDIO'],
+ PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
+ SENSORS: ['BODY_SENSORS'],
+ SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
+ STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
+ };
+
+ static locationMode = {
+ HIGH_ACCURACY: 'high_accuracy',
+ DEVICE_ONLY: 'device_only',
+ BATTERY_SAVING: 'battery_saving',
+ LOCATION_OFF: 'location_off'
+ };
+
+ static bluetoothState = {
+ UNKNOWN: 'unknown',
+ RESETTING: 'resetting', // iOS
+ UNSUPPORTED: 'unsupported', // iOS
+ UNAUTHORIZED: 'unauthorized', // iOS
+ POWERED_OFF: 'powered_off',
+ POWERED_ON: 'powered_on',
+ POWERING_OFF: 'powering_off',
+ POWERING_ON: 'powering_on'
+ };
+
+
/**
* Checks if app is able to access device location.
+ * @returns {Promise}
*/
@Cordova()
static isLocationAvailable(): Promise { return; }
@@ -25,6 +118,7 @@ export class Diagnostic {
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
* On Android this requires permission. ``
+ * @returns {Promise}
*/
@Cordova()
static isWifiAvailable(): Promise { return; }
@@ -32,6 +126,7 @@ export class Diagnostic {
/**
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
+ * @returns {Promise}
*/
@Cordova()
static isCameraAvailable(): Promise { return; }
@@ -39,70 +134,441 @@ export class Diagnostic {
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission
+ * @returns {Promise}
*/
@Cordova()
static isBluetoothAvailable(): Promise { return; }
+ /**
+ * Displays the device location settings to allow user to enable location services/change location mode.
+ */
+ @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
+ static switchToLocationSettings(): void { }
+
+ /**
+ * Displays mobile settings to allow user to enable mobile data.
+ */
+ @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
+ static switchToMobileDataSettings(): void { }
+
+ /**
+ * Displays Bluetooth settings to allow user to enable Bluetooth.
+ */
+ @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
+ static switchToBluetoothSettings(): void { }
+
+ /**
+ * Displays WiFi settings to allow user to enable WiFi.
+ */
+ @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
+ static switchToWifiSettings(): void { }
+
+ /**
+ * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
+ * @returns {Promise}
+ */
+ @Cordova({ platforms: ['Android', 'Windows 10'] })
+ static isWifiEnabled(): Promise { return; }
+
+ /**
+ * Enables/disables WiFi on the device.
+ * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
+ * @param state {boolean}
+ * @returns {Promise}
+ */
+ @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
+ static setWifiState(state: boolean): Promise { return; }
+
+ /**
+ * Enables/disables Bluetooth on the device.
+ * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
+ * @param state {boolean}
+ * @returns {Promise}
+ */
+ @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
+ static setBluetoothState(state: boolean): Promise { return; }
+
+ /**
+ * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
+ * @returns {Promise}
+ */
+ @Cordova({ platforms: ['Android', 'iOS'] })
+ static isLocationEnabled(): Promise { return; }
+
+ /**
+ * Checks if the application is authorized to use location.
+ * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
+ * @returns {Promise}
+ */
+ @Cordova()
+ static isLocationAuthorized(): Promise { return; }
+
+ /**
+ * Returns the location authorization status for the application.
+ * @returns {Promise}
+ */
+ @Cordova({ platforms: ['Android', 'iOS'] })
+ static getLocationAuthorizationStatus(): Promise { return; }
+
/**
* Returns the location authorization status for the application.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
+ * @returns {Promise}
*/
- @Cordova()
+ @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
static requestLocationAuthorization(mode?: string): Promise { return; }
- /**
- * Checks if the application is authorized to use location.
- * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
- */
- @Cordova()
- static isLocationAuthorized(): Promise { return; }
-
/**
* Checks if camera hardware is present on device.
+ * @returns {Promise}
*/
- @Cordova()
+ @Cordova({ platforms: ['Android', 'iOS'] })
static isCameraPresent(): Promise { return; }
/**
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
+ * @returns {Promise}
*/
- @Cordova()
+ @Cordova({ platforms: ['Android', 'iOS'] })
static isCameraAuthorized(): Promise { return; }
+
+ /**
+ * Returns the camera authorization status for the application.
+ * @returns {Promise}
+ */
+ @Cordova({ platforms: ['Android', 'iOS'] })
+ static getCameraAuthorizationStatus(): Promise { return; }
+
+ /**
+ * Requests camera authorization for the application.
+ * @returns {Promise}
+ */
+ @Cordova({ platforms: ['Android', 'iOS'] })
+ static requestCameraAuthorization(): Promise { return; }
+
+ /**
+ * Checks if the application is authorized to use the microphone.
+ * @returns {Promise}
+ */
+ @Cordova({ platforms: ['Android', 'iOS'] })
+ static isMicrophoneAuthorized(): Promise