diff --git a/.gitignore b/.gitignore
index faa71d205..1e12dbb4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.DS_Store
node_modules/
.idea
dist/
+scripts/ionic-native-bower
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1227f004f..013a33745 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,203 @@
+
+## [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)), closes [#459](https://github.com/driftyco/ionic-native/issues/459)
+* **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.13...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)
+
+
+### 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.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13)
+
+
+### Bug Fixes
+
+* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
+
+
+
+
+## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...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))
+* **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)
+
+
+### Features
+
+* **file:** alternate file implementation ([#283](https://github.com/driftyco/ionic-native/issues/283)) ([6ed32ef](https://github.com/driftyco/ionic-native/commit/6ed32ef))
+* **GoogleAnalytics:** Add campaign measurement tracking ([#405](https://github.com/driftyco/ionic-native/issues/405)) ([cf3f0f6](https://github.com/driftyco/ionic-native/commit/cf3f0f6))
+* **GoogleMaps:** Allow specify enableHighAccuracy option that attempt to get your location with highest accuracy ([#410](https://github.com/driftyco/ionic-native/issues/410)) ([43e8a6d](https://github.com/driftyco/ionic-native/commit/43e8a6d))
+* **ibeacon:** using option otherPromise instead of sync ([#388](https://github.com/driftyco/ionic-native/issues/388)) ([306cb5d](https://github.com/driftyco/ionic-native/commit/306cb5d))
+* **inappbrowser:** implement instance based wrapper ([#305](https://github.com/driftyco/ionic-native/issues/305)) ([4b8ab4a](https://github.com/driftyco/ionic-native/commit/4b8ab4a))
+* **keyboard:** enable hideKeyboardAccessoryBar function ([#398](https://github.com/driftyco/ionic-native/issues/398)) ([7a84262](https://github.com/driftyco/ionic-native/commit/7a84262)), closes [#394](https://github.com/driftyco/ionic-native/issues/394)
+* **photo-viewer:** add wrapper for plugin ([#359](https://github.com/driftyco/ionic-native/issues/359)) ([154c029](https://github.com/driftyco/ionic-native/commit/154c029))
+* **video-player:** Added video player plugin ([#391](https://github.com/driftyco/ionic-native/issues/391)) ([cabeeb8](https://github.com/driftyco/ionic-native/commit/cabeeb8)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
+
+
+
+
+## [1.3.10](https://github.com/driftyco/ionic-native/compare/v1.3.9...v1.3.10) (2016-08-01)
+
+
+### Bug Fixes
+
+* **brightness:** use correct pluginRef ([e20c411](https://github.com/driftyco/ionic-native/commit/e20c411))
+* **diagnostics:** Corrects isEnabled functions to isAvailable ([#373](https://github.com/driftyco/ionic-native/issues/373)) ([ccf7fb5](https://github.com/driftyco/ionic-native/commit/ccf7fb5))
+* **ng1:** use $q promises instead of the native Promise ([#378](https://github.com/driftyco/ionic-native/issues/378)) ([817a434](https://github.com/driftyco/ionic-native/commit/817a434))
+* **one-signal:** return Observable instead of promise ([#352](https://github.com/driftyco/ionic-native/issues/352)) ([08fe04e](https://github.com/driftyco/ionic-native/commit/08fe04e))
+
+
+### 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)
+
+
+
+
+## [1.3.9](https://github.com/driftyco/ionic-native/compare/v1.3.8...v1.3.9) (2016-07-23)
+
+
+### Bug Fixes
+
+* **file:** readAsText() and adds readAsDataURL() in File plugin ([#346](https://github.com/driftyco/ionic-native/issues/346)) ([77d31cd](https://github.com/driftyco/ionic-native/commit/77d31cd))
+
+
+### Features
+
+* **android-fingerprint-auth:** add wrapper for plugin ([df326f7](https://github.com/driftyco/ionic-native/commit/df326f7)), closes [#334](https://github.com/driftyco/ionic-native/issues/334)
+* **secure-storage:** Add Secure Storage Wrapper ([#347](https://github.com/driftyco/ionic-native/issues/347)) ([075842d](https://github.com/driftyco/ionic-native/commit/075842d))
+
+
+
+
+## [1.3.8](https://github.com/driftyco/ionic-native/compare/v1.3.7...v1.3.8) (2016-07-20)
+
+
+### 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)
+
+
+### Features
+
+* **facebook:** add FacebookLoginResponse interface ([8b27bed](https://github.com/driftyco/ionic-native/commit/8b27bed))
+* **otherPromise:** can work better with plugins that return promises ([#304](https://github.com/driftyco/ionic-native/issues/304)) ([0aee6c8](https://github.com/driftyco/ionic-native/commit/0aee6c8))
+* **social-sharing:** add canShareViaEmail ([#333](https://github.com/driftyco/ionic-native/issues/333)) ([5807dd7](https://github.com/driftyco/ionic-native/commit/5807dd7))
+* **twitter-connect:** add twitter connect plugin ([979838f](https://github.com/driftyco/ionic-native/commit/979838f)), closes [#308](https://github.com/driftyco/ionic-native/issues/308)
+
+
+
+
+## [1.3.7](https://github.com/driftyco/ionic-native/compare/v1.3.6...v1.3.7) (2016-07-18)
+
+
+### Bug Fixes
+
+* **contacts:** missing name property, types ([#320](https://github.com/driftyco/ionic-native/issues/320)) ([074d166](https://github.com/driftyco/ionic-native/commit/074d166))
+* **geolocation:** handle errors on watchPosition ([1b161d8](https://github.com/driftyco/ionic-native/commit/1b161d8)), closes [#322](https://github.com/driftyco/ionic-native/issues/322)
+
+
+### Features
+
+* **sim:** Add sim plugin ([#317](https://github.com/driftyco/ionic-native/issues/317)) ([4f85110](https://github.com/driftyco/ionic-native/commit/4f85110))
+
+
+
+
+## [1.3.6](https://github.com/driftyco/ionic-native/compare/v1.3.5...v1.3.6) (2016-07-17)
+
+
+### Bug Fixes
+
+* **googlemaps:** able to pass array of LatLng to GoogleMapsLatLngBounds constructor ([de14b0e](https://github.com/driftyco/ionic-native/commit/de14b0e)), closes [#298](https://github.com/driftyco/ionic-native/issues/298)
+* **launch-navigator:** fix the navigate function wrapper to match latest plugin API ([6f625f9](https://github.com/driftyco/ionic-native/commit/6f625f9))
+
+
+### Features
+
+* **camera-preview:** add wrapper for camera-preview ([#301](https://github.com/driftyco/ionic-native/issues/301)) ([3a1a3ce](https://github.com/driftyco/ionic-native/commit/3a1a3ce))
+* **launch-navigator:** add new methods and constants to match latest plugin API ([29de6b3](https://github.com/driftyco/ionic-native/commit/29de6b3))
+
+
+
+
+## [1.3.5](https://github.com/driftyco/ionic-native/compare/v1.3.4...v1.3.5) (2016-07-17)
+
+
+### Bug Fixes
+
+* **ibeacon:** minor fixes ([b5a2ffc](https://github.com/driftyco/ionic-native/commit/b5a2ffc))
+* **safari-view-controller:** fix wrappers ([b4b3ec0](https://github.com/driftyco/ionic-native/commit/b4b3ec0))
+
+
+### 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)
+* **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))
+
+
+
## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14)
@@ -46,28 +246,12 @@
-## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.1) (2016-06-26)
+## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...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)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
-
-
-### 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))
@@ -76,6 +260,7 @@
* **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
@@ -83,6 +268,13 @@
* **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 78ad3045b..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,14 +102,95 @@ 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.
### Cleaning the code
-You need to run `npm run tslint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
+You need to run `npm run lint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
### '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/README.md b/README.md
index 2da5cf8ed..e1be9d43d 100644
--- a/README.md
+++ b/README.md
@@ -17,9 +17,9 @@ For the full Ionic Native documentation, please visit [http://ionicframework.com
Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754), providing a common interface for all plugins and ensuring that native events trigger change detection in Angular 2.
```
-import {Geolocation} from 'ionic-native';
+import { Geolocation } from 'ionic-native';
-Geolocation.getCurrentPosition().then(pos => {
+Geolocation.getCurrentPosition().then(pos => {
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);
});
@@ -31,13 +31,50 @@ let watch = Geolocation.watchPosition().subscribe(pos => {
watch.unsubscribe();
```
+### Angular 1
+
+Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCordova` as our module.
+
+As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`:
+
+```javascript
+angular.module('myApp', ['ionic', 'ionic.native'])
+
+.controller('MyCtrl', function($scope, $cordovaCamera) {
+ $scope.takePicture = function() {
+ $cordovaCamera.getPicture(opts).then(function(p) {
+ }, function(err) {
+ });
+ };
+});
+```
+
+For services that return observables, the Angular 1 digest cycle must be done manually (currently):
+
+```javascript
+angular.module('myApp', ['ionic', 'ionic.native'])
+
+.controller('MyCtrl', function($scope, $cordovaGeolocation) {
+ $scope.takePicture = function() {
+ $cordovaGeolocation.watchPosition(opts).subscribe(function(p) {
+ $scope.$apply(function() {
+ $scope.position = p.coords;
+ });
+ }, function(err) {
+ });
+ };
+});
+```
+
### Runtime Diagnostics
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
+
+
## Installation
-Run following commmand to install ionic-native in your project.
+Run following commmand to install ionic-native in your project.
```
npm install ionic-native --save
```
diff --git a/TEMPLATE b/TEMPLATE
new file mode 100644
index 000000000..4b8667d0b
--- /dev/null
+++ b/TEMPLATE
@@ -0,0 +1,50 @@
+/**
+ * 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({
+ 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/gulpfile.js b/gulpfile.js
index e7ae40909..eaaf8e872 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('gulp-tslint');
+var tslint = require('ionic-gulp-tslint');
+var decamelize = require('decamelize');
+var replace = require('gulp-replace');
var flagConfig = {
string: ['port', 'version', 'ngVersion', 'animations'],
@@ -25,8 +27,17 @@ gulp.task("minify:dist", function(){
.pipe(gulp.dest('./dist'));
});
-gulp.task("tslint", function(){
- gulp.src("src/**/*.ts")
- .pipe(tslint())
- .pipe(tslint.report('verbose'));
+gulp.task('lint', function() {
+ tslint({src: 'src/**/*.ts'});
+});
+
+gulp.task('plugin:create', function(){
+ if(flags.n && flags.n !== ''){
+ return gulp.src('./TEMPLATE')
+ .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/package.json b/package.json
index 31f195e08..653a247ec 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ionic-native",
- "version": "1.3.4",
+ "version": "1.3.17",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"files": [
@@ -16,13 +16,16 @@
"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",
"glob": "^6.0.4",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
+ "gulp-replace": "^0.5.4",
"gulp-tslint": "^5.0.0",
"gulp-uglify": "^1.5.4",
+ "ionic-gulp-tslint": "^1.0.0",
"lodash": "3.10.1",
"minimist": "^1.1.3",
"mkdirp": "^0.5.1",
@@ -30,18 +33,19 @@
"q": "1.4.1",
"semver": "^5.0.1",
"tslint": "^3.8.1",
- "tslint-eslint-rules": "^1.3.0",
+ "tslint-ionic-rules": "0.0.5",
"typescript": "^1.8.10"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
- "tslint": "./node_modules/.bin/gulp tslint",
+ "lint": "./node_modules/.bin/gulp lint",
"watch": "./node_modules/.bin/tsc -w",
- "build": "npm run tslint && npm run build:js && npm run build:bundle && npm run build:minify",
+ "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"
+ "changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
+ "plugin:create": "gulp plugin:create"
},
"repository": {
"type": "git",
diff --git a/scripts/bower.json b/scripts/bower.json
new file mode 100644
index 000000000..678bac591
--- /dev/null
+++ b/scripts/bower.json
@@ -0,0 +1,26 @@
+{
+ "name": "ionic-native",
+ "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
+ "main": [
+ "ionic.native.js"
+ ],
+ "authors": [
+ "Max Lynch "
+ ],
+ "license": "MIT",
+ "keywords": [
+ "ionic",
+ "native",
+ "html5",
+ "hybrid",
+ "mobile"
+ ],
+ "homepage": "https://github.com/driftyco/ionic-native-bower",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ]
+}
diff --git a/scripts/bower.sh b/scripts/bower.sh
new file mode 100644
index 000000000..cf70d3731
--- /dev/null
+++ b/scripts/bower.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+set -e
+
+
+# readJsonProp(jsonFile, property)
+# - restriction: property needs to be on an own line!
+function readJsonProp {
+ echo $(sed -En 's/.*"'$2'"[ ]*:[ ]*"(.*)".*/\1/p' $1)
+}
+
+VERSION=$(readJsonProp "package.json" "version")
+
+echo "BOWERING IONIC-NATIVE VERSION $VERSION. FOR GREAT JUSTICE..."
+
+DIR="scripts/ionic-native-bower"
+rm -rf $DIR
+mkdir $DIR
+cp dist/ionic.native.js dist/ionic.native.min.js $DIR
+cd $DIR
+git init
+git remote add origin git@github.com:driftyco/ionic-native-bower.git
+cp ../bower.json .
+git add .
+git commit -m "Bower release"
+git tag -f -m v$VERSION v$VERSION
+git push -f --tags origin master
+
+echo "BOWERING COMPLETED SOMEWHAT SUCCESSFULLY"
diff --git a/src/index.ts b/src/index.ts
index b85cc9d52..2368cdeb8 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,76 +1,97 @@
-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 {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 {CardIO} from './plugins/card-io';
-import {Clipboard} from './plugins/clipboard';
-import {Contacts} from './plugins/contacts';
-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 {InAppBrowser} from './plugins/inappbrowser';
-import {InAppPurchase} from './plugins/inapppurchase';
-import {Insomnia} from './plugins/insomnia';
-import {Keyboard} from './plugins/keyboard';
-import {LaunchNavigator} from './plugins/launchnavigator';
-import {LocalNotifications} from './plugins/localnotifications';
-import {MediaPlugin} from './plugins/media';
-import {Network} from './plugins/network';
-import {OneSignal} from './plugins/onesignal';
-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 {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 {Vibration} from './plugins/vibration';
-import {WebIntent} from './plugins/webintent';
+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 { EstimoteBeacons } from './plugins/estimote-beacons';
+import { Facebook } from './plugins/facebook';
+import { File } from './plugins/file';
+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/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 { 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 { MediaCapture } from './plugins/media-capture';
+import { NativeAudio } from './plugins/native-audio';
+import { NativeStorage } from './plugins/nativestorage';
+import { MediaPlugin } from './plugins/media';
+import { Network } from './plugins/network';
+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 { 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 { ThreeDeeTouch } from './plugins/3dtouch';
+import { Toast } from './plugins/toast';
+import { TouchID } from './plugins/touchid';
+import { TextToSpeech } from './plugins/text-to-speech';
+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 { Zip } from './plugins/zip';
export * from './plugins/3dtouch';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
@@ -83,24 +104,33 @@ export * from './plugins/datepicker';
export * from './plugins/device';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
+export * from './plugins/facebook';
+export * from './plugins/file';
export * from './plugins/filetransfer';
+export * from './plugins/geolocation';
export * from './plugins/googlemaps';
export * from './plugins/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
+export * from './plugins/imageresizer';
export * from './plugins/inappbrowser';
export * from './plugins/launchnavigator';
export * from './plugins/localnotifications';
export * from './plugins/media';
+export * from './plugins/media-capture';
export * from './plugins/printer';
export * from './plugins/push';
export * from './plugins/safari-view-controller';
export * from './plugins/sms';
export * from './plugins/spinnerdialog';
export * from './plugins/toast';
+export * from './plugins/twitter-connect';
+export * from './plugins/video-editor';
+export * from './plugins/video-player';
export {
ActionSheet,
AdMob,
+ AndroidFingerprintAuth,
AppAvailability,
AppRate,
AppVersion,
@@ -111,36 +141,48 @@ export {
Brightness,
BLE,
BluetoothSerial,
+ CameraPreview,
Clipboard,
+ Crop,
DBMeter,
Deeplinks,
DeviceAccounts,
Dialogs,
Diagnostic,
EmailComposer,
- Facebook,
+ EstimoteBeacons,
File,
Flashlight,
- Geolocation,
+ Geofence,
Globalization,
GooglePlus,
GoogleAnalytics,
Hotspot,
InAppPurchase,
Insomnia,
+ Instagram,
Keyboard,
+ NativeAudio,
+ NativeStorage,
Network,
OneSignal,
+ PhotoViewer,
+ ScreenOrientation,
PinDialog,
Screenshot,
+ SecureStorage,
+ Shake,
SocialSharing,
+ Sim,
Splashscreen,
SQLite,
StatusBar,
TouchID,
Transfer,
+ TextToSpeech,
Vibration,
- WebIntent
+ WebIntent,
+ Zip
}
export * from './plugins/plugin';
@@ -149,6 +191,7 @@ export * from './plugins/plugin';
window['IonicNative'] = {
ActionSheet: ActionSheet,
AdMob: AdMob,
+ AndroidFingerprintAuth: AndroidFingerprintAuth,
AppAvailability: AppAvailability,
AppRate: AppRate,
AppVersion: AppVersion,
@@ -163,9 +206,11 @@ window['IonicNative'] = {
BluetoothSerial: BluetoothSerial,
Calendar: Calendar,
Camera: Camera,
+ CameraPreview: CameraPreview,
CardIO: CardIO,
Clipboard: Clipboard,
Contacts: Contacts,
+ Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
@@ -176,9 +221,11 @@ window['IonicNative'] = {
Dialogs: Dialogs,
Diagnostic: Diagnostic,
EmailComposer: EmailComposer,
+ EstimoteBeacons: EstimoteBeacons,
Facebook: Facebook,
File: File,
Flashlight: Flashlight,
+ Geofence: Geofence,
Geolocation: Geolocation,
Globalization: Globalization,
GooglePlus: GooglePlus,
@@ -188,19 +235,30 @@ window['IonicNative'] = {
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
+ ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser,
InAppPurchase: InAppPurchase,
+ Instagram: Instagram,
+ IsDebug: IsDebug,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications,
+ MediaCapture: MediaCapture,
MediaPlugin: MediaPlugin,
+ NativeAudio: NativeAudio,
+ NativeStorage: NativeStorage,
Network: Network,
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
+ PhotoViewer: PhotoViewer,
+ ScreenOrientation: ScreenOrientation,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
+ SecureStorage: SecureStorage,
+ Shake: Shake,
+ Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
SpinnerDialog: SpinnerDialog,
@@ -211,8 +269,13 @@ window['IonicNative'] = {
Toast: Toast,
TouchID: TouchID,
Transfer: Transfer,
+ TextToSpeech: TextToSpeech,
+ TwitterConnect: TwitterConnect,
+ VideoEditor: VideoEditor,
+ VideoPlayer: VideoPlayer,
Vibration: Vibration,
- WebIntent: WebIntent
+ WebIntent: WebIntent,
+ Zip: Zip
};
initAngular1(window['IonicNative']);
diff --git a/src/ng1.ts b/src/ng1.ts
index 9bca81165..384bd02f8 100644
--- a/src/ng1.ts
+++ b/src/ng1.ts
@@ -3,7 +3,7 @@ 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) {
@@ -15,14 +15,11 @@ export function initAngular1(plugins) {
(function(serviceName, cls, name) {
window.angular.module('ionic.native').service(serviceName, [function() {
- let funcs = {};
- for (var k in cls) {
- funcs[k] = cls[k];
- }
- funcs['name'] = name;
+ var funcs = window.angular.copy(cls);
+ funcs.prototype['name'] = name;
return funcs;
}]);
})(serviceName, cls, name);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts
index 9f83f75dd..0288a28df 100644
--- a/src/plugins/3dtouch.ts
+++ b/src/plugins/3dtouch.ts
@@ -1,19 +1,22 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
+
declare var window: any;
+
/**
* @name 3DTouch
* @description
* @usage
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
* ```
- * import {ThreeDeeTouch} from 'ionic-native';
+ * import { ThreeDeeTouch } from 'ionic-native';
*
* // import for type completion on variables
- * import {ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native';
+ * import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
* ...
*
- * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)):
+ * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
*
* ThreeDeeTouch.watchForceTouches()
* .subscribe(
@@ -54,7 +57,7 @@ declare var window: any;
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
* (payload) => {
* // returns an object that is the button you presed
- * console.log(`Pressed the ${payload.title} button`)
+ * console.log('Pressed the ${payload.title} button')
* console.log(payload.type)
*
* }
@@ -62,81 +65,85 @@ declare var window: any;
* ```
*/
@Plugin({
- plugin: 'cordova-plugin-3dtouch',
- pluginRef: 'ThreeDeeTouch',
- repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
- platforms: ['iOS']
+ plugin: 'cordova-plugin-3dtouch',
+ pluginRef: 'ThreeDeeTouch',
+ repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
+ platforms: ['iOS']
})
export class ThreeDeeTouch {
- /**
- * You need an iPhone 6S or some future tech to use the features of this plugin, so you can check at runtime if the user's device is supported.
- * @returns {Promise} returns a promise that resolves with a boolean that indicates whether the plugin is available or not
- */
- @Cordova()
- static isAvailable(): Promise {return; }
+ /**
+ * You need an iPhone 6S or some future tech to use the features of this plugin, so you can check at runtime if the user's device is supported.
+ * @returns {Promise} returns a promise that resolves with a boolean that indicates whether the plugin is available or not
+ */
+ @Cordova()
+ static isAvailable(): Promise { return; }
- /**
- * You can get a notification when the user force touches the webview. The plugin defines a Force Touch when at least 75% of the maximum force is applied to the screen. Your app will receive the x and y coordinates, so you have to figure out which UI element was touched.
- * @returns {Observable} Returns an observable that sends a `ThreeDeeTouchForceTouch` object
- */
- @Cordova({
- observable: true
- })
- static watchForceTouches(): Observable {return; }
+ /**
+ * You can get a notification when the user force touches the webview. The plugin defines a Force Touch when at least 75% of the maximum force is applied to the screen. Your app will receive the x and y coordinates, so you have to figure out which UI element was touched.
+ * @returns {Observable} Returns an observable that sends a `ThreeDeeTouchForceTouch` object
+ */
+ @Cordova({
+ observable: true
+ })
+ static watchForceTouches(): Observable { return; }
- /**
- * setup the 3D-touch actions, takes an array of objects with the following
- * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback
- * @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
- */
- @Cordova({
- sync: true
- })
- static configureQuickActions(quickActions: Array): void {}
+ /**
+ * setup the 3D-touch actions, takes an array of objects with the following
+ * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback
+ * @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
+ */
+ @Cordova({
+ sync: true
+ })
+ static configureQuickActions(quickActions: Array): void { }
- /**
- * When a home icon is pressed, your app launches and this JS callback is invoked.
- * @returns {Observable} returns an observable that notifies you when he user presses on the home screen icon
- */
- static onHomeIconPressed(): Observable {
- return new Observable(observer => {
- if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
- else {
- observer.error('3dTouch plugin is not available.');
- observer.complete();
- }
- });
- }
+ /**
+ * When a home icon is pressed, your app launches and this JS callback is invoked.
+ * @returns {Observable} returns an observable that notifies you when he user presses on the home screen icon
+ */
+ static onHomeIconPressed(): Observable {
+ return new Observable(observer => {
+ if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) {
+ window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
+ } else {
+ observer.error('3dTouch plugin is not available.');
+ observer.complete();
+ }
+ });
+ }
- /**
- * Enable Link Preview.
- * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
- */
- @Cordova({
- sync: true
- })
- static enableLinkPreview(): void {}
+ /**
+ * Enable Link Preview.
+ * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
+ */
+ @Cordova({
+ sync: true
+ })
+ static enableLinkPreview(): void { }
+
+ /**
+ * Disabled the link preview feature, if enabled.
+ */
+ @Cordova({
+ sync: true
+ })
+ static disableLinkPreview(): void { }
- /**
- * Disabled the link preview feature, if enabled.
- */
- @Cordova({
- sync: true
- })
- static disableLinkPreview(): void {}
}
+
export interface ThreeDeeTouchQuickAction {
- type?: string;
- title: string;
- subtitle?: string;
- iconType?: string;
+ type?: string;
+ title: string;
+ subtitle?: string;
+ iconType?: string;
}
+
export interface ThreeDeeTouchForceTouch {
- force: number;
- timestamp: number;
- x: number;
- y: number;
+ force: number;
+ timestamp: number;
+ x: number;
+ y: number;
}
diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts
index 9019e194a..c5f457868 100644
--- a/src/plugins/actionsheet.ts
+++ b/src/plugins/actionsheet.ts
@@ -1,4 +1,5 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
+
/**
* @name Action Sheet
@@ -8,8 +9,9 @@ import {Plugin, Cordova} from './plugin';
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
*
* @usage
- * ```ts
- * import {ActionSheet} from 'ionic-native';
+ * ```typescript
+ * import { ActionSheet } from 'ionic-native';
+ *
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
@@ -17,8 +19,8 @@ import {Plugin, Cordova} from './plugin';
* 'buttonLabels': buttonLabels,
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
- * }).then(buttonIndex => {
- * console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
+ * }).then((buttonIndex: number) => {
+ * console.log('Button pressed: ' + buttonIndex);
* });
* ```
*
@@ -71,4 +73,5 @@ export class ActionSheet {
*/
@Cordova()
static hide(options?: any): Promise { return; }
+
}
diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts
index 1830e61e1..1c825b305 100644
--- a/src/plugins/admob.ts
+++ b/src/plugins/admob.ts
@@ -1,5 +1,5 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
/**
* @name AdMob
@@ -22,7 +22,7 @@ export class AdMob {
* @param adIdOrOptions
*/
@Cordova()
- static createBanner(adIdOrOptions: any): Promise {return; }
+ static createBanner(adIdOrOptions: any): Promise { return; }
/**
*
@@ -30,7 +30,7 @@ export class AdMob {
@Cordova({
sync: true
})
- static removeBanner(): void {}
+ static removeBanner(): void { }
/**
*
@@ -39,7 +39,7 @@ export class AdMob {
@Cordova({
sync: true
})
- static showBanner(position: any): void {}
+ static showBanner(position: any): void { }
/**
*
@@ -49,7 +49,7 @@ export class AdMob {
@Cordova({
sync: true
})
- static showBannerAtXY(x: number, y: number): void {}
+ static showBannerAtXY(x: number, y: number): void { }
/**
*
@@ -57,14 +57,14 @@ export class AdMob {
@Cordova({
sync: true
})
- static hideBanner(): void {}
+ static hideBanner(): void { }
/**
*
* @param adIdOrOptions
*/
@Cordova()
- static prepareInterstitial(adIdOrOptions: any): Promise {return; }
+ static prepareInterstitial(adIdOrOptions: any): Promise { return; }
/**
* Show interstitial
@@ -72,20 +72,20 @@ export class AdMob {
@Cordova({
sync: true
})
- static showInterstitial(): void {}
+ static showInterstitial(): void { }
/**
*
*/
@Cordova()
- static isInterstitialReady (): Promise {return; }
+ static isInterstitialReady(): Promise { return; }
/**
* Prepare a reward video ad
* @param adIdOrOptions
*/
@Cordova()
- static prepareRewardVideoAd(adIdOrOptions: any): Promise {return; }
+ static prepareRewardVideoAd(adIdOrOptions: any): Promise { return; }
/**
* Show a reward video ad
@@ -100,14 +100,14 @@ export class AdMob {
* @param options Returns a promise that resolves if the options are set successfully
*/
@Cordova()
- static setOptions(options: any): Promise {return; }
+ static setOptions(options: any): Promise { return; }
/**
* Get user ad settings
* @returns {Promise} Returns a promise that resolves with the ad settings
*/
@Cordova()
- static getAdSettings(): Promise {return; }
+ static getAdSettings(): Promise { return; }
// Events
@@ -115,65 +115,65 @@ export class AdMob {
eventObservable: true,
event: 'onBannerFailedToReceive'
})
- static onBannerFailedToReceive (): Observable {return; }
+ static onBannerFailedToReceive(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onBannerReceive'
})
- static onBannerReceive (): Observable {return; }
+ static onBannerReceive(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onBannerPresent'
})
- static onBannerPresent (): Observable {return; }
+ static onBannerPresent(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onBannerLeaveApp'
})
- static onBannerLeaveApp (): Observable {return; }
+ static onBannerLeaveApp(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onBannerDismiss'
})
- static onBannerDismiss (): Observable {return; }
+ static onBannerDismiss(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialFailedToReceive'
})
- static onInterstitialFailedToReceive (): Observable {return; }
+ static onInterstitialFailedToReceive(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialReceive'
})
- static onInterstitialReceive (): Observable {return; }
+ static onInterstitialReceive(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialPresent'
})
- static onInterstitialPresent (): Observable {return; }
+ static onInterstitialPresent(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialLeaveApp'
})
- static onInterstitialLeaveApp (): Observable {return; }
+ static onInterstitialLeaveApp(): Observable { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialDismiss'
})
- static onInterstitialDismiss (): Observable {return; }
+ static onInterstitialDismiss(): Observable { return; }
}
diff --git a/src/plugins/android-fingerprint-auth.ts b/src/plugins/android-fingerprint-auth.ts
new file mode 100644
index 000000000..d75713ac7
--- /dev/null
+++ b/src/plugins/android-fingerprint-auth.ts
@@ -0,0 +1,77 @@
+import { Cordova, Plugin } from './plugin';
+/**
+ * @name Android Fingerprint Auth
+ * @description
+ * This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
+ * @usage
+ * ```typescript
+ * import { AndroidFingerprintAuth } from 'ionic-native';
+ *
+ * AndroidFingerprintAuth.isAvailable()
+ * .then((result)=> {
+ * if(result.isAvailable){
+ * // it is available
+ *
+ * AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" })
+ * .then(result => {
+ * if(result.withFingerprint) {
+ * console.log('Successfully authenticated with fingerprint!');
+ * } else if(result.withPassword) {
+ * console.log('Successfully authenticated with backup password!');
+ * } else console.log('Didn\'t authenticate!');
+ * })
+ * .catch(error => console.error(error));
+ *
+ * } else {
+ * // fingerprint auth isn't available
+ * }
+ * })
+ * .catch(error => console.error(error));
+ * ```
+ */
+@Plugin({
+ plugin: 'cordova-plugin-android-fingerprint-auth',
+ pluginRef: 'FingerprintAuth',
+ repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
+})
+export class AndroidFingerprintAuth {
+ /**
+ * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
+ * @param params {any}
+ */
+ @Cordova()
+ static show(params: {
+ /**
+ * Used as the alias for your key in the Android Key Store.
+ */
+ clientId: string;
+ /**
+ * Used to encrypt the token returned upon successful fingerprint authentication.
+ */
+ clientSecret: string;
+ /**
+ * Set to true to remove the "USE BACKUP" button
+ */
+ disableBackup?: boolean;
+ /**
+ * Change the language. (en_US or es)
+ */
+ locale?: string
+ }): Promise<{
+ /**
+ * Base64 encoded string
+ */
+ withFingerprint: string;
+ /**
+ *
+ */
+ withPassword: boolean;
+ }> {return; }
+
+ /**
+ * Check if service is available
+ */
+ @Cordova()
+ static isAvailable(): Promise<{isAvailable: boolean}> {return; }
+
+}
diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts
index 11283d902..58232e203 100644
--- a/src/plugins/appavailability.ts
+++ b/src/plugins/appavailability.ts
@@ -1,4 +1,4 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name App Availability
@@ -8,22 +8,22 @@ import {Plugin, Cordova} from './plugin';
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
*
* @usage
- * ```js
- * import {AppAvailability} from 'ionic-native';
+ * ```typescript
+ * import { AppAvailability } from 'ionic-native';
*
*
- * var app;
+ * let app;
*
- * if(device.platform === 'iOS') {
+ * if (device.platform === 'iOS') {
* app = 'twitter://';
- * }else if(device.platform === 'Android'){
+ * } else if (device.platform === 'Android') {
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* .then(
- * yes => console.log(app + " is available"),
- * no => console.log(app + " is NOT available")
+ * (yes: string) => console.log(app + ' is available'),
+ * (no: string) => console.log(app + ' is NOT available')
* );
* ```
*/
diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts
index fcdbfb088..91cd59f79 100644
--- a/src/plugins/apprate.ts
+++ b/src/plugins/apprate.ts
@@ -1,4 +1,5 @@
-import {Plugin, Cordova, CordovaProperty} from './plugin';
+import { Cordova, CordovaProperty, Plugin } from './plugin';
+
declare var window;
@@ -10,14 +11,14 @@ declare var window;
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
*
* @usage
- * ```js
- * import {AppRate} from 'ionic-native';
+ * ```typescript
+ * import { AppRate } from 'ionic-native';
*
+ * AppRate.preferences.storeAppURL = {
+ * ios: '',
+ * android: 'market://details?id=',
+ * };
*
- * AppRate.preferences.storeAppURL.ios = '';
- * AppRate.preferences.storeAppURL.android = 'market://details?id=';
- * AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/';
- * AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=';
* AppRate.promptForRating();
* ```
*
@@ -62,6 +63,6 @@ export class AppRate {
* @param {boolean} immediately Show the rating prompt immediately.
*/
@Cordova()
- static promptForRating(immediately: boolean): void {};
+ static promptForRating(immediately: boolean): void { };
}
diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts
index 385280d34..644f9657b 100644
--- a/src/plugins/appversion.ts
+++ b/src/plugins/appversion.ts
@@ -1,4 +1,4 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name App Version
@@ -8,8 +8,8 @@ import {Plugin, Cordova} from './plugin';
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
*
* @usage
- * ```js
- * import {AppVersion} from 'ionic-native';
+ * ```typescript
+ * import { AppVersion } from 'ionic-native';
*
*
* AppVersion.getAppName();
diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts
index 9ed15e67f..bafbb8966 100644
--- a/src/plugins/background-geolocation.ts
+++ b/src/plugins/background-geolocation.ts
@@ -1,5 +1,4 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
declare var window;
@@ -88,7 +87,7 @@ export interface Config {
* When enabled, the plugin will emit sounds for life-cycle events of
* background-geolocation! See debugging sounds table.
*/
- debug: boolean;
+ debug?: boolean;
/**
* The minimum distance (measured in meters) a device must move horizontally
@@ -99,7 +98,9 @@ export interface Config {
/**
* IOS, ANDROID ONLY
* Enable this in order to force a stop() when the application terminated
- * (e.g. on iOS, double-tap home button, swipe away the app).
+ * (e.g. on iOS, double-tap home button, swipe away the app).o
+ *
+ * Defaults to true
*/
stopOnTerminate?: boolean;
@@ -110,7 +111,7 @@ export interface Config {
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
* for more information
*/
- locationTimeout?: number;
+ interval?: number;
/**
* ANDROID ONLY
@@ -141,7 +142,7 @@ export interface Config {
* ANDROID ONLY
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
*/
- locationService?: number;
+ locationProvider?: number;
/**
* IOS ONLY
@@ -161,9 +162,8 @@ export interface Config {
*
* @usage
*
- * ```ts
- * import {BackgroundGeolocation} from 'ionic-native';
- *
+ * ```typescript
+ * import { BackgroundGeolocation } from 'ionic-native';
*
*
* // When device is ready :
@@ -178,18 +178,19 @@ export interface Config {
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
* };
*
- * BackgroundGeolocation.configure(config)
- * .then((location) => {
- * console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
- *
- * // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
- * // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
- * // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
- * BackgroundGeolocation.finish(); // FOR IOS ONLY
- * })
- * .catch((error) => {
- * console.log('BackgroundGeolocation error');
- * });
+ * BackgroundGeolocation.configure((location) => {
+ console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
+
+ // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
+ // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
+ // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
+ BackgroundGeolocation.finish(); // FOR IOS ONLY
+
+ * }, (error) => {
+ * console.log('BackgroundGeolocation error');
+ * }, {
+ * //options
+ * });
*
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
* BackgroundGeolocation.start();
@@ -219,9 +220,9 @@ export class BackgroundGeolocation {
* Options a json object of type Config
*/
@Cordova({
- callbackOrder: 'reverse'
+ sync: true
})
- static configure(options: Config): Promise { return; }
+ static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
/**
diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts
index 9bc7f9b80..9db7f4c86 100644
--- a/src/plugins/backgroundmode.ts
+++ b/src/plugins/backgroundmode.ts
@@ -1,4 +1,4 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name Background Mode
@@ -6,8 +6,8 @@ import {Plugin, Cordova} from './plugin';
* 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
*@usage
-* ```js
-* import {BackgroundMode} from 'ionic-native';
+* ```typescript
+* import { BackgroundMode } from 'ionic-native';
*
* BackgroundMode.enable();
* ```
@@ -39,28 +39,28 @@ export class BackgroundMode {
@Cordova({
sync: true
})
- static enable(): void {}
+ static enable(): void { }
- /**
- * Disable the background mode.
- * Once the background mode has been disabled, the app will be paused when in background.
- */
+ /**
+ * Disable the background mode.
+ * Once the background mode has been disabled, the app will be paused when in background.
+ */
@Cordova()
- static disable(): void {}
+ static disable(): void { }
/**
* Checks if background mode is enabled or not.
* @returns {boolean} returns a true of false if the background mode is enabled.
*/
@Cordova()
- static isEnabled(): Promise {return; }
+ 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.
*/
@Cordova()
- static isActive(): Promise {return; }
+ static isActive(): Promise { return; }
/**
* Override the default title, ticker and text.
@@ -70,7 +70,7 @@ export class BackgroundMode {
@Cordova({
platforms: ['Android']
})
- static setDefaults(options?: Configure): void {}
+ static setDefaults(options?: Configure): void { }
/**
* Modify the displayed information.
@@ -80,17 +80,18 @@ export class BackgroundMode {
@Cordova({
platforms: ['Android']
})
- static update(options?: Configure): void {}
+ static update(options?: Configure): void { }
/**
* 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
+ * @param {string} eventName The name of the event. Available events: activate, deactivate, failure
*/
@Cordova({
sync: true
})
- static on(eventName: string, callback: any): void {}
+ static on(eventName: string, callback: any): void { }
+
}
/**
diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts
index ed79016a0..c188d273e 100644
--- a/src/plugins/badge.ts
+++ b/src/plugins/badge.ts
@@ -1,4 +1,4 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name Badge
@@ -8,8 +8,8 @@ import {Plugin, Cordova} from './plugin';
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
*
* @usage
- * ```js
- * import {Badge} from 'ionic-native';
+ * ```typescript
+ * import { Badge } from 'ionic-native';
*
*
* Badge.set(10);
@@ -74,4 +74,5 @@ export class Badge {
*/
@Cordova()
static registerPermission(): Promise { return; }
+
}
diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts
index 584ffb071..65b4227ff 100644
--- a/src/plugins/barcodescanner.ts
+++ b/src/plugins/barcodescanner.ts
@@ -1,4 +1,4 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name Barcode Scanner
@@ -8,8 +8,8 @@ import {Plugin, Cordova} from './plugin';
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
- * ```js
- * import {BarcodeScanner} from 'ionic-native';
+ * ```typescript
+ * import { BarcodeScanner } from 'ionic-native';
*
*
* BarcodeScanner.scan().then((barcodeData) => {
@@ -38,6 +38,7 @@ export class BarcodeScanner {
};
/**
* Open the barcode scanner.
+ * @param options {Object} Optional options to pass to the scanner
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
@Cordova({
@@ -48,10 +49,10 @@ 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
*/
@Cordova()
- static encode(type: string, data: any): Promise {return; }
+ static encode(type: string, data: any): Promise { return; }
}
diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts
index c786f0078..6e5f63365 100644
--- a/src/plugins/base64togallery.ts
+++ b/src/plugins/base64togallery.ts
@@ -1,15 +1,15 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
* @usage
- * ```ts
- * import {Base64ToGallery} from 'ionic-native';
+ * ```typescript
+ * import { Base64ToGallery } from 'ionic-native';
*
*
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
- * res => console.log("Saved image to gallery ", res),
- * err => console.log("Error saving image to gallery ", err)
+ * res => console.log('Saved image to gallery ', res),
+ * err => console.log('Error saving image to gallery ', err)
* );
* ```
*/
@@ -24,11 +24,11 @@ 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 {sstring} prefix Prefix the file with a string. Default is 'img_'. Optional.
+ * @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()
- static base64ToGallery(data: string , prefix?: string ): Promise {
+ static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise {
return;
}
diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts
index 4758ad72f..c70beae60 100644
--- a/src/plugins/batterystatus.ts
+++ b/src/plugins/batterystatus.ts
@@ -1,5 +1,5 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
/**
* @name Battery Status
@@ -7,14 +7,13 @@ import {Observable} from 'rxjs/Observable';
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
*
* @usage
- * ```js
- * import {BatteryStatus} from 'ionic-native';
- *
+ * ```typescript
+ * import { BatteryStatus } from 'ionic-native';
*
*
* // watch change in battery status
* let subscription = BatteryStatus.onChange().subscribe(
- * status => {
+ * (status: StatusObject) => {
* console.log(status.level, status.isPlugged);
* }
* );
@@ -39,7 +38,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterystatus'
})
- static onChange (): Observable {return; }
+ static onChange(): Observable { return; }
/**
* Watch when the battery level goes low
@@ -49,7 +48,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterylow'
})
- static onLow (): Observable {return; }
+ static onLow(): Observable { return; }
/**
* Watch when the battery level goes to critial
@@ -59,7 +58,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterycritical'
})
- static onCritical (): Observable {return; }
+ static onCritical(): Observable { return; }
}
diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts
index c4bf4e7c4..6df9f2f6d 100644
--- a/src/plugins/ble.ts
+++ b/src/plugins/ble.ts
@@ -1,5 +1,5 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
/**
* @name BLE
@@ -24,7 +24,7 @@ import {Observable} from 'rxjs/Observable';
*
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
*
- * ```ts
+ * ```typescript
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
@@ -34,7 +34,7 @@ import {Observable} from 'rxjs/Observable';
* ```
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
*
- * ```ts
+ * ```typescript
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
@@ -93,7 +93,7 @@ import {Observable} from 'rxjs/Observable';
*
* ### Android
*
- * ```ts
+ * ```typescript
* {
* "name": "demo",
* "id": "00:1A:7D:DA:71:13",
@@ -108,7 +108,7 @@ import {Observable} from 'rxjs/Observable';
*
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
*
- * ```ts
+ * ```typescript
* {
* "name": "demo",
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
@@ -137,7 +137,7 @@ import {Observable} from 'rxjs/Observable';
*
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
*
- * ```ts
+ * ```typescript
* // ASCII only
* function stringToBytes(string) {
* var array = new Uint8Array(string.length);
@@ -272,7 +272,7 @@ export class BLE {
deviceId: string,
serviceUUID: string,
characteristicUUID: string
- ): Promise { return; };
+ ): Promise { return; };
/**
* Write the value of a characteristic.
@@ -308,7 +308,7 @@ export class BLE {
serviceUUID: string,
characteristicUUID: string,
value: ArrayBuffer
- ): Promise { return; }
+ ): Promise { return; }
/**
* Write the value of a characteristic without waiting for confirmation from the peripheral.
@@ -325,7 +325,7 @@ export class BLE {
serviceUUID: string,
characteristicUUID: string,
value: ArrayBuffer
- ): Promise { return; }
+ ): Promise { return; }
/**
* Register to be notified when the value of a characteristic changes.
@@ -351,7 +351,7 @@ export class BLE {
deviceId: string,
serviceUUID: string,
characteristicUUID: string
- ): Observable { return; }
+ ): Observable { return; }
/**
* Stop being notified when the value of a characteristic changes.
@@ -366,7 +366,7 @@ export class BLE {
deviceId: string,
serviceUUID: string,
characteristicUUID: string
- ): Promise { return; }
+ ): Promise { return; }
/**
* Report the connection status.
diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts
index 20726b987..069fed3f3 100644
--- a/src/plugins/bluetoothserial.ts
+++ b/src/plugins/bluetoothserial.ts
@@ -1,16 +1,19 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
/**
* @name Bluetooth Serial
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
* @usage
- * ```ts
+ * ```typescript
+ * import { BluetoothSerial } from 'ionic-native';
+ *
+ *
* // Write a string
- * Bluetooth.write("hello world").then(success, failure);
+ * BluetoothSerial.write("hello world").then(success, failure);
*
* // Array of int or bytes
- * Bluetooth.write([186, 220, 222]).then(success, failure);
+ * BluetoothSerial.write([186, 220, 222]).then(success, failure);
*
* // Typed Array
* var data = new Uint8Array(4);
@@ -18,10 +21,10 @@ import {Observable} from 'rxjs/Observable';
* data[1] = 0x42;
* data[2] = 0x43;
* data[3] = 0x44;
- * Bluetooth.write(data).then(success, failure);
+ * BluetoothSerial.write(data).then(success, failure);
*
* // Array Buffer
- * Bluetooth.write(data.buffer).then(success, failure);
+ * BluetoothSerial.write(data.buffer).then(success, failure);
* ```
*/
@Plugin({
@@ -42,7 +45,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'disconnect'
})
- static connect (macAddress_or_uuid: string): Observable {return; }
+ static connect(macAddress_or_uuid: string): Observable { return; }
/**
* Connect insecurely to a Bluetooth device
@@ -54,7 +57,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'disconnect'
})
- static connectInsecure (macAddress: string): Observable {return; }
+ static connectInsecure(macAddress: string): Observable { return; }
/**
* Writes data to the serial port
@@ -64,7 +67,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static write (data: any): Promise {return; }
+ static write(data: any): Promise { return; }
/**
* Gets the number of bytes of data available
@@ -72,7 +75,7 @@ export class BluetoothSerial {
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
- }) static available (): Promise {return; }
+ }) static available(): Promise { return; }
/**
* Reads data from the buffer
@@ -81,7 +84,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static read (): Promise {return; }
+ static read(): Promise { return; }
/**
* Reads data from the buffer until it reaches a delimiter
@@ -91,7 +94,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static readUntil (delimiter: string): Promise {return; }
+ static readUntil(delimiter: string): Promise { return; }
/**
* Subscribe to be notified when data is received
@@ -103,7 +106,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'unsubscribe'
})
- static subscribe (delimiter: string): Observable {return; }
+ static subscribe(delimiter: string): Observable { return; }
/**
* Subscribe to be notified when data is received
@@ -114,7 +117,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'unsubscribeRawData'
})
- static subscribeRawData (): Observable {return; }
+ static subscribeRawData(): Observable { return; }
/**
* Clears data in buffer
@@ -123,7 +126,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static clear (): Promise {return; }
+ static clear(): Promise { return; }
/**
* Lists bonded devices
@@ -132,7 +135,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static list (): Promise {return; }
+ static list(): Promise { return; }
/**
* Reports if bluetooth is enabled
@@ -141,7 +144,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static isEnabled (): Promise {return; }
+ static isEnabled(): Promise { return; }
/**
* Reports the connection status
@@ -150,7 +153,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static isConnected (): Promise {return; }
+ static isConnected(): Promise { return; }
/**
* Reads the RSSI from the connected peripheral
@@ -159,7 +162,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static readRSSI (): Promise {return; }
+ static readRSSI(): Promise { return; }
/**
* Show the Bluetooth settings on the device
@@ -168,7 +171,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static showBluetoothSettings (): Promise {return; }
+ static showBluetoothSettings(): Promise { return; }
/**
* Enable Bluetooth on the device
@@ -177,7 +180,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static enable (): Promise {return; }
+ static enable(): Promise { return; }
/**
* Discover unpaired devices
@@ -186,7 +189,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
- static discoverUnpaired (): Promise {return; }
+ static discoverUnpaired(): Promise { return; }
/**
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
@@ -197,7 +200,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'clearDeviceDiscoveredListener'
})
- static setDeviceDiscoveredListener (): Observable {return; }
+ static setDeviceDiscoveredListener(): Observable { return; }
/**
* Sets the human readable device name that is broadcasted to other devices
@@ -207,7 +210,7 @@ export class BluetoothSerial {
platforms: ['Android'],
sync: true
})
- static setName (newName: string): void {}
+ static setName(newName: string): void { }
/**
* Makes the device discoverable by other devices
@@ -217,5 +220,6 @@ export class BluetoothSerial {
platforms: ['Android'],
sync: true
})
- static setDiscoverable (discoverableDuration: number): void {}
+ static setDiscoverable(discoverableDuration: number): void { }
+
}
diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts
index 2fc29d992..f23161890 100644
--- a/src/plugins/brightness.ts
+++ b/src/plugins/brightness.ts
@@ -1,4 +1,4 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
/**
* @name Brightness
@@ -8,8 +8,9 @@ import {Plugin, Cordova} from './plugin';
* Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
*
* @usage
- * ```ts
- * import {Brightness} from 'ionic-native';
+ * ```typescript
+ * import { Brightness } from 'ionic-native';
+ *
*
* let brightnessValue: number = 0.8;
* Brightness.setBrightness(brightnessValue);
@@ -17,34 +18,35 @@ import {Plugin, Cordova} from './plugin';
*
*/
@Plugin({
- plugin: 'cordova-plugin-brightness',
- pluginRef: 'plugins.brightness',
- repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
- platforms: ['Android', 'iOS']
+ plugin: 'cordova-plugin-brightness',
+ pluginRef: 'cordova.plugins.brightness',
+ repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
+ platforms: ['Android', 'iOS']
})
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.
- */
- @Cordova()
- static setBrightness(value: number): Promise { return; }
+ /**
+ * 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.
+ */
+ @Cordova()
+ static setBrightness(value: number): Promise { return; }
- /**
- * Reads the current brightness of the device display.
- *
- * @returns {Promise} Returns a Promise that resolves with the
- * brightness value of the device display (floating number between 0 and 1).
- */
- @Cordova()
- static getBrightness(): Promise { return; }
+ /**
+ * Reads the current brightness of the device display.
+ *
+ * @returns {Promise} Returns a Promise that resolves with the
+ * brightness value of the device display (floating number between 0 and 1).
+ */
+ @Cordova()
+ static getBrightness(): Promise { return; }
+
+ /**
+ * Keeps the screen on. Prevents the device from setting the screen to sleep.
+ */
+ @Cordova()
+ static setKeepScreenOn(value: boolean): void { }
- /**
- * Keeps the screen on. Prevents the device from setting the screen to sleep.
- */
- @Cordova()
- static setKeepScreenOn(value: boolean): void { }
}
diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts
index 216b4c7fc..0f09902b9 100644
--- a/src/plugins/calendar.ts
+++ b/src/plugins/calendar.ts
@@ -1,5 +1,9 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
+
+/**
+ * @private
+ */
export interface CalendarOptions {
firstReminderMinutes?: number;
secondReminderMinutes?: number;
@@ -11,11 +15,6 @@ export interface CalendarOptions {
url?: string;
}
-export interface Calendar {
- id: number;
- name: string;
-}
-
/**
* @name Calendar
* @description
@@ -23,8 +22,19 @@ export interface Calendar {
*
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
*
+ *
* @usage
- *
+ * ```
+ * import {Calendar} from 'ionic-native';
+ *
+ *
+ *
+ * Calendar.createCalendar('MyCalendar').then(
+ * (msg) => { console.log(msg); },
+ * (err) => { console.log(err); }
+ * );
+ * ```
+ *
*/
@Plugin({
plugin: 'cordova-plugin-calendar',
@@ -48,78 +58,54 @@ export class Calendar {
@Cordova()
static hasReadWritePermission(): Promise { return; }
- /**
- * Check if we have read permission
- * @returns {Promise}
- */
- @Cordova()
- static hasReadPermission(): Promise {return; }
+ /**
+ * Check if we have read permission
+ * @returns {Promise}
+ */
+ @Cordova()
+ static hasReadPermission(): Promise { return; }
- /**
- * Check if we have write permission
- * @returns {Promise}
- */
- @Cordova()
- static hasWritePermission(): Promise {return; }
+ /**
+ * Check if we have write permission
+ * @returns {Promise}
+ */
+ @Cordova()
+ static hasWritePermission(): Promise { return; }
- /**
- * Request write permission
- * @returns {Promise}
- */
- @Cordova()
- static requestWritePermission(): Promise {return; }
+ /**
+ * Request write permission
+ * @returns {Promise}
+ */
+ @Cordova()
+ static requestWritePermission(): Promise { return; }
- /**
- * Request read permission
- * @returns {Promise}
- */
- @Cordova()
- static requestReadPermission(): Promise {return; }
+ /**
+ * Request read permission
+ * @returns {Promise}
+ */
+ @Cordova()
+ static requestReadPermission(): Promise { return; }
/**
* Requests read/write permissions
* @returns {Promise}
*/
@Cordova()
- static requestReadWritePermission(): Promise {return; }
+ static requestReadWritePermission(): Promise { return; }
/**
* Create a calendar. (iOS only)
*
- * @usage
- * ```
- * import {Calendar} from 'ionic-native';
- *
- *
- *
- * Calendar.createCalendar('MyCalendar').then(
- * (msg) => { console.log(msg); },
- * (err) => { console.log(err); }
- * );
- * ```
- *
- * @param {string | Object} nameOrOptions either a string name or a options object.
- * options:
- * calendarName: string the name of the calendar
- * calendarColor: string the hex color of the calendar
- * @return Returns a Promise
+ * @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
*/
@Cordova()
static createCalendar(
nameOrOptions: string | { calendarName: string, calendarColor: string }
- ): Promise { return; }
+ ): Promise { return; }
/**
* Delete a calendar. (iOS only)
- *
- * @usage
- * ```
- * Calendar.deleteCalendar('MyCalendar').then(
- * (msg) => { console.log(msg); },
- * (err) => { console.log(err); }
- * );
- * ```
- *
* @param {string} name Name of the calendar to delete.
* @return Returns a Promise
*/
@@ -157,7 +143,6 @@ export class Calendar {
/**
* Silently create an event.
- *
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
@@ -172,7 +157,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
- ): Promise { return; }
+ ): Promise { return; }
/**
* Silently create an event with additional options.
@@ -193,7 +178,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
- ): Promise { return; }
+ ): Promise { return; }
/**
* Interactively create an event.
@@ -212,7 +197,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
- ): Promise { return; }
+ ): Promise { return; }
/**
* Interactively create an event with additional options.
@@ -233,7 +218,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
- ): Promise { return; }
+ ): Promise { return; }
// deprecated
// @Cordova()
@@ -263,11 +248,10 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
- ): Promise { return; }
+ ): Promise { return; }
/**
* Find an event with additional options.
- *
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
@@ -284,7 +268,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
- ): Promise { return; }
+ ): Promise { return; }
/**
* Find a list of events within the specified date range. (Android only)
@@ -337,7 +321,7 @@ export class Calendar {
newNotes?: string,
newStartDate?: Date,
newEndDate?: Date
- ): Promise { return; }
+ ): Promise { return; }
/**
* Modify an event with additional options. (iOS only)
@@ -355,31 +339,31 @@ export class Calendar {
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @return Returns a Promise
*/
- @Cordova()
- static modifyEventWithOptions(
- title?: string,
- location?: string,
- notes?: string,
- startDate?: Date,
- endDate?: Date,
- newTitle?: string,
- newLocation?: string,
- newNotes?: string,
- newStartDate?: Date,
- newEndDate?: Date,
- options?: CalendarOptions
- ) { return; }
+ @Cordova()
+ static modifyEventWithOptions(
+ title?: string,
+ location?: string,
+ notes?: string,
+ startDate?: Date,
+ endDate?: Date,
+ newTitle?: string,
+ newLocation?: string,
+ newNotes?: string,
+ newStartDate?: Date,
+ newEndDate?: Date,
+ options?: CalendarOptions
+ ) { return; }
- /**
- * Delete an event.
- *
- * @param {string} [title] The event title
- * @param {string} [location] The event location
- * @param {string} [notes] The event notes
- * @param {Date} [startDate] The event start date
- * @param {Date} [endDate] The event end date
- * @return Returns a Promise
- */
+ /**
+ * Delete an event.
+ *
+ * @param {string} [title] The event title
+ * @param {string} [location] The event location
+ * @param {string} [notes] The event notes
+ * @param {Date} [startDate] The event start date
+ * @param {Date} [endDate] The event end date
+ * @return Returns a Promise
+ */
@Cordova()
static deleteEvent(
title?: string,
@@ -387,7 +371,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
- ): Promise { return; }
+ ): Promise { return; }
/**
* Delete an event from the specified Calendar. (iOS only)
@@ -400,20 +384,22 @@ export class Calendar {
* @param {string} calendarName
* @return Returns a Promise
*/
- @Cordova()
- static deleteEventFromNamedCalendar(
- title?: string,
- location?: string,
- notes?: string,
- startDate?: Date,
- endDate?: Date,
- calendarName?: string
- ): Promise { return; }
+ @Cordova()
+ static deleteEventFromNamedCalendar(
+ title?: string,
+ location?: string,
+ notes?: string,
+ startDate?: Date,
+ endDate?: Date,
+ calendarName?: string
+ ): Promise { return; }
/**
* Open the calendar at the specified date.
- * @return {Date} date
+ * @param {Date} date The date you want to open the calendar on
+ * @return {Promise} Promise returns a promise
*/
@Cordova()
static openCalendar(date: Date): Promise { return; }
+
}
diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts
new file mode 100644
index 000000000..af0499f38
--- /dev/null
+++ b/src/plugins/camera-preview.ts
@@ -0,0 +1,124 @@
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
+
+export interface CameraPreviewRect {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+}
+
+export interface CameraPreviewSize {
+ maxWidth: number;
+ maxHeight: number;
+}
+
+/**
+ * @name CameraPreview
+ * @description
+ * Showing camera preview in HTML
+ *
+ * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
+ *
+ */
+@Plugin({
+ plugin: 'cordova-plugin-camera-preview',
+ pluginRef: 'cordova.plugins.camerapreview',
+ repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
+ platforms: ['Android', 'iOS']
+})
+export class CameraPreview {
+
+ /**
+ * Starts the camera preview instance.
+ * @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(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void {
+
+ };
+
+ /**
+ * Stops the camera preview instance.
+ */
+ @Cordova({
+ sync: true
+ })
+ 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 { };
+
+ /**
+ * Register a callback function that receives the original picture and the image captured from the preview box.
+ */
+ @Cordova({
+ observable: true
+ })
+ static setOnPictureTakenHandler(): Observable { return; };
+
+ /**
+ * Switch from the rear camera and front camera, if available.
+ */
+ @Cordova({
+ sync: true
+ })
+ static switchCamera(): void { };
+
+ /**
+ * Show the camera preview box.
+ */
+ @Cordova({
+ sync: true
+ })
+ static show(): void { };
+
+ /**
+ * Hide the camera preview box.
+ */
+ @Cordova({
+ sync: true
+ })
+ static hide(): void { };
+
+ /**
+ * Set the default mode for the Flash.
+ */
+ // @Cordova({
+ // sync: true
+ // })
+ // static setFlashMode(mode: number): void { };
+
+ /**
+ * Set camera color effect.
+ */
+ @Cordova({
+ sync: true
+ })
+ static setColorEffect(effect: string): void { };
+
+ /**
+ * @private
+ * @enum {number}
+ */
+ static FlashMode = {
+ OFF: 0,
+ ON: 1,
+ AUTO: 2
+ };
+
+}
diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts
index 63203f3f4..9f94df66c 100644
--- a/src/plugins/camera.ts
+++ b/src/plugins/camera.ts
@@ -1,67 +1,67 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
export interface CameraOptions {
- /** Picture quality in range 0-100. Default is 50 */
- quality?: number;
- /**
- * Choose the format of the return value.
- * Defined in navigator.camera.DestinationType. Default is FILE_URI.
- * DATA_URL : 0, Return image as base64-encoded string
- * FILE_URI : 1, Return image file URI
- * NATIVE_URI : 2 Return image native URI
- * (e.g., assets-library:// on iOS or content:// on Android)
- */
- destinationType?: number;
- /**
- * Set the source of the picture.
- * Defined in navigator.camera.PictureSourceType. Default is CAMERA.
- * PHOTOLIBRARY : 0,
- * CAMERA : 1,
- * SAVEDPHOTOALBUM : 2
- */
- sourceType?: number;
- /** Allow simple editing of image before selection. */
- allowEdit?: boolean;
- /**
- * Choose the returned image file's encoding.
- * Defined in navigator.camera.EncodingType. Default is JPEG
- * JPEG : 0 Return JPEG encoded image
- * PNG : 1 Return PNG encoded image
- */
- encodingType?: number;
- /**
- * Width in pixels to scale image. Must be used with targetHeight.
- * Aspect ratio remains constant.
- */
- targetWidth?: number;
- /**
- * Height in pixels to scale image. Must be used with targetWidth.
- * Aspect ratio remains constant.
- */
- targetHeight?: number;
- /**
- * Set the type of media to select from. Only works when PictureSourceType
- * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
- * PICTURE: 0 allow selection of still pictures only. DEFAULT.
- * Will return format specified via DestinationType
- * VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
- * ALLMEDIA : 2 allow selection from all media types
- */
- mediaType?: number;
- /** Rotate the image to correct for the orientation of the device during capture. */
- correctOrientation?: boolean;
- /** Save the image to the photo album on the device after capture. */
- saveToPhotoAlbum?: boolean;
- /**
- * Choose the camera to use (front- or back-facing).
- * Defined in navigator.camera.Direction. Default is BACK.
- * FRONT: 0
- * BACK: 1
- */
- cameraDirection?: number;
- /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
- popoverOptions?: CameraPopoverOptions;
+ /** Picture quality in range 0-100. Default is 50 */
+ quality?: number;
+ /**
+ * Choose the format of the return value.
+ * Defined in navigator.camera.DestinationType. Default is FILE_URI.
+ * DATA_URL : 0, Return image as base64-encoded string
+ * FILE_URI : 1, Return image file URI
+ * NATIVE_URI : 2 Return image native URI
+ * (e.g., assets-library:// on iOS or content:// on Android)
+ */
+ destinationType?: number;
+ /**
+ * Set the source of the picture.
+ * Defined in navigator.camera.PictureSourceType. Default is CAMERA.
+ * PHOTOLIBRARY : 0,
+ * CAMERA : 1,
+ * SAVEDPHOTOALBUM : 2
+ */
+ sourceType?: number;
+ /** Allow simple editing of image before selection. */
+ allowEdit?: boolean;
+ /**
+ * Choose the returned image file's encoding.
+ * Defined in navigator.camera.EncodingType. Default is JPEG
+ * JPEG : 0 Return JPEG encoded image
+ * PNG : 1 Return PNG encoded image
+ */
+ encodingType?: number;
+ /**
+ * Width in pixels to scale image. Must be used with targetHeight.
+ * Aspect ratio remains constant.
+ */
+ targetWidth?: number;
+ /**
+ * Height in pixels to scale image. Must be used with targetWidth.
+ * Aspect ratio remains constant.
+ */
+ targetHeight?: number;
+ /**
+ * Set the type of media to select from. Only works when PictureSourceType
+ * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
+ * PICTURE: 0 allow selection of still pictures only. DEFAULT.
+ * Will return format specified via DestinationType
+ * VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
+ * ALLMEDIA : 2 allow selection from all media types
+ */
+ mediaType?: number;
+ /** Rotate the image to correct for the orientation of the device during capture. */
+ correctOrientation?: boolean;
+ /** Save the image to the photo album on the device after capture. */
+ saveToPhotoAlbum?: boolean;
+ /**
+ * Choose the camera to use (front- or back-facing).
+ * Defined in navigator.camera.Direction. Default is BACK.
+ * FRONT: 0
+ * BACK: 1
+ */
+ cameraDirection?: number;
+ /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
+ popoverOptions?: CameraPopoverOptions;
}
/**
@@ -69,20 +69,20 @@ export interface CameraOptions {
* of the popover when selecting images from an iPad's library or album.
*/
export interface CameraPopoverOptions {
- x: number;
- y: number;
- width: number;
- height: number;
- /**
- * Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
- * Matches iOS UIPopoverArrowDirection constants.
- * ARROW_UP : 1,
- * ARROW_DOWN : 2,
- * ARROW_LEFT : 4,
- * ARROW_RIGHT : 8,
- * ARROW_ANY : 15
- */
- arrowDir: number;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ /**
+ * Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
+ * Matches iOS UIPopoverArrowDirection constants.
+ * ARROW_UP : 1,
+ * ARROW_DOWN : 2,
+ * ARROW_LEFT : 4,
+ * ARROW_RIGHT : 8,
+ * ARROW_ANY : 15
+ */
+ arrowDir: number;
}
/**
@@ -93,14 +93,16 @@ export interface CameraPopoverOptions {
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
*
* @usage
- * ```js
- * import {Camera} from 'ionic-native';
+ * ```typescript
+ * import { Camera } from 'ionic-native';
+ *
*
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
- * let base64Image = "data:image/jpeg;base64," + imageData;
+ * let base64Image = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
+ * // Handle error
* });
* ```
*/
@@ -111,31 +113,11 @@ export interface CameraPopoverOptions {
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
})
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.
- * @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.
- */
- @Cordova({
- callbackOrder: 'reverse'
- })
- static getPicture(options: CameraOptions): Promise { return; }
-
- /**
- * 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
- */
- @Cordova({
- platforms: ['iOS']
- })
- static cleanup() { };
-
/**
* @private
* @enum {number}
*/
- static DestinationType = {
+ public 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) */
@@ -148,7 +130,7 @@ export class Camera {
* @private
* @enum {number}
*/
- static EncodingType = {
+ public static EncodingType = {
/** Return JPEG encoded image */
JPEG: 0,
/** Return PNG encoded image */
@@ -158,26 +140,26 @@ export class Camera {
* @private
* @enum {number}
*/
- static MediaType = {
+ public 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 */
VIDEO: 1,
/** Allow selection from all media types */
- ALLMEDIA : 2
+ ALLMEDIA: 2
};
/**
* @private
* @enum {number}
*/
- static PictureSourceType = {
+ public static PictureSourceType = {
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
- PHOTOLIBRARY : 0,
+ PHOTOLIBRARY: 0,
/** Take picture from camera */
- CAMERA : 1,
+ CAMERA: 1,
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
- SAVEDPHOTOALBUM : 2
+ SAVEDPHOTOALBUM: 2
};
/**
@@ -185,25 +167,43 @@ export class Camera {
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
* @enum {number}
*/
- static PopoverArrowDirection = {
- ARROW_UP : 1,
- ARROW_DOWN : 2,
- ARROW_LEFT : 4,
- ARROW_RIGHT : 8,
- ARROW_ANY : 15
+ public static PopoverArrowDirection = {
+ ARROW_UP: 1,
+ ARROW_DOWN: 2,
+ ARROW_LEFT: 4,
+ ARROW_RIGHT: 8,
+ ARROW_ANY: 15
};
/**
* @private
* @enum {number}
*/
- static Direction = {
+ public static Direction = {
/** Use the back-facing camera */
BACK: 0,
/** Use the front-facing camera */
FRONT: 1
};
+ /**
+ * 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.
+ */
+ @Cordova({
+ callbackOrder: 'reverse'
+ })
+ static getPicture(options?: CameraOptions): Promise { return; }
+
+ /**
+ * 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
+ */
+ @Cordova({
+ platforms: ['iOS']
+ })
+ static cleanup() { };
+
}
-
-
diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts
index 77d0bc23b..ef6952782 100644
--- a/src/plugins/card-io.ts
+++ b/src/plugins/card-io.ts
@@ -1,13 +1,13 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
+
/**
* @name CardIO
* @description
* @usage
* ```
- * import {CardIO} from 'ionic-native';
+ * import { CardIO } from 'ionic-native';
*
- * ...
*
* CardIO.canScan()
* .then(
@@ -25,49 +25,50 @@ import {Plugin, Cordova} from './plugin';
* ```
*/
@Plugin({
- plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
- pluginRef: 'CardIO',
- repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
- platforms: ['iOS', 'Android']
+ plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
+ pluginRef: 'CardIO',
+ repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
+ platforms: ['iOS', 'Android']
})
export class CardIO {
- /**
- * Check whether card scanning is currently available. (May vary by
- * device, OS version, network connectivity, etc.)
- *
- */
- @Cordova()
- static canScan(): Promise {return; }
+ /**
+ * Check whether card scanning is currently available. (May vary by
+ * device, OS version, network connectivity, etc.)
+ *
+ */
+ @Cordova()
+ static canScan(): Promise { return; }
- /**
- * Scan a credit card with card.io.
- * @param {CardIOOptions} options Options for configuring the plugin
- */
- @Cordova()
- static scan(options?: CardIOOptions): Promise {return; }
+ /**
+ * Scan a credit card with card.io.
+ * @param {CardIOOptions} options Options for configuring the plugin
+ */
+ @Cordova()
+ static scan(options?: CardIOOptions): Promise { return; }
+
+ /**
+ * Retrieve the version of the card.io library. Useful when contacting support.
+ */
+ @Cordova()
+ static version(): Promise { return; }
- /**
- * Retrieve the version of the card.io library. Useful when contacting support.
- */
- @Cordova()
- static version(): Promise {return; }
}
export interface CardIOOptions {
- requireExpiry?: boolean;
- requireCCV?: boolean;
- requirePostalCode?: boolean;
- supressManual?: boolean;
- restrictPostalCodeToNumericOnly?: boolean;
- keepApplicationTheme?: boolean;
- requireCardholderName?: boolean;
- scanInstructions?: string;
- noCamera?: boolean;
- scanExpiry?: boolean;
- languageOrLocale?: string;
- guideColor?: string;
- supressConfirmation?: boolean;
- hideCardIOLogo?: boolean;
- useCardIOLogo?: boolean;
- supressScan?: boolean;
+ requireExpiry?: boolean;
+ requireCCV?: boolean;
+ requirePostalCode?: boolean;
+ supressManual?: boolean;
+ restrictPostalCodeToNumericOnly?: boolean;
+ keepApplicationTheme?: boolean;
+ requireCardholderName?: boolean;
+ scanInstructions?: string;
+ noCamera?: boolean;
+ scanExpiry?: boolean;
+ languageOrLocale?: string;
+ guideColor?: string;
+ supressConfirmation?: boolean;
+ hideCardIOLogo?: boolean;
+ useCardIOLogo?: boolean;
+ supressScan?: boolean;
}
diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts
index 8c95da475..77e502190 100644
--- a/src/plugins/clipboard.ts
+++ b/src/plugins/clipboard.ts
@@ -1,4 +1,5 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
+
/**
* @name Clipboard
@@ -9,19 +10,18 @@ import {Plugin, Cordova} from './plugin';
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
*
* @usage
- * ```js
- * import {Clipboard} from 'ionic-native';
+ * ```typescript
+ * import { Clipboard } from 'ionic-native';
*
*
- *
- * Clipboard.copy("Hello world");
+ * Clipboard.copy('Hello world');
*
* Clipboard.paste().then(
- * (resolve : string) => {
+ * (resolve: string) => {
* alert(resolve);
* },
- * (reject : string) => {
- * alert("Error: " + reject);
+ * (reject: string) => {
+ * alert('Error: ' + reject);
* }
* );
* );
diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts
index e079b69c5..ee5335c4d 100644
--- a/src/plugins/contacts.ts
+++ b/src/plugins/contacts.ts
@@ -1,235 +1,253 @@
-import {Plugin, Cordova, InstanceProperty, CordovaInstance} from './plugin';
-declare var window: any,
- navigator: any;
-export interface IContactProperties {
- /** A globally unique identifier. */
- id?: string;
- /** The name of this Contact, suitable for display to end users. */
- displayName?: string;
- /** An object containing all components of a persons name. */
- name?: ContactName;
- /** A casual name by which to address the contact. */
- nickname?: string;
- /** An array of all the contact's phone numbers. */
- phoneNumbers?: IContactField[];
- /** An array of all the contact's email addresses. */
- emails?: IContactField[];
- /** An array of all the contact's addresses. */
- addresses?: ContactAddress[];
- /** An array of all the contact's IM addresses. */
- ims?: IContactField[];
- /** An array of all the contact's organizations. */
- organizations?: ContactOrganization[];
- /** The birthday of the contact. */
- birthday?: Date;
- /** A note about the contact. */
- note?: string;
- /** An array of the contact's photos. */
- photos?: IContactField[];
- /** An array of all the user-defined categories associated with the contact. */
- categories?: IContactField[];
- /** An array of web pages associated with the contact. */
- urls?: IContactField[];
-}
+import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
+declare var window: any,
+ navigator: any;
+
+export interface IContactProperties {
+ /** A globally unique identifier. */
+ id?: string;
+ /** The name of this Contact, suitable for display to end users. */
+ displayName?: string;
+ /** An object containing all components of a persons name. */
+ name?: IContactName;
+ /** A casual name by which to address the contact. */
+ nickname?: string;
+ /** An array of all the contact's phone numbers. */
+ phoneNumbers?: IContactField[];
+ /** An array of all the contact's email addresses. */
+ emails?: IContactField[];
+ /** An array of all the contact's addresses. */
+ addresses?: IContactAddress[];
+ /** An array of all the contact's IM addresses. */
+ ims?: IContactField[];
+ /** An array of all the contact's organizations. */
+ organizations?: IContactOrganization[];
+ /** The birthday of the contact. */
+ birthday?: Date;
+ /** A note about the contact. */
+ note?: string;
+ /** An array of the contact's photos. */
+ photos?: IContactField[];
+ /** An array of all the user-defined categories associated with the contact. */
+ categories?: IContactField[];
+ /** An array of web pages associated with the contact. */
+ urls?: IContactField[];
+}
+
/**
* @private
*/
-export class Contact {
- private _objectInstance: any;
- @InstanceProperty get id(): string {return; }
- @InstanceProperty get displayName(): string {return; }
- @InstanceProperty get nickname(): ContactName {return; }
- @InstanceProperty get phoneNumbers(): string {return; }
- @InstanceProperty get emails(): IContactField[] {return; }
- @InstanceProperty get addresses(): ContactAddress[] {return; }
- @InstanceProperty get ims(): IContactField[] {return; }
- @InstanceProperty get organizations(): ContactOrganization[] {return; }
- @InstanceProperty get birthday(): Date {return; }
- @InstanceProperty get note(): string {return; }
- @InstanceProperty get photos(): IContactField[] {return; }
- @InstanceProperty get categories(): IContactField[] {return; }
- @InstanceProperty get urls(): IContactField[] {return; }
- constructor () {
- this._objectInstance = navigator.contacts.create();
+export class Contact implements IContactProperties {
+ private _objectInstance: any;
+ @InstanceProperty get id(): string { return; }
+ @InstanceProperty get displayName(): string { return; }
+ @InstanceProperty get name(): IContactName {return; }
+ @InstanceProperty get nickname(): string { return; }
+ @InstanceProperty get phoneNumbers(): IContactField[] { return; }
+ @InstanceProperty get emails(): IContactField[] { return; }
+ @InstanceProperty get addresses(): IContactAddress[] { return; }
+ @InstanceProperty get ims(): IContactField[] { return; }
+ @InstanceProperty get organizations(): IContactOrganization[] { return; }
+ @InstanceProperty get birthday(): Date { return; }
+ @InstanceProperty get note(): string { return; }
+ @InstanceProperty get photos(): IContactField[] { return; }
+ @InstanceProperty get categories(): IContactField[] { return; }
+ @InstanceProperty get urls(): IContactField[] { return; }
+
+ constructor() {
+ this._objectInstance = navigator.contacts.create();
+ }
+
+ clone(): Contact {
+ let newContact = new Contact();
+ for (let prop in this) {
+ if (prop === 'id') return;
+ newContact[prop] = this[prop];
}
- clone(): Contact {
- let newContact = new Contact();
- for (let prop in this) {
- if (prop === 'id') return;
- newContact[prop] = this[prop];
- }
- return newContact;
- }
- @CordovaInstance()
- remove(): Promise {return; }
- @CordovaInstance()
- save(): Promise {return; }
+ return newContact;
+ }
+
+ @CordovaInstance()
+ remove(): Promise { return; }
+
+ @CordovaInstance()
+ save(): Promise { return; }
}
+
interface IContactError {
- /** Error code */
- code: number;
- /** Error message */
- message: string;
+ /** Error code */
+ code: number;
+ /** Error message */
+ message: string;
}
+
declare var ContactError: {
- new(code: number): IContactError;
- UNKNOWN_ERROR: number;
- INVALID_ARGUMENT_ERROR: number;
- TIMEOUT_ERROR: number;
- PENDING_OPERATION_ERROR: number;
- IO_ERROR: number;
- NOT_SUPPORTED_ERROR: number;
- PERMISSION_DENIED_ERROR: number
+ new (code: number): IContactError;
+ UNKNOWN_ERROR: number;
+ INVALID_ARGUMENT_ERROR: number;
+ TIMEOUT_ERROR: number;
+ PENDING_OPERATION_ERROR: number;
+ IO_ERROR: number;
+ NOT_SUPPORTED_ERROR: number;
+ PERMISSION_DENIED_ERROR: number
};
+
export interface IContactName {
- /** The complete name of the contact. */
- formatted?: string;
- /** The contact's family name. */
- familyName?: string;
- /** The contact's given name. */
- givenName?: string;
- /** The contact's middle name. */
- middleName?: string;
- /** The contact's prefix (example Mr. or Dr.) */
- honorificPrefix?: string;
- /** The contact's suffix (example Esq.). */
- honorificSuffix?: string;
+ /** The complete name of the contact. */
+ formatted?: string;
+ /** The contact's family name. */
+ familyName?: string;
+ /** The contact's given name. */
+ givenName?: string;
+ /** The contact's middle name. */
+ middleName?: string;
+ /** The contact's prefix (example Mr. or Dr.) */
+ honorificPrefix?: string;
+ /** The contact's suffix (example Esq.). */
+ honorificSuffix?: string;
}
/**
* @private
*/
export class ContactName implements IContactName {
- private _objectInstance: any;
- constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) {
- this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix);
- }
- @InstanceProperty get formatted(): string {return; }
- @InstanceProperty get familyName(): string {return; }
- @InstanceProperty get givenName(): string {return; }
- @InstanceProperty get middleName(): string {return; }
- @InstanceProperty get honorificPrefix(): string {return; }
- @InstanceProperty get honorificSuffix(): string {return; }
+ private _objectInstance: any;
+
+ constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) {
+ this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix);
+ }
+
+ @InstanceProperty get formatted(): string { return; }
+ @InstanceProperty get familyName(): string { return; }
+ @InstanceProperty get givenName(): string { return; }
+ @InstanceProperty get middleName(): string { return; }
+ @InstanceProperty get honorificPrefix(): string { return; }
+ @InstanceProperty get honorificSuffix(): string { return; }
}
export interface IContactField {
- /** A string that indicates what type of field this is, home for example. */
- type: string;
- /** The value of the field, such as a phone number or email address. */
- value: string;
- /** Set to true if this ContactField contains the user's preferred value. */
- pref: boolean;
+ /** A string that indicates what type of field this is, home for example. */
+ type: string;
+ /** The value of the field, such as a phone number or email address. */
+ value: string;
+ /** Set to true if this ContactField contains the user's preferred value. */
+ pref: boolean;
}
/**
* @private
*/
export class ContactField implements IContactField {
- private _objectInstance: any;
- constructor(type?: string, value?: string, pref?: boolean) {
- this._objectInstance = new window.ContactField(type, value, pref);
- }
- @InstanceProperty get type(): string {return; }
- @InstanceProperty get value(): string {return; }
- @InstanceProperty get pref(): boolean {return; }
+ private _objectInstance: any;
+
+ constructor(type?: string, value?: string, pref?: boolean) {
+ this._objectInstance = new window.ContactField(type, value, pref);
+ }
+
+ @InstanceProperty get type(): string { return; }
+ @InstanceProperty get value(): string { return; }
+ @InstanceProperty get pref(): boolean { return; }
}
export interface IContactAddress {
- /** Set to true if this ContactAddress contains the user's preferred value. */
- pref?: boolean;
- /** A string indicating what type of field this is, home for example. */
- type?: string;
- /** The full address formatted for display. */
- formatted?: string;
- /** The full street address. */
- streetAddress?: string;
- /** The city or locality. */
- locality?: string;
- /** The state or region. */
- region?: string;
- /** The zip code or postal code. */
- postalCode?: string;
- /** The country name. */
- country?: string;
+ /** Set to true if this ContactAddress contains the user's preferred value. */
+ pref?: boolean;
+ /** A string indicating what type of field this is, home for example. */
+ type?: string;
+ /** The full address formatted for display. */
+ formatted?: string;
+ /** The full street address. */
+ streetAddress?: string;
+ /** The city or locality. */
+ locality?: string;
+ /** The state or region. */
+ region?: string;
+ /** The zip code or postal code. */
+ postalCode?: string;
+ /** The country name. */
+ country?: string;
}
/**
* @private
*/
export class ContactAddress implements IContactAddress {
- private _objectInstance: any;
- constructor (pref?: boolean,
- type?: string,
- formatted?: string,
- streetAddress?: string,
- locality?: string,
- region?: string,
- postalCode?: string,
- country?: string) {
- this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
- }
- @InstanceProperty get pref(): boolean {return; }
- @InstanceProperty get type(): string {return; }
- @InstanceProperty get formatted(): string {return; }
- @InstanceProperty get streetAddress(): string {return; }
- @InstanceProperty get locality(): string {return; }
- @InstanceProperty get region(): string {return; }
- @InstanceProperty get postalCode(): string {return; }
- @InstanceProperty get country(): string {return; }
+ private _objectInstance: any;
+
+ constructor(pref?: boolean,
+ type?: string,
+ formatted?: string,
+ streetAddress?: string,
+ locality?: string,
+ region?: string,
+ postalCode?: string,
+ country?: string) {
+ this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
+ }
+
+ @InstanceProperty get pref(): boolean { return; }
+ @InstanceProperty get type(): string { return; }
+ @InstanceProperty get formatted(): string { return; }
+ @InstanceProperty get streetAddress(): string { return; }
+ @InstanceProperty get locality(): string { return; }
+ @InstanceProperty get region(): string { return; }
+ @InstanceProperty get postalCode(): string { return; }
+ @InstanceProperty get country(): string { return; }
}
export interface IContactOrganization {
- /** Set to true if this ContactOrganization contains the user's preferred value. */
- pref?: boolean;
- /** A string that indicates what type of field this is, home for example. */
- type?: string;
- /** The name of the organization. */
- name?: string;
- /** The department the contract works for. */
- department?: string;
- /** The contact's title at the organization. */
- title?: string;
+ /** Set to true if this ContactOrganization contains the user's preferred value. */
+ pref?: boolean;
+ /** A string that indicates what type of field this is, home for example. */
+ type?: string;
+ /** The name of the organization. */
+ name?: string;
+ /** The department the contract works for. */
+ department?: string;
+ /** The contact's title at the organization. */
+ title?: string;
}
/**
* @private
*/
export class ContactOrganization implements IContactOrganization {
- private _objectInstance: any;
- constructor () {
- this._objectInstance = new window.ContactOrganization();
- }
- @InstanceProperty get pref(): boolean {return; }
- @InstanceProperty get type(): string {return; }
- @InstanceProperty get name(): string {return; }
- @InstanceProperty get department(): string {return; }
- @InstanceProperty get title(): string {return; }
+ private _objectInstance: any;
+ constructor() {
+ this._objectInstance = new window.ContactOrganization();
+ }
+ @InstanceProperty get pref(): boolean { return; }
+ @InstanceProperty get type(): string { return; }
+ @InstanceProperty get name(): string { return; }
+ @InstanceProperty get department(): string { return; }
+ @InstanceProperty get title(): string { return; }
}
/** Search options to filter navigator.contacts. */
export interface IContactFindOptions {
- /** The search string used to find navigator.contacts. */
- filter?: string;
- /** Determines if the find operation returns multiple navigator.contacts. */
- multiple?: boolean;
- /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
- desiredFields?: string[];
+ /** The search string used to find navigator.contacts. */
+ filter?: string;
+ /** Determines if the find operation returns multiple navigator.contacts. */
+ multiple?: boolean;
+ /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
+ desiredFields?: string[];
}
/**
* @private
*/
export class ContactFindOptions implements IContactFindOptions {
- private _objectInstance: any;
- constructor () {
- this._objectInstance = new window.ContactFindOptions();
- }
- @InstanceProperty get filter(): string {return; }
- @InstanceProperty get multiple(): boolean {return; }
- @InstanceProperty get desiredFields(): any {return; }
- @InstanceProperty get hasPhoneNumber(): boolean {return; }
+ private _objectInstance: any;
+
+ constructor() {
+ this._objectInstance = new window.ContactFindOptions();
+ }
+
+ @InstanceProperty get filter(): string { return; }
+ @InstanceProperty get multiple(): boolean { return; }
+ @InstanceProperty get desiredFields(): any { return; }
+ @InstanceProperty get hasPhoneNumber(): boolean { return; }
}
/**
@@ -239,16 +257,15 @@ export class ContactFindOptions implements IContactFindOptions {
*
* @usage
*
- * ```js
- * import {Contact} from 'ionic-native';
- *
+ * ```typescript
+ * import { Contact } from 'ionic-native';
*
*
* let contact = new Contact();
- * contact.displayName = "Mr. Ionitron";
+ * contact.displayName = 'Mr. Ionitron';
* contact.save().then(
- * () => console.log("Contact saved!", contact),
- * (error: any) => console.error("Error saving contact.", error)
+ * () => console.log('Contact saved!', contact),
+ * (error: any) => console.error('Error saving contact.', error)
* );
* ```
*
@@ -260,9 +277,10 @@ export class ContactFindOptions implements IContactFindOptions {
repo: 'https://github.com/apache/cordova-plugin-contacts'
})
export class Contacts {
- static create(): Contact {
- return new Contact();
- }
+ static create(): Contact {
+ return new Contact();
+ }
+
/**
* Search for contacts in the Contacts list.
* @param fields {string[]} Contact fields to be used as a search qualifier.
@@ -282,10 +300,12 @@ export class Contacts {
errorIndex: 2
})
static find(fields: string[], options?: any): Promise { return; }
+
/**
* Select a single Contact.
* @return Returns a Promise that resolves with the selected Contact
*/
@Cordova()
- static pickContact(): Promise {return; }
+ static pickContact(): Promise { return; }
+
}
diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts
new file mode 100644
index 000000000..92f42d000
--- /dev/null
+++ b/src/plugins/crop.ts
@@ -0,0 +1,34 @@
+import {Cordova, Plugin} from './plugin';
+/**
+ * @name Crop
+ * @description Crops images
+ * @usage
+ * ```
+ * import {Crop} from 'ionic-native';
+ *
+ * ...
+ *
+ * Crop.crop('path/to/image.jpg', {quality: 75})
+ * .then(
+ * newImage => console.log("new image path is: " + newImage),
+ * error => console.error("Error cropping image", error)
+ * );
+ * ```
+ */
+@Plugin({
+ plugin: 'cordova-plugin-crop',
+ pluginRef: 'plugins',
+ repo: 'https://github.com/jeduan/cordova-plugin-crop'
+})
+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.
+ */
+ @Cordova({
+ callbackOrder: 'reverse'
+ })
+ static crop(pathToImage: string, options?: {quality: number}): Promise {return; }
+}
diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts
index 222fcefde..cb16a453a 100644
--- a/src/plugins/datepicker.ts
+++ b/src/plugins/datepicker.ts
@@ -1,4 +1,5 @@
-import {Plugin, Cordova} from './plugin';
+import { Cordova, Plugin } from './plugin';
+
export interface DatePickerOptions {
/**
@@ -12,7 +13,7 @@ export interface DatePickerOptions {
* Platforms: iOS, Android, Windows
* Selected date
*/
- date: Date;
+ date: Date | string | number;
/**
* Platforms: iOS, Android, Windows
@@ -20,7 +21,7 @@ export interface DatePickerOptions {
* Type: Date | empty String
* Default: empty String
*/
- minDate?: Date;
+ minDate?: Date | string | number;
/**
* Platforms?: iOS, Android, Windows
@@ -28,7 +29,7 @@ export interface DatePickerOptions {
* Type?: Date | empty String
* Default?: empty String
*/
- maxDate?: Date;
+ maxDate?: Date | string | number;
/**
* Platforms?: Android
@@ -73,16 +74,16 @@ export interface DatePickerOptions {
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
*
* @usage
- * ```js
- * import {DatePicker} from 'ionic-native';
+ * ```typescript
+ * import { DatePicker } from 'ionic-native';
*
*
* DatePicker.show({
* date: new Date(),
* mode: 'date'
* }).then(
- * date => console.log("Got date: ", date),
- * err => console.log("Error occurred while getting date:", err)
+ * date => console.log('Got date: ', date),
+ * err => console.log('Error occurred while getting date: ', err)
* );
* ```
*
diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts
index 3ef16c487..138ee643a 100644
--- a/src/plugins/dbmeter.ts
+++ b/src/plugins/dbmeter.ts
@@ -1,12 +1,13 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
+
/**
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
* @usage
- * ```ts
- * import {DBMeter} from 'ionic-native';
- *
+ * ```typescript
+ * import { DBMeter } from 'ionic-native';
*
*
* // Start listening
@@ -16,7 +17,7 @@ import {Observable} from 'rxjs/Observable';
*
* // Check if we are listening
* DBMeter.isListening().then(
- * (isListening : boolean) => console.log(isListening)
+ * (isListening: boolean) => console.log(isListening)
* );
*
* // Stop listening
@@ -24,8 +25,8 @@ import {Observable} from 'rxjs/Observable';
*
* // Delete DBMeter instance from memory
* DBMeter.delete().then(
- * () => console.log("Deleted DB Meter instance"),
- * error => console.log("Error occurred while deleting DB Meter instance")
+ * () => console.log('Deleted DB Meter instance'),
+ * error => console.log('Error occurred while deleting DB Meter instance')
* );
* ```
*/
@@ -45,27 +46,27 @@ export class DBMeter {
observable: true,
clearFunction: 'stop'
})
- static start (): Observable {return; }
+ static start(): Observable { return; }
/**
* Stops listening
* @private
*/
@Cordova()
- static stop (): Promise {return; }
+ static stop(): Promise { return; }
/**
* Check if the DB Meter is listening
* @return {Promise} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
*/
@Cordova()
- static isListening(): Promise {return; }
+ static isListening(): Promise { return; }
/**
* Delete the DB Meter instance
* @return {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/
@Cordova()
- static delete(): Promise {return; }
+ static delete(): Promise { return; }
}
diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts
index 05ab2fd27..c394150ba 100644
--- a/src/plugins/deeplinks.ts
+++ b/src/plugins/deeplinks.ts
@@ -1,5 +1,6 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
export interface DeeplinkMatch {
/**
@@ -17,7 +18,7 @@ export interface DeeplinkMatch {
* any internal native data available as "extras" at the time
* the route was matched (for example, Facebook sometimes adds extra data)
*/
- $link: any;
+ $link: any;
}
/**
@@ -26,8 +27,8 @@ export interface DeeplinkMatch {
* and Universal App Links.
*
* @usage
- * ```ts
- * import {IonicDeeplinks} from 'ionic-native';
+ * ```typescript
+ * import { IonicDeeplinks } from 'ionic-native';
*
* ```
*/
@@ -52,7 +53,7 @@ export class Deeplinks {
@Cordova({
observable: true
})
- static route(paths): Observable {return; }
+ static route(paths): Observable { return; }
/**
*
@@ -75,5 +76,6 @@ export class Deeplinks {
@Cordova({
observable: true
})
- static routeWithNavController(navController, paths): Observable {return; }
+ static routeWithNavController(navController, paths): Observable { return; }
+
}
diff --git a/src/plugins/device.ts b/src/plugins/device.ts
index e0c78d45c..6dd106936 100644
--- a/src/plugins/device.ts
+++ b/src/plugins/device.ts
@@ -1,4 +1,5 @@
-import {Plugin, CordovaProperty} from './plugin';
+import { CordovaProperty, Plugin } from './plugin';
+
declare var window: {
device: Device
@@ -32,9 +33,8 @@ export interface Device {
* Access information about the underlying device and platform.
*
* @usage
- * ```js
- * import {Device} from 'ionic-native';
- *
+ * ```typescript
+ * import { Device } from 'ionic-native';
*
*
* console.log('Device UUID is: ' + Device.device.uuid);
@@ -54,4 +54,5 @@ export class Device {
*/
@CordovaProperty
static get device() { return window.device; }
+
}
diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts
index bc17415ca..1b1a7a11f 100644
--- a/src/plugins/deviceaccounts.ts
+++ b/src/plugins/deviceaccounts.ts
@@ -1,33 +1,36 @@
-import {Cordova, Plugin} from './plugin';
-@Plugin({
- plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
- pluginRef: 'plugins.DeviceAccounts',
- repo: 'https://github.com/loicknuchel/cordova-device-accounts',
- platforms: ['Android']
-})
-export class DeviceAccounts {
-
- /**
- * Gets all accounts registered on the Android Device
- */
- @Cordova()
- static get(): Promise {return; }
-
- /**
- * Get all accounts registered on Android device for requested type
- */
- @Cordova()
- static getByType(type: string): Promise {return; }
-
- /**
- * Get all emails registered on Android device (accounts with 'com.google' type)
- */
- @Cordova()
- static getEmails(): Promise {return; }
-
- /**
- * Get the first email registered on Android device
- */
- @Cordova()
- static getEmail(): Promise {return; }
-}
\ No newline at end of file
+import { Cordova, Plugin } from './plugin';
+
+
+@Plugin({
+ plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
+ pluginRef: 'plugins.DeviceAccounts',
+ repo: 'https://github.com/loicknuchel/cordova-device-accounts',
+ platforms: ['Android']
+})
+export class DeviceAccounts {
+
+ /**
+ * Gets all accounts registered on the Android Device
+ */
+ @Cordova()
+ static get(): Promise { return; }
+
+ /**
+ * Get all accounts registered on Android device for requested type
+ */
+ @Cordova()
+ static getByType(type: string): Promise { return; }
+
+ /**
+ * Get all emails registered on Android device (accounts with 'com.google' type)
+ */
+ @Cordova()
+ static getEmails(): Promise { return; }
+
+ /**
+ * Get the first email registered on Android device
+ */
+ @Cordova()
+ static getEmail(): Promise { return; }
+
+}
diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts
index 200d49906..b3a67bcfd 100644
--- a/src/plugins/devicemotion.ts
+++ b/src/plugins/devicemotion.ts
@@ -1,5 +1,6 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
export interface AccelerationData {
@@ -40,19 +41,18 @@ export interface AccelerometerOptions {
* Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
*
* @usage
- * ```ts
- * import {DeviceMotion} from 'ionic-native';
- *
+ * ```typescript
+ * import { DeviceMotion } from 'ionic-native';
*
*
* // Get the device current acceleration
* DeviceMotion.getCurrentAcceleration().then(
- * acceleration => console.log(acceleration),
- * error => console.log(error)
+ * (acceleration: AccelerationData) => console.log(acceleration),
+ * (error: any) => console.log(error)
* );
*
* // Watch device acceleration
- * var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => {
+ * var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
* console.log(acceleration);
* });
*
@@ -73,9 +73,7 @@ export class DeviceMotion {
* @returns {Promise} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
- static getCurrentAcceleration(): Promise {
- return;
- }
+ static getCurrentAcceleration(): Promise { return; }
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
@@ -87,7 +85,6 @@ export class DeviceMotion {
observable: true,
clearFunction: 'clearWatch'
})
- static watchAcceleration(options?: AccelerometerOptions): Observable {
- return;
- }
+ static watchAcceleration(options?: AccelerometerOptions): Observable { return; }
+
}
diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts
index 916ad9df5..431b9aa20 100644
--- a/src/plugins/deviceorientation.ts
+++ b/src/plugins/deviceorientation.ts
@@ -1,5 +1,6 @@
-import {Plugin, Cordova} from './plugin';
-import {Observable} from 'rxjs/Observable';
+import { Cordova, Plugin } from './plugin';
+import { Observable } from 'rxjs/Observable';
+
export interface CompassHeading {
@@ -45,20 +46,20 @@ export interface CompassOptions {
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
*
* @usage
- * ```ts
- * import {DeviceOrientation} from 'ionic-native';
- *
+ * ```typescript
+ * // CompassHeading is an interface for compass
+ * import { DeviceOrientation, CompassHeading } from 'ionic-native';
*
*
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
- * data => console.log(data),
- * error => console.log(error)
+ * (data: CompassHeading) => console.log(data),
+ * (error: any) => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
- * data => console.log(data)
+ * (data: CompassHeading) => console.log(data)
* );
*
* // Stop watching heading change
diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts
index d1c31cd63..fbb031067 100644
--- a/src/plugins/diagnostic.ts
+++ b/src/plugins/diagnostic.ts
@@ -1,37 +1,197 @@
-import {Plugin, Cordova} from './plugin';
+import {Cordova, Plugin, CordovaProperty} from './plugin';
+/**
+ * @name Diagnostic
+ * @description
+ * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
+ *
+ * @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({
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 = {
+ 'NOT_REQUESTED': 'not_determined',
+ 'DENIED': 'denied',
+ 'RESTRICTED': 'restricted',
+ 'GRANTED': 'authorized',
+ 'GRANTED_WHEN_IN_USE': 'authorized_when_in_use'
+ };
+
+ static locationAuthorizationMode = {
+ 'ALWAYS': 'always',
+ 'WHEN_IN_USE': 'when_in_use'
+ };
+
+ static permissionGroups = {
+ 'GRANTED': 'GRANTED',
+ 'DENIED': 'DENIED',
+ 'NOT_REQUESTED': 'NOT_REQUESTED',
+ 'DENIED_ALWAYS': 'DENIED_ALWAYS'
+ };
+
+ 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.
*/
@Cordova()
- static isLocationEnabled(): Promise {return; }
+ static isLocationAvailable(): Promise { return; }
/**
* 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. ``
*/
@Cordova()
- static isWifiEnabled(): Promise {return; }
+ static isWifiAvailable(): Promise { return; }
/**
* 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.
*/
@Cordova()
- static isCameraEnabled(): Promise {return; }
+ static isCameraAvailable(): Promise { return; }
/**
* 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
*/
@Cordova()
- static isBluetoothEnabled(): Promise {return; }
+ 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()`
+ */
+ @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}
+ */
+ @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}
+ */
+ @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.
+ */
+ @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.
+ */
+ @Cordova()
+ static isLocationAuthorized(): Promise { return; }
+
+ /**
+ * Returns the location authorization status for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static getLocationAuthorizationStatus(): Promise {return; }
/**
* Returns the location authorization status for the application.
@@ -39,36 +199,159 @@ export class Diagnostic {
*
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
*/
- @Cordova()
- 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; }
+ @Cordova({platforms: ['Android', 'iOS']})
+ static requestLocationAuthorization(mode?: string): Promise { return; }
/**
* Checks if camera hardware is present on device.
*/
- @Cordova()
- static isCameraPresent(): Promise {return; }
+ @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.
*/
- @Cordova()
- static isCameraAuthorized(): Promise {return; }
+ @Cordova({platforms: ['Android', 'iOS']})
+ static isCameraAuthorized(): Promise { return; }
+
+ /**
+ * Returns the camera authorization status for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static getCameraAuthorizationStatus(): Promise { return; }
+
+ /**
+ * Requests camera authorization for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static requestCameraAuthorization(): Promise { return; }
+
+ /**
+ * Checks if the application is authorized to use the microphone.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static isMicrophoneAuthorized(): Promise { return; }
+
+ /**
+ * Returns the microphone authorization status for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static getMicrophoneAuthorizationStatus(): Promise { return; }
+
+ /**
+ * Requests microphone authorization for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static requestMicrophoneAuthorization(): Promise { return; }
+
+ /**
+ * Checks if the application is authorized to use contacts (address book).
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static isContactsAuthorized(): Promise { return; }
+
+ /**
+ * Returns the contacts authorization status for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static getContactsAuthroizationStatus(): Promise { return; }
+
+ /**
+ * Requests contacts authorization for the application.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static requestContactsAuthorization(): Promise { return; }
+
+ /**
+ * Checks if the application is authorized to use the calendar.
+ *
+ * Notes 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.
+ *
+ * Notes for iOS:
+ * - This relates to Calendar Events (not Calendar Reminders)
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static isCalendarAuthorized(): Promise { return; }
+
+ /**
+ * Returns the calendar authorization status for the application.
+ *
+ * Notes 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.
+ *
+ * Notes for iOS:
+ * - This relates to Calendar Events (not Calendar Reminders)
+ *
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static getCalendarAuthorizationStatus(): Promise { return; }
+
+ /**
+ * Requests calendar authorization for the application.
+ *
+ * Notes for iOS:
+ * - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
+ * - This relates to Calendar Events (not Calendar Reminders)
+ *
+ * Notes for Android:
+ * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
+ * - This requests permission for `READ_CALENDAR` run-time permission
+ * - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
+ *
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static requestCalendarAuthorization(): Promise { return; }
+
+ /**
+ * Opens settings page for this app.
+ * On Android, this opens the "App Info" page in the Settings app.
+ * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static switchToSettings(): Promise {return; }
+
+ /**
+ * Returns the state of Bluetooth on the device.
+ */
+ @Cordova({platforms: ['Android', 'iOS']})
+ static getBluetoothState(): Promise {return; }
+
+ /**
+ * Registers a function to be called when a change in Bluetooth state occurs.
+ * @param handler
+ */
+ @Cordova({platforms: ['Android', 'iOS'], sync: true})
+ static registerBluetoothStateChangeHandler(handler: Function): void { }
+
+ /**
+ * Registers a function to be called when a change in Location state occurs.
+ * @param handler
+ */
+ @Cordova({platforms: ['Android', 'iOS'], sync: true})
+ static registerLocationStateChangeHandler(handler: Function): void { }
+
+ /**
+ * Checks if high-accuracy locations are available to the app from GPS hardware. Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
+ */
+ @Cordova({platforms: ['Android']})
+ static isGpsLocationAvailable(): Promise {return; }
+
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
* Returns true if Location mode is enabled and is set to either:
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
- @Cordova()
- static isGpsLocationEnabled(): Promise {return; }
+ @Cordova({platforms: ['Android']})
+ static isGpsLocationEnabled(): Promise { return; }
+
+ /**
+ * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
+ */
+ @Cordova({platforms: ['Android']})
+ static isNetworkLocationAvailable(): Promise {return; }
/**
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
@@ -76,22 +359,137 @@ export class Diagnostic {
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
- @Cordova()
- static isNetworkLocationEnabled(): Promise {return; }
+ @Cordova({platforms: ['Android']})
+ static isNetworkLocationEnabled(): Promise { return; }
+
+ /**
+ * Returns the current location mode setting for the device.
+ */
+ @Cordova({platforms: ['Android']})
+ static getLocationMode(): Promise {return; }
+
+ /**
+ * Returns the current authorisation status for a given permission.
+ * Note: 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.
+ * @param permission
+ */
+ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
+ static getPermissionAuthorizationStatus(permission: any): Promise {return; }
+
+ /**
+ * Returns the current authorisation status for multiple permissions.
+ * Note: 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.
+ * @param permissions
+ */
+ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
+ static getPermissionsAuthorizationStatus(permissions: any[]): Promise {return; }
+
+ /**
+ * Requests app to be granted authorisation for a runtime permission.
+ * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
+ * @param permission
+ */
+ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
+ static requestRuntimePermission(permission: any): Promise {return; }
+
+ /**
+ * Requests app to be granted authorisation for multiple runtime permissions.
+ * Note: 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.
+ * @param permissions
+ */
+ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
+ static requestRuntimePermissions(permissions: any[]): Promise {return; }
+
+ /**
+ * Checks if the device setting for Bluetooth is switched on.
+ * This requires `BLUETOOTH` permission on Android
+ */
+ @Cordova({platforms: ['Android']})
+ static isBluetoothEnabled(): Promise {return; }
+
+ /**
+ * Checks if the device has Bluetooth capabilities.
+ */
+ @Cordova({platforms: ['Android']})
+ static hasBluetoothSupport(): Promise {return; }
+
+ /**
+ * Checks if the device has Bluetooth Low Energy (LE) capabilities.
+ */
+ @Cordova({platforms: ['Android']})
+ static hasBluetoothLESupport(): Promise