merge
This commit is contained in:
commit
bde47eb37b
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
.DS_Store
|
||||||
node_modules/
|
node_modules/
|
||||||
.idea
|
.idea
|
||||||
dist/
|
dist/
|
||||||
|
scripts/ionic-native-bower
|
||||||
|
226
CHANGELOG.md
226
CHANGELOG.md
@ -1,3 +1,203 @@
|
|||||||
|
<a name="1.3.17"></a>
|
||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.16"></a>
|
||||||
|
## [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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.15"></a>
|
||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.14"></a>
|
||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.13"></a>
|
||||||
|
## [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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.12"></a>
|
||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.10"></a>
|
||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.9"></a>
|
||||||
|
## [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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.8"></a>
|
||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.7"></a>
|
||||||
|
## [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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.6"></a>
|
||||||
|
## [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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.3.5"></a>
|
||||||
|
## [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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.3.4"></a>
|
<a name="1.3.4"></a>
|
||||||
## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14)
|
## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14)
|
||||||
|
|
||||||
@ -46,28 +246,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<a name="1.3.1"></a>
|
<a name="1.3.1"></a>
|
||||||
## [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
|
### 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)
|
* **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))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.3.0"></a>
|
|
||||||
# [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)
|
* **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)
|
* **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))
|
* **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))
|
* **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)
|
* **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))
|
* **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
|
### Features
|
||||||
@ -83,6 +268,13 @@
|
|||||||
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
|
* **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)
|
* **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))
|
* **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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="1.2.4"></a>
|
||||||
|
## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
93
DEVELOPER.md
93
DEVELOPER.md
@ -5,6 +5,16 @@ This is a short guide on creating new plugin wrappers for Ionic Native.
|
|||||||
|
|
||||||
## Creating Plugin Wrappers
|
## 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):
|
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.
|
`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
|
### 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.
|
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
|
### 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
|
### 'Wrapping' Up
|
||||||
|
|
||||||
That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.
|
That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.
|
||||||
|
|
||||||
|
## 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
|
39
README.md
39
README.md
@ -17,7 +17,7 @@ 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.
|
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);
|
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);
|
||||||
@ -31,10 +31,47 @@ let watch = Geolocation.watchPosition().subscribe(pos => {
|
|||||||
watch.unsubscribe();
|
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
|
### 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.
|
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
|
## Installation
|
||||||
|
|
||||||
Run following commmand to install ionic-native in your project.
|
Run following commmand to install ionic-native in your project.
|
||||||
|
50
TEMPLATE
Normal file
50
TEMPLATE
Normal file
@ -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<any>} Returns a promise that resolves when something happens
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static functionName(arg1: string, arg2: number): Promise<any> {
|
||||||
|
return; // We add return; here to avoid any IDE / Compiler errors
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
gulpfile.js
21
gulpfile.js
@ -2,7 +2,9 @@ var gulp = require('gulp');
|
|||||||
var minimist = require('minimist');
|
var minimist = require('minimist');
|
||||||
var uglify = require('gulp-uglify');
|
var uglify = require('gulp-uglify');
|
||||||
var rename = require("gulp-rename");
|
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 = {
|
var flagConfig = {
|
||||||
string: ['port', 'version', 'ngVersion', 'animations'],
|
string: ['port', 'version', 'ngVersion', 'animations'],
|
||||||
@ -25,8 +27,17 @@ gulp.task("minify:dist", function(){
|
|||||||
.pipe(gulp.dest('./dist'));
|
.pipe(gulp.dest('./dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("tslint", function(){
|
gulp.task('lint', function() {
|
||||||
gulp.src("src/**/*.ts")
|
tslint({src: 'src/**/*.ts'});
|
||||||
.pipe(tslint())
|
});
|
||||||
.pipe(tslint.report('verbose'));
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ionic-native",
|
"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",
|
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
@ -16,13 +16,16 @@
|
|||||||
"conventional-github-releaser": "^1.1.3",
|
"conventional-github-releaser": "^1.1.3",
|
||||||
"cpr": "^1.0.0",
|
"cpr": "^1.0.0",
|
||||||
"cz-conventional-changelog": "^1.1.6",
|
"cz-conventional-changelog": "^1.1.6",
|
||||||
|
"decamelize": "^1.2.0",
|
||||||
"dgeni": "^0.4.2",
|
"dgeni": "^0.4.2",
|
||||||
"dgeni-packages": "^0.10.18",
|
"dgeni-packages": "^0.10.18",
|
||||||
"glob": "^6.0.4",
|
"glob": "^6.0.4",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
|
"gulp-replace": "^0.5.4",
|
||||||
"gulp-tslint": "^5.0.0",
|
"gulp-tslint": "^5.0.0",
|
||||||
"gulp-uglify": "^1.5.4",
|
"gulp-uglify": "^1.5.4",
|
||||||
|
"ionic-gulp-tslint": "^1.0.0",
|
||||||
"lodash": "3.10.1",
|
"lodash": "3.10.1",
|
||||||
"minimist": "^1.1.3",
|
"minimist": "^1.1.3",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
@ -30,18 +33,19 @@
|
|||||||
"q": "1.4.1",
|
"q": "1.4.1",
|
||||||
"semver": "^5.0.1",
|
"semver": "^5.0.1",
|
||||||
"tslint": "^3.8.1",
|
"tslint": "^3.8.1",
|
||||||
"tslint-eslint-rules": "^1.3.0",
|
"tslint-ionic-rules": "0.0.5",
|
||||||
"typescript": "^1.8.10"
|
"typescript": "^1.8.10"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"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",
|
"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:js": "./node_modules/.bin/tsc",
|
||||||
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
|
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
|
||||||
"build:minify": "./node_modules/.bin/gulp minify:dist",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
26
scripts/bower.json
Normal file
26
scripts/bower.json
Normal file
@ -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 <max@ionic.io>"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"ionic",
|
||||||
|
"native",
|
||||||
|
"html5",
|
||||||
|
"hybrid",
|
||||||
|
"mobile"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/driftyco/ionic-native-bower",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
]
|
||||||
|
}
|
28
scripts/bower.sh
Normal file
28
scripts/bower.sh
Normal file
@ -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"
|
207
src/index.ts
207
src/index.ts
@ -1,76 +1,97 @@
|
|||||||
import {initAngular1} from './ng1';
|
import { initAngular1 } from './ng1';
|
||||||
|
|
||||||
const DEVICE_READY_TIMEOUT = 2000;
|
const DEVICE_READY_TIMEOUT = 2000;
|
||||||
|
|
||||||
declare var window;
|
declare var window;
|
||||||
|
|
||||||
import {ActionSheet} from './plugins/actionsheet';
|
import { ActionSheet } from './plugins/actionsheet';
|
||||||
import {AdMob} from './plugins/admob';
|
import { AdMob } from './plugins/admob';
|
||||||
import {AppAvailability} from './plugins/appavailability';
|
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
|
||||||
import {AppRate} from './plugins/apprate';
|
import { AppAvailability } from './plugins/appavailability';
|
||||||
import {AppVersion} from './plugins/appversion';
|
import { AppRate } from './plugins/apprate';
|
||||||
import {Badge} from './plugins/badge';
|
import { AppVersion } from './plugins/appversion';
|
||||||
import {BackgroundGeolocation} from './plugins/background-geolocation';
|
import { Badge } from './plugins/badge';
|
||||||
import {BackgroundMode} from './plugins/backgroundmode';
|
import { BackgroundGeolocation } from './plugins/background-geolocation';
|
||||||
import {BarcodeScanner} from './plugins/barcodescanner';
|
import { BackgroundMode } from './plugins/backgroundmode';
|
||||||
import {Base64ToGallery} from './plugins/base64togallery';
|
import { BarcodeScanner } from './plugins/barcodescanner';
|
||||||
import {BatteryStatus} from './plugins/batterystatus';
|
import { Base64ToGallery } from './plugins/base64togallery';
|
||||||
import {Brightness} from './plugins/brightness';
|
import { BatteryStatus } from './plugins/batterystatus';
|
||||||
import {BLE} from './plugins/ble';
|
import { Brightness } from './plugins/brightness';
|
||||||
import {BluetoothSerial} from './plugins/bluetoothserial';
|
import { BLE } from './plugins/ble';
|
||||||
import {Calendar} from './plugins/calendar';
|
import { BluetoothSerial } from './plugins/bluetoothserial';
|
||||||
import {Camera} from './plugins/camera';
|
import { Calendar } from './plugins/calendar';
|
||||||
import {CardIO} from './plugins/card-io';
|
import { Camera } from './plugins/camera';
|
||||||
import {Clipboard} from './plugins/clipboard';
|
import { CameraPreview } from './plugins/camera-preview';
|
||||||
import {Contacts} from './plugins/contacts';
|
import { CardIO } from './plugins/card-io';
|
||||||
import {DatePicker} from './plugins/datepicker';
|
import { Clipboard } from './plugins/clipboard';
|
||||||
import {DBMeter} from './plugins/dbmeter';
|
import { Contacts } from './plugins/contacts';
|
||||||
import {Deeplinks} from './plugins/deeplinks';
|
import { Crop } from './plugins/crop';
|
||||||
import {Device} from './plugins/device';
|
import { DatePicker } from './plugins/datepicker';
|
||||||
import {DeviceAccounts} from './plugins/deviceaccounts';
|
import { DBMeter } from './plugins/dbmeter';
|
||||||
import {DeviceMotion} from './plugins/devicemotion';
|
import { Deeplinks } from './plugins/deeplinks';
|
||||||
import {DeviceOrientation} from './plugins/deviceorientation';
|
import { Device } from './plugins/device';
|
||||||
import {Diagnostic} from './plugins/diagnostic';
|
import { DeviceAccounts } from './plugins/deviceaccounts';
|
||||||
import {Dialogs} from './plugins/dialogs';
|
import { DeviceMotion } from './plugins/devicemotion';
|
||||||
import {EmailComposer} from './plugins/emailcomposer';
|
import { DeviceOrientation } from './plugins/deviceorientation';
|
||||||
import {Facebook} from './plugins/facebook';
|
import { Diagnostic } from './plugins/diagnostic';
|
||||||
import {File} from './plugins/file';
|
import { Dialogs } from './plugins/dialogs';
|
||||||
import {Transfer} from './plugins/filetransfer';
|
import { EmailComposer } from './plugins/emailcomposer';
|
||||||
import {Flashlight} from './plugins/flashlight';
|
import { EstimoteBeacons } from './plugins/estimote-beacons';
|
||||||
import {Geolocation} from './plugins/geolocation';
|
import { Facebook } from './plugins/facebook';
|
||||||
import {Globalization} from './plugins/globalization';
|
import { File } from './plugins/file';
|
||||||
import {GooglePlus} from './plugins/google-plus';
|
import { Transfer } from './plugins/filetransfer';
|
||||||
import {GoogleMap} from './plugins/googlemaps';
|
import { Flashlight } from './plugins/flashlight';
|
||||||
import {GoogleAnalytics} from './plugins/googleanalytics';
|
import { Geofence } from './plugins/geofence';
|
||||||
import {Hotspot} from './plugins/hotspot';
|
import { Geolocation } from './plugins/geolocation';
|
||||||
import {Httpd} from './plugins/httpd';
|
import { Globalization } from './plugins/globalization';
|
||||||
import {IBeacon} from './plugins/ibeacon';
|
import { GooglePlus } from './plugins/google-plus';
|
||||||
import {ImagePicker} from './plugins/imagepicker';
|
import { GoogleMap } from './plugins/googlemaps';
|
||||||
import {InAppBrowser} from './plugins/inappbrowser';
|
import { GoogleAnalytics } from './plugins/googleanalytics';
|
||||||
import {InAppPurchase} from './plugins/inapppurchase';
|
import { Hotspot } from './plugins/hotspot';
|
||||||
import {Insomnia} from './plugins/insomnia';
|
import { Httpd } from './plugins/httpd';
|
||||||
import {Keyboard} from './plugins/keyboard';
|
import { IBeacon } from './plugins/ibeacon';
|
||||||
import {LaunchNavigator} from './plugins/launchnavigator';
|
import { ImagePicker } from './plugins/imagepicker';
|
||||||
import {LocalNotifications} from './plugins/localnotifications';
|
import { ImageResizer } from './plugins/imageresizer';
|
||||||
import {MediaPlugin} from './plugins/media';
|
import { InAppBrowser } from './plugins/inappbrowser';
|
||||||
import {Network} from './plugins/network';
|
import { InAppPurchase } from './plugins/inapppurchase';
|
||||||
import {OneSignal} from './plugins/onesignal';
|
import { Insomnia } from './plugins/insomnia';
|
||||||
import {PinDialog} from './plugins/pin-dialog';
|
import { Instagram } from './plugins/instagram';
|
||||||
import {Printer} from './plugins/printer';
|
import { IsDebug } from './plugins/is-debug';
|
||||||
import {Push} from './plugins/push';
|
import { Keyboard } from './plugins/keyboard';
|
||||||
import {SafariViewController} from './plugins/safari-view-controller';
|
import { LaunchNavigator } from './plugins/launchnavigator';
|
||||||
import {Screenshot} from './plugins/screenshot';
|
import { LocalNotifications } from './plugins/localnotifications';
|
||||||
import {SMS} from './plugins/sms';
|
import { MediaCapture } from './plugins/media-capture';
|
||||||
import {SocialSharing} from './plugins/socialsharing';
|
import { NativeAudio } from './plugins/native-audio';
|
||||||
import {SpinnerDialog} from './plugins/spinnerdialog';
|
import { NativeStorage } from './plugins/nativestorage';
|
||||||
import {Splashscreen} from './plugins/splashscreen';
|
import { MediaPlugin } from './plugins/media';
|
||||||
import {SQLite} from './plugins/sqlite';
|
import { Network } from './plugins/network';
|
||||||
import {StatusBar} from './plugins/statusbar';
|
import { OneSignal } from './plugins/onesignal';
|
||||||
import {ThreeDeeTouch} from './plugins/3dtouch';
|
import { PhotoViewer } from './plugins/photo-viewer';
|
||||||
import {Toast} from './plugins/toast';
|
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||||
import {TouchID} from './plugins/touchid';
|
import { PinDialog } from './plugins/pin-dialog';
|
||||||
import {Vibration} from './plugins/vibration';
|
import { Printer } from './plugins/printer';
|
||||||
import {WebIntent} from './plugins/webintent';
|
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/3dtouch';
|
||||||
export * from './plugins/background-geolocation';
|
export * from './plugins/background-geolocation';
|
||||||
export * from './plugins/backgroundmode';
|
export * from './plugins/backgroundmode';
|
||||||
@ -83,24 +104,33 @@ export * from './plugins/datepicker';
|
|||||||
export * from './plugins/device';
|
export * from './plugins/device';
|
||||||
export * from './plugins/devicemotion';
|
export * from './plugins/devicemotion';
|
||||||
export * from './plugins/deviceorientation';
|
export * from './plugins/deviceorientation';
|
||||||
|
export * from './plugins/facebook';
|
||||||
|
export * from './plugins/file';
|
||||||
export * from './plugins/filetransfer';
|
export * from './plugins/filetransfer';
|
||||||
|
export * from './plugins/geolocation';
|
||||||
export * from './plugins/googlemaps';
|
export * from './plugins/googlemaps';
|
||||||
export * from './plugins/httpd';
|
export * from './plugins/httpd';
|
||||||
export * from './plugins/ibeacon';
|
export * from './plugins/ibeacon';
|
||||||
export * from './plugins/imagepicker';
|
export * from './plugins/imagepicker';
|
||||||
|
export * from './plugins/imageresizer';
|
||||||
export * from './plugins/inappbrowser';
|
export * from './plugins/inappbrowser';
|
||||||
export * from './plugins/launchnavigator';
|
export * from './plugins/launchnavigator';
|
||||||
export * from './plugins/localnotifications';
|
export * from './plugins/localnotifications';
|
||||||
export * from './plugins/media';
|
export * from './plugins/media';
|
||||||
|
export * from './plugins/media-capture';
|
||||||
export * from './plugins/printer';
|
export * from './plugins/printer';
|
||||||
export * from './plugins/push';
|
export * from './plugins/push';
|
||||||
export * from './plugins/safari-view-controller';
|
export * from './plugins/safari-view-controller';
|
||||||
export * from './plugins/sms';
|
export * from './plugins/sms';
|
||||||
export * from './plugins/spinnerdialog';
|
export * from './plugins/spinnerdialog';
|
||||||
export * from './plugins/toast';
|
export * from './plugins/toast';
|
||||||
|
export * from './plugins/twitter-connect';
|
||||||
|
export * from './plugins/video-editor';
|
||||||
|
export * from './plugins/video-player';
|
||||||
export {
|
export {
|
||||||
ActionSheet,
|
ActionSheet,
|
||||||
AdMob,
|
AdMob,
|
||||||
|
AndroidFingerprintAuth,
|
||||||
AppAvailability,
|
AppAvailability,
|
||||||
AppRate,
|
AppRate,
|
||||||
AppVersion,
|
AppVersion,
|
||||||
@ -111,36 +141,48 @@ export {
|
|||||||
Brightness,
|
Brightness,
|
||||||
BLE,
|
BLE,
|
||||||
BluetoothSerial,
|
BluetoothSerial,
|
||||||
|
CameraPreview,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
|
Crop,
|
||||||
DBMeter,
|
DBMeter,
|
||||||
Deeplinks,
|
Deeplinks,
|
||||||
DeviceAccounts,
|
DeviceAccounts,
|
||||||
Dialogs,
|
Dialogs,
|
||||||
Diagnostic,
|
Diagnostic,
|
||||||
EmailComposer,
|
EmailComposer,
|
||||||
Facebook,
|
EstimoteBeacons,
|
||||||
File,
|
File,
|
||||||
Flashlight,
|
Flashlight,
|
||||||
Geolocation,
|
Geofence,
|
||||||
Globalization,
|
Globalization,
|
||||||
GooglePlus,
|
GooglePlus,
|
||||||
GoogleAnalytics,
|
GoogleAnalytics,
|
||||||
Hotspot,
|
Hotspot,
|
||||||
InAppPurchase,
|
InAppPurchase,
|
||||||
Insomnia,
|
Insomnia,
|
||||||
|
Instagram,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
|
NativeAudio,
|
||||||
|
NativeStorage,
|
||||||
Network,
|
Network,
|
||||||
OneSignal,
|
OneSignal,
|
||||||
|
PhotoViewer,
|
||||||
|
ScreenOrientation,
|
||||||
PinDialog,
|
PinDialog,
|
||||||
Screenshot,
|
Screenshot,
|
||||||
|
SecureStorage,
|
||||||
|
Shake,
|
||||||
SocialSharing,
|
SocialSharing,
|
||||||
|
Sim,
|
||||||
Splashscreen,
|
Splashscreen,
|
||||||
SQLite,
|
SQLite,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
TouchID,
|
TouchID,
|
||||||
Transfer,
|
Transfer,
|
||||||
|
TextToSpeech,
|
||||||
Vibration,
|
Vibration,
|
||||||
WebIntent
|
WebIntent,
|
||||||
|
Zip
|
||||||
}
|
}
|
||||||
|
|
||||||
export * from './plugins/plugin';
|
export * from './plugins/plugin';
|
||||||
@ -149,6 +191,7 @@ export * from './plugins/plugin';
|
|||||||
window['IonicNative'] = {
|
window['IonicNative'] = {
|
||||||
ActionSheet: ActionSheet,
|
ActionSheet: ActionSheet,
|
||||||
AdMob: AdMob,
|
AdMob: AdMob,
|
||||||
|
AndroidFingerprintAuth: AndroidFingerprintAuth,
|
||||||
AppAvailability: AppAvailability,
|
AppAvailability: AppAvailability,
|
||||||
AppRate: AppRate,
|
AppRate: AppRate,
|
||||||
AppVersion: AppVersion,
|
AppVersion: AppVersion,
|
||||||
@ -163,9 +206,11 @@ window['IonicNative'] = {
|
|||||||
BluetoothSerial: BluetoothSerial,
|
BluetoothSerial: BluetoothSerial,
|
||||||
Calendar: Calendar,
|
Calendar: Calendar,
|
||||||
Camera: Camera,
|
Camera: Camera,
|
||||||
|
CameraPreview: CameraPreview,
|
||||||
CardIO: CardIO,
|
CardIO: CardIO,
|
||||||
Clipboard: Clipboard,
|
Clipboard: Clipboard,
|
||||||
Contacts: Contacts,
|
Contacts: Contacts,
|
||||||
|
Crop: Crop,
|
||||||
DatePicker: DatePicker,
|
DatePicker: DatePicker,
|
||||||
DBMeter: DBMeter,
|
DBMeter: DBMeter,
|
||||||
Deeplinks: Deeplinks,
|
Deeplinks: Deeplinks,
|
||||||
@ -176,9 +221,11 @@ window['IonicNative'] = {
|
|||||||
Dialogs: Dialogs,
|
Dialogs: Dialogs,
|
||||||
Diagnostic: Diagnostic,
|
Diagnostic: Diagnostic,
|
||||||
EmailComposer: EmailComposer,
|
EmailComposer: EmailComposer,
|
||||||
|
EstimoteBeacons: EstimoteBeacons,
|
||||||
Facebook: Facebook,
|
Facebook: Facebook,
|
||||||
File: File,
|
File: File,
|
||||||
Flashlight: Flashlight,
|
Flashlight: Flashlight,
|
||||||
|
Geofence: Geofence,
|
||||||
Geolocation: Geolocation,
|
Geolocation: Geolocation,
|
||||||
Globalization: Globalization,
|
Globalization: Globalization,
|
||||||
GooglePlus: GooglePlus,
|
GooglePlus: GooglePlus,
|
||||||
@ -188,19 +235,30 @@ window['IonicNative'] = {
|
|||||||
Httpd: Httpd,
|
Httpd: Httpd,
|
||||||
IBeacon: IBeacon,
|
IBeacon: IBeacon,
|
||||||
ImagePicker: ImagePicker,
|
ImagePicker: ImagePicker,
|
||||||
|
ImageResizer: ImageResizer,
|
||||||
InAppBrowser: InAppBrowser,
|
InAppBrowser: InAppBrowser,
|
||||||
InAppPurchase: InAppPurchase,
|
InAppPurchase: InAppPurchase,
|
||||||
|
Instagram: Instagram,
|
||||||
|
IsDebug: IsDebug,
|
||||||
Keyboard: Keyboard,
|
Keyboard: Keyboard,
|
||||||
LaunchNavigator: LaunchNavigator,
|
LaunchNavigator: LaunchNavigator,
|
||||||
LocalNotifications: LocalNotifications,
|
LocalNotifications: LocalNotifications,
|
||||||
|
MediaCapture: MediaCapture,
|
||||||
MediaPlugin: MediaPlugin,
|
MediaPlugin: MediaPlugin,
|
||||||
|
NativeAudio: NativeAudio,
|
||||||
|
NativeStorage: NativeStorage,
|
||||||
Network: Network,
|
Network: Network,
|
||||||
Printer: Printer,
|
Printer: Printer,
|
||||||
Push: Push,
|
Push: Push,
|
||||||
OneSignal: OneSignal,
|
OneSignal: OneSignal,
|
||||||
|
PhotoViewer: PhotoViewer,
|
||||||
|
ScreenOrientation: ScreenOrientation,
|
||||||
PinDialog: PinDialog,
|
PinDialog: PinDialog,
|
||||||
SafariViewController: SafariViewController,
|
SafariViewController: SafariViewController,
|
||||||
Screenshot: Screenshot,
|
Screenshot: Screenshot,
|
||||||
|
SecureStorage: SecureStorage,
|
||||||
|
Shake: Shake,
|
||||||
|
Sim: Sim,
|
||||||
SMS: SMS,
|
SMS: SMS,
|
||||||
SocialSharing: SocialSharing,
|
SocialSharing: SocialSharing,
|
||||||
SpinnerDialog: SpinnerDialog,
|
SpinnerDialog: SpinnerDialog,
|
||||||
@ -211,8 +269,13 @@ window['IonicNative'] = {
|
|||||||
Toast: Toast,
|
Toast: Toast,
|
||||||
TouchID: TouchID,
|
TouchID: TouchID,
|
||||||
Transfer: Transfer,
|
Transfer: Transfer,
|
||||||
|
TextToSpeech: TextToSpeech,
|
||||||
|
TwitterConnect: TwitterConnect,
|
||||||
|
VideoEditor: VideoEditor,
|
||||||
|
VideoPlayer: VideoPlayer,
|
||||||
Vibration: Vibration,
|
Vibration: Vibration,
|
||||||
WebIntent: WebIntent
|
WebIntent: WebIntent,
|
||||||
|
Zip: Zip
|
||||||
};
|
};
|
||||||
|
|
||||||
initAngular1(window['IonicNative']);
|
initAngular1(window['IonicNative']);
|
||||||
|
@ -3,7 +3,7 @@ declare var window;
|
|||||||
/**
|
/**
|
||||||
* Initialize the ionic.native Angular module if we're running in ng1.
|
* Initialize the ionic.native Angular module if we're running in ng1.
|
||||||
* This iterates through the list of registered plugins and dynamically
|
* 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) {
|
export function initAngular1(plugins) {
|
||||||
if (window.angular) {
|
if (window.angular) {
|
||||||
@ -15,11 +15,8 @@ export function initAngular1(plugins) {
|
|||||||
|
|
||||||
(function(serviceName, cls, name) {
|
(function(serviceName, cls, name) {
|
||||||
window.angular.module('ionic.native').service(serviceName, [function() {
|
window.angular.module('ionic.native').service(serviceName, [function() {
|
||||||
let funcs = {};
|
var funcs = window.angular.copy(cls);
|
||||||
for (var k in cls) {
|
funcs.prototype['name'] = name;
|
||||||
funcs[k] = cls[k];
|
|
||||||
}
|
|
||||||
funcs['name'] = name;
|
|
||||||
return funcs;
|
return funcs;
|
||||||
}]);
|
}]);
|
||||||
})(serviceName, cls, name);
|
})(serviceName, cls, name);
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
declare var window: any;
|
declare var window: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 3DTouch
|
* @name 3DTouch
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
|
* 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 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()
|
* ThreeDeeTouch.watchForceTouches()
|
||||||
* .subscribe(
|
* .subscribe(
|
||||||
@ -54,7 +57,7 @@ declare var window: any;
|
|||||||
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
|
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
|
||||||
* (payload) => {
|
* (payload) => {
|
||||||
* // returns an object that is the button you presed
|
* // 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)
|
* console.log(payload.type)
|
||||||
*
|
*
|
||||||
* }
|
* }
|
||||||
@ -62,81 +65,85 @@ declare var window: any;
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-3dtouch',
|
plugin: 'cordova-plugin-3dtouch',
|
||||||
pluginRef: 'ThreeDeeTouch',
|
pluginRef: 'ThreeDeeTouch',
|
||||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
|
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
|
||||||
platforms: ['iOS']
|
platforms: ['iOS']
|
||||||
})
|
})
|
||||||
export class ThreeDeeTouch {
|
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.
|
* 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<boolean>} returns a promise that resolves with a boolean that indicates whether the plugin is available or not
|
* @returns {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether the plugin is available or not
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isAvailable(): Promise<boolean> {return; }
|
static isAvailable(): Promise<boolean> { 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.
|
* 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<ThreeDeeTouchForceTouch>} Returns an observable that sends a `ThreeDeeTouchForceTouch` object
|
* @returns {Observable<ThreeDeeTouchForceTouch>} Returns an observable that sends a `ThreeDeeTouchForceTouch` object
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
observable: true
|
observable: true
|
||||||
})
|
})
|
||||||
static watchForceTouches(): Observable<ThreeDeeTouchForceTouch> {return; }
|
static watchForceTouches(): Observable<ThreeDeeTouchForceTouch> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setup the 3D-touch actions, takes an array of objects with the following
|
* 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} type (optional) A type that can be used `onHomeIconPressed` callback
|
||||||
* @param {string} title Title for your action
|
* @param {string} title Title for your action
|
||||||
* @param {string} subtitle (optional) A short description for your action
|
* @param {string} subtitle (optional) A short description for your action
|
||||||
* @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update
|
* @param {string} 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({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static configureQuickActions(quickActions: Array<ThreeDeeTouchQuickAction>): void {}
|
static configureQuickActions(quickActions: Array<ThreeDeeTouchQuickAction>): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a home icon is pressed, your app launches and this JS callback is invoked.
|
* When a home icon is pressed, your app launches and this JS callback is invoked.
|
||||||
* @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon
|
* @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon
|
||||||
*/
|
*/
|
||||||
static onHomeIconPressed(): Observable<any> {
|
static onHomeIconPressed(): Observable<any> {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
|
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) {
|
||||||
else {
|
window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
|
||||||
observer.error('3dTouch plugin is not available.');
|
} else {
|
||||||
observer.complete();
|
observer.error('3dTouch plugin is not available.');
|
||||||
}
|
observer.complete();
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Link Preview.
|
* Enable Link Preview.
|
||||||
* UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
|
* UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static enableLinkPreview(): void {}
|
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 {
|
export interface ThreeDeeTouchQuickAction {
|
||||||
type?: string;
|
type?: string;
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
iconType?: string;
|
iconType?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ThreeDeeTouchForceTouch {
|
export interface ThreeDeeTouchForceTouch {
|
||||||
force: number;
|
force: number;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Action Sheet
|
* @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).
|
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {ActionSheet} from 'ionic-native';
|
* import { ActionSheet } from 'ionic-native';
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||||
* ActionSheet.show({
|
* ActionSheet.show({
|
||||||
@ -17,8 +19,8 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* 'buttonLabels': buttonLabels,
|
* 'buttonLabels': buttonLabels,
|
||||||
* 'addCancelButtonWithLabel': 'Cancel',
|
* 'addCancelButtonWithLabel': 'Cancel',
|
||||||
* 'addDestructiveButtonWithLabel' : 'Delete'
|
* 'addDestructiveButtonWithLabel' : 'Delete'
|
||||||
* }).then(buttonIndex => {
|
* }).then((buttonIndex: number) => {
|
||||||
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
|
* console.log('Button pressed: ' + buttonIndex);
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -71,4 +73,5 @@ export class ActionSheet {
|
|||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static hide(options?: any): Promise<any> { return; }
|
static hide(options?: any): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name AdMob
|
* @name AdMob
|
||||||
@ -22,7 +22,7 @@ export class AdMob {
|
|||||||
* @param adIdOrOptions
|
* @param adIdOrOptions
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static createBanner(adIdOrOptions: any): Promise<any> {return; }
|
static createBanner(adIdOrOptions: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -30,7 +30,7 @@ export class AdMob {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static removeBanner(): void {}
|
static removeBanner(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -39,7 +39,7 @@ export class AdMob {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static showBanner(position: any): void {}
|
static showBanner(position: any): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -49,7 +49,7 @@ export class AdMob {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static showBannerAtXY(x: number, y: number): void {}
|
static showBannerAtXY(x: number, y: number): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -57,14 +57,14 @@ export class AdMob {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static hideBanner(): void {}
|
static hideBanner(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param adIdOrOptions
|
* @param adIdOrOptions
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static prepareInterstitial(adIdOrOptions: any): Promise<any> {return; }
|
static prepareInterstitial(adIdOrOptions: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show interstitial
|
* Show interstitial
|
||||||
@ -72,20 +72,20 @@ export class AdMob {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static showInterstitial(): void {}
|
static showInterstitial(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isInterstitialReady (): Promise<boolean> {return; }
|
static isInterstitialReady(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare a reward video ad
|
* Prepare a reward video ad
|
||||||
* @param adIdOrOptions
|
* @param adIdOrOptions
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static prepareRewardVideoAd(adIdOrOptions: any): Promise<any> {return; }
|
static prepareRewardVideoAd(adIdOrOptions: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a reward video ad
|
* 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
|
* @param options Returns a promise that resolves if the options are set successfully
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static setOptions(options: any): Promise<any> {return; }
|
static setOptions(options: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user ad settings
|
* Get user ad settings
|
||||||
* @returns {Promise<any>} Returns a promise that resolves with the ad settings
|
* @returns {Promise<any>} Returns a promise that resolves with the ad settings
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getAdSettings(): Promise<any> {return; }
|
static getAdSettings(): Promise<any> { return; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
@ -115,65 +115,65 @@ export class AdMob {
|
|||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onBannerFailedToReceive'
|
event: 'onBannerFailedToReceive'
|
||||||
})
|
})
|
||||||
static onBannerFailedToReceive (): Observable<any> {return; }
|
static onBannerFailedToReceive(): Observable<any> { return; }
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onBannerReceive'
|
event: 'onBannerReceive'
|
||||||
})
|
})
|
||||||
static onBannerReceive (): Observable<any> {return; }
|
static onBannerReceive(): Observable<any> { return; }
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onBannerPresent'
|
event: 'onBannerPresent'
|
||||||
})
|
})
|
||||||
static onBannerPresent (): Observable<any> {return; }
|
static onBannerPresent(): Observable<any> { return; }
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onBannerLeaveApp'
|
event: 'onBannerLeaveApp'
|
||||||
})
|
})
|
||||||
static onBannerLeaveApp (): Observable<any> {return; }
|
static onBannerLeaveApp(): Observable<any> { return; }
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onBannerDismiss'
|
event: 'onBannerDismiss'
|
||||||
})
|
})
|
||||||
static onBannerDismiss (): Observable<any> {return; }
|
static onBannerDismiss(): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onInterstitialFailedToReceive'
|
event: 'onInterstitialFailedToReceive'
|
||||||
})
|
})
|
||||||
static onInterstitialFailedToReceive (): Observable<any> {return; }
|
static onInterstitialFailedToReceive(): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onInterstitialReceive'
|
event: 'onInterstitialReceive'
|
||||||
})
|
})
|
||||||
static onInterstitialReceive (): Observable<any> {return; }
|
static onInterstitialReceive(): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onInterstitialPresent'
|
event: 'onInterstitialPresent'
|
||||||
})
|
})
|
||||||
static onInterstitialPresent (): Observable<any> {return; }
|
static onInterstitialPresent(): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onInterstitialLeaveApp'
|
event: 'onInterstitialLeaveApp'
|
||||||
})
|
})
|
||||||
static onInterstitialLeaveApp (): Observable<any> {return; }
|
static onInterstitialLeaveApp(): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
@Cordova({
|
@Cordova({
|
||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'onInterstitialDismiss'
|
event: 'onInterstitialDismiss'
|
||||||
})
|
})
|
||||||
static onInterstitialDismiss (): Observable<any> {return; }
|
static onInterstitialDismiss(): Observable<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
77
src/plugins/android-fingerprint-auth.ts
Normal file
77
src/plugins/android-fingerprint-auth.ts
Normal file
@ -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; }
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name App Availability
|
* @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).
|
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {AppAvailability} from 'ionic-native';
|
* import { AppAvailability } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* var app;
|
* let app;
|
||||||
*
|
*
|
||||||
* if(device.platform === 'iOS') {
|
* if (device.platform === 'iOS') {
|
||||||
* app = 'twitter://';
|
* app = 'twitter://';
|
||||||
* }else if(device.platform === 'Android'){
|
* } else if (device.platform === 'Android') {
|
||||||
* app = 'com.twitter.android';
|
* app = 'com.twitter.android';
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* AppAvailability.check(app)
|
* AppAvailability.check(app)
|
||||||
* .then(
|
* .then(
|
||||||
* yes => console.log(app + " is available"),
|
* (yes: string) => console.log(app + ' is available'),
|
||||||
* no => console.log(app + " is NOT available")
|
* (no: string) => console.log(app + ' is NOT available')
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova, CordovaProperty} from './plugin';
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var window;
|
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).
|
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {AppRate} from 'ionic-native';
|
* import { AppRate } from 'ionic-native';
|
||||||
*
|
*
|
||||||
|
* AppRate.preferences.storeAppURL = {
|
||||||
|
* ios: '<my_app_id>',
|
||||||
|
* android: 'market://details?id=<package_name>',
|
||||||
|
* };
|
||||||
*
|
*
|
||||||
* AppRate.preferences.storeAppURL.ios = '<my_app_id>';
|
|
||||||
* AppRate.preferences.storeAppURL.android = 'market://details?id=<package_name>';
|
|
||||||
* AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/';
|
|
||||||
* AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=<the Package Family Name of the application>';
|
|
||||||
* AppRate.promptForRating();
|
* AppRate.promptForRating();
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -62,6 +63,6 @@ export class AppRate {
|
|||||||
* @param {boolean} immediately Show the rating prompt immediately.
|
* @param {boolean} immediately Show the rating prompt immediately.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static promptForRating(immediately: boolean): void {};
|
static promptForRating(immediately: boolean): void { };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name App Version
|
* @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).
|
* 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
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {AppVersion} from 'ionic-native';
|
* import { AppVersion } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* AppVersion.getAppName();
|
* AppVersion.getAppName();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
|
|
||||||
declare var window;
|
declare var window;
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ export interface Config {
|
|||||||
* When enabled, the plugin will emit sounds for life-cycle events of
|
* When enabled, the plugin will emit sounds for life-cycle events of
|
||||||
* background-geolocation! See debugging sounds table.
|
* background-geolocation! See debugging sounds table.
|
||||||
*/
|
*/
|
||||||
debug: boolean;
|
debug?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The minimum distance (measured in meters) a device must move horizontally
|
* The minimum distance (measured in meters) a device must move horizontally
|
||||||
@ -99,7 +98,9 @@ export interface Config {
|
|||||||
/**
|
/**
|
||||||
* IOS, ANDROID ONLY
|
* IOS, ANDROID ONLY
|
||||||
* Enable this in order to force a stop() when the application terminated
|
* 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;
|
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)
|
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
|
||||||
* for more information
|
* for more information
|
||||||
*/
|
*/
|
||||||
locationTimeout?: number;
|
interval?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ANDROID ONLY
|
* ANDROID ONLY
|
||||||
@ -141,7 +142,7 @@ export interface Config {
|
|||||||
* ANDROID ONLY
|
* ANDROID ONLY
|
||||||
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
|
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
|
||||||
*/
|
*/
|
||||||
locationService?: number;
|
locationProvider?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IOS ONLY
|
* IOS ONLY
|
||||||
@ -161,9 +162,8 @@ export interface Config {
|
|||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {BackgroundGeolocation} from 'ionic-native';
|
* import { BackgroundGeolocation } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // When device is ready :
|
* // When device is ready :
|
||||||
@ -178,18 +178,19 @@ export interface Config {
|
|||||||
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
|
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* BackgroundGeolocation.configure(config)
|
* BackgroundGeolocation.configure((location) => {
|
||||||
* .then((location) => {
|
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
|
||||||
* 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,
|
||||||
* // 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.
|
||||||
* // 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.
|
||||||
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||||
* BackgroundGeolocation.finish(); // FOR IOS ONLY
|
|
||||||
* })
|
* }, (error) => {
|
||||||
* .catch((error) => {
|
* console.log('BackgroundGeolocation error');
|
||||||
* console.log('BackgroundGeolocation error');
|
* }, {
|
||||||
* });
|
* //options
|
||||||
|
* });
|
||||||
*
|
*
|
||||||
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
|
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
|
||||||
* BackgroundGeolocation.start();
|
* BackgroundGeolocation.start();
|
||||||
@ -219,9 +220,9 @@ export class BackgroundGeolocation {
|
|||||||
* Options a json object of type Config
|
* Options a json object of type Config
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
callbackOrder: 'reverse'
|
sync: true
|
||||||
})
|
})
|
||||||
static configure(options: Config): Promise<Location> { return; }
|
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Background Mode
|
* @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.
|
* Cordova plugin to prevent the app from going to sleep while in background.
|
||||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
|
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
|
||||||
*@usage
|
*@usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {BackgroundMode} from 'ionic-native';
|
* import { BackgroundMode } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* BackgroundMode.enable();
|
* BackgroundMode.enable();
|
||||||
* ```
|
* ```
|
||||||
@ -39,28 +39,28 @@ export class BackgroundMode {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static enable(): void {}
|
static enable(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the background mode.
|
* Disable the background mode.
|
||||||
* Once the background mode has been disabled, the app will be paused when in background.
|
* Once the background mode has been disabled, the app will be paused when in background.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static disable(): void {}
|
static disable(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if background mode is enabled or not.
|
* Checks if background mode is enabled or not.
|
||||||
* @returns {boolean} returns a true of false if the background mode is enabled.
|
* @returns {boolean} returns a true of false if the background mode is enabled.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isEnabled(): Promise<boolean> {return; }
|
static isEnabled(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be used to get the information if the background mode is active.
|
* Can be used to get the information if the background mode is active.
|
||||||
* @returns {boolean} returns tru or flase if the background mode is active.
|
* @returns {boolean} returns tru or flase if the background mode is active.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isActive(): Promise<boolean> {return; }
|
static isActive(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override the default title, ticker and text.
|
* Override the default title, ticker and text.
|
||||||
@ -70,7 +70,7 @@ export class BackgroundMode {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android']
|
platforms: ['Android']
|
||||||
})
|
})
|
||||||
static setDefaults(options?: Configure): void {}
|
static setDefaults(options?: Configure): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify the displayed information.
|
* Modify the displayed information.
|
||||||
@ -80,17 +80,18 @@ export class BackgroundMode {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android']
|
platforms: ['Android']
|
||||||
})
|
})
|
||||||
static update(options?: Configure): void {}
|
static update(options?: Configure): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a callback for a specific event
|
* 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.
|
* 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({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static on(eventName: string, callback: any): void {}
|
static on(eventName: string, callback: any): void { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Badge
|
* @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).
|
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Badge} from 'ionic-native';
|
* import { Badge } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Badge.set(10);
|
* Badge.set(10);
|
||||||
@ -74,4 +74,5 @@ export class Badge {
|
|||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static registerPermission(): Promise<any> { return; }
|
static registerPermission(): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Barcode Scanner
|
* @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).
|
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {BarcodeScanner} from 'ionic-native';
|
* import { BarcodeScanner } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* BarcodeScanner.scan().then((barcodeData) => {
|
* BarcodeScanner.scan().then((barcodeData) => {
|
||||||
@ -38,6 +38,7 @@ export class BarcodeScanner {
|
|||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Open the barcode scanner.
|
* 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.
|
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
@ -48,10 +49,10 @@ export class BarcodeScanner {
|
|||||||
/**
|
/**
|
||||||
* Encodes data into a barcode.
|
* Encodes data into a barcode.
|
||||||
* NOTE: not well supported on Android
|
* NOTE: not well supported on Android
|
||||||
* @param type
|
* @param type {string} Type of encoding
|
||||||
* @param data
|
* @param data {any} Data to encode
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static encode(type: string, data: any): Promise<any> {return; }
|
static encode(type: string, data: any): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
/**
|
/**
|
||||||
* @name Base64 To Gallery
|
* @name Base64 To Gallery
|
||||||
* @description This plugin allows you to save base64 data as a png image into the device
|
* @description This plugin allows you to save base64 data as a png image into the device
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {Base64ToGallery} from 'ionic-native';
|
* import { Base64ToGallery } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
|
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
|
||||||
* res => console.log("Saved image to gallery ", res),
|
* res => console.log('Saved image to gallery ', res),
|
||||||
* err => console.log("Error saving image to gallery ", err)
|
* 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
|
* 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 {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.
|
* @returns {Promise} returns a promise that resolves when the image is saved.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static base64ToGallery(data: string , prefix?: string ): Promise<any> {
|
static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Battery Status
|
* @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).
|
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {BatteryStatus} from 'ionic-native';
|
* import { BatteryStatus } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // watch change in battery status
|
* // watch change in battery status
|
||||||
* let subscription = BatteryStatus.onChange().subscribe(
|
* let subscription = BatteryStatus.onChange().subscribe(
|
||||||
* status => {
|
* (status: StatusObject) => {
|
||||||
* console.log(status.level, status.isPlugged);
|
* console.log(status.level, status.isPlugged);
|
||||||
* }
|
* }
|
||||||
* );
|
* );
|
||||||
@ -39,7 +38,7 @@ export class BatteryStatus {
|
|||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'batterystatus'
|
event: 'batterystatus'
|
||||||
})
|
})
|
||||||
static onChange (): Observable<StatusObject> {return; }
|
static onChange(): Observable<StatusObject> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watch when the battery level goes low
|
* Watch when the battery level goes low
|
||||||
@ -49,7 +48,7 @@ export class BatteryStatus {
|
|||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'batterylow'
|
event: 'batterylow'
|
||||||
})
|
})
|
||||||
static onLow (): Observable<StatusObject> {return; }
|
static onLow(): Observable<StatusObject> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watch when the battery level goes to critial
|
* Watch when the battery level goes to critial
|
||||||
@ -59,7 +58,7 @@ export class BatteryStatus {
|
|||||||
eventObservable: true,
|
eventObservable: true,
|
||||||
event: 'batterycritical'
|
event: 'batterycritical'
|
||||||
})
|
})
|
||||||
static onCritical (): Observable<StatusObject> {return; }
|
static onCritical(): Observable<StatusObject> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BLE
|
* @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.
|
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* {
|
* {
|
||||||
* "name": "Battery Demo",
|
* "name": "Battery Demo",
|
||||||
* "id": "20:FF:D0:FF:D1:C0",
|
* "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.
|
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* {
|
* {
|
||||||
* "name": "Battery Demo",
|
* "name": "Battery Demo",
|
||||||
* "id": "20:FF:D0:FF:D1:C0",
|
* "id": "20:FF:D0:FF:D1:C0",
|
||||||
@ -93,7 +93,7 @@ import {Observable} from 'rxjs/Observable';
|
|||||||
*
|
*
|
||||||
* ### Android
|
* ### Android
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* {
|
* {
|
||||||
* "name": "demo",
|
* "name": "demo",
|
||||||
* "id": "00:1A:7D:DA:71:13",
|
* "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.
|
* 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",
|
* "name": "demo",
|
||||||
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
|
* "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.
|
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* // ASCII only
|
* // ASCII only
|
||||||
* function stringToBytes(string) {
|
* function stringToBytes(string) {
|
||||||
* var array = new Uint8Array(string.length);
|
* var array = new Uint8Array(string.length);
|
||||||
@ -272,7 +272,7 @@ export class BLE {
|
|||||||
deviceId: string,
|
deviceId: string,
|
||||||
serviceUUID: string,
|
serviceUUID: string,
|
||||||
characteristicUUID: string
|
characteristicUUID: string
|
||||||
): Promise<any> { return; };
|
): Promise<any> { return; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the value of a characteristic.
|
* Write the value of a characteristic.
|
||||||
@ -308,7 +308,7 @@ export class BLE {
|
|||||||
serviceUUID: string,
|
serviceUUID: string,
|
||||||
characteristicUUID: string,
|
characteristicUUID: string,
|
||||||
value: ArrayBuffer
|
value: ArrayBuffer
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the value of a characteristic without waiting for confirmation from the peripheral.
|
* Write the value of a characteristic without waiting for confirmation from the peripheral.
|
||||||
@ -325,7 +325,7 @@ export class BLE {
|
|||||||
serviceUUID: string,
|
serviceUUID: string,
|
||||||
characteristicUUID: string,
|
characteristicUUID: string,
|
||||||
value: ArrayBuffer
|
value: ArrayBuffer
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register to be notified when the value of a characteristic changes.
|
* Register to be notified when the value of a characteristic changes.
|
||||||
@ -351,7 +351,7 @@ export class BLE {
|
|||||||
deviceId: string,
|
deviceId: string,
|
||||||
serviceUUID: string,
|
serviceUUID: string,
|
||||||
characteristicUUID: string
|
characteristicUUID: string
|
||||||
): Observable<any> { return; }
|
): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop being notified when the value of a characteristic changes.
|
* Stop being notified when the value of a characteristic changes.
|
||||||
@ -366,7 +366,7 @@ export class BLE {
|
|||||||
deviceId: string,
|
deviceId: string,
|
||||||
serviceUUID: string,
|
serviceUUID: string,
|
||||||
characteristicUUID: string
|
characteristicUUID: string
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report the connection status.
|
* Report the connection status.
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Bluetooth Serial
|
* @name Bluetooth Serial
|
||||||
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
|
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
|
* import { BluetoothSerial } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
* // Write a string
|
* // Write a string
|
||||||
* Bluetooth.write("hello world").then(success, failure);
|
* BluetoothSerial.write("hello world").then(success, failure);
|
||||||
*
|
*
|
||||||
* // Array of int or bytes
|
* // Array of int or bytes
|
||||||
* Bluetooth.write([186, 220, 222]).then(success, failure);
|
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
|
||||||
*
|
*
|
||||||
* // Typed Array
|
* // Typed Array
|
||||||
* var data = new Uint8Array(4);
|
* var data = new Uint8Array(4);
|
||||||
@ -18,10 +21,10 @@ import {Observable} from 'rxjs/Observable';
|
|||||||
* data[1] = 0x42;
|
* data[1] = 0x42;
|
||||||
* data[2] = 0x43;
|
* data[2] = 0x43;
|
||||||
* data[3] = 0x44;
|
* data[3] = 0x44;
|
||||||
* Bluetooth.write(data).then(success, failure);
|
* BluetoothSerial.write(data).then(success, failure);
|
||||||
*
|
*
|
||||||
* // Array Buffer
|
* // Array Buffer
|
||||||
* Bluetooth.write(data.buffer).then(success, failure);
|
* BluetoothSerial.write(data.buffer).then(success, failure);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -42,7 +45,7 @@ export class BluetoothSerial {
|
|||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'disconnect'
|
clearFunction: 'disconnect'
|
||||||
})
|
})
|
||||||
static connect (macAddress_or_uuid: string): Observable<any> {return; }
|
static connect(macAddress_or_uuid: string): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect insecurely to a Bluetooth device
|
* Connect insecurely to a Bluetooth device
|
||||||
@ -54,7 +57,7 @@ export class BluetoothSerial {
|
|||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'disconnect'
|
clearFunction: 'disconnect'
|
||||||
})
|
})
|
||||||
static connectInsecure (macAddress: string): Observable<any> {return; }
|
static connectInsecure(macAddress: string): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes data to the serial port
|
* Writes data to the serial port
|
||||||
@ -64,7 +67,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static write (data: any): Promise<any> {return; }
|
static write(data: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the number of bytes of data available
|
* Gets the number of bytes of data available
|
||||||
@ -72,7 +75,7 @@ export class BluetoothSerial {
|
|||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
}) static available (): Promise<any> {return; }
|
}) static available(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads data from the buffer
|
* Reads data from the buffer
|
||||||
@ -81,7 +84,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static read (): Promise<any> {return; }
|
static read(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads data from the buffer until it reaches a delimiter
|
* Reads data from the buffer until it reaches a delimiter
|
||||||
@ -91,7 +94,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static readUntil (delimiter: string): Promise<any> {return; }
|
static readUntil(delimiter: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to be notified when data is received
|
* Subscribe to be notified when data is received
|
||||||
@ -103,7 +106,7 @@ export class BluetoothSerial {
|
|||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'unsubscribe'
|
clearFunction: 'unsubscribe'
|
||||||
})
|
})
|
||||||
static subscribe (delimiter: string): Observable<any> {return; }
|
static subscribe(delimiter: string): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to be notified when data is received
|
* Subscribe to be notified when data is received
|
||||||
@ -114,7 +117,7 @@ export class BluetoothSerial {
|
|||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'unsubscribeRawData'
|
clearFunction: 'unsubscribeRawData'
|
||||||
})
|
})
|
||||||
static subscribeRawData (): Observable<any> {return; }
|
static subscribeRawData(): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears data in buffer
|
* Clears data in buffer
|
||||||
@ -123,7 +126,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static clear (): Promise<any> {return; }
|
static clear(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists bonded devices
|
* Lists bonded devices
|
||||||
@ -132,7 +135,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static list (): Promise<any> {return; }
|
static list(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports if bluetooth is enabled
|
* Reports if bluetooth is enabled
|
||||||
@ -141,7 +144,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static isEnabled (): Promise<any> {return; }
|
static isEnabled(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports the connection status
|
* Reports the connection status
|
||||||
@ -150,7 +153,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static isConnected (): Promise<any> {return; }
|
static isConnected(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the RSSI from the connected peripheral
|
* Reads the RSSI from the connected peripheral
|
||||||
@ -159,7 +162,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static readRSSI (): Promise<any> {return; }
|
static readRSSI(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the Bluetooth settings on the device
|
* Show the Bluetooth settings on the device
|
||||||
@ -168,7 +171,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static showBluetoothSettings (): Promise<any> {return; }
|
static showBluetoothSettings(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Bluetooth on the device
|
* Enable Bluetooth on the device
|
||||||
@ -177,7 +180,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static enable (): Promise<any> {return; }
|
static enable(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discover unpaired devices
|
* Discover unpaired devices
|
||||||
@ -186,7 +189,7 @@ export class BluetoothSerial {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
})
|
})
|
||||||
static discoverUnpaired (): Promise<any> {return; }
|
static discoverUnpaired(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
|
* 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,
|
observable: true,
|
||||||
clearFunction: 'clearDeviceDiscoveredListener'
|
clearFunction: 'clearDeviceDiscoveredListener'
|
||||||
})
|
})
|
||||||
static setDeviceDiscoveredListener (): Observable<any> {return; }
|
static setDeviceDiscoveredListener(): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the human readable device name that is broadcasted to other devices
|
* Sets the human readable device name that is broadcasted to other devices
|
||||||
@ -207,7 +210,7 @@ export class BluetoothSerial {
|
|||||||
platforms: ['Android'],
|
platforms: ['Android'],
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static setName (newName: string): void {}
|
static setName(newName: string): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes the device discoverable by other devices
|
* Makes the device discoverable by other devices
|
||||||
@ -217,5 +220,6 @@ export class BluetoothSerial {
|
|||||||
platforms: ['Android'],
|
platforms: ['Android'],
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static setDiscoverable (discoverableDuration: number): void {}
|
static setDiscoverable(discoverableDuration: number): void { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Brightness
|
* @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).
|
* Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {Brightness} from 'ionic-native';
|
* import { Brightness } from 'ionic-native';
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* let brightnessValue: number = 0.8;
|
* let brightnessValue: number = 0.8;
|
||||||
* Brightness.setBrightness(brightnessValue);
|
* Brightness.setBrightness(brightnessValue);
|
||||||
@ -17,34 +18,35 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-brightness',
|
plugin: 'cordova-plugin-brightness',
|
||||||
pluginRef: 'plugins.brightness',
|
pluginRef: 'cordova.plugins.brightness',
|
||||||
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
|
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
|
||||||
platforms: ['Android', 'iOS']
|
platforms: ['Android', 'iOS']
|
||||||
})
|
})
|
||||||
export class Brightness {
|
export class Brightness {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the brightness of the display.
|
* 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.
|
* @param {value} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
|
||||||
* @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
|
* @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static setBrightness(value: number): Promise<any> { return; }
|
static setBrightness(value: number): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the current brightness of the device display.
|
* Reads the current brightness of the device display.
|
||||||
*
|
*
|
||||||
* @returns {Promise} Returns a Promise that resolves with the
|
* @returns {Promise} Returns a Promise that resolves with the
|
||||||
* brightness value of the device display (floating number between 0 and 1).
|
* brightness value of the device display (floating number between 0 and 1).
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getBrightness(): Promise<any> { return; }
|
static getBrightness(): Promise<any> { 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 { }
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
export interface CalendarOptions {
|
export interface CalendarOptions {
|
||||||
firstReminderMinutes?: number;
|
firstReminderMinutes?: number;
|
||||||
secondReminderMinutes?: number;
|
secondReminderMinutes?: number;
|
||||||
@ -11,11 +15,6 @@ export interface CalendarOptions {
|
|||||||
url?: string;
|
url?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Calendar {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Calendar
|
* @name Calendar
|
||||||
* @description
|
* @description
|
||||||
@ -23,7 +22,18 @@ export interface Calendar {
|
|||||||
*
|
*
|
||||||
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
|
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @usage
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {Calendar} from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Calendar.createCalendar('MyCalendar').then(
|
||||||
|
* (msg) => { console.log(msg); },
|
||||||
|
* (err) => { console.log(err); }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -48,78 +58,54 @@ export class Calendar {
|
|||||||
@Cordova()
|
@Cordova()
|
||||||
static hasReadWritePermission(): Promise<boolean> { return; }
|
static hasReadWritePermission(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we have read permission
|
* Check if we have read permission
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static hasReadPermission(): Promise<boolean> {return; }
|
static hasReadPermission(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we have write permission
|
* Check if we have write permission
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static hasWritePermission(): Promise<boolean> {return; }
|
static hasWritePermission(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request write permission
|
* Request write permission
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static requestWritePermission(): Promise<any> {return; }
|
static requestWritePermission(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request read permission
|
* Request read permission
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static requestReadPermission(): Promise<any> {return; }
|
static requestReadPermission(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests read/write permissions
|
* Requests read/write permissions
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static requestReadWritePermission(): Promise<any> {return; }
|
static requestReadWritePermission(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a calendar. (iOS only)
|
* Create a calendar. (iOS only)
|
||||||
*
|
*
|
||||||
* @usage
|
* @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
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static createCalendar(
|
static createCalendar(
|
||||||
nameOrOptions: string | { calendarName: string, calendarColor: string }
|
nameOrOptions: string | { calendarName: string, calendarColor: string }
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a calendar. (iOS only)
|
* 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.
|
* @param {string} name Name of the calendar to delete.
|
||||||
* @return Returns a Promise
|
* @return Returns a Promise
|
||||||
*/
|
*/
|
||||||
@ -157,7 +143,6 @@ export class Calendar {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Silently create an event.
|
* Silently create an event.
|
||||||
*
|
|
||||||
* @param {string} [title] The event title
|
* @param {string} [title] The event title
|
||||||
* @param {string} [location] The event location
|
* @param {string} [location] The event location
|
||||||
* @param {string} [notes] The event notes
|
* @param {string} [notes] The event notes
|
||||||
@ -172,7 +157,7 @@ export class Calendar {
|
|||||||
notes?: string,
|
notes?: string,
|
||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date
|
endDate?: Date
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Silently create an event with additional options.
|
* Silently create an event with additional options.
|
||||||
@ -193,7 +178,7 @@ export class Calendar {
|
|||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date,
|
endDate?: Date,
|
||||||
options?: CalendarOptions
|
options?: CalendarOptions
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactively create an event.
|
* Interactively create an event.
|
||||||
@ -212,7 +197,7 @@ export class Calendar {
|
|||||||
notes?: string,
|
notes?: string,
|
||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date
|
endDate?: Date
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactively create an event with additional options.
|
* Interactively create an event with additional options.
|
||||||
@ -233,7 +218,7 @@ export class Calendar {
|
|||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date,
|
endDate?: Date,
|
||||||
options?: CalendarOptions
|
options?: CalendarOptions
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
// deprecated
|
// deprecated
|
||||||
// @Cordova()
|
// @Cordova()
|
||||||
@ -263,11 +248,10 @@ export class Calendar {
|
|||||||
notes?: string,
|
notes?: string,
|
||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date
|
endDate?: Date
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find an event with additional options.
|
* Find an event with additional options.
|
||||||
*
|
|
||||||
* @param {string} [title] The event title
|
* @param {string} [title] The event title
|
||||||
* @param {string} [location] The event location
|
* @param {string} [location] The event location
|
||||||
* @param {string} [notes] The event notes
|
* @param {string} [notes] The event notes
|
||||||
@ -284,7 +268,7 @@ export class Calendar {
|
|||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date,
|
endDate?: Date,
|
||||||
options?: CalendarOptions
|
options?: CalendarOptions
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a list of events within the specified date range. (Android only)
|
* Find a list of events within the specified date range. (Android only)
|
||||||
@ -337,7 +321,7 @@ export class Calendar {
|
|||||||
newNotes?: string,
|
newNotes?: string,
|
||||||
newStartDate?: Date,
|
newStartDate?: Date,
|
||||||
newEndDate?: Date
|
newEndDate?: Date
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify an event with additional options. (iOS only)
|
* Modify an event with additional options. (iOS only)
|
||||||
@ -355,31 +339,31 @@ export class Calendar {
|
|||||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||||
* @return Returns a Promise
|
* @return Returns a Promise
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static modifyEventWithOptions(
|
static modifyEventWithOptions(
|
||||||
title?: string,
|
title?: string,
|
||||||
location?: string,
|
location?: string,
|
||||||
notes?: string,
|
notes?: string,
|
||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date,
|
endDate?: Date,
|
||||||
newTitle?: string,
|
newTitle?: string,
|
||||||
newLocation?: string,
|
newLocation?: string,
|
||||||
newNotes?: string,
|
newNotes?: string,
|
||||||
newStartDate?: Date,
|
newStartDate?: Date,
|
||||||
newEndDate?: Date,
|
newEndDate?: Date,
|
||||||
options?: CalendarOptions
|
options?: CalendarOptions
|
||||||
) { return; }
|
) { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an event.
|
* Delete an event.
|
||||||
*
|
*
|
||||||
* @param {string} [title] The event title
|
* @param {string} [title] The event title
|
||||||
* @param {string} [location] The event location
|
* @param {string} [location] The event location
|
||||||
* @param {string} [notes] The event notes
|
* @param {string} [notes] The event notes
|
||||||
* @param {Date} [startDate] The event start date
|
* @param {Date} [startDate] The event start date
|
||||||
* @param {Date} [endDate] The event end date
|
* @param {Date} [endDate] The event end date
|
||||||
* @return Returns a Promise
|
* @return Returns a Promise
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static deleteEvent(
|
static deleteEvent(
|
||||||
title?: string,
|
title?: string,
|
||||||
@ -387,7 +371,7 @@ export class Calendar {
|
|||||||
notes?: string,
|
notes?: string,
|
||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date
|
endDate?: Date
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an event from the specified Calendar. (iOS only)
|
* Delete an event from the specified Calendar. (iOS only)
|
||||||
@ -400,20 +384,22 @@ export class Calendar {
|
|||||||
* @param {string} calendarName
|
* @param {string} calendarName
|
||||||
* @return Returns a Promise
|
* @return Returns a Promise
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static deleteEventFromNamedCalendar(
|
static deleteEventFromNamedCalendar(
|
||||||
title?: string,
|
title?: string,
|
||||||
location?: string,
|
location?: string,
|
||||||
notes?: string,
|
notes?: string,
|
||||||
startDate?: Date,
|
startDate?: Date,
|
||||||
endDate?: Date,
|
endDate?: Date,
|
||||||
calendarName?: string
|
calendarName?: string
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the calendar at the specified date.
|
* Open the calendar at the specified date.
|
||||||
* @return {Date} date
|
* @param {Date} date The date you want to open the calendar on
|
||||||
|
* @return {Promise<any>} Promise returns a promise
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static openCalendar(date: Date): Promise<any> { return; }
|
static openCalendar(date: Date): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
124
src/plugins/camera-preview.ts
Normal file
124
src/plugins/camera-preview.ts
Normal file
@ -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<any> { 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
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,67 +1,67 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface CameraOptions {
|
export interface CameraOptions {
|
||||||
/** Picture quality in range 0-100. Default is 50 */
|
/** Picture quality in range 0-100. Default is 50 */
|
||||||
quality?: number;
|
quality?: number;
|
||||||
/**
|
/**
|
||||||
* Choose the format of the return value.
|
* Choose the format of the return value.
|
||||||
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
||||||
* DATA_URL : 0, Return image as base64-encoded string
|
* DATA_URL : 0, Return image as base64-encoded string
|
||||||
* FILE_URI : 1, Return image file URI
|
* FILE_URI : 1, Return image file URI
|
||||||
* NATIVE_URI : 2 Return image native URI
|
* NATIVE_URI : 2 Return image native URI
|
||||||
* (e.g., assets-library:// on iOS or content:// on Android)
|
* (e.g., assets-library:// on iOS or content:// on Android)
|
||||||
*/
|
*/
|
||||||
destinationType?: number;
|
destinationType?: number;
|
||||||
/**
|
/**
|
||||||
* Set the source of the picture.
|
* Set the source of the picture.
|
||||||
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
|
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
|
||||||
* PHOTOLIBRARY : 0,
|
* PHOTOLIBRARY : 0,
|
||||||
* CAMERA : 1,
|
* CAMERA : 1,
|
||||||
* SAVEDPHOTOALBUM : 2
|
* SAVEDPHOTOALBUM : 2
|
||||||
*/
|
*/
|
||||||
sourceType?: number;
|
sourceType?: number;
|
||||||
/** Allow simple editing of image before selection. */
|
/** Allow simple editing of image before selection. */
|
||||||
allowEdit?: boolean;
|
allowEdit?: boolean;
|
||||||
/**
|
/**
|
||||||
* Choose the returned image file's encoding.
|
* Choose the returned image file's encoding.
|
||||||
* Defined in navigator.camera.EncodingType. Default is JPEG
|
* Defined in navigator.camera.EncodingType. Default is JPEG
|
||||||
* JPEG : 0 Return JPEG encoded image
|
* JPEG : 0 Return JPEG encoded image
|
||||||
* PNG : 1 Return PNG encoded image
|
* PNG : 1 Return PNG encoded image
|
||||||
*/
|
*/
|
||||||
encodingType?: number;
|
encodingType?: number;
|
||||||
/**
|
/**
|
||||||
* Width in pixels to scale image. Must be used with targetHeight.
|
* Width in pixels to scale image. Must be used with targetHeight.
|
||||||
* Aspect ratio remains constant.
|
* Aspect ratio remains constant.
|
||||||
*/
|
*/
|
||||||
targetWidth?: number;
|
targetWidth?: number;
|
||||||
/**
|
/**
|
||||||
* Height in pixels to scale image. Must be used with targetWidth.
|
* Height in pixels to scale image. Must be used with targetWidth.
|
||||||
* Aspect ratio remains constant.
|
* Aspect ratio remains constant.
|
||||||
*/
|
*/
|
||||||
targetHeight?: number;
|
targetHeight?: number;
|
||||||
/**
|
/**
|
||||||
* Set the type of media to select from. Only works when PictureSourceType
|
* Set the type of media to select from. Only works when PictureSourceType
|
||||||
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
|
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
|
||||||
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
|
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
|
||||||
* Will return format specified via DestinationType
|
* Will return format specified via DestinationType
|
||||||
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
||||||
* ALLMEDIA : 2 allow selection from all media types
|
* ALLMEDIA : 2 allow selection from all media types
|
||||||
*/
|
*/
|
||||||
mediaType?: number;
|
mediaType?: number;
|
||||||
/** Rotate the image to correct for the orientation of the device during capture. */
|
/** Rotate the image to correct for the orientation of the device during capture. */
|
||||||
correctOrientation?: boolean;
|
correctOrientation?: boolean;
|
||||||
/** Save the image to the photo album on the device after capture. */
|
/** Save the image to the photo album on the device after capture. */
|
||||||
saveToPhotoAlbum?: boolean;
|
saveToPhotoAlbum?: boolean;
|
||||||
/**
|
/**
|
||||||
* Choose the camera to use (front- or back-facing).
|
* Choose the camera to use (front- or back-facing).
|
||||||
* Defined in navigator.camera.Direction. Default is BACK.
|
* Defined in navigator.camera.Direction. Default is BACK.
|
||||||
* FRONT: 0
|
* FRONT: 0
|
||||||
* BACK: 1
|
* BACK: 1
|
||||||
*/
|
*/
|
||||||
cameraDirection?: number;
|
cameraDirection?: number;
|
||||||
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
|
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
|
||||||
popoverOptions?: CameraPopoverOptions;
|
popoverOptions?: CameraPopoverOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,20 +69,20 @@ export interface CameraOptions {
|
|||||||
* of the popover when selecting images from an iPad's library or album.
|
* of the popover when selecting images from an iPad's library or album.
|
||||||
*/
|
*/
|
||||||
export interface CameraPopoverOptions {
|
export interface CameraPopoverOptions {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
/**
|
/**
|
||||||
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
|
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
|
||||||
* Matches iOS UIPopoverArrowDirection constants.
|
* Matches iOS UIPopoverArrowDirection constants.
|
||||||
* ARROW_UP : 1,
|
* ARROW_UP : 1,
|
||||||
* ARROW_DOWN : 2,
|
* ARROW_DOWN : 2,
|
||||||
* ARROW_LEFT : 4,
|
* ARROW_LEFT : 4,
|
||||||
* ARROW_RIGHT : 8,
|
* ARROW_RIGHT : 8,
|
||||||
* ARROW_ANY : 15
|
* ARROW_ANY : 15
|
||||||
*/
|
*/
|
||||||
arrowDir: number;
|
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).
|
* 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
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Camera} from 'ionic-native';
|
* import { Camera } from 'ionic-native';
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* Camera.getPicture(options).then((imageData) => {
|
* Camera.getPicture(options).then((imageData) => {
|
||||||
* // imageData is either a base64 encoded string or a file URI
|
* // imageData is either a base64 encoded string or a file URI
|
||||||
* // If it's base64:
|
* // If it's base64:
|
||||||
* let base64Image = "data:image/jpeg;base64," + imageData;
|
* let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||||
* }, (err) => {
|
* }, (err) => {
|
||||||
|
* // Handle error
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -111,31 +113,11 @@ export interface CameraPopoverOptions {
|
|||||||
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
|
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
|
||||||
})
|
})
|
||||||
export class Camera {
|
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<any> { 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
|
* @private
|
||||||
* @enum {number}
|
* @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 */
|
/** 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,
|
DATA_URL: 0,
|
||||||
/** Return file uri (content://media/external/images/media/2 for Android) */
|
/** Return file uri (content://media/external/images/media/2 for Android) */
|
||||||
@ -148,7 +130,7 @@ export class Camera {
|
|||||||
* @private
|
* @private
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
static EncodingType = {
|
public static EncodingType = {
|
||||||
/** Return JPEG encoded image */
|
/** Return JPEG encoded image */
|
||||||
JPEG: 0,
|
JPEG: 0,
|
||||||
/** Return PNG encoded image */
|
/** Return PNG encoded image */
|
||||||
@ -158,26 +140,26 @@ export class Camera {
|
|||||||
* @private
|
* @private
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
static MediaType = {
|
public static MediaType = {
|
||||||
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
|
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
|
||||||
PICTURE: 0,
|
PICTURE: 0,
|
||||||
/** Allow selection of video only, ONLY RETURNS URL */
|
/** Allow selection of video only, ONLY RETURNS URL */
|
||||||
VIDEO: 1,
|
VIDEO: 1,
|
||||||
/** Allow selection from all media types */
|
/** Allow selection from all media types */
|
||||||
ALLMEDIA : 2
|
ALLMEDIA: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
static PictureSourceType = {
|
public static PictureSourceType = {
|
||||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||||
PHOTOLIBRARY : 0,
|
PHOTOLIBRARY: 0,
|
||||||
/** Take picture from camera */
|
/** Take picture from camera */
|
||||||
CAMERA : 1,
|
CAMERA: 1,
|
||||||
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
/** 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.
|
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
static PopoverArrowDirection = {
|
public static PopoverArrowDirection = {
|
||||||
ARROW_UP : 1,
|
ARROW_UP: 1,
|
||||||
ARROW_DOWN : 2,
|
ARROW_DOWN: 2,
|
||||||
ARROW_LEFT : 4,
|
ARROW_LEFT: 4,
|
||||||
ARROW_RIGHT : 8,
|
ARROW_RIGHT: 8,
|
||||||
ARROW_ANY : 15
|
ARROW_ANY: 15
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
static Direction = {
|
public static Direction = {
|
||||||
/** Use the back-facing camera */
|
/** Use the back-facing camera */
|
||||||
BACK: 0,
|
BACK: 0,
|
||||||
/** Use the front-facing camera */
|
/** Use the front-facing camera */
|
||||||
FRONT: 1
|
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<any> { 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() { };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name CardIO
|
* @name CardIO
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```
|
* ```
|
||||||
* import {CardIO} from 'ionic-native';
|
* import { CardIO } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
|
||||||
*
|
*
|
||||||
* CardIO.canScan()
|
* CardIO.canScan()
|
||||||
* .then(
|
* .then(
|
||||||
@ -25,49 +25,50 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
||||||
pluginRef: 'CardIO',
|
pluginRef: 'CardIO',
|
||||||
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
export class CardIO {
|
export class CardIO {
|
||||||
/**
|
/**
|
||||||
* Check whether card scanning is currently available. (May vary by
|
* Check whether card scanning is currently available. (May vary by
|
||||||
* device, OS version, network connectivity, etc.)
|
* device, OS version, network connectivity, etc.)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static canScan(): Promise<boolean> {return; }
|
static canScan(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan a credit card with card.io.
|
* Scan a credit card with card.io.
|
||||||
* @param {CardIOOptions} options Options for configuring the plugin
|
* @param {CardIOOptions} options Options for configuring the plugin
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static scan(options?: CardIOOptions): Promise<any> {return; }
|
static scan(options?: CardIOOptions): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the version of the card.io library. Useful when contacting support.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static version(): Promise<string> { return; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the version of the card.io library. Useful when contacting support.
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
static version(): Promise<string> {return; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CardIOOptions {
|
export interface CardIOOptions {
|
||||||
requireExpiry?: boolean;
|
requireExpiry?: boolean;
|
||||||
requireCCV?: boolean;
|
requireCCV?: boolean;
|
||||||
requirePostalCode?: boolean;
|
requirePostalCode?: boolean;
|
||||||
supressManual?: boolean;
|
supressManual?: boolean;
|
||||||
restrictPostalCodeToNumericOnly?: boolean;
|
restrictPostalCodeToNumericOnly?: boolean;
|
||||||
keepApplicationTheme?: boolean;
|
keepApplicationTheme?: boolean;
|
||||||
requireCardholderName?: boolean;
|
requireCardholderName?: boolean;
|
||||||
scanInstructions?: string;
|
scanInstructions?: string;
|
||||||
noCamera?: boolean;
|
noCamera?: boolean;
|
||||||
scanExpiry?: boolean;
|
scanExpiry?: boolean;
|
||||||
languageOrLocale?: string;
|
languageOrLocale?: string;
|
||||||
guideColor?: string;
|
guideColor?: string;
|
||||||
supressConfirmation?: boolean;
|
supressConfirmation?: boolean;
|
||||||
hideCardIOLogo?: boolean;
|
hideCardIOLogo?: boolean;
|
||||||
useCardIOLogo?: boolean;
|
useCardIOLogo?: boolean;
|
||||||
supressScan?: boolean;
|
supressScan?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Clipboard
|
* @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).
|
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Clipboard} from 'ionic-native';
|
* import { Clipboard } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
* Clipboard.copy('Hello world');
|
||||||
* Clipboard.copy("Hello world");
|
|
||||||
*
|
*
|
||||||
* Clipboard.paste().then(
|
* Clipboard.paste().then(
|
||||||
* (resolve : string) => {
|
* (resolve: string) => {
|
||||||
* alert(resolve);
|
* alert(resolve);
|
||||||
* },
|
* },
|
||||||
* (reject : string) => {
|
* (reject: string) => {
|
||||||
* alert("Error: " + reject);
|
* alert('Error: ' + reject);
|
||||||
* }
|
* }
|
||||||
* );
|
* );
|
||||||
* );
|
* );
|
||||||
|
@ -1,235 +1,253 @@
|
|||||||
import {Plugin, Cordova, InstanceProperty, CordovaInstance} from './plugin';
|
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?: 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[];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
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
|
* @private
|
||||||
*/
|
*/
|
||||||
export class Contact {
|
export class Contact implements IContactProperties {
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
@InstanceProperty get id(): string {return; }
|
@InstanceProperty get id(): string { return; }
|
||||||
@InstanceProperty get displayName(): string {return; }
|
@InstanceProperty get displayName(): string { return; }
|
||||||
@InstanceProperty get nickname(): ContactName {return; }
|
@InstanceProperty get name(): IContactName {return; }
|
||||||
@InstanceProperty get phoneNumbers(): string {return; }
|
@InstanceProperty get nickname(): string { return; }
|
||||||
@InstanceProperty get emails(): IContactField[] {return; }
|
@InstanceProperty get phoneNumbers(): IContactField[] { return; }
|
||||||
@InstanceProperty get addresses(): ContactAddress[] {return; }
|
@InstanceProperty get emails(): IContactField[] { return; }
|
||||||
@InstanceProperty get ims(): IContactField[] {return; }
|
@InstanceProperty get addresses(): IContactAddress[] { return; }
|
||||||
@InstanceProperty get organizations(): ContactOrganization[] {return; }
|
@InstanceProperty get ims(): IContactField[] { return; }
|
||||||
@InstanceProperty get birthday(): Date {return; }
|
@InstanceProperty get organizations(): IContactOrganization[] { return; }
|
||||||
@InstanceProperty get note(): string {return; }
|
@InstanceProperty get birthday(): Date { return; }
|
||||||
@InstanceProperty get photos(): IContactField[] {return; }
|
@InstanceProperty get note(): string { return; }
|
||||||
@InstanceProperty get categories(): IContactField[] {return; }
|
@InstanceProperty get photos(): IContactField[] { return; }
|
||||||
@InstanceProperty get urls(): IContactField[] {return; }
|
@InstanceProperty get categories(): IContactField[] { return; }
|
||||||
constructor () {
|
@InstanceProperty get urls(): IContactField[] { return; }
|
||||||
this._objectInstance = navigator.contacts.create();
|
|
||||||
|
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 {
|
return newContact;
|
||||||
let newContact = new Contact();
|
}
|
||||||
for (let prop in this) {
|
|
||||||
if (prop === 'id') return;
|
@CordovaInstance()
|
||||||
newContact[prop] = this[prop];
|
remove(): Promise<any> { return; }
|
||||||
}
|
|
||||||
return newContact;
|
@CordovaInstance()
|
||||||
}
|
save(): Promise<any> { return; }
|
||||||
@CordovaInstance()
|
|
||||||
remove(): Promise<any> {return; }
|
|
||||||
@CordovaInstance()
|
|
||||||
save(): Promise<any> {return; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IContactError {
|
interface IContactError {
|
||||||
/** Error code */
|
/** Error code */
|
||||||
code: number;
|
code: number;
|
||||||
/** Error message */
|
/** Error message */
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare var ContactError: {
|
declare var ContactError: {
|
||||||
new(code: number): IContactError;
|
new (code: number): IContactError;
|
||||||
UNKNOWN_ERROR: number;
|
UNKNOWN_ERROR: number;
|
||||||
INVALID_ARGUMENT_ERROR: number;
|
INVALID_ARGUMENT_ERROR: number;
|
||||||
TIMEOUT_ERROR: number;
|
TIMEOUT_ERROR: number;
|
||||||
PENDING_OPERATION_ERROR: number;
|
PENDING_OPERATION_ERROR: number;
|
||||||
IO_ERROR: number;
|
IO_ERROR: number;
|
||||||
NOT_SUPPORTED_ERROR: number;
|
NOT_SUPPORTED_ERROR: number;
|
||||||
PERMISSION_DENIED_ERROR: number
|
PERMISSION_DENIED_ERROR: number
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IContactName {
|
export interface IContactName {
|
||||||
/** The complete name of the contact. */
|
/** The complete name of the contact. */
|
||||||
formatted?: string;
|
formatted?: string;
|
||||||
/** The contact's family name. */
|
/** The contact's family name. */
|
||||||
familyName?: string;
|
familyName?: string;
|
||||||
/** The contact's given name. */
|
/** The contact's given name. */
|
||||||
givenName?: string;
|
givenName?: string;
|
||||||
/** The contact's middle name. */
|
/** The contact's middle name. */
|
||||||
middleName?: string;
|
middleName?: string;
|
||||||
/** The contact's prefix (example Mr. or Dr.) */
|
/** The contact's prefix (example Mr. or Dr.) */
|
||||||
honorificPrefix?: string;
|
honorificPrefix?: string;
|
||||||
/** The contact's suffix (example Esq.). */
|
/** The contact's suffix (example Esq.). */
|
||||||
honorificSuffix?: string;
|
honorificSuffix?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export class ContactName implements IContactName {
|
export class ContactName implements IContactName {
|
||||||
private _objectInstance: any;
|
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);
|
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 formatted(): string { return; }
|
||||||
@InstanceProperty get middleName(): string {return; }
|
@InstanceProperty get familyName(): string { return; }
|
||||||
@InstanceProperty get honorificPrefix(): string {return; }
|
@InstanceProperty get givenName(): string { return; }
|
||||||
@InstanceProperty get honorificSuffix(): string {return; }
|
@InstanceProperty get middleName(): string { return; }
|
||||||
|
@InstanceProperty get honorificPrefix(): string { return; }
|
||||||
|
@InstanceProperty get honorificSuffix(): string { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IContactField {
|
export interface IContactField {
|
||||||
/** A string that indicates what type of field this is, home for example. */
|
/** A string that indicates what type of field this is, home for example. */
|
||||||
type: string;
|
type: string;
|
||||||
/** The value of the field, such as a phone number or email address. */
|
/** The value of the field, such as a phone number or email address. */
|
||||||
value: string;
|
value: string;
|
||||||
/** Set to true if this ContactField contains the user's preferred value. */
|
/** Set to true if this ContactField contains the user's preferred value. */
|
||||||
pref: boolean;
|
pref: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export class ContactField implements IContactField {
|
export class ContactField implements IContactField {
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
constructor(type?: string, value?: string, pref?: boolean) {
|
|
||||||
this._objectInstance = new window.ContactField(type, value, pref);
|
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; }
|
@InstanceProperty get type(): string { return; }
|
||||||
|
@InstanceProperty get value(): string { return; }
|
||||||
|
@InstanceProperty get pref(): boolean { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IContactAddress {
|
export interface IContactAddress {
|
||||||
/** Set to true if this ContactAddress contains the user's preferred value. */
|
/** Set to true if this ContactAddress contains the user's preferred value. */
|
||||||
pref?: boolean;
|
pref?: boolean;
|
||||||
/** A string indicating what type of field this is, home for example. */
|
/** A string indicating what type of field this is, home for example. */
|
||||||
type?: string;
|
type?: string;
|
||||||
/** The full address formatted for display. */
|
/** The full address formatted for display. */
|
||||||
formatted?: string;
|
formatted?: string;
|
||||||
/** The full street address. */
|
/** The full street address. */
|
||||||
streetAddress?: string;
|
streetAddress?: string;
|
||||||
/** The city or locality. */
|
/** The city or locality. */
|
||||||
locality?: string;
|
locality?: string;
|
||||||
/** The state or region. */
|
/** The state or region. */
|
||||||
region?: string;
|
region?: string;
|
||||||
/** The zip code or postal code. */
|
/** The zip code or postal code. */
|
||||||
postalCode?: string;
|
postalCode?: string;
|
||||||
/** The country name. */
|
/** The country name. */
|
||||||
country?: string;
|
country?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export class ContactAddress implements IContactAddress {
|
export class ContactAddress implements IContactAddress {
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
constructor (pref?: boolean,
|
|
||||||
type?: string,
|
constructor(pref?: boolean,
|
||||||
formatted?: string,
|
type?: string,
|
||||||
streetAddress?: string,
|
formatted?: string,
|
||||||
locality?: string,
|
streetAddress?: string,
|
||||||
region?: string,
|
locality?: string,
|
||||||
postalCode?: string,
|
region?: string,
|
||||||
country?: string) {
|
postalCode?: string,
|
||||||
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
|
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 pref(): boolean { return; }
|
||||||
@InstanceProperty get streetAddress(): string {return; }
|
@InstanceProperty get type(): string { return; }
|
||||||
@InstanceProperty get locality(): string {return; }
|
@InstanceProperty get formatted(): string { return; }
|
||||||
@InstanceProperty get region(): string {return; }
|
@InstanceProperty get streetAddress(): string { return; }
|
||||||
@InstanceProperty get postalCode(): string {return; }
|
@InstanceProperty get locality(): string { return; }
|
||||||
@InstanceProperty get country(): string {return; }
|
@InstanceProperty get region(): string { return; }
|
||||||
|
@InstanceProperty get postalCode(): string { return; }
|
||||||
|
@InstanceProperty get country(): string { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IContactOrganization {
|
export interface IContactOrganization {
|
||||||
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
||||||
pref?: boolean;
|
pref?: boolean;
|
||||||
/** A string that indicates what type of field this is, home for example. */
|
/** A string that indicates what type of field this is, home for example. */
|
||||||
type?: string;
|
type?: string;
|
||||||
/** The name of the organization. */
|
/** The name of the organization. */
|
||||||
name?: string;
|
name?: string;
|
||||||
/** The department the contract works for. */
|
/** The department the contract works for. */
|
||||||
department?: string;
|
department?: string;
|
||||||
/** The contact's title at the organization. */
|
/** The contact's title at the organization. */
|
||||||
title?: string;
|
title?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export class ContactOrganization implements IContactOrganization {
|
export class ContactOrganization implements IContactOrganization {
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
constructor () {
|
constructor() {
|
||||||
this._objectInstance = new window.ContactOrganization();
|
this._objectInstance = new window.ContactOrganization();
|
||||||
}
|
}
|
||||||
@InstanceProperty get pref(): boolean {return; }
|
@InstanceProperty get pref(): boolean { return; }
|
||||||
@InstanceProperty get type(): string {return; }
|
@InstanceProperty get type(): string { return; }
|
||||||
@InstanceProperty get name(): string {return; }
|
@InstanceProperty get name(): string { return; }
|
||||||
@InstanceProperty get department(): string {return; }
|
@InstanceProperty get department(): string { return; }
|
||||||
@InstanceProperty get title(): string {return; }
|
@InstanceProperty get title(): string { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Search options to filter navigator.contacts. */
|
/** Search options to filter navigator.contacts. */
|
||||||
export interface IContactFindOptions {
|
export interface IContactFindOptions {
|
||||||
/** The search string used to find navigator.contacts. */
|
/** The search string used to find navigator.contacts. */
|
||||||
filter?: string;
|
filter?: string;
|
||||||
/** Determines if the find operation returns multiple navigator.contacts. */
|
/** Determines if the find operation returns multiple navigator.contacts. */
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
|
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
|
||||||
desiredFields?: string[];
|
desiredFields?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export class ContactFindOptions implements IContactFindOptions {
|
export class ContactFindOptions implements IContactFindOptions {
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
constructor () {
|
|
||||||
this._objectInstance = new window.ContactFindOptions();
|
constructor() {
|
||||||
}
|
this._objectInstance = new window.ContactFindOptions();
|
||||||
@InstanceProperty get filter(): string {return; }
|
}
|
||||||
@InstanceProperty get multiple(): boolean {return; }
|
|
||||||
@InstanceProperty get desiredFields(): any {return; }
|
@InstanceProperty get filter(): string { return; }
|
||||||
@InstanceProperty get hasPhoneNumber(): boolean {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
|
* @usage
|
||||||
*
|
*
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Contact} from 'ionic-native';
|
* import { Contact } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* let contact = new Contact();
|
* let contact = new Contact();
|
||||||
* contact.displayName = "Mr. Ionitron";
|
* contact.displayName = 'Mr. Ionitron';
|
||||||
* contact.save().then(
|
* contact.save().then(
|
||||||
* () => console.log("Contact saved!", contact),
|
* () => console.log('Contact saved!', contact),
|
||||||
* (error: any) => console.error("Error saving contact.", error)
|
* (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'
|
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||||||
})
|
})
|
||||||
export class Contacts {
|
export class Contacts {
|
||||||
static create(): Contact {
|
static create(): Contact {
|
||||||
return new Contact();
|
return new Contact();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for contacts in the Contacts list.
|
* Search for contacts in the Contacts list.
|
||||||
* @param fields {string[]} Contact fields to be used as a search qualifier.
|
* @param fields {string[]} Contact fields to be used as a search qualifier.
|
||||||
@ -282,10 +300,12 @@ export class Contacts {
|
|||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static find(fields: string[], options?: any): Promise<any> { return; }
|
static find(fields: string[], options?: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a single Contact.
|
* Select a single Contact.
|
||||||
* @return Returns a Promise that resolves with the selected Contact
|
* @return Returns a Promise that resolves with the selected Contact
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static pickContact(): Promise<any> {return; }
|
static pickContact(): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
34
src/plugins/crop.ts
Normal file
34
src/plugins/crop.ts
Normal file
@ -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<string>} 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<string> {return; }
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface DatePickerOptions {
|
export interface DatePickerOptions {
|
||||||
/**
|
/**
|
||||||
@ -12,7 +13,7 @@ export interface DatePickerOptions {
|
|||||||
* Platforms: iOS, Android, Windows
|
* Platforms: iOS, Android, Windows
|
||||||
* Selected date
|
* Selected date
|
||||||
*/
|
*/
|
||||||
date: Date;
|
date: Date | string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms: iOS, Android, Windows
|
* Platforms: iOS, Android, Windows
|
||||||
@ -20,7 +21,7 @@ export interface DatePickerOptions {
|
|||||||
* Type: Date | empty String
|
* Type: Date | empty String
|
||||||
* Default: empty String
|
* Default: empty String
|
||||||
*/
|
*/
|
||||||
minDate?: Date;
|
minDate?: Date | string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms?: iOS, Android, Windows
|
* Platforms?: iOS, Android, Windows
|
||||||
@ -28,7 +29,7 @@ export interface DatePickerOptions {
|
|||||||
* Type?: Date | empty String
|
* Type?: Date | empty String
|
||||||
* Default?: empty String
|
* Default?: empty String
|
||||||
*/
|
*/
|
||||||
maxDate?: Date;
|
maxDate?: Date | string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms?: Android
|
* 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).
|
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {DatePicker} from 'ionic-native';
|
* import { DatePicker } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* DatePicker.show({
|
* DatePicker.show({
|
||||||
* date: new Date(),
|
* date: new Date(),
|
||||||
* mode: 'date'
|
* mode: 'date'
|
||||||
* }).then(
|
* }).then(
|
||||||
* date => console.log("Got date: ", date),
|
* date => console.log('Got date: ', date),
|
||||||
* err => console.log("Error occurred while getting date:", err)
|
* err => console.log('Error occurred while getting date: ', err)
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name DB Meter
|
* @name DB Meter
|
||||||
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
|
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {DBMeter} from 'ionic-native';
|
* import { DBMeter } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Start listening
|
* // Start listening
|
||||||
@ -16,7 +17,7 @@ import {Observable} from 'rxjs/Observable';
|
|||||||
*
|
*
|
||||||
* // Check if we are listening
|
* // Check if we are listening
|
||||||
* DBMeter.isListening().then(
|
* DBMeter.isListening().then(
|
||||||
* (isListening : boolean) => console.log(isListening)
|
* (isListening: boolean) => console.log(isListening)
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* // Stop listening
|
* // Stop listening
|
||||||
@ -24,8 +25,8 @@ import {Observable} from 'rxjs/Observable';
|
|||||||
*
|
*
|
||||||
* // Delete DBMeter instance from memory
|
* // Delete DBMeter instance from memory
|
||||||
* DBMeter.delete().then(
|
* DBMeter.delete().then(
|
||||||
* () => console.log("Deleted DB Meter instance"),
|
* () => console.log('Deleted DB Meter instance'),
|
||||||
* error => console.log("Error occurred while deleting DB Meter instance")
|
* error => console.log('Error occurred while deleting DB Meter instance')
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -45,27 +46,27 @@ export class DBMeter {
|
|||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'stop'
|
clearFunction: 'stop'
|
||||||
})
|
})
|
||||||
static start (): Observable<any> {return; }
|
static start(): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops listening
|
* Stops listening
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static stop (): Promise<any> {return; }
|
static stop(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the DB Meter is listening
|
* Check if the DB Meter is listening
|
||||||
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
|
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isListening(): Promise<boolean> {return; }
|
static isListening(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the DB Meter instance
|
* Delete the DB Meter instance
|
||||||
* @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
|
* @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static delete(): Promise<any> {return; }
|
static delete(): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
export interface DeeplinkMatch {
|
export interface DeeplinkMatch {
|
||||||
/**
|
/**
|
||||||
@ -17,7 +18,7 @@ export interface DeeplinkMatch {
|
|||||||
* any internal native data available as "extras" at the time
|
* any internal native data available as "extras" at the time
|
||||||
* the route was matched (for example, Facebook sometimes adds extra data)
|
* 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.
|
* and Universal App Links.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {IonicDeeplinks} from 'ionic-native';
|
* import { IonicDeeplinks } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -52,7 +53,7 @@ export class Deeplinks {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
observable: true
|
observable: true
|
||||||
})
|
})
|
||||||
static route(paths): Observable<DeeplinkMatch> {return; }
|
static route(paths): Observable<DeeplinkMatch> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -75,5 +76,6 @@ export class Deeplinks {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
observable: true
|
observable: true
|
||||||
})
|
})
|
||||||
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> {return; }
|
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, CordovaProperty} from './plugin';
|
import { CordovaProperty, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var window: {
|
declare var window: {
|
||||||
device: Device
|
device: Device
|
||||||
@ -32,9 +33,8 @@ export interface Device {
|
|||||||
* Access information about the underlying device and platform.
|
* Access information about the underlying device and platform.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Device} from 'ionic-native';
|
* import { Device } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* console.log('Device UUID is: ' + Device.device.uuid);
|
* console.log('Device UUID is: ' + Device.device.uuid);
|
||||||
@ -54,4 +54,5 @@ export class Device {
|
|||||||
*/
|
*/
|
||||||
@CordovaProperty
|
@CordovaProperty
|
||||||
static get device() { return window.device; }
|
static get device() { return window.device; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import {Cordova, Plugin} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
||||||
pluginRef: 'plugins.DeviceAccounts',
|
pluginRef: 'plugins.DeviceAccounts',
|
||||||
@ -11,23 +13,24 @@ export class DeviceAccounts {
|
|||||||
* Gets all accounts registered on the Android Device
|
* Gets all accounts registered on the Android Device
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static get(): Promise<any> {return; }
|
static get(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all accounts registered on Android device for requested type
|
* Get all accounts registered on Android device for requested type
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getByType(type: string): Promise<any> {return; }
|
static getByType(type: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all emails registered on Android device (accounts with 'com.google' type)
|
* Get all emails registered on Android device (accounts with 'com.google' type)
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getEmails(): Promise<any> {return; }
|
static getEmails(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first email registered on Android device
|
* Get the first email registered on Android device
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getEmail(): Promise<any> {return; }
|
static getEmail(): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
export interface AccelerationData {
|
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).
|
* 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
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {DeviceMotion} from 'ionic-native';
|
* import { DeviceMotion } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Get the device current acceleration
|
* // Get the device current acceleration
|
||||||
* DeviceMotion.getCurrentAcceleration().then(
|
* DeviceMotion.getCurrentAcceleration().then(
|
||||||
* acceleration => console.log(acceleration),
|
* (acceleration: AccelerationData) => console.log(acceleration),
|
||||||
* error => console.log(error)
|
* (error: any) => console.log(error)
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* // Watch device acceleration
|
* // Watch device acceleration
|
||||||
* var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => {
|
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
|
||||||
* console.log(acceleration);
|
* console.log(acceleration);
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
@ -73,9 +73,7 @@ export class DeviceMotion {
|
|||||||
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
|
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getCurrentAcceleration(): Promise<AccelerationData> {
|
static getCurrentAcceleration(): Promise<AccelerationData> { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
||||||
@ -87,7 +85,6 @@ export class DeviceMotion {
|
|||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'clearWatch'
|
clearFunction: 'clearWatch'
|
||||||
})
|
})
|
||||||
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> {
|
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
export interface CompassHeading {
|
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).
|
* 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
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {DeviceOrientation} from 'ionic-native';
|
* // CompassHeading is an interface for compass
|
||||||
*
|
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Get the device current compass heading
|
* // Get the device current compass heading
|
||||||
* DeviceOrientation.getCurrentHeading().then(
|
* DeviceOrientation.getCurrentHeading().then(
|
||||||
* data => console.log(data),
|
* (data: CompassHeading) => console.log(data),
|
||||||
* error => console.log(error)
|
* (error: any) => console.log(error)
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* // Watch the device compass heading change
|
* // Watch the device compass heading change
|
||||||
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
||||||
* data => console.log(data)
|
* (data: CompassHeading) => console.log(data)
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* // Stop watching heading change
|
* // Stop watching heading change
|
||||||
|
@ -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({
|
||||||
plugin: 'cordova.plugins.diagnostic',
|
plugin: 'cordova.plugins.diagnostic',
|
||||||
pluginRef: 'cordova.plugins.diagnostic',
|
pluginRef: 'cordova.plugins.diagnostic',
|
||||||
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
|
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
|
||||||
})
|
})
|
||||||
export class Diagnostic {
|
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.
|
* Checks if app is able to access device location.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isLocationEnabled(): Promise<any> {return; }
|
static isLocationAvailable(): Promise<any> { 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.
|
* 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. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
|
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isWifiEnabled(): Promise<any> {return; }
|
static isWifiAvailable(): Promise<any> { 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
|
* 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.
|
* application is authorized to use it.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isCameraEnabled(): Promise<any> {return; }
|
static isCameraAvailable(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
|
* 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 <uses-permission android:name="android.permission.BLUETOOTH" />
|
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isBluetoothEnabled(): Promise<any> {return; }
|
static isBluetoothAvailable(): Promise<any> { 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<boolean> { 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<any> { 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<any> { 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<boolean> {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<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the location authorization status for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static getLocationAuthorizationStatus(): Promise<any> {return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the location authorization status for the application.
|
* 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".
|
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
static requestLocationAuthorization(mode?: string): Promise<any> {return; }
|
static requestLocationAuthorization(mode?: string): Promise<any> { 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<any> {return; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if camera hardware is present on device.
|
* Checks if camera hardware is present on device.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
static isCameraPresent(): Promise<any> {return; }
|
static isCameraPresent(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the application is authorized to use the camera.
|
* 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.
|
* 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()
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
static isCameraAuthorized(): Promise<any> {return; }
|
static isCameraAuthorized(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the camera authorization status for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static getCameraAuthorizationStatus(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests camera authorization for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static requestCameraAuthorization(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the application is authorized to use the microphone.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static isMicrophoneAuthorized(): Promise<boolean> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the microphone authorization status for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests microphone authorization for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static requestMicrophoneAuthorization(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the application is authorized to use contacts (address book).
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static isContactsAuthorized(): Promise<boolean> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contacts authorization status for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static getContactsAuthroizationStatus(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests contacts authorization for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static requestContactsAuthorization(): Promise<any> { 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<boolean> { 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<any> { 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<any> { 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<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state of Bluetooth on the device.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android', 'iOS']})
|
||||||
|
static getBluetoothState(): Promise<any> {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<boolean> {return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
|
* 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:
|
* Returns true if Location mode is enabled and is set to either:
|
||||||
* - Device only = GPS hardware only (high accuracy)
|
* - Device only = GPS hardware only (high accuracy)
|
||||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({platforms: ['Android']})
|
||||||
static isGpsLocationEnabled(): Promise<any> {return; }
|
static isGpsLocationEnabled(): Promise<any> { 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<any> {return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
|
* 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)
|
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
|
||||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({platforms: ['Android']})
|
||||||
static isNetworkLocationEnabled(): Promise<any> {return; }
|
static isNetworkLocationEnabled(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current location mode setting for the device.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android']})
|
||||||
|
static getLocationMode(): Promise<any> {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<any> {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<any> {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<any> {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<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the device setting for Bluetooth is switched on.
|
||||||
|
* This requires `BLUETOOTH` permission on Android
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android']})
|
||||||
|
static isBluetoothEnabled(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the device has Bluetooth capabilities.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android']})
|
||||||
|
static hasBluetoothSupport(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android']})
|
||||||
|
static hasBluetoothLESupport(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['Android']})
|
||||||
|
static hasBluetoothLEPeripheralSupport(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static isCameraRollAuthorized(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the authorization status for the application to use the Camera Roll in Photos app.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static getCameraRollAuthorizationStatus(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests camera roll authorization for the application. Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static requestCameraRollAuthorization(): Promise<any> {return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if remote (push) notifications are enabled.
|
* Checks if remote (push) notifications are enabled.
|
||||||
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
|
|
||||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
|
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({platforms: ['iOS']})
|
||||||
static isRemoteNotificationsEnabled(): Promise<any> {return; }
|
static isRemoteNotificationsEnabled(): Promise<boolean> {return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||||
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
|
|
||||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
|
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({platforms: ['iOS']})
|
||||||
static isRegisteredForRemoteNotifications(): Promise<any> {return; }
|
static isRegisteredForRemoteNotifications(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the current setting of notification types for the app in the Settings app.
|
||||||
|
* Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static getRemoteNotificationTypes(): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the application is authorized to use reminders.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static isRemindersAuthorized(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the reminders authorization status for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static getRemindersAuthorizationStatus(): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests reminders authorization for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static requestRemindersAuthorization(): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the application is authorized for background refresh.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static isBackgroundRefreshAuthorized(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the background refresh authorization status for the application.
|
||||||
|
*/
|
||||||
|
@Cordova({platforms: ['iOS']})
|
||||||
|
static getBackgroundRefreshStatus(): Promise<any> {return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface PromptCallback {
|
export interface PromptCallback {
|
||||||
|
|
||||||
@ -11,7 +12,6 @@ export interface PromptCallback {
|
|||||||
* The text entered in the prompt dialog box. (String)
|
* The text entered in the prompt dialog box. (String)
|
||||||
*/
|
*/
|
||||||
input1: string;
|
input1: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ export interface PromptCallback {
|
|||||||
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
|
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Dialogs} from 'ionic-native';
|
* import { Dialogs } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -53,7 +53,7 @@ export class Dialogs {
|
|||||||
message,
|
message,
|
||||||
title: string = 'Alert',
|
title: string = 'Alert',
|
||||||
buttonName: string = 'OK'
|
buttonName: string = 'OK'
|
||||||
): Promise<any> {return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a customizable confirmation dialog box.
|
* Displays a customizable confirmation dialog box.
|
||||||
@ -70,7 +70,7 @@ export class Dialogs {
|
|||||||
message,
|
message,
|
||||||
title: string = 'Confirm',
|
title: string = 'Confirm',
|
||||||
buttonLabels: Array<string> = ['OK', 'Cancel']
|
buttonLabels: Array<string> = ['OK', 'Cancel']
|
||||||
): Promise<number> { return; }
|
): Promise<number> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
||||||
@ -89,7 +89,7 @@ export class Dialogs {
|
|||||||
title: string = 'Prompt',
|
title: string = 'Prompt',
|
||||||
buttonLabels: Array<string> = ['OK', 'Cancel'],
|
buttonLabels: Array<string> = ['OK', 'Cancel'],
|
||||||
defaultText: string = ''
|
defaultText: string = ''
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,6 +99,6 @@ export class Dialogs {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static beep(times: number): void {}
|
static beep(times: number): void { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var cordova: any;
|
declare var cordova: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Email Composer
|
* @name Email Composer
|
||||||
* @description
|
* @description
|
||||||
@ -7,13 +10,14 @@ declare var cordova: any;
|
|||||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
|
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
|
||||||
*
|
*
|
||||||
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
|
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
|
||||||
|
* A good alternative to this plugin is the social sharing plugin.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {EmailComposer} from 'ionic-native';
|
* import { EmailComposer } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* EmailComposer.isAvailable().then((available) =>{
|
* EmailComposer.isAvailable().then((available: boolean) =>{
|
||||||
* if(available) {
|
* if(available) {
|
||||||
* //Now we know we can send
|
* //Now we know we can send
|
||||||
* }
|
* }
|
||||||
@ -53,10 +57,25 @@ export class EmailComposer {
|
|||||||
* @param app {string?} An optional app id or uri scheme.
|
* @param app {string?} An optional app id or uri scheme.
|
||||||
* @returns {Promise<boolean>} Resolves if available, rejects if not available
|
* @returns {Promise<boolean>} Resolves if available, rejects if not available
|
||||||
*/
|
*/
|
||||||
static isAvailable (app?: string): Promise<any> {
|
static isAvailable(app?: string): Promise<any> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); });
|
if (app) {
|
||||||
else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); });
|
cordova.plugins.email.isAvailable(app, (isAvailable) => {
|
||||||
|
if (isAvailable) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
cordova.plugins.email.isAvailable((isAvailable) => {
|
||||||
|
if (isAvailable) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +86,7 @@ export class EmailComposer {
|
|||||||
* @param packageName {string} The package name
|
* @param packageName {string} The package name
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static addAlias(alias: string, packageName: string): void {}
|
static addAlias(alias: string, packageName: string): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the email composer pre-filled with data.
|
* Displays the email composer pre-filled with data.
|
||||||
@ -80,9 +99,10 @@ export class EmailComposer {
|
|||||||
successIndex: 1,
|
successIndex: 1,
|
||||||
errorIndex: 3
|
errorIndex: 3
|
||||||
})
|
})
|
||||||
static open(email: Email, scope?: any): Promise<any> {return; }
|
static open(email: Email, scope?: any): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Email {
|
export interface Email {
|
||||||
app?: string;
|
app?: string;
|
||||||
to?: string | Array<string>;
|
to?: string | Array<string>;
|
||||||
|
482
src/plugins/estimote-beacons.ts
Normal file
482
src/plugins/estimote-beacons.ts
Normal file
@ -0,0 +1,482 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name EstimoteBeacons
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* This plugin enables communication between a phone and Estimote Beacons peripherals.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-estimote',
|
||||||
|
pluginRef: 'estimote.beacons',
|
||||||
|
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
|
||||||
|
platforms: ['iOS', 'Android']
|
||||||
|
})
|
||||||
|
export class EstimoteBeacons {
|
||||||
|
|
||||||
|
/** Proximity value */
|
||||||
|
static ProximityUnknown = 0;
|
||||||
|
|
||||||
|
/** Proximity value */
|
||||||
|
static ProximityImmediate = 1;
|
||||||
|
|
||||||
|
/** Proximity value */
|
||||||
|
static ProximityNear = 2;
|
||||||
|
|
||||||
|
/** Proximity value */
|
||||||
|
static ProximityFar = 3;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorUnknown = 0;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorMintCocktail = 1;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorIcyMarshmallow = 2;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorBlueberryPie = 3;
|
||||||
|
/**
|
||||||
|
* Beacon colour.
|
||||||
|
*/
|
||||||
|
static BeaconColorSweetBeetroot = 4;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorCandyFloss = 5;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorLemonTart = 6;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorVanillaJello = 7;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorLiquoriceSwirl = 8;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorWhite = 9;
|
||||||
|
|
||||||
|
/** Beacon colour */
|
||||||
|
static BeaconColorTransparent = 10;
|
||||||
|
|
||||||
|
/** Region state */
|
||||||
|
static RegionStateUnknown = 'unknown';
|
||||||
|
|
||||||
|
/** Region state */
|
||||||
|
static RegionStateOutside = 'outside';
|
||||||
|
|
||||||
|
/** Region state */
|
||||||
|
static RegionStateInside = 'inside';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ask the user for permission to use location services
|
||||||
|
* while the app is in the foreground.
|
||||||
|
* You need to call this function or requestAlwaysAuthorization
|
||||||
|
* on iOS 8+.
|
||||||
|
* Does nothing on other platforms.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.requestWhenInUseAuthorization().then(
|
||||||
|
* () => { console.log('on success'); },
|
||||||
|
* () => { console.log('on error'); }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static requestWhenInUseAuthorization(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ask the user for permission to use location services
|
||||||
|
* whenever the app is running.
|
||||||
|
* You need to call this function or requestWhenInUseAuthorization
|
||||||
|
* on iOS 8+.
|
||||||
|
* Does nothing on other platforms.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.requestAlwaysAuthorization().then(
|
||||||
|
* () => { console.log('on success'); },
|
||||||
|
* () => { console.log('on error'); }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static requestAlwaysAuthorization(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current location authorization status.
|
||||||
|
* Implemented on iOS 8+.
|
||||||
|
* Does nothing on other platforms.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.authorizationStatus().then(
|
||||||
|
* (result) => { console.log('Location authorization status: ' + result); },
|
||||||
|
* (errorMessage) => { console.log('Error: ' + errorMessage); }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static authorizationStatus(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start advertising as a beacon.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
|
||||||
|
* .then(() => { console.log('Beacon started'); });
|
||||||
|
* setTimeout(() => {
|
||||||
|
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||||
|
* }, 5000);
|
||||||
|
* ```
|
||||||
|
* @param uuid {string} UUID string the beacon should advertise (mandatory).
|
||||||
|
* @param major {number} Major value to advertise (mandatory).
|
||||||
|
* @param minor {number} Minor value to advertise (mandatory).
|
||||||
|
* @param regionId {string} Identifier of the region used to advertise (mandatory).
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
clearFunction: 'stopAdvertisingAsBeacon'
|
||||||
|
})
|
||||||
|
static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop advertising as a beacon.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
|
||||||
|
* .then(() => { console.log('Beacon started'); });
|
||||||
|
* setTimeout(() => {
|
||||||
|
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||||
|
* }, 5000);
|
||||||
|
* ```
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stopAdvertisingAsBeacon(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable analytics.
|
||||||
|
*
|
||||||
|
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); });
|
||||||
|
* ```
|
||||||
|
* @param enable {number} Boolean value to turn analytics on or off (mandatory).
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static enableAnalytics(enable: boolean): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if analytics is enabled.
|
||||||
|
*
|
||||||
|
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); });
|
||||||
|
* ```
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static isAnalyticsEnabled(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if App ID and App Token is set.
|
||||||
|
*
|
||||||
|
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); });
|
||||||
|
* ```
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static isAuthorized(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set App ID and App Token.
|
||||||
|
*
|
||||||
|
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.setupAppIDAndAppToken('MyAppID', 'MyAppToken').then(() => { console.log('AppID and AppToken configured!'); });
|
||||||
|
* ```
|
||||||
|
* @param appID {string} The App ID (mandatory).
|
||||||
|
* @param appToken {string} The App Token (mandatory).
|
||||||
|
* @return Returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
|
||||||
|
* Available on iOS.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
|
||||||
|
* console.log(JSON.stringify(beacons));
|
||||||
|
* });
|
||||||
|
* setTimeout(() => {
|
||||||
|
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
|
||||||
|
* }, 5000);
|
||||||
|
* ```
|
||||||
|
* @return Returns an Observable that notifies of each beacon discovered.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
observable: true,
|
||||||
|
clearFunction: 'stopEstimoteBeaconDiscovery'
|
||||||
|
})
|
||||||
|
static startEstimoteBeaconDiscovery(): Observable<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop CoreBluetooth scan. Available on iOS.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
|
||||||
|
* console.log(JSON.stringify(beacons));
|
||||||
|
* });
|
||||||
|
* setTimeout(() => {
|
||||||
|
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
|
||||||
|
* }, 5000);
|
||||||
|
* ```
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stopEstimoteBeaconDiscovery(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start ranging beacons. Available on iOS and Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||||
|
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||||
|
* console.log(JSON.stringify(info));
|
||||||
|
* });
|
||||||
|
* setTimeout(() => {
|
||||||
|
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||||
|
* }, 5000);
|
||||||
|
* ```
|
||||||
|
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||||
|
* @return Returns an Observable that notifies of each beacon discovered.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
observable: true,
|
||||||
|
clearFunction: 'stopRangingBeaconsInRegion',
|
||||||
|
clearWithArgs: true
|
||||||
|
})
|
||||||
|
static startRangingBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop ranging beacons. Available on iOS and Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||||
|
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||||
|
* console.log(JSON.stringify(info));
|
||||||
|
* });
|
||||||
|
* setTimeout(() => {
|
||||||
|
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||||
|
* }, 5000);
|
||||||
|
* ```
|
||||||
|
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start ranging secure beacons. Available on iOS.
|
||||||
|
* This function has the same parameters/behaviour as
|
||||||
|
* {@link EstimoteBeacons.startRangingBeaconsInRegion}.
|
||||||
|
* To use secure beacons set the App ID and App Token using
|
||||||
|
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
observable: true,
|
||||||
|
clearFunction: 'stopRangingSecureBeaconsInRegion',
|
||||||
|
clearWithArgs: true
|
||||||
|
})
|
||||||
|
static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop ranging secure beacons. Available on iOS.
|
||||||
|
* This function has the same parameters/behaviour as
|
||||||
|
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stopRangingSecureBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start monitoring beacons. Available on iOS and Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||||
|
* EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
|
||||||
|
* console.log('Region state: ' + JSON.stringify(state));
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||||
|
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
|
||||||
|
* are inside a region when the user turns display on, see
|
||||||
|
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
|
||||||
|
* for further details (optional, defaults to false, iOS only).
|
||||||
|
* @return Returns an Observable that notifies of each region state discovered.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
observable: true,
|
||||||
|
clearFunction: 'stopMonitoringForRegion',
|
||||||
|
clearWithArgs: true,
|
||||||
|
successIndex: 1,
|
||||||
|
errorIndex: 2
|
||||||
|
})
|
||||||
|
static startMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop monitoring beacons. Available on iOS and Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||||
|
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
|
||||||
|
* ```
|
||||||
|
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stopMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start monitoring secure beacons. Available on iOS.
|
||||||
|
* This function has the same parameters/behaviour as
|
||||||
|
* EstimoteBeacons.startMonitoringForRegion.
|
||||||
|
* To use secure beacons set the App ID and App Token using
|
||||||
|
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||||
|
* @see {@link EstimoteBeacons.startMonitoringForRegion}
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
observable: true,
|
||||||
|
clearFunction: 'stopSecureMonitoringForRegion',
|
||||||
|
clearWithArgs: true,
|
||||||
|
successIndex: 1,
|
||||||
|
errorIndex: 2
|
||||||
|
})
|
||||||
|
static startSecureMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop monitoring secure beacons. Available on iOS.
|
||||||
|
* This function has the same parameters/behaviour as
|
||||||
|
* {@link EstimoteBeacons.stopMonitoringForRegion}.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stopSecureMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to Estimote Beacon. Available on Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.connectToBeacon(FF:0F:F0:00:F0:00);
|
||||||
|
* ```
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.connectToBeacon({
|
||||||
|
* proximityUUID: '000000FF-F00F-0FF0-F000-000FF0F00000',
|
||||||
|
* major: 1,
|
||||||
|
* minor: 1
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @param beacon {Beacon} Beacon to connect to.
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static connectToBeacon(beacon: any): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect from connected Estimote Beacon. Available on Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* EstimoteBeacons.disconnectConnectedBeacon();
|
||||||
|
* ```
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static disconnectConnectedBeacon(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write proximity UUID to connected Estimote Beacon. Available on Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* // Example that writes constant ESTIMOTE_PROXIMITY_UUID
|
||||||
|
* EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID);
|
||||||
|
*
|
||||||
|
* @param uuid {string} String to write as new UUID
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write major to connected Estimote Beacon. Available on Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* // Example that writes 1
|
||||||
|
* EstimoteBeacons.writeConnectedMajor(1);
|
||||||
|
*
|
||||||
|
* @param major {number} number to write as new major
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static writeConnectedMajor(major: number): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write minor to connected Estimote Beacon. Available on Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* // Example that writes 1
|
||||||
|
* EstimoteBeacons.writeConnectedMinor(1);
|
||||||
|
*
|
||||||
|
* @param minor {number} number to write as new minor
|
||||||
|
* @return returns a Promise.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static writeConnectedMinor(minor: number): Promise<any> { return; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BeaconRegion {
|
||||||
|
state?: string;
|
||||||
|
major: number;
|
||||||
|
minor: number;
|
||||||
|
identifier?: string;
|
||||||
|
uuid: string;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Facebook
|
* @name Facebook
|
||||||
@ -69,8 +69,8 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* For tracking events, see `logEvent` and `logPurchase`.
|
* For tracking events, see `logEvent` and `logPurchase`.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Facebook} from 'ionic-native';
|
* import { Facebook } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -85,20 +85,20 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
})
|
})
|
||||||
export class Facebook {
|
export class Facebook {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browser wrapper
|
* Browser wrapper
|
||||||
* @param {number} appId Your Facebook AppID from their dashboard
|
* @param {number} appId Your Facebook AppID from their dashboard
|
||||||
* @param {string} version The version of API you may want to use. Optional
|
* @param {string} version The version of API you may want to use. Optional
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static browserInit(appId: number, version?: string): Promise<any> {
|
static browserInit(appId: number, version?: string): Promise<any> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Login to Facebook to authenticate this app.
|
* Login to Facebook to authenticate this app.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* {
|
* {
|
||||||
* status: "connected",
|
* status: "connected",
|
||||||
* authResponse: {
|
* authResponse: {
|
||||||
@ -113,10 +113,10 @@ export class Facebook {
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
||||||
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
* @return {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static login(permissions: string[]): Promise<any> { return; }
|
static login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logout of Facebook.
|
* Logout of Facebook.
|
||||||
@ -213,7 +213,7 @@ export class Facebook {
|
|||||||
name: string,
|
name: string,
|
||||||
params?: Object,
|
params?: Object,
|
||||||
valueToSum?: number
|
valueToSum?: number
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a purchase. For more information see the Events section above.
|
* Log a purchase. For more information see the Events section above.
|
||||||
@ -245,4 +245,17 @@ export class Facebook {
|
|||||||
url: string,
|
url: string,
|
||||||
picture: string
|
picture: string
|
||||||
}): Promise<any> { return; }
|
}): Promise<any> { return; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FacebookLoginResponse {
|
||||||
|
status: string;
|
||||||
|
authResponse: {
|
||||||
|
session_key: boolean;
|
||||||
|
accessToken: string;
|
||||||
|
expiresIn: number;
|
||||||
|
sig: string;
|
||||||
|
secret: string;
|
||||||
|
userID: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
1235
src/plugins/file.ts
1235
src/plugins/file.ts
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, CordovaInstance} from './plugin';
|
import { CordovaInstance, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var FileTransfer;
|
declare var FileTransfer;
|
||||||
|
|
||||||
@ -106,19 +107,49 @@ export interface FileTransferError {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Transfer
|
* @name Transfer
|
||||||
* @description This plugin allows you to upload and download files.
|
*
|
||||||
* Example:
|
* @description
|
||||||
* Create instance:
|
* This plugin allows you to upload and download files.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { Transfer } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // Create instance:
|
||||||
* const fileTransfer = new Transfer();
|
* const fileTransfer = new Transfer();
|
||||||
*
|
*
|
||||||
* Upload a file:
|
* // Upload a file:
|
||||||
* fileTransfer.upload(..).then(..).catch(..);
|
* fileTransfer.upload(..).then(..).catch(..);
|
||||||
*
|
*
|
||||||
* Download a file:
|
* // Download a file:
|
||||||
* fileTransfer.download(..).then(..).catch(..);
|
* fileTransfer.download(..).then(..).catch(..);
|
||||||
*
|
*
|
||||||
* Abort active transfer:
|
* // Abort active transfer:
|
||||||
* fileTransfer.abort();
|
* fileTransfer.abort();
|
||||||
|
*
|
||||||
|
* E.g
|
||||||
|
*
|
||||||
|
* upload(){
|
||||||
|
* const fileTransfer = new Transfer();
|
||||||
|
* var options: any;
|
||||||
|
*
|
||||||
|
* options = {
|
||||||
|
* fileKey: 'file',
|
||||||
|
* fileName: 'name.jpg',
|
||||||
|
* headers: {}
|
||||||
|
* .....
|
||||||
|
* }
|
||||||
|
* fileTransfer.upload("<file path>", "<api endpoint>", options)
|
||||||
|
* .then((data) => {
|
||||||
|
* // success
|
||||||
|
* }, (err) => {
|
||||||
|
* // error
|
||||||
|
* })
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-file-transfer',
|
plugin: 'cordova-plugin-file-transfer',
|
||||||
@ -127,11 +158,23 @@ export interface FileTransferError {
|
|||||||
})
|
})
|
||||||
export class Transfer {
|
export class Transfer {
|
||||||
|
|
||||||
public static FILE_NOT_FOUND_ERR: number = 1;
|
/**
|
||||||
public static INVALID_URL_ERR: number = 2;
|
* Error code rejected from upload with FileTransferError
|
||||||
public static CONNECTION_ERR: number = 3;
|
* Defined in FileTransferError.
|
||||||
public static ABORT_ERR: number = 4;
|
* FILE_NOT_FOUND_ERR: 1 Return when file was not found
|
||||||
public static NOT_MODIFIED_ERR: number = 4;
|
* INVALID_URL_ERR: 2, Return when url was invalid
|
||||||
|
* CONNECTION_ERR: 3, Return on connection error
|
||||||
|
* ABORT_ERR: 4, Return on aborting
|
||||||
|
* NOT_MODIFIED_ERR: 5 Return on "304 Not Modified" HTTP response
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
public static FileTransferErrorCode = {
|
||||||
|
FILE_NOT_FOUND_ERR: 1,
|
||||||
|
INVALID_URL_ERR: 2,
|
||||||
|
CONNECTION_ERR: 3,
|
||||||
|
ABORT_ERR: 4,
|
||||||
|
NOT_MODIFIED_ERR: 5
|
||||||
|
};
|
||||||
|
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
|
|
||||||
@ -145,7 +188,7 @@ export class Transfer {
|
|||||||
* @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device.
|
* @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device.
|
||||||
* @param {string} url URL of the server to receive the file, as encoded by encodeURI().
|
* @param {string} url URL of the server to receive the file, as encoded by encodeURI().
|
||||||
* @param {FileUploadOptions} options Optional parameters.
|
* @param {FileUploadOptions} options Optional parameters.
|
||||||
* @param {boolean} trustAllHosts: Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||||
* @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
|
* @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
|
||||||
*/
|
*/
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
@ -189,6 +232,6 @@ export class Transfer {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
abort(): void {}
|
abort(): void { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Flashlight
|
* @name Flashlight
|
||||||
@ -7,8 +8,8 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
|
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Flashlight} from 'ionic-native';
|
* import { Flashlight } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -21,7 +22,6 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
})
|
})
|
||||||
export class Flashlight {
|
export class Flashlight {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the flashlight is available
|
* Checks if the flashlight is available
|
||||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
|
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
|
||||||
@ -53,7 +53,7 @@ export class Flashlight {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the flashlight is turned on.
|
* Checks if the flashlight is turned on.
|
||||||
* Returns a boolean
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
|
164
src/plugins/geofence.ts
Normal file
164
src/plugins/geofence.ts
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
/**
|
||||||
|
* @name Geofence
|
||||||
|
* @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence.
|
||||||
|
* Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import { Geofence } from 'ionic-native';
|
||||||
|
* import { Platform } from 'ionic-angular'
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* constructor(private platform: Platform) {
|
||||||
|
* this.platform.ready().then(() => {
|
||||||
|
// initialize the plugin
|
||||||
|
* Geofence.initialize().then(
|
||||||
|
* // resolved promise does not return a value
|
||||||
|
* () => console.log('Geofence Plugin Ready'),
|
||||||
|
* (err) => console.log(err)
|
||||||
|
* )
|
||||||
|
* })
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* private addGeofence() {
|
||||||
|
* //options describing geofence
|
||||||
|
* let fence = {
|
||||||
|
* id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb", //any unique ID
|
||||||
|
* latitude: 37.285951, //center of geofence radius
|
||||||
|
* longitude: -121.936650,
|
||||||
|
* radius: 100, //radius to edge of geofence
|
||||||
|
* transitionType: 3, //see 'Transition Types' below
|
||||||
|
* notification: { //notification settings
|
||||||
|
* id: 1, //any unique ID
|
||||||
|
* title: "You crossed a fence", //notification title
|
||||||
|
* text: "You just arrived to Gliwice city center.", //notification body
|
||||||
|
* openAppOnClick: true //open app when notification is tapped
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Geofence.addOrUpdate(fence).then(
|
||||||
|
* () => console.log('Geofence added'),
|
||||||
|
* (err) => console.log('Geofence failed to add')
|
||||||
|
* );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* ### Transition Types ###
|
||||||
|
* Transition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence.
|
||||||
|
*
|
||||||
|
* #### Supported values ####
|
||||||
|
* - 1: Enter
|
||||||
|
* - 2: Leave
|
||||||
|
* - 3: Both
|
||||||
|
*
|
||||||
|
* ### Defining a Geofence ###
|
||||||
|
* Geofences are defined by an object that is passed to `addOrUpdate()`. Object properties are:
|
||||||
|
* - id: Any unique ID for the geofence. This ID is used to remove and update a geofence
|
||||||
|
* - latitude: Latitude coordinate of the center of the geofence radius
|
||||||
|
* - longitude: Latitude coordinate of the center of the geofence radius
|
||||||
|
* - radius: Radius from the center to the edge of the geofence
|
||||||
|
* - transitionType: Type of geofence transition to monitor for. See 'Transition Types' above
|
||||||
|
* - notification: Object. Options for defining the notification sent when a geofence is crossed
|
||||||
|
* - id: Any unique ID
|
||||||
|
* - title: Notification title
|
||||||
|
* - text: Notification body
|
||||||
|
* - openAppOnClick: Boolean. Whether to open the app when the notification is tapped by the user
|
||||||
|
*
|
||||||
|
* ### Troubleshooting ###
|
||||||
|
* #### I get compile errors when I run `ionic build ios` or `ionic run ios`. ####
|
||||||
|
* This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly.
|
||||||
|
* Try running `ionic platform rm <platform>` then run `ionic platform add <platform>` to recreate the
|
||||||
|
* platform directories.
|
||||||
|
*/
|
||||||
|
declare var window: any;
|
||||||
|
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-geofence',
|
||||||
|
pluginRef: 'geofence',
|
||||||
|
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
|
||||||
|
})
|
||||||
|
|
||||||
|
export class Geofence {
|
||||||
|
|
||||||
|
public static TransitionType = {
|
||||||
|
ENTER: 1,
|
||||||
|
EXIT: 2,
|
||||||
|
BOTH: 3
|
||||||
|
};
|
||||||
|
|
||||||
|
public static onTrasitionReceived: Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static initialize(): Promise<void> { return };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new geofence or array of geofences. For geofence object, see above.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
|
||||||
|
* geofence was created.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static remove(geofenceId: string | Array<string>): Promise<void> { return };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all geofences.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static removeAll(): Promise<void> { return };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of geofences currently being monitored.
|
||||||
|
*
|
||||||
|
* @return {Promise<Array<string>>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static getWatched(): Promise<string> { return };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a geofence is crossed in the direction specified by `TransitType`.
|
||||||
|
* Commenting out. Not yet implemented in plugin.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
|
static onTransitionReceived(): Observable<any> {
|
||||||
|
|
||||||
|
return new Observable<any>((observer) => {
|
||||||
|
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||||
|
return () => window.geofence.onTransitionReceived = () => {};
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the user clicks a geofence notification. iOS and Android only.
|
||||||
|
* Commenting out. Not yet implemented in plugin.
|
||||||
|
*
|
||||||
|
* @return {Promise<Object>}
|
||||||
|
*/
|
||||||
|
static onNotificationClicked(): Observable<any> {
|
||||||
|
|
||||||
|
return new Observable<any>((observer) => {
|
||||||
|
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||||
|
return () => window.geofence.onNotificationClicked = () => {};
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
declare var navigator: any;
|
declare var navigator: any;
|
||||||
|
|
||||||
@ -101,20 +102,19 @@ export interface GeolocationOptions {
|
|||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {Geolocation} from 'ionic-native';
|
* import { Geolocation } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Geolocation.getCurrentPosition().then((resp) => {
|
* Geolocation.getCurrentPosition().then((resp) => {
|
||||||
* //resp.coords.latitude
|
* // resp.coords.latitude
|
||||||
* //resp.coords.longitude
|
* // resp.coords.longitude
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
* let watch = Geolocation.watchPosition();
|
* let watch = Geolocation.watchPosition();
|
||||||
* watch.subscribe((data) => {
|
* watch.subscribe((data) => {
|
||||||
* //data.coords.latitude
|
* // data.coords.latitude
|
||||||
* //data.coords.longitude
|
* // data.coords.longitude
|
||||||
* })
|
* })
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -139,7 +139,7 @@ export class Geolocation {
|
|||||||
* Watch the current device's position. Clear the watch by unsubscribing from
|
* Watch the current device's position. Clear the watch by unsubscribing from
|
||||||
* Observable changes.
|
* Observable changes.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* var subscription = Geolocation.watchPosition().subscribe(position => {
|
* var subscription = Geolocation.watchPosition().subscribe(position => {
|
||||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||||
* });
|
* });
|
||||||
@ -154,8 +154,7 @@ export class Geolocation {
|
|||||||
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
|
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
|
||||||
return new Observable<Geoposition>(
|
return new Observable<Geoposition>(
|
||||||
(observer: any) => {
|
(observer: any) => {
|
||||||
let cb = (data: Geoposition) => observer.next(data);
|
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.error.bind(observer), options);
|
||||||
let watchId = navigator.geolocation.watchPosition(cb, options);
|
|
||||||
return () => navigator.geolocation.clearWatch(watchId);
|
return () => navigator.geolocation.clearWatch(watchId);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Globalization
|
* @name Globalization
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Globalization} from 'ionic-native';
|
* import { Globalization } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-globalization',
|
plugin: 'cordova-plugin-globalization',
|
||||||
pluginRef: 'navigator.globalization',
|
pluginRef: 'navigator.globalization',
|
||||||
repo: 'https://github.com/apache/cordova-plugin-globalization'
|
repo: 'https://github.com/apache/cordova-plugin-globalization'
|
||||||
})
|
})
|
||||||
export class Globalization {
|
export class Globalization {
|
||||||
|
|
||||||
@ -23,14 +22,14 @@ export class Globalization {
|
|||||||
* @return {Promise<{value: string}>}
|
* @return {Promise<{value: string}>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getPreferredLanguage(): Promise<{value: string}> {return; }
|
static getPreferredLanguage(): Promise<{ value: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
|
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
|
||||||
* @return {Promise<{value: string}>}
|
* @return {Promise<{value: string}>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getLocaleName(): Promise<{value: string}> {return; }
|
static getLocaleName(): Promise<{ value: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts date to string
|
* Converts date to string
|
||||||
@ -39,10 +38,10 @@ export class Globalization {
|
|||||||
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
|
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 1,
|
successIndex: 1,
|
||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static dateToString(date: Date, options: {formatLength: string, selector: string}): Promise<{value: string}> {return; }
|
static dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
|
* Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
|
||||||
@ -51,11 +50,10 @@ export class Globalization {
|
|||||||
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
|
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 1,
|
successIndex: 1,
|
||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static stringToDate(dateString: string, options: {formatLength: string, selector: string}): Promise<{year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number}> {return; }
|
static stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pattern string to format and parse dates according to the client's user preferences.
|
* Returns a pattern string to format and parse dates according to the client's user preferences.
|
||||||
@ -63,10 +61,9 @@ export class Globalization {
|
|||||||
* @return {Promise<{value: string}>} Returns a promise.
|
* @return {Promise<{value: string}>} Returns a promise.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
callbackOrder: 'reverse'
|
callbackOrder: 'reverse'
|
||||||
})
|
})
|
||||||
static getDatePattern(options: {formatLength: string, selector: string}): Promise<{pattern: string}> {return; }
|
static getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
||||||
@ -74,9 +71,9 @@ export class Globalization {
|
|||||||
* @return {Promise<{value: string}>} Returns a promise.
|
* @return {Promise<{value: string}>} Returns a promise.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
callbackOrder: 'reverse'
|
callbackOrder: 'reverse'
|
||||||
})
|
})
|
||||||
static getDateNames(options: {type: string, item: string}): Promise<{value: Array<string>}> {return; }
|
static getDateNames(options: { type: string, item: string }): Promise<{ value: Array<string> }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
|
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
|
||||||
@ -84,24 +81,24 @@ export class Globalization {
|
|||||||
* @returns {Promise<dst>} reutrns a promise with the value
|
* @returns {Promise<dst>} reutrns a promise with the value
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isDayLightSavingsTime(date: Date): Promise<{dst: string}> {return; }
|
static isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first day of the week according to the client's user preferences and calendar.
|
* Returns the first day of the week according to the client's user preferences and calendar.
|
||||||
* @returns {Promise<value>} reutrns a promise with the value
|
* @returns {Promise<value>} reutrns a promise with the value
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getFirstDayOfWeek(): Promise<{value: string}> {return; }
|
static getFirstDayOfWeek(): Promise<{ value: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a number formatted as a string according to the client's user preferences.
|
* Returns a number formatted as a string according to the client's user preferences.
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 1,
|
successIndex: 1,
|
||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static numberToString(options: {type: string}): Promise<{value: string}> {return; }
|
static numberToString(options: { type: string }): Promise<{ value: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -110,10 +107,10 @@ export class Globalization {
|
|||||||
* @returns {Promise} Returns a promise with the value.
|
* @returns {Promise} Returns a promise with the value.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 1,
|
successIndex: 1,
|
||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value: number|string}> {return; }
|
static stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pattern string to format and parse numbers according to the client's user preferences.
|
* Returns a pattern string to format and parse numbers according to the client's user preferences.
|
||||||
@ -121,9 +118,9 @@ export class Globalization {
|
|||||||
* @returns {Promise} returns a promise with the value.
|
* @returns {Promise} returns a promise with the value.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
callbackOrder: 'reverse'
|
callbackOrder: 'reverse'
|
||||||
})
|
})
|
||||||
static getNumberPattern(options: {type: string}): Promise<{pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string}> {return; }
|
static getNumberPattern(options: { type: string }): Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
|
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
|
||||||
@ -131,6 +128,6 @@ export class Globalization {
|
|||||||
* @returns {Promise} returns a promise with the value
|
* @returns {Promise} returns a promise with the value
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; }
|
static getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Google Plus
|
* @name Google Plus
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```
|
* ```typescript
|
||||||
|
* import { GooglePlus } from 'ionic-native';
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -22,25 +25,25 @@ export class GooglePlus {
|
|||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static login(options?: any): Promise<any> {return; }
|
static login(options?: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are.
|
* You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are.
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static trySilentLogin(options?: any): Promise<any> {return; }
|
static trySilentLogin(options?: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will clear the OAuth2 token.
|
* This will clear the OAuth2 token.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static logout(): Promise<any> {return; }
|
static logout(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect.
|
* This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static disconnect(): Promise<any> {return; }
|
static disconnect(): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var window;
|
declare var window;
|
||||||
|
|
||||||
@ -12,112 +13,134 @@ declare var window;
|
|||||||
* - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
|
* - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-google-analytics',
|
plugin: 'cordova-plugin-google-analytics',
|
||||||
pluginRef: 'analytics',
|
pluginRef: 'analytics',
|
||||||
repo: 'https://github.com/danwilson/google-analytics-plugin',
|
repo: 'https://github.com/danwilson/google-analytics-plugin',
|
||||||
platforms: ['Android', 'iOS']
|
platforms: ['Android', 'iOS']
|
||||||
})
|
})
|
||||||
export class GoogleAnalytics {
|
export class GoogleAnalytics {
|
||||||
/**
|
/**
|
||||||
* In your 'deviceready' handler, set up your Analytics tracker.
|
* In your 'deviceready' handler, set up your Analytics tracker.
|
||||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/
|
* https://developers.google.com/analytics/devguides/collection/analyticsjs/
|
||||||
* @param {string} id Your Google Analytics Mobile App property
|
* @param {string} id Your Google Analytics Mobile App property
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static startTrackerWithId(id: string): Promise<any> { return; }
|
static startTrackerWithId(id: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track a screen
|
* Track a screen
|
||||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
|
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
|
||||||
*
|
*
|
||||||
* @param {string} title Screen title
|
* @param {string} title Screen title
|
||||||
*/
|
* @param {string} campaignUrl Campaign url for measuring referrals
|
||||||
@Cordova()
|
*/
|
||||||
static trackView(title: string): Promise<any> { return; }
|
@Cordova()
|
||||||
|
static trackView(title: string, campaignUrl?: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track an event
|
* Track an event
|
||||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
||||||
* @param {string} category
|
* @param {string} category
|
||||||
* @param {string} action
|
* @param {string} action
|
||||||
* @param {string} label
|
* @param {string} label
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return; }
|
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track an exception
|
* Track an exception
|
||||||
* @param {string} description
|
* @param {string} description
|
||||||
* @param {boolean} fatal
|
* @param {boolean} fatal
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static trackException(description: string, fatal: boolean): Promise<any> { return; }
|
static trackException(description: string, fatal: boolean): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track User Timing (App Speed)
|
* Track User Timing (App Speed)
|
||||||
* @param {string} category
|
* @param {string} category
|
||||||
* @param {number} intervalInMilliseconds
|
* @param {number} intervalInMilliseconds
|
||||||
* @param {string} variable
|
* @param {string} variable
|
||||||
* @param {string} label
|
* @param {string} label
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
|
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Transaction (Ecommerce)
|
* Add a Transaction (Ecommerce)
|
||||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
|
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
* @param {string} affiliation
|
* @param {string} affiliation
|
||||||
* @param {number} revenue
|
* @param {number} revenue
|
||||||
* @param {number} tax
|
* @param {number} tax
|
||||||
* @param {number} shipping
|
* @param {number} shipping
|
||||||
* @param {string} currencyCode
|
* @param {string} currencyCode
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
|
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Transaction Item (Ecommerce)
|
* Add a Transaction Item (Ecommerce)
|
||||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem
|
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
* @param {string} sku
|
* @param {string} sku
|
||||||
* @param {string} category
|
* @param {string} category
|
||||||
* @param {number} price
|
* @param {number} price
|
||||||
* @param {number} quantity
|
* @param {number} quantity
|
||||||
* @param {string} currencyCode
|
* @param {string} currencyCode
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
|
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Custom Dimension
|
* Add a Custom Dimension
|
||||||
* https://developers.google.com/analytics/devguides/platform/customdimsmets
|
* https://developers.google.com/analytics/devguides/platform/customdimsmets
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static addCustomDimension(key: number, value: string): Promise<any> { return; }
|
static addCustomDimension(key: number, value: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a UserId
|
* Set a UserId
|
||||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
|
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({sync: true})
|
||||||
static setUserId(id: string): Promise<any> { return; }
|
static setUserId(id: string): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable verbose logging
|
* Sets the app version
|
||||||
*/
|
* @param appVersion
|
||||||
@Cordova()
|
*/
|
||||||
static debugMode(): Promise<any> { return; }
|
@Cordova({sync: true})
|
||||||
|
static setAppVersion(appVersion: string): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable automatic reporting of uncaught exceptions
|
* Set a anonymize Ip address
|
||||||
* @param {boolean} shouldEnable
|
* @param anonymize
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({sync: true})
|
||||||
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
|
static setAnonymizeIp(anonymize: boolean): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
||||||
|
* @param allow
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static setAllowIDFACollection(allow: boolean): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable verbose logging
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static debugMode(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable automatic reporting of uncaught exceptions
|
||||||
|
* @param {boolean} shouldEnable
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import { Cordova, CordovaInstance, Plugin } from './plugin';
|
import { Cordova, CordovaInstance, Plugin } from './plugin';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* Created by Ibrahim on 3/29/2016.
|
* Created by Ibrahim on 3/29/2016.
|
||||||
*/
|
*/
|
||||||
declare var plugin: any;
|
declare var plugin: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* You can listen to these events where appropriate
|
* You can listen to these events where appropriate
|
||||||
@ -43,14 +46,16 @@ export const GoogleMapsAnimation = {
|
|||||||
* @description This plugin uses the native Google Maps SDK
|
* @description This plugin uses the native Google Maps SDK
|
||||||
* @usage
|
* @usage
|
||||||
* ```
|
* ```
|
||||||
* import {GoogleMap, GoogleMapsEvent} from 'ionic-native';
|
* import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
* // somewhere in your component
|
* // somewhere in your component
|
||||||
* let map = new GoogleMap('elementID');
|
* let map = new GoogleMap('elementID', {
|
||||||
|
* // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions
|
||||||
|
});
|
||||||
*
|
*
|
||||||
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log("Map is ready!"));
|
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -62,8 +67,9 @@ export class GoogleMap {
|
|||||||
_objectInstance: any;
|
_objectInstance: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a map object has been created.
|
* Checks if a map object has been created and is available.
|
||||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the plugin is available.
|
*
|
||||||
|
* @return {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isAvailable(): Promise<boolean> {
|
static isAvailable(): Promise<boolean> {
|
||||||
@ -74,23 +80,31 @@ export class GoogleMap {
|
|||||||
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
|
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen to a map event.
|
||||||
|
*
|
||||||
|
* @return {Observable<any>}
|
||||||
|
*/
|
||||||
on(event: any): Observable<any> {
|
on(event: any): Observable<any> {
|
||||||
return new Observable(
|
return new Observable(
|
||||||
(observer) => {
|
(observer) => {
|
||||||
let cb = data => observer.next(data);
|
this._objectInstance.on(event, observer.next.bind(observer));
|
||||||
this._objectInstance.on(event, cb);
|
|
||||||
return () => this._objectInstance.off(event);
|
return () => this._objectInstance.off(event);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen to a map event only once.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
one(event: any): Promise<any> {
|
one(event: any): Promise<any> {
|
||||||
return new Promise<any>(
|
return new Promise<any>(
|
||||||
resolve => this._objectInstance.one(event, resolve)
|
resolve => this._objectInstance.one(event, resolve)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@CordovaInstance({ sync: true })
|
@CordovaInstance({ sync: true })
|
||||||
setDebuggable(isDebuggable: boolean): void {
|
setDebuggable(isDebuggable: boolean): void {
|
||||||
}
|
}
|
||||||
@ -100,7 +114,9 @@ export class GoogleMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the position of the camera
|
* Get the position of the camera.
|
||||||
|
*
|
||||||
|
* @return {Promise<CameraPosition>}
|
||||||
*/
|
*/
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
getCameraPosition(): Promise<CameraPosition> {
|
getCameraPosition(): Promise<CameraPosition> {
|
||||||
@ -108,15 +124,19 @@ export class GoogleMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the location of the user
|
* Get the location of the user.
|
||||||
|
*
|
||||||
|
* @return {Promise<MyLocation>}
|
||||||
*/
|
*/
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
getMyLocation(): Promise<MyLocation> {
|
getMyLocation(options?: MyLocationOptions): Promise<MyLocation> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the visible region
|
* Get the visible region.
|
||||||
|
*
|
||||||
|
* @return {Promise<VisibleRegion>}
|
||||||
*/
|
*/
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
getVisibleRegion(): Promise<VisibleRegion> {
|
getVisibleRegion(): Promise<VisibleRegion> {
|
||||||
@ -184,8 +204,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsMarker>(
|
return new Promise<GoogleMapsMarker>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addMarker(options, (marker: any) => {
|
this._objectInstance.addMarker(options, (marker: any) => {
|
||||||
if (marker) resolve(new GoogleMapsMarker(marker));
|
if (marker) {
|
||||||
else reject();
|
resolve(new GoogleMapsMarker(marker));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -195,8 +218,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsCircle>(
|
return new Promise<GoogleMapsCircle>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addCircle(options, (circle: any) => {
|
this._objectInstance.addCircle(options, (circle: any) => {
|
||||||
if (circle) resolve(new GoogleMapsCircle(circle));
|
if (circle) {
|
||||||
else reject();
|
resolve(new GoogleMapsCircle(circle));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -206,8 +232,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsPolygon>(
|
return new Promise<GoogleMapsPolygon>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addPolygon(options, (polygon: any) => {
|
this._objectInstance.addPolygon(options, (polygon: any) => {
|
||||||
if (polygon) resolve(new GoogleMapsPolygon(polygon));
|
if (polygon) {
|
||||||
else reject();
|
resolve(new GoogleMapsPolygon(polygon));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -217,8 +246,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsPolyline>(
|
return new Promise<GoogleMapsPolyline>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addPolyline(options, (polyline: any) => {
|
this._objectInstance.addPolyline(options, (polyline: any) => {
|
||||||
if (polyline) resolve(new GoogleMapsPolyline(polyline));
|
if (polyline) {
|
||||||
else reject();
|
resolve(new GoogleMapsPolyline(polyline));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -228,8 +260,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsTileOverlay>(
|
return new Promise<GoogleMapsTileOverlay>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
|
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
|
||||||
if (tileOverlay) resolve(new GoogleMapsTileOverlay(tileOverlay));
|
if (tileOverlay) {
|
||||||
else reject();
|
resolve(new GoogleMapsTileOverlay(tileOverlay));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -239,8 +274,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsGroundOverlay>(
|
return new Promise<GoogleMapsGroundOverlay>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
|
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
|
||||||
if (groundOverlay) resolve(new GoogleMapsGroundOverlay(groundOverlay));
|
if (groundOverlay) {
|
||||||
else reject();
|
resolve(new GoogleMapsGroundOverlay(groundOverlay));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -250,8 +288,11 @@ export class GoogleMap {
|
|||||||
return new Promise<GoogleMapsKmlOverlay>(
|
return new Promise<GoogleMapsKmlOverlay>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
|
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
|
||||||
if (kmlOverlay) resolve(new GoogleMapsKmlOverlay(kmlOverlay));
|
if (kmlOverlay) {
|
||||||
else reject();
|
resolve(new GoogleMapsKmlOverlay(kmlOverlay));
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -341,6 +382,13 @@ export interface MyLocation {
|
|||||||
bearing?: number;
|
bearing?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export interface MyLocationOptions {
|
||||||
|
enableHighAccuracy?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -389,11 +437,8 @@ export class GoogleMapsMarker {
|
|||||||
addEventListener(event: any): Observable<any> {
|
addEventListener(event: any): Observable<any> {
|
||||||
return new Observable(
|
return new Observable(
|
||||||
(observer) => {
|
(observer) => {
|
||||||
let cb = (data: any) => {
|
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||||
observer.next(data);
|
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||||
};
|
|
||||||
this._objectInstance.addEventListener(event, cb);
|
|
||||||
return () => this._objectInstance.removeEventListener(event, cb);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -537,9 +582,8 @@ export class GoogleMapsCircle {
|
|||||||
addEventListener(event: any): Observable<any> {
|
addEventListener(event: any): Observable<any> {
|
||||||
return new Observable(
|
return new Observable(
|
||||||
(observer) => {
|
(observer) => {
|
||||||
let cb = data => observer.next(data);
|
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||||
this._objectInstance.addEventListener(event, cb);
|
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||||
return () => this._objectInstance.removeEventListener(event, cb);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -629,9 +673,8 @@ export class GoogleMapsPolyline {
|
|||||||
addEventListener(event: any): Observable<any> {
|
addEventListener(event: any): Observable<any> {
|
||||||
return new Observable(
|
return new Observable(
|
||||||
(observer) => {
|
(observer) => {
|
||||||
let cb = data => observer.next(data);
|
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||||
this._objectInstance.addEventListener(event, cb);
|
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||||
return () => this._objectInstance.removeEventListener(event, cb);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -721,9 +764,8 @@ export class GoogleMapsPolygon {
|
|||||||
addEventListener(event: any): Observable<any> {
|
addEventListener(event: any): Observable<any> {
|
||||||
return new Observable(
|
return new Observable(
|
||||||
(observer) => {
|
(observer) => {
|
||||||
let cb = data => observer.next(data);
|
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||||
this._objectInstance.addEventListener(event, cb);
|
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||||
return () => this._objectInstance.removeEventListener(event, cb);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -951,8 +993,9 @@ export class GoogleMapsKmlOverlay {
|
|||||||
export class GoogleMapsLatLngBounds {
|
export class GoogleMapsLatLngBounds {
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
|
|
||||||
constructor(public southwest: GoogleMapsLatLng, public northeast: GoogleMapsLatLng) {
|
constructor(public southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], public northeast?: GoogleMapsLatLng) {
|
||||||
this._objectInstance = new plugin.google.maps.LatLngBounds([southwest, northeast]);
|
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
|
||||||
|
this._objectInstance = new plugin.google.maps.LatLngBounds(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@CordovaInstance({ sync: true })
|
@CordovaInstance({ sync: true })
|
||||||
@ -1005,3 +1048,52 @@ export class GoogleMapsLatLng {
|
|||||||
return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
|
return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export interface GeocoderRequest {
|
||||||
|
address?: string;
|
||||||
|
position?: { lat: number; lng: number };
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export interface GeocoderResult {
|
||||||
|
adminArea?: string;
|
||||||
|
country?: string;
|
||||||
|
countryCode?: string;
|
||||||
|
extra?: {
|
||||||
|
featureName?: string;
|
||||||
|
lines?: Array<string>;
|
||||||
|
permises?: string;
|
||||||
|
phone?: string;
|
||||||
|
url?: string
|
||||||
|
};
|
||||||
|
locale?: string;
|
||||||
|
locality?: string;
|
||||||
|
position?: { lat: number; lng: number };
|
||||||
|
postalCode?: string;
|
||||||
|
subAdminArea?: string;
|
||||||
|
subLocality?: string;
|
||||||
|
subThoroughfare?: string;
|
||||||
|
thoroughfare?: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export class Geocoder {
|
||||||
|
/**
|
||||||
|
* Converts position to address and vice versa
|
||||||
|
* @param {GeocoderRequest} request Request object with either an address or a position
|
||||||
|
* @returns {Promise<GeocoderResult[]>}
|
||||||
|
*/
|
||||||
|
static geocode(request: GeocoderRequest): Promise<GeocoderResult[]> {
|
||||||
|
return new Promise<GeocoderResult[]>((resolve, reject) => {
|
||||||
|
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) {
|
||||||
|
reject({ error: 'plugin_not_installed' });
|
||||||
|
} else {
|
||||||
|
plugin.google.maps.Geocoder.geocode(request, resolve);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Hotspot
|
* @name Hotspot
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Hotspot, Network} from 'ionic-native';
|
* import { Hotspot, Network } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
*
|
||||||
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
||||||
* console.log(networks);
|
* console.log(networks);
|
||||||
* });
|
* });
|
||||||
* ...
|
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -24,10 +23,10 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
export class Hotspot {
|
export class Hotspot {
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isAvailable(): Promise<boolean> {return; }
|
static isAvailable(): Promise<boolean> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static toggleWifi(): Promise<boolean> {return; }
|
static toggleWifi(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures and starts hotspot with SSID and Password
|
* Configures and starts hotspot with SSID and Password
|
||||||
@ -39,7 +38,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
|
* @return {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static createHotspot(ssid: string, mode: string, password: string): Promise<void> {return; }
|
static createHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns on Access Point
|
* Turns on Access Point
|
||||||
@ -47,7 +46,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<boolean>} - true if AP is started
|
* @return {Promise<boolean>} - true if AP is started
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static startHotspot(): Promise<boolean> {return; }
|
static startHotspot(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures hotspot with SSID and Password
|
* Configures hotspot with SSID and Password
|
||||||
@ -59,7 +58,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
|
* @return {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> {return; }
|
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns off Access Point
|
* Turns off Access Point
|
||||||
@ -67,7 +66,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
|
* @return {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static stopHotspot(): Promise<boolean> {return; }
|
static stopHotspot(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if hotspot is enabled
|
* Checks if hotspot is enabled
|
||||||
@ -75,10 +74,10 @@ export class Hotspot {
|
|||||||
* @return {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
|
* @return {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isHotspotEnabled(): Promise<void> {return; }
|
static isHotspotEnabled(): Promise<void> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> {return; }
|
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to a WiFi network
|
* Connect to a WiFi network
|
||||||
@ -92,25 +91,25 @@ export class Hotspot {
|
|||||||
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static connectToWifi(ssid: string, password: string): Promise<void> {return; }
|
static connectToWifi(ssid: string, password: string): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to a WiFi network
|
* Connect to a WiFi network
|
||||||
*
|
*
|
||||||
* @param {string} ssid
|
* @param {string} ssid
|
||||||
* SSID to connect
|
* SSID to connect
|
||||||
* @param {string} password
|
* @param {string} password
|
||||||
* Password to use
|
* Password to use
|
||||||
* @param {string} authentication
|
* @param {string} authentication
|
||||||
* Authentication modes to use (LEAP, SHARED, OPEN)
|
* Authentication modes to use (LEAP, SHARED, OPEN)
|
||||||
* @param {string[]} encryption
|
* @param {string[]} encryption
|
||||||
* Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
|
* Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
|
||||||
*
|
*
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> {return; }
|
static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a WiFi network
|
* Add a WiFi network
|
||||||
@ -126,7 +125,7 @@ export class Hotspot {
|
|||||||
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
|
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> {return; }
|
static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a WiFi network
|
* Remove a WiFi network
|
||||||
@ -138,43 +137,43 @@ export class Hotspot {
|
|||||||
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
|
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static removeWifiNetwork(ssid: string): Promise<void> {return; }
|
static removeWifiNetwork(ssid: string): Promise<void> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isConnectedToInternet(): Promise<boolean> {return; }
|
static isConnectedToInternet(): Promise<boolean> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isConnectedToInternetViaWifi(): Promise<boolean> {return; }
|
static isConnectedToInternetViaWifi(): Promise<boolean> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isWifiOn(): Promise<boolean> {return; }
|
static isWifiOn(): Promise<boolean> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isWifiSupported(): Promise<boolean> {return; }
|
static isWifiSupported(): Promise<boolean> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isWifiDirectSupported(): Promise<boolean> {return; }
|
static isWifiDirectSupported(): Promise<boolean> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static scanWifi(): Promise<Array<Network>> {return; }
|
static scanWifi(): Promise<Array<Network>> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static scanWifiByLevel(): Promise<Array<Network>> {return; }
|
static scanWifiByLevel(): Promise<Array<Network>> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> {return; }
|
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static stopWifiPeriodicallyScan(): Promise<any> {return; }
|
static stopWifiPeriodicallyScan(): Promise<any> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getNetConfig(): Promise<NetworkConfig> {return; }
|
static getNetConfig(): Promise<NetworkConfig> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getConnectionInfo(): Promise<ConnectionInfo> {return; }
|
static getConnectionInfo(): Promise<ConnectionInfo> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static pingHost(ip: string): Promise<string> {return; }
|
static pingHost(ip: string): Promise<string> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets MAC Address associated with IP Address from ARP File
|
* Gets MAC Address associated with IP Address from ARP File
|
||||||
@ -184,7 +183,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<string>} - A Promise for the MAC Address
|
* @return {Promise<string>} - A Promise for the MAC Address
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getMacAddressOfHost(ip: string): Promise<string> {return; }
|
static getMacAddressOfHost(ip: string): Promise<string> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if IP is live using DNS
|
* Checks if IP is live using DNS
|
||||||
@ -194,7 +193,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isDnsLive(ip: string): Promise<boolean> {return; }
|
static isDnsLive(ip: string): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if IP is live using socket And PORT
|
* Checks if IP is live using socket And PORT
|
||||||
@ -204,7 +203,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isPortLive(ip: string): Promise<boolean> {return; }
|
static isPortLive(ip: string): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if device is rooted
|
* Checks if device is rooted
|
||||||
@ -212,7 +211,7 @@ export class Hotspot {
|
|||||||
* @return {Promise<boolean>} - A Promise for whether the device is rooted
|
* @return {Promise<boolean>} - A Promise for whether the device is rooted
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isRooted(): Promise<boolean> {return; }
|
static isRooted(): Promise<boolean> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,61 +1,79 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Httpd
|
* @name Httpd
|
||||||
* @description
|
* @description
|
||||||
* Embedded httpd for Cordova apps. Light weight HTTP server.
|
* Embedded httpd for Cordova apps. Light weight HTTP server.
|
||||||
* @usage
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import {Httpd, HttpdOptions} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* let options: HttpdOptions = {
|
||||||
|
* www_root: 'httpd_root', // relative path to app's www directory
|
||||||
|
* port: 80,
|
||||||
|
* localhost_only: false
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* Httpd.startServer(options).subscribe((data) => {
|
||||||
|
* console.log('Server is live');
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
|
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
|
||||||
pluginRef: 'cordova.plugins.CorHttpd',
|
pluginRef: 'cordova.plugins.CorHttpd',
|
||||||
repo: 'https://github.com/floatinghotpot/cordova-httpd',
|
repo: 'https://github.com/floatinghotpot/cordova-httpd',
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
export class Httpd {
|
export class Httpd {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a web server.
|
* Starts a web server.
|
||||||
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
||||||
* @param options {HttpdOptions}
|
* @param options {HttpdOptions}
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'stopServer'
|
clearFunction: 'stopServer'
|
||||||
})
|
})
|
||||||
static startServer(options: any): Observable<string> {return; }
|
static startServer(options?: any): Observable<string> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL of the running server
|
* Gets the URL of the running server
|
||||||
* @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
|
* @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getUrl(): Promise<string> {return; }
|
static getUrl(): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the local path of the running webserver
|
||||||
|
* @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static getLocalPath(): Promise<string> { return; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the local path of the running webserver
|
|
||||||
* @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
static getLocalPath(): Promise<string> {return; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These options are used for the Httpd.startServer() function.
|
* These options are used for the Httpd.startServer() function.
|
||||||
*/
|
*/
|
||||||
export interface HttpdOptions {
|
export interface HttpdOptions {
|
||||||
/**
|
/**
|
||||||
* The public root directory for your web server. This path is relative to your app's www directory.
|
* The public root directory for your web server. This path is relative to your app's www directory.
|
||||||
* Default is current directory.
|
* Default is current directory.
|
||||||
*/
|
*/
|
||||||
www_root?: string;
|
www_root?: string;
|
||||||
/**
|
/**
|
||||||
* The port number to use.
|
* The port number to use.
|
||||||
* Default is 8888
|
* Default is 8888
|
||||||
*/
|
*/
|
||||||
port?: number;
|
port?: number;
|
||||||
/**
|
/**
|
||||||
* Setting this option to false will allow remote access to your web server (over any IP).
|
* Setting this option to false will allow remote access to your web server (over any IP).
|
||||||
* Default is false.
|
* Default is false.
|
||||||
*/
|
*/
|
||||||
localhost_only?: boolean;
|
localhost_only?: boolean;
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
declare var cordova: any;
|
declare var cordova: any;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ export interface Beacon {
|
|||||||
accuracy: number;
|
accuracy: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BeaconRegion {
|
export interface BeaconRegion {
|
||||||
/**
|
/**
|
||||||
* A unique identifier for this region.
|
* A unique identifier for this region.
|
||||||
@ -65,7 +67,7 @@ export interface BeaconRegion {
|
|||||||
major?: number;
|
major?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The beacon's major identifier number. Optional, of nothing is supplied
|
* The beacon's minor identifier number. Optional, of nothing is supplied
|
||||||
* the plugin will treat it as a wildcard.
|
* the plugin will treat it as a wildcard.
|
||||||
*/
|
*/
|
||||||
minor?: number;
|
minor?: number;
|
||||||
@ -76,6 +78,7 @@ export interface BeaconRegion {
|
|||||||
*/
|
*/
|
||||||
notifyEntryStateOnDisplay?: boolean;
|
notifyEntryStateOnDisplay?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CircularRegion {
|
export interface CircularRegion {
|
||||||
/**
|
/**
|
||||||
* A unique identifier for this region.
|
* A unique identifier for this region.
|
||||||
@ -97,6 +100,7 @@ export interface CircularRegion {
|
|||||||
*/
|
*/
|
||||||
radius: number;
|
radius: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Region = BeaconRegion | CircularRegion;
|
export type Region = BeaconRegion | CircularRegion;
|
||||||
|
|
||||||
export interface PluginResult {
|
export interface PluginResult {
|
||||||
@ -125,7 +129,13 @@ export interface PluginResult {
|
|||||||
* The state of the phone in relation to the region. Inside/outside for example.
|
* The state of the phone in relation to the region. Inside/outside for example.
|
||||||
*/
|
*/
|
||||||
state: 'CLRegionStateInside' | 'CLRegionStateOutside';
|
state: 'CLRegionStateInside' | 'CLRegionStateOutside';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error message, used only with monitoringDidFailForRegionWithError delegate.
|
||||||
|
*/
|
||||||
|
error: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Delegate {
|
export interface Delegate {
|
||||||
/**
|
/**
|
||||||
* An observable that publishes information about the location permission authorization status.
|
* An observable that publishes information about the location permission authorization status.
|
||||||
@ -221,8 +231,8 @@ export interface Delegate {
|
|||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {IBeacon} from 'ionic-native';
|
* import { IBeacon } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Request permission to use location on iOS
|
* // Request permission to use location on iOS
|
||||||
@ -233,13 +243,13 @@ export interface Delegate {
|
|||||||
* // Subscribe to some of the delegate's event handlers
|
* // Subscribe to some of the delegate's event handlers
|
||||||
* delegate.didRangeBeaconsInRegion()
|
* delegate.didRangeBeaconsInRegion()
|
||||||
* .subscribe(
|
* .subscribe(
|
||||||
* data => {console.log('didRangeBeaconsInRegion: ', data)},
|
* data => console.log('didRangeBeaconsInRegion: ', data),
|
||||||
* error => console.error
|
* error => console.error();
|
||||||
* );
|
* );
|
||||||
* delegate.didStartMonitoringForRegion()
|
* delegate.didStartMonitoringForRegion()
|
||||||
* .subscribe(
|
* .subscribe(
|
||||||
* data => {console.log('didStartMonitoringForRegion: ', data)},
|
* data => console.log('didStartMonitoringForRegion: ', data),
|
||||||
* error => console.error
|
* error => console.error();
|
||||||
* );
|
* );
|
||||||
* delegate.didEnterRegion()
|
* delegate.didEnterRegion()
|
||||||
* .subscribe(
|
* .subscribe(
|
||||||
@ -258,14 +268,13 @@ export interface Delegate {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-ibeacon',
|
plugin: 'cordova-plugin-ibeacon',
|
||||||
pluginRef: 'cordova.plugins.locationManager',
|
pluginRef: 'cordova.plugins.locationManager',
|
||||||
repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
|
repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
|
||||||
platforms: ['Android', 'iOS']
|
platforms: ['Android', 'iOS']
|
||||||
})
|
})
|
||||||
export class IBeacon {
|
export class IBeacon {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instances of this class are delegates between the {@link LocationManager} and
|
* Instances of this class are delegates between the {@link LocationManager} and
|
||||||
* the code that consumes the messages generated on in the native layer.
|
* the code that consumes the messages generated on in the native layer.
|
||||||
@ -372,8 +381,8 @@ export class IBeacon {
|
|||||||
*
|
*
|
||||||
* @return Returns the BeaconRegion that was created
|
* @return Returns the BeaconRegion that was created
|
||||||
*/
|
*/
|
||||||
static BeaconRegion(identifer: string, uuid: string, minor?: number, major?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, minor, major, notifyEntryStateOnDisplay);
|
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -410,7 +419,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the request and started to send events.
|
* native layer acknowledged the request and started to send events.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static onDomDelegateReady(): Promise<void> { return; }
|
static onDomDelegateReady(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -418,7 +427,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with a {Boolean}
|
* @returns Returns a promise which is resolved with a {Boolean}
|
||||||
* indicating whether bluetooth is active.
|
* indicating whether bluetooth is active.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static isBluetoothEnabled(): Promise<boolean> { return; }
|
static isBluetoothEnabled(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -427,7 +436,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved when Bluetooth
|
* @returns Returns a promise which is resolved when Bluetooth
|
||||||
* could be enabled. If not, the promise will be rejected with an error.
|
* could be enabled. If not, the promise will be rejected with an error.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static enableBluetooth(): Promise<void> { return; }
|
static enableBluetooth(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -436,7 +445,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved when Bluetooth
|
* @returns Returns a promise which is resolved when Bluetooth
|
||||||
* could be enabled. If not, the promise will be rejected with an error.
|
* could be enabled. If not, the promise will be rejected with an error.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static disableBluetooth(): Promise<void> { return; }
|
static disableBluetooth(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -456,7 +465,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the monitoring request.
|
* native layer acknowledged the dispatch of the monitoring request.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -473,7 +482,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -489,7 +498,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static requestStateForRegion(region: Region): Promise<void> { return; }
|
static requestStateForRegion(region: Region): Promise<void> { return; }
|
||||||
|
|
||||||
|
|
||||||
@ -507,7 +516,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the monitoring request.
|
* native layer acknowledged the dispatch of the monitoring request.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -524,7 +533,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -533,7 +542,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with the
|
* @returns Returns a promise which is resolved with the
|
||||||
* requested authorization status.
|
* requested authorization status.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static getAuthorizationStatus(): Promise<any> { return; }
|
static getAuthorizationStatus(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -545,7 +554,7 @@ export class IBeacon {
|
|||||||
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
|
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
|
||||||
* @returns Returns a promise that is resolved when the request dialog is shown.
|
* @returns Returns a promise that is resolved when the request dialog is shown.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static requestWhenInUseAuthorization(): Promise<void> { return; }
|
static requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||||
|
|
||||||
|
|
||||||
@ -555,7 +564,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved when the native layer
|
* @returns Returns a promise which is resolved when the native layer
|
||||||
* shows the request dialog.
|
* shows the request dialog.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static requestAlwaysAuthorization(): Promise<void> { return; }
|
static requestAlwaysAuthorization(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -563,7 +572,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with an {Array}
|
* @returns Returns a promise which is resolved with an {Array}
|
||||||
* of {Region} instances that are being monitored by the native layer.
|
* of {Region} instances that are being monitored by the native layer.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static getMonitoredRegions(): Promise<Region[]> { return; }
|
static getMonitoredRegions(): Promise<Region[]> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -571,7 +580,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with an {Array}
|
* @returns Returns a promise which is resolved with an {Array}
|
||||||
* of {Region} instances that are being ranged by the native layer.
|
* of {Region} instances that are being ranged by the native layer.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static getRangedRegions(): Promise<Region[]> { return; }
|
static getRangedRegions(): Promise<Region[]> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -579,7 +588,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with a {Boolean}
|
* @returns Returns a promise which is resolved with a {Boolean}
|
||||||
* indicating whether ranging is available or not.
|
* indicating whether ranging is available or not.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static isRangingAvailable(): Promise<boolean> { return; }
|
static isRangingAvailable(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -591,7 +600,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with a {Boolean}
|
* @returns Returns a promise which is resolved with a {Boolean}
|
||||||
* indicating whether the region type is supported or not.
|
* indicating whether the region type is supported or not.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -611,7 +620,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the advertising request.
|
* native layer acknowledged the dispatch of the advertising request.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
|
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -622,7 +631,7 @@ export class IBeacon {
|
|||||||
* @return Returns a promise which is resolved as soon as the
|
* @return Returns a promise which is resolved as soon as the
|
||||||
* native layer acknowledged the dispatch of the request to stop advertising.
|
* native layer acknowledged the dispatch of the request to stop advertising.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static stopAdvertising(region: Region): Promise<void> { return; }
|
static stopAdvertising(region: Region): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -630,7 +639,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with a {Boolean}
|
* @returns Returns a promise which is resolved with a {Boolean}
|
||||||
* indicating whether advertising is available or not.
|
* indicating whether advertising is available or not.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static isAdvertisingAvailable(): Promise<boolean> { return; }
|
static isAdvertisingAvailable(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -638,7 +647,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved with a {Boolean}
|
* @returns Returns a promise which is resolved with a {Boolean}
|
||||||
* indicating whether advertising is active.
|
* indicating whether advertising is active.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static isAdvertising(): Promise<boolean> { return; }
|
static isAdvertising(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -648,7 +657,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved as soon as the
|
* @returns Returns a promise which is resolved as soon as the
|
||||||
* native layer has set the logging level accordingly.
|
* native layer has set the logging level accordingly.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static disableDebugLogs(): Promise<void> { return; }
|
static disableDebugLogs(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -659,7 +668,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved as soon as the
|
* @returns Returns a promise which is resolved as soon as the
|
||||||
* native layer has set the flag to enabled.
|
* native layer has set the flag to enabled.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static enableDebugNotifications(): Promise<void> { return; }
|
static enableDebugNotifications(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -669,7 +678,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved as soon as the
|
* @returns Returns a promise which is resolved as soon as the
|
||||||
* native layer has set the flag to disabled.
|
* native layer has set the flag to disabled.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static disableDebugNotifications(): Promise<void> { return; }
|
static disableDebugNotifications(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -679,7 +688,7 @@ export class IBeacon {
|
|||||||
* @returns Returns a promise which is resolved as soon as the
|
* @returns Returns a promise which is resolved as soon as the
|
||||||
* native layer has set the logging level accordingly.
|
* native layer has set the logging level accordingly.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static enableDebugLogs(): Promise<void> { return; }
|
static enableDebugLogs(): Promise<void> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -692,7 +701,7 @@ export class IBeacon {
|
|||||||
* message received by the native layer for appending. The returned message
|
* message received by the native layer for appending. The returned message
|
||||||
* is expected to be equivalent to the one provided in the original call.
|
* is expected to be equivalent to the one provided in the original call.
|
||||||
*/
|
*/
|
||||||
@Cordova({sync: true})
|
@Cordova({otherPromise: true})
|
||||||
static appendToDeviceLog(message: string): Promise<void> { return; }
|
static appendToDeviceLog(message: string): Promise<void> { return; }
|
||||||
|
|
||||||
}
|
}
|
@ -1,20 +1,21 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface ImagePickerOptions {
|
export interface ImagePickerOptions {
|
||||||
// max images to be selected, defaults to 15. If this is set to 1, upon
|
// max images to be selected, defaults to 15. If this is set to 1, upon
|
||||||
// selection of a single image, the plugin will return it.
|
// selection of a single image, the plugin will return it.
|
||||||
maximumImagesCount?: number;
|
maximumImagesCount?: number;
|
||||||
|
|
||||||
// max width and height to allow the images to be. Will keep aspect
|
// max width and height to allow the images to be. Will keep aspect
|
||||||
// ratio no matter what. So if both are 800, the returned image
|
// ratio no matter what. So if both are 800, the returned image
|
||||||
// will be at most 800 pixels wide and 800 pixels tall. If the width is
|
// will be at most 800 pixels wide and 800 pixels tall. If the width is
|
||||||
// 800 and height 0 the image will be 800 pixels wide if the source
|
// 800 and height 0 the image will be 800 pixels wide if the source
|
||||||
// is at least that wide.
|
// is at least that wide.
|
||||||
width?: number;
|
width?: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
|
|
||||||
// quality of resized image, defaults to 100
|
// quality of resized image, defaults to 100
|
||||||
quality?: number;
|
quality?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,8 +27,8 @@ export interface ImagePickerOptions {
|
|||||||
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
|
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {ImagePicker} from 'ionic-native';
|
* import { ImagePicker } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -35,8 +36,7 @@ export interface ImagePickerOptions {
|
|||||||
* for (var i = 0; i < results.length; i++) {
|
* for (var i = 0; i < results.length; i++) {
|
||||||
* console.log('Image URI: ' + results[i]);
|
* console.log('Image URI: ' + results[i]);
|
||||||
* }
|
* }
|
||||||
* }, (err) => {
|
* }, (err) => { });
|
||||||
* });
|
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -55,4 +55,5 @@ export class ImagePicker {
|
|||||||
callbackOrder: 'reverse'
|
callbackOrder: 'reverse'
|
||||||
})
|
})
|
||||||
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
|
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
77
src/plugins/imageresizer.ts
Normal file
77
src/plugins/imageresizer.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
export interface ImageResizerOptions {
|
||||||
|
/**
|
||||||
|
* The URI for the image on the device to get scaled
|
||||||
|
*/
|
||||||
|
uri: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The width of the new image
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the new image
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the folder the image should be put
|
||||||
|
* (Android only)
|
||||||
|
*/
|
||||||
|
folderName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Quality given as Number for the quality of the new image
|
||||||
|
* (Android and iOS only)
|
||||||
|
*/
|
||||||
|
quality?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom name for the file. Default name is a timestamp
|
||||||
|
* (Android and Windows only)
|
||||||
|
*/
|
||||||
|
fileName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name ImageResizer
|
||||||
|
* @description
|
||||||
|
* Cordova Plugin For Image Resize
|
||||||
|
*
|
||||||
|
* Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command:
|
||||||
|
* `ionic plugin add https://github.com/protonet/cordova-plugin-image-resizer.git`
|
||||||
|
*
|
||||||
|
* For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { ImageResizer, ImageResizerOptions } from 'ionic-native';
|
||||||
|
*
|
||||||
|
* let options = {
|
||||||
|
* uri: uri,
|
||||||
|
* folderName: 'Protonet',
|
||||||
|
* quality: 90,
|
||||||
|
* width: 1280,
|
||||||
|
* height: 1280
|
||||||
|
* } as ImageResizerOptions;
|
||||||
|
*
|
||||||
|
* ImageResizer
|
||||||
|
* .resize(options)
|
||||||
|
* .then(
|
||||||
|
* (filePath: string) => { console.log('FilePath', filePath); },
|
||||||
|
* () => { console.log('Error occured'); }
|
||||||
|
* )
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
|
||||||
|
pluginRef: 'ImageResizer',
|
||||||
|
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
|
||||||
|
})
|
||||||
|
export class ImageResizer {
|
||||||
|
@Cordova()
|
||||||
|
static resize(options: ImageResizerOptions): Promise<any> { return; }
|
||||||
|
}
|
@ -1,4 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Plugin, CordovaInstance } from './plugin';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
declare var cordova: any;
|
||||||
|
|
||||||
export interface InAppBrowserEvent extends Event {
|
export interface InAppBrowserEvent extends Event {
|
||||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||||
@ -10,66 +12,36 @@ export interface InAppBrowserEvent extends Event {
|
|||||||
/** the error message, only in the case of loaderror. */
|
/** the error message, only in the case of loaderror. */
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
export interface InAppBrowserRef {
|
* @name InAppBrowser
|
||||||
/**
|
* @description Launches in app Browser
|
||||||
* Adds a listener for an event from the InAppBrowser.
|
* @usage
|
||||||
* @param type the event to listen for
|
* ```typescript
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
* import {InAppBrowser} from 'ionic-native';
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
*
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
*
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
* ...
|
||||||
* @param callback the function that executes when the event fires. The function is
|
*
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
*
|
||||||
*/
|
* let browser = new InAppBrowser('https://ionic.io', '_system');
|
||||||
addEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
|
* browser.executeScript(...);
|
||||||
|
* browser.insertCSS(...);
|
||||||
/**
|
* browser.close();
|
||||||
* Removes a listener for an event from the InAppBrowser.
|
* ```
|
||||||
* @param type The event to stop listening for.
|
*/
|
||||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
|
||||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
|
||||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
|
||||||
* exit: event fires when the InAppBrowser window is closed.
|
|
||||||
* @param callback the function that executes when the event fires. The function is
|
|
||||||
* passed an InAppBrowserEvent object as a parameter.
|
|
||||||
*/
|
|
||||||
removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
|
|
||||||
|
|
||||||
/** Closes the InAppBrowser window. */
|
|
||||||
close();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
|
||||||
* if the InAppBrowser was already visible.
|
|
||||||
*/
|
|
||||||
show();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Injects JavaScript code into the InAppBrowser window.
|
|
||||||
* @param script Details of the script to run, specifying either a file or code key.
|
|
||||||
* @param callback The function that executes after the JavaScript code is injected.
|
|
||||||
* If the injected script is of type code, the callback executes with
|
|
||||||
* a single parameter, which is the return value of the script, wrapped in an Array.
|
|
||||||
* For multi-line scripts, this is the return value of the last statement,
|
|
||||||
* or the last expression evaluated.
|
|
||||||
*/
|
|
||||||
executeScript(script: {file?: string, code?: string}, callback?: (result?: any) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Injects CSS into the InAppBrowser window.
|
|
||||||
* @param css Details of the script to run, specifying either a file or code key.
|
|
||||||
* @param callback The function that executes after the CSS is injected.
|
|
||||||
*/
|
|
||||||
insertCSS(css: {file?: string, code?: string}, callback?: () => void);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-inappbrowser',
|
plugin: 'cordova-plugin-inappbrowser',
|
||||||
pluginRef: 'cordova.InAppBrowser'
|
pluginRef: 'cordova.InAppBrowser',
|
||||||
|
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
|
||||||
})
|
})
|
||||||
export class InAppBrowser {
|
export class InAppBrowser {
|
||||||
|
|
||||||
|
static open(url: string, target?: string, options?: string): void {
|
||||||
|
console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private _objectInstance: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
||||||
* @param url The URL to load.
|
* @param url The URL to load.
|
||||||
@ -78,8 +50,54 @@ export class InAppBrowser {
|
|||||||
* The options string must not contain any blank space, and each feature's
|
* The options string must not contain any blank space, and each feature's
|
||||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
constructor(url: string, target?: string, options?: string) {
|
||||||
sync: true
|
try {
|
||||||
})
|
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||||
static open(url: string, target?: string, options?: string): InAppBrowserRef { return; }
|
} catch (e) {
|
||||||
|
window.open(url);
|
||||||
|
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||||
|
* if the InAppBrowser was already visible.
|
||||||
|
*/
|
||||||
|
@CordovaInstance({sync: true})
|
||||||
|
show(): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the InAppBrowser window.
|
||||||
|
*/
|
||||||
|
@CordovaInstance({sync: true})
|
||||||
|
close(): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injects JavaScript code into the InAppBrowser window.
|
||||||
|
* @param script Details of the script to run, specifying either a file or code key.
|
||||||
|
*/
|
||||||
|
@CordovaInstance()
|
||||||
|
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injects CSS into the InAppBrowser window.
|
||||||
|
* @param css Details of the script to run, specifying either a file or code key.
|
||||||
|
*/
|
||||||
|
@CordovaInstance()
|
||||||
|
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A method that allows you to listen to events happening in the browser.
|
||||||
|
* @param event Event name
|
||||||
|
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||||
|
*/
|
||||||
|
on(event: string): Observable<InAppBrowserEvent> {
|
||||||
|
return new Observable<InAppBrowserEvent>((observer) => {
|
||||||
|
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||||
|
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Insomnia
|
* @name Insomnia
|
||||||
@ -6,8 +7,9 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* Prevent the screen of the mobile device from falling asleep.
|
* Prevent the screen of the mobile device from falling asleep.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Insomnia} from 'ionic-native';
|
* import { Insomnia } from 'ionic-native';
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* Insomnia.keepAwake()
|
* Insomnia.keepAwake()
|
||||||
* .then(
|
* .then(
|
||||||
@ -44,4 +46,5 @@ export class Insomnia {
|
|||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static allowSleepAgain(): Promise<any> { return; }
|
static allowSleepAgain(): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
57
src/plugins/instagram.ts
Normal file
57
src/plugins/instagram.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import {Plugin, Cordova} from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Instagram
|
||||||
|
* @description Share a photo with the instagram app
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {Instagram} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
|
||||||
|
* .then(() => console.log('Shared!'))
|
||||||
|
* .catch((error: any) => console.error(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-instagram-plugin',
|
||||||
|
pluginRef: 'Instagram',
|
||||||
|
repo: 'https://github.com/vstirbu/InstagramPlugin'
|
||||||
|
})
|
||||||
|
export class Instagram {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect if the Instagram application is installed on the device.
|
||||||
|
*
|
||||||
|
* @return {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackStyle: 'node'
|
||||||
|
})
|
||||||
|
static isInstalled(): Promise<boolean|string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share an image on Instagram
|
||||||
|
* Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption.
|
||||||
|
*
|
||||||
|
* @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share
|
||||||
|
* @param caption The caption of the image
|
||||||
|
* @return {Promise<any>} Returns a promise that resolves if the image was shared
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackStyle: 'node'
|
||||||
|
})
|
||||||
|
static share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share a library asset or video
|
||||||
|
* @param assetLocalIdentifier A local fileURI
|
||||||
|
* @return {Promise<any>} Returns a promise that resolves if the image was shared
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
}
|
35
src/plugins/is-debug.ts
Normal file
35
src/plugins/is-debug.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import {Plugin, Cordova} from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name IsDebug
|
||||||
|
* @description
|
||||||
|
* Detect if the app is running in debug mode or not.
|
||||||
|
* Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {IsDebug} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* IsDebug.getIsDebug()
|
||||||
|
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
|
||||||
|
* .catch((error: any) => console.error(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-is-debug',
|
||||||
|
pluginRef: 'cordova.plugins.IsDebug',
|
||||||
|
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
|
||||||
|
})
|
||||||
|
export class IsDebug {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if an app was installed via xcode / eclipse / the ionic CLI etc
|
||||||
|
* @return {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static getIsDebug(): Promise<boolean> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,13 @@
|
|||||||
import {Cordova, Plugin} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Keyboard
|
* @name Keyboard
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Keyboard} from 'ionic-native';
|
* import { Keyboard } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -23,9 +24,8 @@ export class Keyboard {
|
|||||||
* Hide the keyboard accessory bar with the next, previous and done buttons.
|
* Hide the keyboard accessory bar with the next, previous and done buttons.
|
||||||
* @param hide {boolean}
|
* @param hide {boolean}
|
||||||
*/
|
*/
|
||||||
static hideKeyboardAccessoryBar(hide: boolean): void {
|
@Cordova({sync: true})
|
||||||
console.log('hideKeyboardAccessoryBar method has been removed temporarily.');
|
static hideKeyboardAccessoryBar(hide: boolean): void { }
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force keyboard to be shown.
|
* Force keyboard to be shown.
|
||||||
@ -34,7 +34,7 @@ export class Keyboard {
|
|||||||
sync: true,
|
sync: true,
|
||||||
platforms: ['Android', 'BlackBerry 10', 'Windows']
|
platforms: ['Android', 'BlackBerry 10', 'Windows']
|
||||||
})
|
})
|
||||||
static show(): void {}
|
static show(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the keyboard if open.
|
* Close the keyboard if open.
|
||||||
@ -43,7 +43,7 @@ export class Keyboard {
|
|||||||
sync: true,
|
sync: true,
|
||||||
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
||||||
})
|
})
|
||||||
static close(): void {}
|
static close(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevents the native UIScrollView from moving when an input is focused.
|
* Prevents the native UIScrollView from moving when an input is focused.
|
||||||
@ -53,7 +53,7 @@ export class Keyboard {
|
|||||||
sync: true,
|
sync: true,
|
||||||
platforms: ['iOS', 'Windows']
|
platforms: ['iOS', 'Windows']
|
||||||
})
|
})
|
||||||
static disableScroll(disable: boolean): void {}
|
static disableScroll(disable: boolean): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
|
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
|
||||||
@ -63,7 +63,7 @@ export class Keyboard {
|
|||||||
event: 'native.keyboardshow',
|
event: 'native.keyboardshow',
|
||||||
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
||||||
})
|
})
|
||||||
static onKeyboardShow(): Observable<any> {return; }
|
static onKeyboardShow(): Observable<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
|
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
|
||||||
@ -73,6 +73,6 @@ export class Keyboard {
|
|||||||
event: 'native.keyboardhide',
|
event: 'native.keyboardhide',
|
||||||
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
|
||||||
})
|
})
|
||||||
static onKeyboardHide(): Observable<any> {return; }
|
static onKeyboardHide(): Observable<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,49 +1,61 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface LaunchNavigatorOptions {
|
export interface LaunchNavigatorOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS, Android, Windows
|
* name of the navigation app to use for directions. Specify using launchnavigator.APP constants. If not specified, defaults to User Selection.
|
||||||
* If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false.
|
|
||||||
*/
|
*/
|
||||||
disableAutoGeolocation?: boolean;
|
app?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nickname to display in app for destination. e.g. "Bob's House".
|
||||||
|
*/
|
||||||
|
destinationName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start point of the navigation
|
||||||
|
*/
|
||||||
|
start?: string | number[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nickname to display in app for start . e.g. "My House".
|
||||||
|
*/
|
||||||
|
startName?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS, Android, Windows
|
|
||||||
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
|
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
|
||||||
*/
|
*/
|
||||||
transportMode?: string;
|
transportMode?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS
|
|
||||||
* If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps.
|
|
||||||
*/
|
|
||||||
preferGoogleMaps?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* iOS
|
|
||||||
* If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app.
|
|
||||||
*/
|
|
||||||
urlScheme?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* iOS
|
|
||||||
* If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified.
|
|
||||||
*/
|
|
||||||
backButtonText?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* iOS
|
|
||||||
* If true, debug log output will be generated by the plugin. Defaults to false.
|
* If true, debug log output will be generated by the plugin. Defaults to false.
|
||||||
*/
|
*/
|
||||||
enableDebug?: boolean;
|
enableDebug?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Android
|
* a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}`
|
||||||
* Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified.
|
|
||||||
*/
|
*/
|
||||||
navigationMode?: string;
|
extras?: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants.
|
||||||
|
*/
|
||||||
|
launchMode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified.
|
||||||
|
*/
|
||||||
|
appSelectionDialogHeader?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified.
|
||||||
|
*/
|
||||||
|
appSelectionCancelButton?: string;
|
||||||
|
|
||||||
|
successCallback?: Function;
|
||||||
|
|
||||||
|
errorCallback?: Function;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,15 +64,20 @@ export interface LaunchNavigatorOptions {
|
|||||||
* Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator).
|
* Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
|
||||||
* import {LaunchNavigator} from 'ionic-native';
|
|
||||||
*
|
*
|
||||||
|
* ```typescript
|
||||||
|
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
|
||||||
*
|
*
|
||||||
|
* let options: LaunchNavigatorOptions = {
|
||||||
|
* start: 'London, ON',
|
||||||
|
* app: LaunchNavigator.APPS.UBER
|
||||||
|
* };
|
||||||
*
|
*
|
||||||
* LaunchNavigator.navigate("Toronto, ON", "London, ON")
|
* LaunchNavigator.navigate('Toronto, ON', options)
|
||||||
* .then(
|
* .then(
|
||||||
* success => console.log("Launched navigator"),
|
* success => console.log('Launched navigator'),
|
||||||
* error => console.log("Error launching navigator", error)
|
* error => console.log('Error launching navigator', error)
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@ -73,19 +90,109 @@ export class LaunchNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches navigator app
|
* Launches navigator app
|
||||||
* @param destination Location name or coordinates
|
* @param destination {string|number[]} Location name or coordinates (as string or array)
|
||||||
* @param start Location name or coordinates
|
* @param options {LaunchNavigatorOptions}
|
||||||
* @param options
|
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 2,
|
successIndex: 1,
|
||||||
errorIndex: 3
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static navigate(
|
static navigate(
|
||||||
destination: any,
|
destination: string | number[],
|
||||||
start: any = null,
|
|
||||||
options?: LaunchNavigatorOptions
|
options?: LaunchNavigatorOptions
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the given app is installed and available on the current device.
|
||||||
|
* @param app {string}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static isAppAvailable(app: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list indicating which apps are installed and available on the current device.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static availableApps(): Promise<string[]> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the display name of the specified app.
|
||||||
|
* @param app {string}
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static getAppDisplayName(app: string): string { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns list of supported apps on a given platform.
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static getAppsForPlatform(platform: string): string[] { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if an app on a given platform supports specification of transport mode.
|
||||||
|
* @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS`
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static supportsTransportMode(app: string, platform: string): boolean { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of transport modes supported by an app on a given platform.
|
||||||
|
* @param app {string}
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static getTransportModes(app: string, platform: string): string[] { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if an app on a given platform supports specification of launch mode.
|
||||||
|
* Note that currently only Google Maps on Android does.
|
||||||
|
* @param app {string}
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if an app on a given platform supports specification of start location.
|
||||||
|
* @param app {string}
|
||||||
|
* @param platform {string}
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static supportsStart(app: string, platform: string): boolean { return; }
|
||||||
|
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static supportsStartName(app: string, platform: string): boolean { return; }
|
||||||
|
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static supportsDestName(app: string, platform: string): boolean { return; }
|
||||||
|
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
|
||||||
|
|
||||||
|
static APP: any = {
|
||||||
|
USER_SELECT: 'user_select',
|
||||||
|
APPLE_MAPS: 'apple_maps',
|
||||||
|
GOOGLE_MAPS: 'google_maps',
|
||||||
|
WAZE: 'waze',
|
||||||
|
CITYMAPPER: 'citymapper',
|
||||||
|
NAVIGON: 'navigon',
|
||||||
|
TRANSIT_APP: 'transit_app',
|
||||||
|
YANDEX: 'yandex',
|
||||||
|
UBER: 'uber',
|
||||||
|
TOMTOM: 'tomtom',
|
||||||
|
BING_MAPS: 'bing_maps',
|
||||||
|
SYGIC: 'sygic',
|
||||||
|
HERE_MAPS: 'here_maps',
|
||||||
|
MOOVIT: 'moovit'
|
||||||
|
};
|
||||||
|
|
||||||
|
static TRANSPORT_MODE: any = {
|
||||||
|
DRIVING: 'driving',
|
||||||
|
WALKING: 'walking',
|
||||||
|
BICYCLING: 'bicycling',
|
||||||
|
TRANSIT: 'transit'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Local Notifications
|
* @name Local Notifications
|
||||||
* @description
|
* @description
|
||||||
* This plugin allows you to display local notifications on the device
|
* This plugin allows you to display local notifications on the device
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {LocalNotifications} from 'ionic-native';
|
* import { LocalNotifications } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Schedule a single notification
|
* // Schedule a single notification
|
||||||
* LocalNotifications.schedule({
|
* LocalNotifications.schedule({
|
||||||
* id: 1,
|
* id: 1,
|
||||||
* text: "Single Notification",
|
* text: 'Single Notification',
|
||||||
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
|
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
|
||||||
* data: { secret: key }
|
* data: { secret: key }
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
@ -22,22 +23,22 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* // Schedule multiple notifications
|
* // Schedule multiple notifications
|
||||||
* LocalNotifications.schedule([{
|
* LocalNotifications.schedule([{
|
||||||
* id: 1,
|
* id: 1,
|
||||||
* text: "Multi Notification 1",
|
* text: 'Multi Notification 1',
|
||||||
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
|
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
|
||||||
* data: { secret:key }
|
* data: { secret:key }
|
||||||
* },{
|
* },{
|
||||||
* id: 2,
|
* id: 2,
|
||||||
* title: "Local Notification Example",
|
* title: 'Local Notification Example',
|
||||||
* text: "Multi Notification 2",
|
* text: 'Multi Notification 2',
|
||||||
* icon: "http://example.com/icon.png"
|
* icon: 'http://example.com/icon.png'
|
||||||
* }]);
|
* }]);
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Schedule delayed notification
|
* // Schedule delayed notification
|
||||||
* LocalNotifications.schedule({
|
* LocalNotifications.schedule({
|
||||||
* text: "Delayed Notification",
|
* text: 'Delayed Notification',
|
||||||
* at: new Date(new Date().getTime() + 3600),
|
* at: new Date(new Date().getTime() + 3600),
|
||||||
* led: "FF0000",
|
* led: 'FF0000',
|
||||||
* sound: null
|
* sound: null
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
@ -57,7 +58,7 @@ export class LocalNotifications {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static schedule(options?: Notification|Array<Notification>): void {}
|
static schedule(options?: Notification | Array<Notification>): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a previously scheduled notification. Must include the id in the options parameter.
|
* Updates a previously scheduled notification. Must include the id in the options parameter.
|
||||||
@ -66,14 +67,14 @@ export class LocalNotifications {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static update(options?: Notification): void {}
|
static update(options?: Notification): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears single or multiple notifications
|
* Clears single or multiple notifications
|
||||||
* @param notificationId A single notification id, or an array of notification ids.
|
* @param notificationId A single notification id, or an array of notification ids.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static clear(notificationId: any): Promise<any> {return; }
|
static clear(notificationId: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all notifications
|
* Clears all notifications
|
||||||
@ -82,14 +83,14 @@ export class LocalNotifications {
|
|||||||
successIndex: 0,
|
successIndex: 0,
|
||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static clearAll(): Promise<any> {return; }
|
static clearAll(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels single or multiple notifications
|
* Cancels single or multiple notifications
|
||||||
* @param notificationId A single notification id, or an array of notification ids.
|
* @param notificationId A single notification id, or an array of notification ids.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static cancel(notificationId: any): Promise<any> {return; }
|
static cancel(notificationId: any): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels all notifications
|
* Cancels all notifications
|
||||||
@ -98,85 +99,85 @@ export class LocalNotifications {
|
|||||||
successIndex: 0,
|
successIndex: 0,
|
||||||
errorIndex: 2
|
errorIndex: 2
|
||||||
})
|
})
|
||||||
static cancelAll(): Promise<any> {return; }
|
static cancelAll(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks presence of a notification
|
* Checks presence of a notification
|
||||||
* @param notificationId
|
* @param notificationId
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isPresent (notificationId: number): Promise<boolean> {return; }
|
static isPresent(notificationId: number): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks is a notification is scheduled
|
* Checks is a notification is scheduled
|
||||||
* @param notificationId
|
* @param notificationId
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isScheduled (notificationId: number): Promise<boolean> {return; }
|
static isScheduled(notificationId: number): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a notification is triggered
|
* Checks if a notification is triggered
|
||||||
* @param notificationId
|
* @param notificationId
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isTriggered (notificationId: number): Promise<boolean> {return; }
|
static isTriggered(notificationId: number): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the notification ids
|
* Get all the notification ids
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getAllIds (): Promise<Array<number>> {return; }
|
static getAllIds(): Promise<Array<number>> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ids of triggered notifications
|
* Get the ids of triggered notifications
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getTriggeredIds (): Promise<Array<number>> {return; }
|
static getTriggeredIds(): Promise<Array<number>> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ids of scheduled notifications
|
* Get the ids of scheduled notifications
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getScheduledIds (): Promise<Array<number>> {return; }
|
static getScheduledIds(): Promise<Array<number>> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a notification object
|
* Get a notification object
|
||||||
* @param notificationId The id of the notification to get
|
* @param notificationId The id of the notification to get
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static get (notificationId: any): Promise <Notification> {return; }
|
static get(notificationId: any): Promise<Notification> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a scheduled notification object
|
* Get a scheduled notification object
|
||||||
* @param notificationId The id of the notification to get
|
* @param notificationId The id of the notification to get
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getScheduled (notificationId: any): Promise <Notification> {return; }
|
static getScheduled(notificationId: any): Promise<Notification> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a triggered notification object
|
* Get a triggered notification object
|
||||||
* @param notificationId The id of the notification to get
|
* @param notificationId The id of the notification to get
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getTriggered (notificationId: any): Promise <Notification> {return; }
|
static getTriggered(notificationId: any): Promise<Notification> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all notification objects
|
* Get all notification objects
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getAll(): Promise<Array<Notification>> {return; }
|
static getAll(): Promise<Array<Notification>> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all scheduled notification objects
|
* Get all scheduled notification objects
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getAllScheduled(): Promise<Array<Notification>> {return; }
|
static getAllScheduled(): Promise<Array<Notification>> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all triggered notification objects
|
* Get all triggered notification objects
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getAllTriggered(): Promise<Array<Notification>> {return; }
|
static getAllTriggered(): Promise<Array<Notification>> { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,7 +188,7 @@ export class LocalNotifications {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static on(eventName: string, callback: any): void {}
|
static on(eventName: string, callback: any): void { }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
221
src/plugins/media-capture.ts
Normal file
221
src/plugins/media-capture.ts
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
|
|
||||||
|
declare var navigator: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Media Capture
|
||||||
|
* @description
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { MediaCapture } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* let options: CaptureImageOptions = { limit: 3 };
|
||||||
|
* MediaCapture.captureImage(options)
|
||||||
|
* .then(
|
||||||
|
* (data: MediaFile[]) => console.log(data),
|
||||||
|
* (err: CaptureError) => console.error(err)
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-media-capture',
|
||||||
|
pluginRef: 'navigator.device.capture',
|
||||||
|
repo: 'https://github.com/apache/cordova-plugin-media-capture'
|
||||||
|
})
|
||||||
|
export class MediaCapture {
|
||||||
|
/**
|
||||||
|
* The audio recording formats supported by the device.
|
||||||
|
* @returns {ConfigurationData[]}
|
||||||
|
*/
|
||||||
|
@CordovaProperty
|
||||||
|
static get supportedImageModes(): ConfigurationData[] {
|
||||||
|
return <ConfigurationData[]>navigator.device.capture.supportedImageModes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The recording image sizes and formats supported by the device.
|
||||||
|
* @returns {ConfigurationData[]}
|
||||||
|
*/
|
||||||
|
@CordovaProperty
|
||||||
|
static get supportedAudioModes(): ConfigurationData[] {
|
||||||
|
return <ConfigurationData[]>navigator.device.capture.supportedAudioModes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The recording video resolutions and formats supported by the device.
|
||||||
|
* @returns {ConfigurationData[]}
|
||||||
|
*/
|
||||||
|
@CordovaProperty
|
||||||
|
static get supportedVideoModes(): ConfigurationData[] {
|
||||||
|
return <ConfigurationData[]>navigator.device.capture.supportedVideoModes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the audio recorder application and return information about captured audio clip files.
|
||||||
|
* @param options
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static captureAudio(options?: CaptureAudioOptions): Promise<MediaFile[] | CaptureError> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the camera application and return information about captured image files.
|
||||||
|
* @param options
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static captureImage(options?: CaptureImageOptions): Promise<MediaFile[] | CaptureError> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the video recorder application and return information about captured video clip files.
|
||||||
|
* @param options
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static captureVideo(options?: CaptureVideoOptions): Promise<MediaFile[] | CaptureError> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is fired if the capture call is successful
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
eventObservable: true,
|
||||||
|
event: 'pendingcaptureresult'
|
||||||
|
})
|
||||||
|
static onPendingCaptureResult(): Observable<MediaFile[]> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is fired if the capture call is unsuccessful
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
eventObservable: true,
|
||||||
|
event: 'pendingcaptureerror'
|
||||||
|
})
|
||||||
|
static onPendingCaptureError(): Observable<CaptureError> { return; }
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates properties of a media capture file.
|
||||||
|
*/
|
||||||
|
export interface MediaFile {
|
||||||
|
/**
|
||||||
|
* The name of the file, without path information.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* The full path of the file, including the name.
|
||||||
|
*/
|
||||||
|
fullPath: string;
|
||||||
|
/**
|
||||||
|
* The file's mime type
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
/**
|
||||||
|
* The date and time when the file was last modified.
|
||||||
|
*/
|
||||||
|
lastModifiedDate: Date;
|
||||||
|
/**
|
||||||
|
* The size of the file, in bytes.
|
||||||
|
*/
|
||||||
|
size: number;
|
||||||
|
/**
|
||||||
|
* Retrieves the format information of the media file.
|
||||||
|
* @param {Function} successCallback
|
||||||
|
* @param {Function} errorCallback
|
||||||
|
*/
|
||||||
|
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates format information about a media file.
|
||||||
|
*/
|
||||||
|
export interface MediaFileData {
|
||||||
|
/**
|
||||||
|
* The actual format of the audio and video content.
|
||||||
|
*/
|
||||||
|
codecs: string;
|
||||||
|
/**
|
||||||
|
* The average bitrate of the content. The value is zero for images.
|
||||||
|
*/
|
||||||
|
bitrate: number;
|
||||||
|
/**
|
||||||
|
* The height of the image or video in pixels. The value is zero for audio clips.
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
/**
|
||||||
|
* The width of the image or video in pixels. The value is zero for audio clips.
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
/**
|
||||||
|
* The length of the video or sound clip in seconds. The value is zero for images.
|
||||||
|
*/
|
||||||
|
duration: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates the error code resulting from a failed media capture operation.
|
||||||
|
*/
|
||||||
|
export interface CaptureError {
|
||||||
|
code: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates audio capture configuration options.
|
||||||
|
*/
|
||||||
|
export interface CaptureAudioOptions {
|
||||||
|
/**
|
||||||
|
* Maximum number of audio clips. Defaults to 1.
|
||||||
|
* On iOS you can only record one file.
|
||||||
|
*/
|
||||||
|
limit?: number;
|
||||||
|
/**
|
||||||
|
* Maximum duration of an audio sound clip, in seconds. This does not work on Android devices.
|
||||||
|
*/
|
||||||
|
duration?: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates image capture configuration options.
|
||||||
|
*/
|
||||||
|
export interface CaptureImageOptions {
|
||||||
|
/**
|
||||||
|
* Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation.
|
||||||
|
*/
|
||||||
|
limit?: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates video capture configuration options.
|
||||||
|
*/
|
||||||
|
export interface CaptureVideoOptions {
|
||||||
|
/**
|
||||||
|
* Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation.
|
||||||
|
*/
|
||||||
|
limit?: number;
|
||||||
|
/**
|
||||||
|
* Maximum duration per video clip. This will be ignored on BlackBerry.
|
||||||
|
*/
|
||||||
|
duration?: number;
|
||||||
|
/**
|
||||||
|
* Quality of the video. This parameter can only be used with Android.
|
||||||
|
*/
|
||||||
|
quality?: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates a set of media capture parameters that a device supports.
|
||||||
|
*/
|
||||||
|
export interface ConfigurationData {
|
||||||
|
/**
|
||||||
|
* The ASCII-encoded lowercase string representing the media type.
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
/**
|
||||||
|
* The height of the image or video in pixels. The value is zero for sound clips.
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
/**
|
||||||
|
* The width of the image or video in pixels. The value is zero for sound clips.
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
}
|
@ -1,26 +1,34 @@
|
|||||||
import {CordovaInstance, Plugin} from './plugin';
|
import { CordovaInstance, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
declare var Media: any;
|
declare var Media: any;
|
||||||
|
|
||||||
|
export interface MediaError {
|
||||||
|
code: number;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name MediaPlugin
|
* @name MediaPlugin
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {MediaPlugin} from 'ionic-native';
|
* import { MediaPlugin } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Create a MediaPlugin instance. Expects path to file or url as argument
|
* // Create a MediaPlugin instance. Expects path to file or url as argument
|
||||||
* var file = new MediaPlugin("path/to/file.mp3");
|
* var file = new MediaPlugin('path/to/file.mp3');
|
||||||
*
|
*
|
||||||
* // Catch the Success & Error Output
|
* // Catch the Success & Error Output
|
||||||
* // Platform Quirks
|
* // Platform Quirks
|
||||||
* // iOS calls success on completion of playback only
|
* // iOS calls success on completion of playback only
|
||||||
* // Android calls success on completion of playback AND on release()
|
* // Android calls success on completion of playback AND on release()
|
||||||
* file.init.then(() => {
|
* file.init.then(() => {
|
||||||
* console.log("Playback Finished");
|
* console.log('Playback Finished');
|
||||||
* }, (err) => {
|
* }, (err) => {
|
||||||
* console.log("somthing went wrong! error code: "+err.code+" message: "+err.message);
|
* console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* // play the file
|
* // play the file
|
||||||
@ -52,7 +60,7 @@ declare var Media: any;
|
|||||||
* file.release();
|
* file.release();
|
||||||
*
|
*
|
||||||
* // Recording to a file
|
* // Recording to a file
|
||||||
* var newFile = new MediaPlugin("path/to/file.mp3");
|
* var newFile = new MediaPlugin('path/to/file.mp3');
|
||||||
* newFile.startRecord();
|
* newFile.startRecord();
|
||||||
*
|
*
|
||||||
* newFile.stopRecord();
|
* newFile.stopRecord();
|
||||||
@ -75,6 +83,12 @@ export class MediaPlugin {
|
|||||||
static MEDIA_PAUSED: number = 3;
|
static MEDIA_PAUSED: number = 3;
|
||||||
static MEDIA_STOPPED: number = 4;
|
static MEDIA_STOPPED: number = 4;
|
||||||
|
|
||||||
|
// error codes
|
||||||
|
static MEDIA_ERR_ABORTED: number = 1;
|
||||||
|
static MEDIA_ERR_NETWORK: number = 2;
|
||||||
|
static MEDIA_ERR_DECODE: number = 3;
|
||||||
|
static MEDIA_ERR_NONE_SUPPORTED: number = 4;
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
status: Observable<any>;
|
status: Observable<any>;
|
||||||
@ -85,11 +99,11 @@ export class MediaPlugin {
|
|||||||
* Open a media file
|
* Open a media file
|
||||||
* @param src {string} A URI containing the audio content.
|
* @param src {string} A URI containing the audio content.
|
||||||
*/
|
*/
|
||||||
constructor (src: string) {
|
constructor(src: string) {
|
||||||
let res, rej, next;
|
let res, rej, next;
|
||||||
this.init = new Promise<any>((resolve, reject) => {res = resolve; rej = reject; });
|
this.init = new Promise<any>((resolve, reject) => { res = resolve; rej = reject; });
|
||||||
this.status = new Observable((observer) => {
|
this.status = new Observable((observer) => {
|
||||||
next = data => observer.next(data);
|
next = data => observer.next(data);
|
||||||
});
|
});
|
||||||
this._objectInstance = new Media(src, res, rej, next);
|
this._objectInstance = new Media(src, res, rej, next);
|
||||||
}
|
}
|
||||||
@ -98,13 +112,13 @@ export class MediaPlugin {
|
|||||||
* Returns the current amplitude of the current recording.
|
* Returns the current amplitude of the current recording.
|
||||||
*/
|
*/
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
getCurrentAmplitude (): Promise<any> {return; }
|
getCurrentAmplitude(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current position within an audio file. Also updates the Media object's position parameter.
|
* Returns the current position within an audio file. Also updates the Media object's position parameter.
|
||||||
*/
|
*/
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
getCurrentPosition (): Promise<any> {return; }
|
getCurrentPosition(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
|
* Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
|
||||||
@ -112,7 +126,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
getDuration (): number {return; }
|
getDuration(): number { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts or resumes playing an audio file.
|
* Starts or resumes playing an audio file.
|
||||||
@ -120,10 +134,10 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
play (iosOptions?: {
|
play(iosOptions?: {
|
||||||
numberOfLoops?: number,
|
numberOfLoops?: number,
|
||||||
playAudioWhenScreenIsLocked?: boolean
|
playAudioWhenScreenIsLocked?: boolean
|
||||||
}): void {}
|
}): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pauses playing an audio file.
|
* Pauses playing an audio file.
|
||||||
@ -131,7 +145,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
pause (): void {}
|
pause(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
|
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
|
||||||
@ -139,7 +153,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
release (): void {}
|
release(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current position within an audio file.
|
* Sets the current position within an audio file.
|
||||||
@ -148,7 +162,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
seekTo (milliseconds: number): void {}
|
seekTo(milliseconds: number): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the volume for an audio file.
|
* Set the volume for an audio file.
|
||||||
@ -157,7 +171,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
setVolume (volume: number): void {}
|
setVolume(volume: number): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts recording an audio file.
|
* Starts recording an audio file.
|
||||||
@ -165,7 +179,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
startRecord (): void {}
|
startRecord(): void { }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,7 +188,7 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
stopRecord (): void {}
|
stopRecord(): void { }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,17 +197,6 @@ export class MediaPlugin {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
stop (): void {}
|
stop(): void { }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MediaError {
|
|
||||||
static get MEDIA_ERR_ABORTED () {return 1; }
|
|
||||||
static get MEDIA_ERR_NETWORK () {return 2; }
|
|
||||||
static get MEDIA_ERR_DECODE () {return 3; }
|
|
||||||
static get MEDIA_ERR_NONE_SUPPORTED () {return 4; }
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
}
|
|
91
src/plugins/native-audio.ts
Normal file
91
src/plugins/native-audio.ts
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
/**
|
||||||
|
* @name NativeAudio
|
||||||
|
* @description Native Audio Playback
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import {NativeAudio} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
|
||||||
|
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
|
||||||
|
*
|
||||||
|
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
|
||||||
|
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
|
||||||
|
*
|
||||||
|
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
|
||||||
|
*
|
||||||
|
* NativeAudio.stop('uniqueId1').then(onSuccess,onError);
|
||||||
|
*
|
||||||
|
* NativeAudio.unload('uniqueId1').then(onSuccess,onError);
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-nativeaudio',
|
||||||
|
pluginRef: 'plugins.NativeAudio',
|
||||||
|
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
|
||||||
|
})
|
||||||
|
export class NativeAudio {
|
||||||
|
/**
|
||||||
|
* Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
|
||||||
|
* @returns {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static preloadSimple(id: string, assetPath: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
|
||||||
|
* @param volume {number} the volume of the preloaded sound (0.1 to 1.0)
|
||||||
|
* @param voices {number} the number of multichannel voices available
|
||||||
|
* @param delay {number}
|
||||||
|
* @returns {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays an audio asset
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
* @param completeCallback {Function} callback to be invoked when audio is done playing
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
successIndex: 1,
|
||||||
|
errorIndex: 2
|
||||||
|
})
|
||||||
|
static play(id: string, completeCallback: Function): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops playing an audio
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static stop(id: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loops an audio asset infinitely, this only works for complex assets
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
* @return {Promise<any>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static loop(id: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unloads an audio file from memory
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static unload(id: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the volume for preloaded complex assets.
|
||||||
|
* @param id {string} unique ID for the audio file
|
||||||
|
* @param volume {number} the volume of the audio asset (0.1 to 1.0)
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
|
||||||
|
|
||||||
|
}
|
59
src/plugins/nativestorage.ts
Normal file
59
src/plugins/nativestorage.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name NativeStorage
|
||||||
|
* @description Native storage of variables in Android and iOS
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { NativeStorage } from 'ionic-native';
|
||||||
|
*
|
||||||
|
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
|
||||||
|
* .then(
|
||||||
|
* () => console.log('Stored item!'),
|
||||||
|
* error => console.error('Error storing item', error)
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* NativeStorage.getItem('myitem')
|
||||||
|
* .then(
|
||||||
|
* data => console.log(data),
|
||||||
|
* error => console.error(error)
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-nativestorage',
|
||||||
|
pluginRef: 'NativeStorage',
|
||||||
|
repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage'
|
||||||
|
})
|
||||||
|
export class NativeStorage {
|
||||||
|
/**
|
||||||
|
* Stores a value
|
||||||
|
* @param reference {string}
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static setItem(reference: string, value: any): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a stored item
|
||||||
|
* @param reference {string}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static getItem(reference: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a single stored item
|
||||||
|
* @param reference {string}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static remove(reference: string): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all stored values.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static clear(): Promise<any> {return; }
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova, CordovaProperty} from './plugin';
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
declare var navigator: any;
|
declare var navigator: any;
|
||||||
|
|
||||||
@ -9,12 +10,12 @@ declare var navigator: any;
|
|||||||
* Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
|
* Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Network} from 'ionic-native';
|
* import { Network } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* // watch network for a disconnect
|
* // watch network for a disconnect
|
||||||
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
|
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
|
||||||
* console.log('network was disconnected :-( ')
|
* console.log('network was disconnected :-(');
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* // stop disconnect watch
|
* // stop disconnect watch
|
||||||
@ -23,9 +24,9 @@ declare var navigator: any;
|
|||||||
*
|
*
|
||||||
* // watch network for a connection
|
* // watch network for a connection
|
||||||
* let connectSubscription = Network.onConnect().subscribe(() => {
|
* let connectSubscription = Network.onConnect().subscribe(() => {
|
||||||
* console.log('network connected!');
*
|
* console.log('network connected!');
|
||||||
* // We just got a connection but we need to wait briefly
|
* // We just got a connection but we need to wait briefly
|
||||||
*
// before we determine the connection type. Might need to wait
|
*
// before we determine the connection type. Might need to wait
|
||||||
* // prior to doing any api requests as well.
|
* // prior to doing any api requests as well.
|
||||||
* setTimeout(() => {
|
* setTimeout(() => {
|
||||||
* if (Network.connection === 'wifi') {
|
* if (Network.connection === 'wifi') {
|
||||||
@ -53,7 +54,7 @@ export class Network {
|
|||||||
* Return the network connection type
|
* Return the network connection type
|
||||||
*/
|
*/
|
||||||
@CordovaProperty
|
@CordovaProperty
|
||||||
static get connection(): String { return navigator.connection.type; }
|
static get connection(): string { return navigator.connection.type; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get notified when the device goes offline
|
* Get notified when the device goes offline
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name OneSignal
|
* @name OneSignal
|
||||||
@ -9,245 +11,244 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {OneSignal} from 'ionic-native';
|
* import { OneSignal } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* let notificationOpenedCallback(jsonData: any) {
|
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
|
||||||
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
|
* {googleProjectNumber: '703322744261'})
|
||||||
* };
|
* .subscribe(jsonData => {
|
||||||
* OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
|
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
|
||||||
* {googleProjectNumber: "703322744261"},
|
* });
|
||||||
* notificationOpenedCallback);
|
|
||||||
*
|
*
|
||||||
* OneSignal.enableInAppAlertNotification(true);
|
* OneSignal.enableInAppAlertNotification(true);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'onesignal-cordova-plugin',
|
plugin: 'onesignal-cordova-plugin',
|
||||||
pluginRef: 'plugins.OneSignal',
|
pluginRef: 'plugins.OneSignal',
|
||||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
|
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
|
||||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
|
||||||
})
|
})
|
||||||
export class OneSignal {
|
export class OneSignal {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
|
* Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
|
||||||
*
|
*
|
||||||
* @param {appId} Your AppId from your OneSignal app
|
* @param {appId} Your AppId from your OneSignal app
|
||||||
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
|
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
|
||||||
* @returns {Promise} Returns a Promise that resolves when remote notification was recieved.
|
* @returns {Observable} when a notification is received. Handle your notification action here.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({ observable: true })
|
||||||
static init(appId: string,
|
static init(appId: string,
|
||||||
options: {
|
options: {
|
||||||
googleProjectNumber: string,
|
googleProjectNumber: string,
|
||||||
autoRegister: boolean
|
autoRegister: boolean
|
||||||
}): Promise<any> { return; }
|
}): Observable<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
|
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
|
||||||
* Only use if you passed false to autoRegister when calling init.
|
* Only use if you passed false to autoRegister when calling init.
|
||||||
*/
|
*/
|
||||||
@Cordova({ sync: true })
|
@Cordova({ sync: true })
|
||||||
static registerForPushNotifications(): void { }
|
static registerForPushNotifications(): void { }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
|
||||||
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
|
||||||
*
|
|
||||||
* @param {key} Key of your choosing to create or update.
|
|
||||||
* @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
|
|
||||||
*/
|
|
||||||
@Cordova({ sync: true })
|
|
||||||
static sendTag(key: string, value: string): void { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
||||||
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
||||||
*
|
*
|
||||||
* @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
|
* @param {key} Key of your choosing to create or update.
|
||||||
|
* @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
|
||||||
*/
|
*/
|
||||||
@Cordova({ sync: true })
|
@Cordova({ sync: true })
|
||||||
static sendTags(json: any): void { }
|
static sendTag(key: string, value: string): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a list of tags that have been set on the user from the OneSignal server.
|
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
||||||
*
|
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
||||||
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
|
*
|
||||||
*/
|
* @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
|
||||||
@Cordova()
|
*/
|
||||||
static getTags(): Promise<any> { return; }
|
@Cordova({ sync: true })
|
||||||
|
static sendTags(json: any): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
|
* Retrieve a list of tags that have been set on the user from the OneSignal server.
|
||||||
*
|
*
|
||||||
* @param {key} Key to remove.
|
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
|
||||||
*/
|
*/
|
||||||
@Cordova({ sync: true })
|
@Cordova()
|
||||||
static deleteTag(key: string): void { }
|
static getTags(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
|
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
|
||||||
*
|
*
|
||||||
* @param {keys} Keys to remove.
|
* @param {key} Key to remove.
|
||||||
*/
|
*/
|
||||||
@Cordova({ sync: true })
|
@Cordova({ sync: true })
|
||||||
static deleteTags(keys: string[]): void { }
|
static deleteTag(key: string): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lets you retrieve the OneSignal user id and device token.
|
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
|
||||||
* Your handler is called after the device is successfully registered with OneSignal.
|
*
|
||||||
*
|
* @param {keys} Keys to remove.
|
||||||
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
|
*/
|
||||||
* It returns a JSON with `userId`and `pushToken`.
|
@Cordova({ sync: true })
|
||||||
*/
|
static deleteTags(keys: string[]): void { }
|
||||||
@Cordova()
|
|
||||||
static getIds(): Promise<any> { return; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warning:
|
* Lets you retrieve the OneSignal user id and device token.
|
||||||
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
|
* Your handler is called after the device is successfully registered with OneSignal.
|
||||||
*
|
*
|
||||||
* By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
|
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
|
||||||
* Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.
|
* It returns a JSON with `userId`and `pushToken`.
|
||||||
*
|
*/
|
||||||
* @param {enable} false to disable vibrate, true to re-enable it.
|
@Cordova()
|
||||||
*/
|
static getIds(): Promise<any> { return; }
|
||||||
@Cordova({ sync: true })
|
|
||||||
static enableVibrate(enable: boolean): void { }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warning:
|
* Warning:
|
||||||
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
|
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
|
||||||
*
|
*
|
||||||
* By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
|
* By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
|
||||||
* Passing false means that the device will only vibrate unless the device is set to a total silent mode.
|
* Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.
|
||||||
*
|
*
|
||||||
* @param {enable} false to disable sound, true to re-enable it.
|
* @param {enable} false to disable vibrate, true to re-enable it.
|
||||||
*/
|
*/
|
||||||
@Cordova({ sync: true })
|
@Cordova({ sync: true })
|
||||||
static enableSound(enable: boolean): void { }
|
static enableVibrate(enable: boolean): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warning:
|
* Warning:
|
||||||
* Only applies to Android and Amazon devices.
|
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
|
||||||
*
|
*
|
||||||
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
|
* By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
|
||||||
* If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
|
* Passing false means that the device will only vibrate unless the device is set to a total silent mode.
|
||||||
*
|
*
|
||||||
* @param {enable} enable
|
* @param {enable} false to disable sound, true to re-enable it.
|
||||||
*/
|
*/
|
||||||
@Cordova({ sync: true })
|
@Cordova({ sync: true })
|
||||||
static enableNotificationsWhenActive(enable: boolean): void { }
|
static enableSound(enable: boolean): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
|
* Warning:
|
||||||
* If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
|
* Only applies to Android and Amazon devices.
|
||||||
* The notificationOpenedCallback is then fired after the alert box is closed.
|
*
|
||||||
*
|
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
|
||||||
* @param {enable} enable
|
* If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
|
||||||
*/
|
*
|
||||||
@Cordova({ sync: true })
|
* @param {enable} enable
|
||||||
static enableInAppAlertNotification(enable: boolean): void { }
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static enableNotificationsWhenActive(enable: boolean): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can call this method with false to opt users out of receiving all notifications through OneSignal.
|
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
|
||||||
* You can pass true later to opt users back into notifications.
|
* If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
|
||||||
*
|
* The notificationOpenedCallback is then fired after the alert box is closed.
|
||||||
* @param {enable} enable
|
*
|
||||||
*/
|
* @param {enable} enable
|
||||||
@Cordova({ sync: true })
|
*/
|
||||||
static setSubscription(enable: boolean): void { }
|
@Cordova({ sync: true })
|
||||||
|
static enableInAppAlertNotification(enable: boolean): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* You can call this method with false to opt users out of receiving all notifications through OneSignal.
|
||||||
* @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification)
|
* You can pass true later to opt users back into notifications.
|
||||||
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
|
*
|
||||||
*/
|
* @param {enable} enable
|
||||||
@Cordova()
|
*/
|
||||||
static postNotification(notificationObj: {
|
@Cordova({ sync: true })
|
||||||
app_id: string,
|
static setSubscription(enable: boolean): void { }
|
||||||
contents: any,
|
|
||||||
headings?: any,
|
|
||||||
isIos?: boolean,
|
|
||||||
isAndroid?: boolean,
|
|
||||||
isWP?: boolean,
|
|
||||||
isWP_WNS?: boolean,
|
|
||||||
isAdm?: boolean,
|
|
||||||
isChrome?: boolean,
|
|
||||||
isChromeWeb?: boolean,
|
|
||||||
isSafari?: boolean,
|
|
||||||
isAnyWeb?: boolean,
|
|
||||||
included_segments?: string[],
|
|
||||||
excluded_segments?: string[],
|
|
||||||
include_player_ids?: string[],
|
|
||||||
include_ios_tokens?: string[],
|
|
||||||
include_android_reg_ids?: string[],
|
|
||||||
include_wp_uris?: string[],
|
|
||||||
include_wp_wns_uris?: string[],
|
|
||||||
include_amazon_reg_ids?: string[],
|
|
||||||
include_chrome_reg_ids?: string[],
|
|
||||||
include_chrome_web_reg_ids?: string[],
|
|
||||||
app_ids?: string[];
|
|
||||||
tags?: any[],
|
|
||||||
ios_badgeType?: string,
|
|
||||||
ios_badgeCount?: number,
|
|
||||||
ios_sound?: string,
|
|
||||||
android_sound?: string,
|
|
||||||
adm_sound?: string,
|
|
||||||
wp_sound?: string,
|
|
||||||
wp_wns_sound?: string,
|
|
||||||
data?: any,
|
|
||||||
buttons?: any,
|
|
||||||
small_icon?: string,
|
|
||||||
large_icon?: string,
|
|
||||||
big_picture?: string,
|
|
||||||
adm_small_icon?: string,
|
|
||||||
adm_large_icon?: string,
|
|
||||||
adm_big_picture?: string,
|
|
||||||
chrome_icon?: string,
|
|
||||||
chrome_big_picture?: string,
|
|
||||||
chrome_web_icon?: string,
|
|
||||||
firefox_icon?: string,
|
|
||||||
url?: string,
|
|
||||||
send_after?: string,
|
|
||||||
delayed_option?: string,
|
|
||||||
delivery_time_of_day?: string,
|
|
||||||
android_led_color?: string,
|
|
||||||
android_accent_color?: string,
|
|
||||||
android_visibility?: number,
|
|
||||||
content_available?: boolean,
|
|
||||||
amazon_background_data?: boolean,
|
|
||||||
template_id?: string,
|
|
||||||
android_group?: string,
|
|
||||||
android_group_message?: any,
|
|
||||||
adm_group?: string,
|
|
||||||
adm_group_message?: any,
|
|
||||||
ttl?: number,
|
|
||||||
priority?: number,
|
|
||||||
ios_category?: string
|
|
||||||
}): Promise<any> { return; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
|
*
|
||||||
*/
|
* @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification)
|
||||||
@Cordova({ sync: true })
|
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
|
||||||
static promptLocation(): void { }
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static postNotification(notificationObj: {
|
||||||
|
app_id: string,
|
||||||
|
contents: any,
|
||||||
|
headings?: any,
|
||||||
|
isIos?: boolean,
|
||||||
|
isAndroid?: boolean,
|
||||||
|
isWP?: boolean,
|
||||||
|
isWP_WNS?: boolean,
|
||||||
|
isAdm?: boolean,
|
||||||
|
isChrome?: boolean,
|
||||||
|
isChromeWeb?: boolean,
|
||||||
|
isSafari?: boolean,
|
||||||
|
isAnyWeb?: boolean,
|
||||||
|
included_segments?: string[],
|
||||||
|
excluded_segments?: string[],
|
||||||
|
include_player_ids?: string[],
|
||||||
|
include_ios_tokens?: string[],
|
||||||
|
include_android_reg_ids?: string[],
|
||||||
|
include_wp_uris?: string[],
|
||||||
|
include_wp_wns_uris?: string[],
|
||||||
|
include_amazon_reg_ids?: string[],
|
||||||
|
include_chrome_reg_ids?: string[],
|
||||||
|
include_chrome_web_reg_ids?: string[],
|
||||||
|
app_ids?: string[];
|
||||||
|
tags?: any[],
|
||||||
|
ios_badgeType?: string,
|
||||||
|
ios_badgeCount?: number,
|
||||||
|
ios_sound?: string,
|
||||||
|
android_sound?: string,
|
||||||
|
adm_sound?: string,
|
||||||
|
wp_sound?: string,
|
||||||
|
wp_wns_sound?: string,
|
||||||
|
data?: any,
|
||||||
|
buttons?: any,
|
||||||
|
small_icon?: string,
|
||||||
|
large_icon?: string,
|
||||||
|
big_picture?: string,
|
||||||
|
adm_small_icon?: string,
|
||||||
|
adm_large_icon?: string,
|
||||||
|
adm_big_picture?: string,
|
||||||
|
chrome_icon?: string,
|
||||||
|
chrome_big_picture?: string,
|
||||||
|
chrome_web_icon?: string,
|
||||||
|
firefox_icon?: string,
|
||||||
|
url?: string,
|
||||||
|
send_after?: string,
|
||||||
|
delayed_option?: string,
|
||||||
|
delivery_time_of_day?: string,
|
||||||
|
android_led_color?: string,
|
||||||
|
android_accent_color?: string,
|
||||||
|
android_visibility?: number,
|
||||||
|
content_available?: boolean,
|
||||||
|
amazon_background_data?: boolean,
|
||||||
|
template_id?: string,
|
||||||
|
android_group?: string,
|
||||||
|
android_group_message?: any,
|
||||||
|
adm_group?: string,
|
||||||
|
adm_group_message?: any,
|
||||||
|
ttl?: number,
|
||||||
|
priority?: number,
|
||||||
|
ios_category?: string
|
||||||
|
}): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable logging to help debug if you run into an issue setting up OneSignal.
|
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
|
||||||
* The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static promptLocation(): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable logging to help debug if you run into an issue setting up OneSignal.
|
||||||
|
* The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
|
||||||
|
|
||||||
|
* The higher the value the more information is shown.
|
||||||
|
*
|
||||||
|
* @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static setLogLevel(logLevel: {
|
||||||
|
logLevel: number,
|
||||||
|
visualLevel: number
|
||||||
|
}): void { }
|
||||||
|
|
||||||
* The higher the value the more information is shown.
|
|
||||||
*
|
|
||||||
* @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
|
|
||||||
*/
|
|
||||||
@Cordova({ sync: true })
|
|
||||||
static setLogLevel(logLevel: {
|
|
||||||
logLevel: number,
|
|
||||||
visualLevel: number
|
|
||||||
}): void { }
|
|
||||||
}
|
}
|
||||||
|
28
src/plugins/photo-viewer.ts
Normal file
28
src/plugins/photo-viewer.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
/**
|
||||||
|
* @name Photo Viewer
|
||||||
|
* @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image.
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { PhotoViewer } from 'ionic-native';
|
||||||
|
*
|
||||||
|
* PhotoViewer.show('https://mysite.com/path/to/image.jpg');
|
||||||
|
*
|
||||||
|
* PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'com-sarriaroman-photoviewer',
|
||||||
|
pluginRef: 'PhotoViewer',
|
||||||
|
repo: 'https://github.com/sarriaroman/photoviewer'
|
||||||
|
})
|
||||||
|
export class PhotoViewer {
|
||||||
|
/**
|
||||||
|
* Shows an image in full screen
|
||||||
|
* @param url {string} URL or path to image
|
||||||
|
* @param title {string}
|
||||||
|
* @param options {any}
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static show(url: string, title?: string, options?: {share?: boolean; }): void { }
|
||||||
|
}
|
@ -1,18 +1,19 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Pin Dialog
|
* @name Pin Dialog
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* import {PinDialog} from 'ionic-native';
|
* import { PinDialog } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
|
||||||
*
|
*
|
||||||
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
|
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
|
||||||
* .then(
|
* .then(
|
||||||
* (result: any) => {
|
* (result: any) => {
|
||||||
* if(result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
|
* if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
|
||||||
* else if(result.buttonIndex == 2) console.log('User cancelled');
|
* else if(result.buttonIndex == 2) console.log('User cancelled');
|
||||||
* }
|
* }
|
||||||
* );
|
* );
|
||||||
@ -33,5 +34,6 @@ export class PinDialog {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 1
|
successIndex: 1
|
||||||
})
|
})
|
||||||
static prompt(message: string, title: string, buttons: string[]): Promise<{buttonIndex: number, input1: string}> {return; }
|
static prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number, input1: string }> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {get} from '../util';
|
import { get } from '../util';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
declare var window;
|
declare var window;
|
||||||
declare var Promise;
|
declare var Promise;
|
||||||
declare var $q;
|
declare var $q;
|
||||||
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -22,8 +22,11 @@ export const getPlugin = function(pluginRef: string): any {
|
|||||||
*/
|
*/
|
||||||
export const pluginWarn = function(pluginObj: any, method: string) {
|
export const pluginWarn = function(pluginObj: any, method: string) {
|
||||||
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
|
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
|
||||||
if (method) console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
if (method) {
|
||||||
else console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
|
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||||
|
} else {
|
||||||
|
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
|
||||||
|
}
|
||||||
console.warn('Install the ' + pluginName + ' plugin: \'ionic plugin add ' + plugin + '\'');
|
console.warn('Install the ' + pluginName + ' plugin: \'ionic plugin add ' + plugin + '\'');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,19 +36,36 @@ export const pluginWarn = function(pluginObj: any, method: string) {
|
|||||||
* @param method
|
* @param method
|
||||||
*/
|
*/
|
||||||
export const cordovaWarn = function(pluginName: string, method: string) {
|
export const cordovaWarn = function(pluginName: string, method: string) {
|
||||||
if (method) console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
if (method) {
|
||||||
else console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||||
|
} else {
|
||||||
|
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
function setIndex (args: any[], opts: any= {}, resolve?: Function, reject?: Function): any {
|
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
||||||
// If the plugin method expects myMethod(success, err, options)
|
// If the plugin method expects myMethod(success, err, options)
|
||||||
if (opts.callbackOrder === 'reverse') {
|
if (opts.callbackOrder === 'reverse') {
|
||||||
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
||||||
args.unshift(reject);
|
args.unshift(reject);
|
||||||
args.unshift(resolve);
|
args.unshift(resolve);
|
||||||
|
} else if (opts.callbackStyle === 'node') {
|
||||||
|
args.push((err, result) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||||
// If we've specified a success/error index
|
// If we've specified a success/error index
|
||||||
args.splice(opts.successIndex, 0, resolve);
|
args.splice(opts.successIndex, 0, resolve);
|
||||||
args.splice(opts.errorIndex, 0, reject);
|
|
||||||
|
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
|
||||||
|
if (opts.errorIndex > args.length) {
|
||||||
|
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
|
||||||
|
} else {
|
||||||
|
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, let's tack them on to the end of the argument list
|
// Otherwise, let's tack them on to the end of the argument list
|
||||||
// which is 90% of cases
|
// which is 90% of cases
|
||||||
@ -55,10 +75,10 @@ function setIndex (args: any[], opts: any= {}, resolve?: Function, reject?: Func
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts: any= {}, resolve?: Function, reject?: Function) {
|
function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) {
|
||||||
// Try to figure out where the success/error callbacks need to be bound
|
// Try to figure out where the success/error callbacks need to be bound
|
||||||
// to our promise resolve/reject handlers.
|
// to our promise resolve/reject handlers.
|
||||||
args = setIndex (args, opts, resolve, reject);
|
args = setIndex(args, opts, resolve, reject);
|
||||||
|
|
||||||
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
||||||
|
|
||||||
@ -82,21 +102,21 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPromise(cb) {
|
function getPromise(cb) {
|
||||||
if (window.Promise) {
|
if (window.angular) {
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
cb(resolve, reject);
|
|
||||||
});
|
|
||||||
} else if (window.angular) {
|
|
||||||
let $q = window.angular.injector(['ng']).get('$q');
|
let $q = window.angular.injector(['ng']).get('$q');
|
||||||
return $q((resolve, reject) => {
|
return $q((resolve, reject) => {
|
||||||
cb(resolve, reject);
|
cb(resolve, reject);
|
||||||
});
|
});
|
||||||
|
} else if (window.Promise) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
cb(resolve, reject);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
|
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
|
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||||
let pluginResult, rej;
|
let pluginResult, rej;
|
||||||
const p = getPromise((resolve, reject) => {
|
const p = getPromise((resolve, reject) => {
|
||||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||||
@ -106,12 +126,22 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any=
|
|||||||
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
|
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
|
||||||
// to error
|
// to error
|
||||||
if (pluginResult && pluginResult.error) {
|
if (pluginResult && pluginResult.error) {
|
||||||
p.catch(() => {});
|
p.catch(() => { });
|
||||||
rej(pluginResult.error);
|
rej(pluginResult.error);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
|
||||||
|
return getPromise((resolve, reject) => {
|
||||||
|
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||||
|
if (pluginResult && pluginResult.error) {
|
||||||
|
reject(pluginResult.error);
|
||||||
|
}
|
||||||
|
pluginResult.then(resolve).catch(reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||||
@ -139,7 +169,7 @@ function callInstance(pluginObj: any, methodName: string, args: any[], opts: any
|
|||||||
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
|
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
|
function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||||
return (...args) => {
|
return (...args) => {
|
||||||
if (opts.sync) {
|
if (opts.sync) {
|
||||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||||
@ -159,6 +189,11 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
} else if (opts.otherPromise) {
|
||||||
|
return getPromise((resolve, reject) => {
|
||||||
|
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||||
|
result.then(resolve, reject);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return getPromise((resolve, reject) => {
|
return getPromise((resolve, reject) => {
|
||||||
callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||||
@ -172,11 +207,10 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
|
|||||||
* @param event
|
* @param event
|
||||||
* @returns {Observable}
|
* @returns {Observable}
|
||||||
*/
|
*/
|
||||||
function wrapEventObservable (event: string): Observable<any> {
|
function wrapEventObservable(event: string): Observable<any> {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
let callback = (status: any) => observer.next(status);
|
window.addEventListener(event, observer.next.bind(observer), false);
|
||||||
window.addEventListener(event, callback, false);
|
return () => window.removeEventListener(event, observer.next.bind(observer), false);
|
||||||
return () => window.removeEventListener(event, callback, false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,21 +221,20 @@ function wrapEventObservable (event: string): Observable<any> {
|
|||||||
* @param opts
|
* @param opts
|
||||||
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
|
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
|
||||||
*/
|
*/
|
||||||
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
|
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
|
||||||
return (...args) => {
|
return (...args) => {
|
||||||
|
if (opts.sync) {
|
||||||
if (opts.sync)
|
|
||||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||||
return callCordovaPlugin(pluginObj, methodName, args, opts);
|
return callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||||
|
} else if (opts.observable) {
|
||||||
else if (opts.observable)
|
|
||||||
return wrapObservable(pluginObj, methodName, args, opts);
|
return wrapObservable(pluginObj, methodName, args, opts);
|
||||||
|
} else if (opts.eventObservable && opts.event) {
|
||||||
else if (opts.eventObservable && opts.event)
|
|
||||||
return wrapEventObservable(opts.event);
|
return wrapEventObservable(opts.event);
|
||||||
|
} else if (opts.otherPromise) {
|
||||||
else
|
return wrapOtherPromise(pluginObj, methodName, args, opts);
|
||||||
|
} else {
|
||||||
return wrapPromise(pluginObj, methodName, args, opts);
|
return wrapPromise(pluginObj, methodName, args, opts);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -211,7 +244,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}
|
|||||||
* Class decorator specifying Plugin metadata. Required for all plugins.
|
* Class decorator specifying Plugin metadata. Required for all plugins.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* @Plugin({
|
* @Plugin({
|
||||||
* name: 'MyPlugin',
|
* name: 'MyPlugin',
|
||||||
* plugin: 'cordova-plugin-myplugin',
|
* plugin: 'cordova-plugin-myplugin',
|
||||||
@ -289,7 +322,7 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed
|
|||||||
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
||||||
if (!pluginInstance) {
|
if (!pluginInstance) {
|
||||||
pluginWarn(this, key);
|
pluginWarn(this, key);
|
||||||
return { };
|
return {};
|
||||||
}
|
}
|
||||||
return originalMethod.apply(this, args);
|
return originalMethod.apply(this, args);
|
||||||
};
|
};
|
||||||
|
@ -1,64 +1,85 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var cordova: any;
|
declare var cordova: any;
|
||||||
|
|
||||||
export interface PrintOptions {
|
export interface PrintOptions {
|
||||||
/**
|
/**
|
||||||
* The name of the print job and the document
|
* The name of the print job and the document
|
||||||
*/
|
*/
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The network URL of the printer.
|
* The network URL of the printer.
|
||||||
* Only supported on iOS.
|
* Only supported on iOS.
|
||||||
*/
|
*/
|
||||||
printerId?: string;
|
printerId?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the duplex mode to use for the print job.
|
* Specifies the duplex mode to use for the print job.
|
||||||
* Either double-sided (duplex:true) or single-sided (duplex:false).
|
* Either double-sided (duplex:true) or single-sided (duplex:false).
|
||||||
* Double-sided by default.
|
* Double-sided by default.
|
||||||
* Only supported on iOS
|
* Only supported on iOS
|
||||||
*/
|
*/
|
||||||
duplex?: boolean;
|
duplex?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The orientation of the printed content, portrait or landscape
|
* The orientation of the printed content, portrait or landscape
|
||||||
* Portrait by default.
|
* Portrait by default.
|
||||||
*/
|
*/
|
||||||
landscape?: boolean;
|
landscape?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If your application only prints black text, setting this property to true can result in better performance in many cases.
|
* If your application only prints black text, setting this property to true can result in better performance in many cases.
|
||||||
* False by default.
|
* False by default.
|
||||||
*/
|
*/
|
||||||
grayscale?: boolean;
|
grayscale?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Size and position of the print view
|
* The Size and position of the print view
|
||||||
*/
|
*/
|
||||||
bounds?: number[] | any;
|
bounds?: number[] | any;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @name Printer
|
||||||
|
* @description Prints documents or HTML rendered content
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import {Printer, PrintOptions} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* Printer.isAvailable().then(onSuccess, onError);
|
||||||
|
*
|
||||||
|
* let options: PrintOptions = {
|
||||||
|
* name: 'MyDocument',
|
||||||
|
* printerId: 'printer007',
|
||||||
|
* duplex: true,
|
||||||
|
* landscape: true,
|
||||||
|
* grayscale: true
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* Printer.print(content, options).then(onSuccess, onError);
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'de.appplant.cordova.plugin.printer',
|
plugin: 'de.appplant.cordova.plugin.printer',
|
||||||
pluginRef: 'cordova.plugins.printer',
|
pluginRef: 'cordova.plugins.printer',
|
||||||
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
|
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
|
||||||
platforms: ['Android', 'iOS']
|
platforms: ['Android', 'iOS']
|
||||||
})
|
})
|
||||||
export class Printer {
|
export class Printer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether to device is capable of printing.
|
* Checks whether to device is capable of printing.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isAvailable(): Promise<boolean> { return; }
|
static isAvailable(): Promise<boolean> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends content to the printer.
|
||||||
|
* @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
|
||||||
|
* @param {options} The options to pass to the printer
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends content to the printer.
|
|
||||||
* @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
|
|
||||||
* @param {options} The options to pass to the printer
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
|
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
|
||||||
|
|
||||||
@ -64,19 +65,19 @@ export interface PushNotification {
|
|||||||
* @param event
|
* @param event
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
on(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
|
on(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
|
||||||
/**
|
/**
|
||||||
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
|
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
|
||||||
* @param event
|
* @param event
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
on(event: "notification", callback: (response: NotificationEventResponse) => any): void;
|
on(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
|
||||||
/**
|
/**
|
||||||
* The event error will trigger when an internal error occurs and the cache is aborted.
|
* The event error will trigger when an internal error occurs and the cache is aborted.
|
||||||
* @param event
|
* @param event
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
on(event: "error", callback: (response: Error) => any): void;
|
on(event: 'error', callback: (response: Error) => any): void;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param event Name of the event to listen to. See below(above) for all the event names.
|
* @param event Name of the event to listen to. See below(above) for all the event names.
|
||||||
@ -86,9 +87,9 @@ export interface PushNotification {
|
|||||||
*/
|
*/
|
||||||
on(event: string, callback: (response: EventResponse) => any): void;
|
on(event: string, callback: (response: EventResponse) => any): void;
|
||||||
|
|
||||||
off(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
|
off(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
|
||||||
off(event: "notification", callback: (response: NotificationEventResponse) => any): void;
|
off(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
|
||||||
off(event: "error", callback: (response: Error) => any): void;
|
off(event: 'error', callback: (response: Error) => any): void;
|
||||||
/**
|
/**
|
||||||
* As stated in the example, you will have to store your event handler if you are planning to remove it.
|
* As stated in the example, you will have to store your event handler if you are planning to remove it.
|
||||||
* @param event Name of the event type. The possible event names are the same as for the push.on function.
|
* @param event Name of the event type. The possible event names are the same as for the push.on function.
|
||||||
@ -265,7 +266,7 @@ export interface PushOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare var PushNotification: {
|
declare var PushNotification: {
|
||||||
new(): PushNotification
|
new (): PushNotification
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -278,11 +279,8 @@ declare var PushNotification: {
|
|||||||
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
|
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {Push} from 'ionic-native';
|
* import { Push } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -298,10 +296,10 @@ export class Push {
|
|||||||
* ```
|
* ```
|
||||||
* var push = Push.init({
|
* var push = Push.init({
|
||||||
* android: {
|
* android: {
|
||||||
* senderID: "12345679"
|
* senderID: '12345679'
|
||||||
* },
|
* },
|
||||||
* ios: {
|
* ios: {
|
||||||
* alert: "true",
|
* alert: 'true',
|
||||||
* badge: true,
|
* badge: true,
|
||||||
* sound: 'false'
|
* sound: 'false'
|
||||||
* },
|
* },
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name SafariViewController
|
* @name SafariViewController
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```
|
* ```
|
||||||
* import {SafariViewController} from 'ionic-native';
|
* import { SafariViewController } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
|
||||||
*
|
*
|
||||||
* SafariViewController.isAvailable()
|
* SafariViewController.isAvailable()
|
||||||
* .then(
|
* .then(
|
||||||
* (available) => {
|
* (available: boolean) => {
|
||||||
* if(available){
|
* if(available){
|
||||||
*
|
*
|
||||||
* SafariViewController.show({
|
* SafariViewController.show({
|
||||||
@ -24,9 +24,9 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* })
|
* })
|
||||||
* .then(
|
* .then(
|
||||||
* (result: any) => {
|
* (result: any) => {
|
||||||
* if(result.event === 'opened') console.log("Opened");
|
* if(result.event === 'opened') console.log('Opened');
|
||||||
* else if(result.event === 'loaded') console.log("Loaded");
|
* else if(result.event === 'loaded') console.log('Loaded');
|
||||||
* else if(result.event === 'closed') console.log("Closed");
|
* else if(result.event === 'closed') console.log('Closed');
|
||||||
* },
|
* },
|
||||||
* (error: any) => console.error(error)
|
* (error: any) => console.error(error)
|
||||||
* );
|
* );
|
||||||
@ -39,63 +39,60 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-safariviewcontroller',
|
plugin: 'cordova-plugin-safariviewcontroller',
|
||||||
pluginRef: 'SafariViewController',
|
pluginRef: 'SafariViewController',
|
||||||
platforms: ['iOS'],
|
platforms: ['iOS', 'Android'],
|
||||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller'
|
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller'
|
||||||
})
|
})
|
||||||
export class SafariViewController {
|
export class SafariViewController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if SafariViewController is available
|
* Checks if SafariViewController is available
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static isAvailable(): Promise<boolean> {return; }
|
static isAvailable(): Promise<boolean> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows Safari View Controller
|
* Shows Safari View Controller
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova()
|
||||||
callbackOrder: 'reverse'
|
static show(options?: SafariViewControllerOptions): Promise<any> { return; }
|
||||||
})
|
|
||||||
static show(options?: SafariViewControllerOptions): Promise<any> {return; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides Safari View Controller
|
* Hides Safari View Controller
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova()
|
||||||
sync: true
|
static hide(): void { }
|
||||||
})
|
|
||||||
static hide(): void {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.
|
* Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static connectToService(): Promise<any> {return; }
|
static connectToService(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this method whenever there's a chance the user will open an external url.
|
* Call this method whenever there's a chance the user will open an external url.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static warmUp(): Promise<any> {return; }
|
static warmUp(): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL.
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static mayLaunchUrl(url: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
|
||||||
* For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL.
|
|
||||||
* @param url
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
static mayLaunchUrl(url: string): Promise<any> {return; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SafariViewControllerOptions {
|
export interface SafariViewControllerOptions {
|
||||||
url?: string;
|
url?: string;
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
toolbarColor?: string;
|
toolbarColor?: string;
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
showDefaultShareMenuItem?: boolean;
|
showDefaultShareMenuItem?: boolean;
|
||||||
enterReaderModeIfAvailable?: boolean;
|
enterReaderModeIfAvailable?: boolean;
|
||||||
tintColor?: string;
|
tintColor?: string;
|
||||||
transition?: string;
|
transition?: string;
|
||||||
}
|
}
|
||||||
|
68
src/plugins/screen-orientation.ts
Normal file
68
src/plugins/screen-orientation.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
|
|
||||||
|
declare var window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Screen Orientation
|
||||||
|
* @description
|
||||||
|
* Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
|
||||||
|
* This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
|
||||||
|
*
|
||||||
|
* Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation).
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { ScreenOrientation } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // set to either landscape
|
||||||
|
* ScreenOrientation.lockOrientation('landscape');
|
||||||
|
*
|
||||||
|
* // allow user rotate
|
||||||
|
* ScreenOrientation.unlockOrientation();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @advanced
|
||||||
|
*
|
||||||
|
* Accepted orientation values:
|
||||||
|
*
|
||||||
|
* | Value | Description |
|
||||||
|
* |-------------------------------|------------------------------------------------------------------------------|
|
||||||
|
* | portrait-primary | The orientation is in the primary portrait mode. |
|
||||||
|
* | portrait-secondary | The orientation is in the secondary portrait mode. |
|
||||||
|
* | landscape-primary | The orientation is in the primary landscape mode. |
|
||||||
|
* | landscape-secondary | The orientation is in the secondary landscape mode. |
|
||||||
|
* | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
|
||||||
|
* | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-screen-orientation',
|
||||||
|
pluginRef: 'window.screen',
|
||||||
|
repo: 'https://github.com/apache/cordova-plugin-screen-orientation',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||||
|
})
|
||||||
|
export class ScreenOrientation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock the orientation to the passed value.
|
||||||
|
* See below for accepted values
|
||||||
|
* @param {orientation} The orientation which should be locked. Accepted values see table below.
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static lockOrientation(orientation: string): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlock and allow all orientations.
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static unlockOrientation(): void { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the current orientation of the device.
|
||||||
|
*/
|
||||||
|
@CordovaProperty
|
||||||
|
static get orientation() {
|
||||||
|
return window.screen.orientation;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,21 @@
|
|||||||
import {Cordova, Plugin} from './plugin';
|
import { Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var navigator: any;
|
declare var navigator: any;
|
||||||
|
/**
|
||||||
|
* @name Screenshot
|
||||||
|
* @description Captures a screen shot
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import {Screenshot} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* // Take a screenshot and save to file
|
||||||
|
* Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
|
||||||
|
*
|
||||||
|
* // Take a screenshot and get temporary file URI
|
||||||
|
* Screenshot.URI(80).then(onSuccess, onError);
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'https://github.com/gitawego/cordova-screenshot.git',
|
plugin: 'https://github.com/gitawego/cordova-screenshot.git',
|
||||||
pluginRef: 'navigator.screenshot',
|
pluginRef: 'navigator.screenshot',
|
||||||
@ -7,23 +23,23 @@ declare var navigator: any;
|
|||||||
})
|
})
|
||||||
export class Screenshot {
|
export class Screenshot {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes screenshot and saves the image
|
* Takes screenshot and saves the image
|
||||||
*
|
*
|
||||||
* @param {string} format. Format can take the value of either 'jpg' or 'png'
|
* @param {string} format. Format can take the value of either 'jpg' or 'png'
|
||||||
* On ios, only 'jpg' format is supported
|
* On ios, only 'jpg' format is supported
|
||||||
* @param {number} quality. Determines the quality of the screenshot.
|
* @param {number} quality. Determines the quality of the screenshot.
|
||||||
* Default quality is set to 100.
|
* Default quality is set to 100.
|
||||||
* @param {string} filename. Name of the file as stored on the storage
|
* @param {string} filename. Name of the file as stored on the storage
|
||||||
*/
|
*/
|
||||||
static save (format?: string, quality?: number, filename?: string): Promise<any> {
|
static save(format?: string, quality?: number, filename?: string): Promise<any> {
|
||||||
return new Promise<any>(
|
return new Promise<any>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
navigator.screenshot.save(
|
navigator.screenshot.save(
|
||||||
(error, result) => {
|
(error, result) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
}else {
|
} else {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -35,20 +51,20 @@ export class Screenshot {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes screenshot and returns the image as an URI
|
* Takes screenshot and returns the image as an URI
|
||||||
*
|
*
|
||||||
* @param {number} quality. Determines the quality of the screenshot.
|
* @param {number} quality. Determines the quality of the screenshot.
|
||||||
* Default quality is set to 100.
|
* Default quality is set to 100.
|
||||||
*/
|
*/
|
||||||
static URI (quality?: number): Promise<any> {
|
static URI(quality?: number): Promise<any> {
|
||||||
return new Promise<any>(
|
return new Promise<any>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
navigator.screenshot.URI(
|
navigator.screenshot.URI(
|
||||||
(error, result) => {
|
(error, result) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
}else {
|
} else {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -56,5 +72,5 @@ export class Screenshot {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
90
src/plugins/securestorage.ts
Normal file
90
src/plugins/securestorage.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { CordovaInstance, Plugin } from './plugin';
|
||||||
|
declare var cordova: any;
|
||||||
|
/**
|
||||||
|
* @name Secure Storage
|
||||||
|
* @description
|
||||||
|
* This plugin gets, sets and removes key,value pairs from a device's secure storage.
|
||||||
|
*
|
||||||
|
* Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage).
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
*
|
||||||
|
* ```typescript
|
||||||
|
* import { SecureStorage } from 'ionic-native';
|
||||||
|
*
|
||||||
|
* let secureStorage: SecureStorage = new SecureStorage();
|
||||||
|
* secureStorage.create('my_store_name')
|
||||||
|
* .then(
|
||||||
|
* () => console.log('Storage is ready!'),
|
||||||
|
* error => console.log(error)
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* secureStorage.get('myitem')
|
||||||
|
* .then(
|
||||||
|
* data => console.log(data),
|
||||||
|
* error => console.log(error)
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* secureStorage.set('myitem', 'myvalue')
|
||||||
|
* .then(
|
||||||
|
* data => console.log(data),
|
||||||
|
* error => console.log(error)
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* secureStorage.remove('myitem')
|
||||||
|
* .then(
|
||||||
|
* data => console.log(data),
|
||||||
|
* error => console.log(error)
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-secure-storage',
|
||||||
|
pluginRef: 'plugins.securestorage',
|
||||||
|
repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
|
||||||
|
})
|
||||||
|
export class SecureStorage {
|
||||||
|
|
||||||
|
private _objectInstance: any;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a namespaced storage.
|
||||||
|
* @param store {string}
|
||||||
|
*/
|
||||||
|
create(store: string): Promise<any> {
|
||||||
|
return new Promise((res, rej) => {
|
||||||
|
this._objectInstance = new cordova.plugins.SecureStorage(res, rej, store);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a stored item
|
||||||
|
* @param reference {string}
|
||||||
|
*/
|
||||||
|
@CordovaInstance({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
get(reference: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores a value
|
||||||
|
* @param reference {string}
|
||||||
|
* @param value {string}
|
||||||
|
*/
|
||||||
|
@CordovaInstance({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
set(reference: string, value: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a single stored item
|
||||||
|
* @param reference {string}
|
||||||
|
*/
|
||||||
|
@CordovaInstance({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
remove(reference: string): Promise<any> { return; }
|
||||||
|
}
|
35
src/plugins/shake.ts
Normal file
35
src/plugins/shake.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
/**
|
||||||
|
* @name Shake
|
||||||
|
* @description Handles shake gesture
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import {Shake} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* let watch = Shake.startWatch(60).subscribe(() => {
|
||||||
|
* // do something
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* watch.unsubscribe();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-shake',
|
||||||
|
pluginRef: 'shake',
|
||||||
|
repo: 'https://github.com/leecrossley/cordova-plugin-shake'
|
||||||
|
})
|
||||||
|
export class Shake {
|
||||||
|
/**
|
||||||
|
* Watch for shake gesture
|
||||||
|
* @param sensitivity {number} Optional sensitivity parameter. Defaults to 40
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
observable: true,
|
||||||
|
clearFunction: 'stopWatch',
|
||||||
|
successIndex: 0,
|
||||||
|
errorIndex: 2
|
||||||
|
})
|
||||||
|
static startWatch(sensitivity?: number): Observable<any> {return; }
|
||||||
|
|
||||||
|
}
|
36
src/plugins/sim.ts
Normal file
36
src/plugins/sim.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Sim
|
||||||
|
* @description
|
||||||
|
* Gets info from the Sim card like the carrier name, mcc, mnc and country code and other system dependent info.
|
||||||
|
*
|
||||||
|
* Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim).
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { Sim } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sim.getSimInfo().then(
|
||||||
|
* (info) => console.log('Sim info: ', info),
|
||||||
|
* (err) => console.log('Unable to get sim info: ', err)
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-sim',
|
||||||
|
pluginRef: 'plugins.sim',
|
||||||
|
repo: 'https://github.com/pbakondy/cordova-plugin-sim',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||||
|
})
|
||||||
|
export class Sim {
|
||||||
|
/**
|
||||||
|
* Returns info from the SIM card.
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static getSimInfo(): Promise<any> { return; }
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for sending an SMS
|
* Options for sending an SMS
|
||||||
@ -30,14 +31,12 @@ export interface SmsOptionsAndroid {
|
|||||||
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
|
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {SMS} from 'ionic-native';
|
* import { SMS } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Send a text message using default options
|
* // Send a text message using default options
|
||||||
* SMS.send('416123456','Hello world!');
|
* SMS.send('416123456', 'Hello world!');
|
||||||
*
|
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -60,6 +59,6 @@ export class SMS {
|
|||||||
phoneNumber: string | string[],
|
phoneNumber: string | string[],
|
||||||
message: string,
|
message: string,
|
||||||
options?: SmsOptions
|
options?: SmsOptions
|
||||||
): Promise<any> { return; }
|
): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,45 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Social Sharing
|
* @name Social Sharing
|
||||||
* @description
|
* @description
|
||||||
* Share text, files, images, and links via social networks, sms, and email.
|
* Share text, files, images, and links via social networks, sms, and email.
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {SocialSharing} from 'ionic-native';
|
* import { SocialSharing } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
* // Check if sharing via email is supported
|
||||||
* // TODO add usage info
|
* SocialSharing.canShareViaEmail().then(() => {
|
||||||
|
* // Sharing via email is possible
|
||||||
|
* }).catch(() => {
|
||||||
|
* // Sharing via email is not possible
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Share via email
|
||||||
|
* SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
|
||||||
|
* // Success!
|
||||||
|
* }).catch(() => {
|
||||||
|
* // Error!
|
||||||
|
* });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-x-socialsharing',
|
plugin: 'cordova-plugin-x-socialsharing',
|
||||||
pluginRef: 'window.plugins.socialsharing',
|
pluginRef: 'plugins.socialsharing',
|
||||||
repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
|
repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
|
||||||
platforms: ['iOS', 'Android', 'Windows Phone']
|
platforms: ['iOS', 'Android', 'Windows Phone']
|
||||||
})
|
})
|
||||||
export class SocialSharing {
|
export class SocialSharing {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares using the share sheet
|
* Shares using the share sheet
|
||||||
* @param message {string} The message you would like to share.
|
* @param message {string} The message you would like to share.
|
||||||
* @param subject {string} The subject
|
* @param subject {string} The subject
|
||||||
* @param file {string|Array<string>} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.
|
* @param file {string|string[]} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.
|
||||||
* @param url {string} A URL to share
|
* @param url {string} A URL to share
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): Promise<any> {return; }
|
static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
|
* Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
|
||||||
@ -38,7 +48,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareWithOptions (options: { message?: string, subject?: string, file?: string|Array<string>, url?: string, chooserTitle?: string }): Promise<any> {return; }
|
static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if you can share via a specific app.
|
* Checks if you can share via a specific app.
|
||||||
@ -47,7 +57,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static canShareVia (appName: string): Promise<any> {return; }
|
static canShareVia(appName: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares directly to Twitter
|
* Shares directly to Twitter
|
||||||
@ -58,7 +68,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaTwitter (message: string, image?: string, url?: string): Promise<any> {return; }
|
static shareViaTwitter(message: string, image?: string, url?: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares directly to Facebook
|
* Shares directly to Facebook
|
||||||
@ -69,7 +79,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaFacebook (message: string, image?: string, url?: string): Promise<any> {return; }
|
static shareViaFacebook(message: string, image?: string, url?: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +92,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaFacebookWithPasteMessageHint (message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any> {return; }
|
static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares directly to Instagram
|
* Shares directly to Instagram
|
||||||
@ -92,7 +102,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaInstagram (message: string, image: string): Promise<any> {return; }
|
static shareViaInstagram(message: string, image: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares directly to WhatsApp
|
* Shares directly to WhatsApp
|
||||||
@ -103,7 +113,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaWhatsApp (message: string, image?: string, url?: string): Promise<any> {return; }
|
static shareViaWhatsApp(message: string, image?: string, url?: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shares directly to a WhatsApp Contact
|
* Shares directly to a WhatsApp Contact
|
||||||
@ -115,7 +125,7 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaWhatsAppToReceiver (receiver: string, message: string, image?: string, url?: string): Promise<any> {return; }
|
static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Share via SMS
|
* Share via SMS
|
||||||
@ -125,21 +135,28 @@ export class SocialSharing {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaSMS(messge: string, phoneNumber: string): Promise<any> {return; }
|
static shareViaSMS(messge: string, phoneNumber: string): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if you can share via email
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
platforms: ['iOS', 'Android']
|
||||||
|
})
|
||||||
|
static canShareViaEmail(): Promise<any> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Share via Email
|
* Share via Email
|
||||||
* @param message {string}
|
* @param message {string}
|
||||||
* @param subject {string}
|
* @param subject {string}
|
||||||
* @param to {Array<string>}
|
* @param to {string[]}
|
||||||
* @param cc {Array<string>}
|
* @param cc {string[]}
|
||||||
* @param bcc {Array<string>}
|
* @param bcc {string[]}
|
||||||
* @param files {string|Array<string>} URL or local path to file(s) to attach
|
* @param files {string|string[]} URL or local path to file(s) to attach
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
static shareViaEmail(message: string, subject: string, to: Array<string>, cc: Array<string>, bcc: Array<string>, files: string|Array<string>): Promise<any> {return; }
|
static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise<any> { return; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Spinner Dialog
|
* @name Spinner Dialog
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```typescript
|
||||||
* import {SpinnerDialog} from 'ionic-native';
|
* import { SpinnerDialog } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* SpinnerDialog.show();
|
* SpinnerDialog.show();
|
||||||
@ -22,7 +22,6 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
})
|
})
|
||||||
export class SpinnerDialog {
|
export class SpinnerDialog {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the spinner dialog
|
* Shows the spinner dialog
|
||||||
* @param title {string} Spinner title (shows on Android only)
|
* @param title {string} Spinner title (shows on Android only)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Splashscreen
|
* @name Splashscreen
|
||||||
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
|
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {Splashscreen} from 'ionic-native';
|
* import { Splashscreen } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Splashscreen.show();
|
* Splashscreen.show();
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import {CordovaInstance, Plugin, Cordova} from './plugin';
|
import { Cordova, CordovaInstance, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var sqlitePlugin;
|
declare var sqlitePlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name SQLite
|
* @name SQLite
|
||||||
*
|
*
|
||||||
@ -8,21 +11,21 @@ declare var sqlitePlugin;
|
|||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import { SQLite } from 'ionic-native';
|
* import { SQLite } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* let db = new SQLite();
|
* let db = new SQLite();
|
||||||
* db.openDatabse({
|
* db.openDatabase({
|
||||||
* name: 'data.db',
|
* name: 'data.db',
|
||||||
* location: 'default' // the location field is required
|
* location: 'default' // the location field is required
|
||||||
* }).then(() => {
|
* }).then(() => {
|
||||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||||
*
|
*
|
||||||
* }, (err) => {
|
* }, (err) => {
|
||||||
* console.error('Unable to execute sql', err);
|
* console.error('Unable to execute sql: ', err);
|
||||||
* })
|
* });
|
||||||
* }, (err) => {
|
* }, (err) => {
|
||||||
* console.error('Unable to open database', err);
|
* console.error('Unable to open database: ', err);
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -34,142 +37,142 @@ declare var sqlitePlugin;
|
|||||||
})
|
})
|
||||||
export class SQLite {
|
export class SQLite {
|
||||||
|
|
||||||
private _objectInstance: any;
|
private _objectInstance: any;
|
||||||
get databaseFeatures(): any {
|
get databaseFeatures(): any {
|
||||||
return this._objectInstance.databaseFeatures;
|
return this._objectInstance.databaseFeatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor () {}
|
constructor() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open or create a SQLite database file.
|
* Open or create a SQLite database file.
|
||||||
*
|
*
|
||||||
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
|
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
|
||||||
*
|
*
|
||||||
* @param config the config for opening the database.
|
* @param config the config for opening the database.
|
||||||
* @usage
|
* @usage
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import { SQLite } from 'ionic-native';
|
* import { SQLite } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* let db = new SQLite();
|
* let db = new SQLite();
|
||||||
* db.openDatabse({
|
* db.openDatabase({
|
||||||
* name: 'data.db',
|
* name: 'data.db',
|
||||||
* location: 'default' // the location field is required
|
* location: 'default' // the location field is required
|
||||||
* }).then(() => {
|
* }).then(() => {
|
||||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||||
*
|
*
|
||||||
* }, (err) => {
|
* }, (err) => {
|
||||||
* console.error('Unable to execute sql', err);
|
* console.error('Unable to execute sql', err);
|
||||||
* })
|
* })
|
||||||
* }, (err) => {
|
* }, (err) => {
|
||||||
* console.error('Unable to open database', err);
|
* console.error('Unable to open database', err);
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
openDatabase (config: any): Promise<any> {
|
openDatabase(config: any): Promise<any> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
sqlitePlugin.openDatabase(config, db => {
|
sqlitePlugin.openDatabase(config, db => {
|
||||||
this._objectInstance = db;
|
this._objectInstance = db;
|
||||||
resolve(db);
|
resolve(db);
|
||||||
}, error => {
|
}, error => {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
addTransaction (transaction: any): void {}
|
addTransaction(transaction: any): void { }
|
||||||
|
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
transaction (fn: any): Promise<any> {return; }
|
transaction(fn: any): Promise<any> { return; }
|
||||||
|
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
readTransaction (fn: any): Promise<any> {return; }
|
readTransaction(fn: any): Promise<any> { return; }
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
startNextTransaction (): void {}
|
startNextTransaction(): void { }
|
||||||
|
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
close (): Promise<any> {return; }
|
close(): Promise<any> { return; }
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
start (): void {}
|
start(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute SQL on the opened database. Note, you must call `openDatabase` first, and
|
* Execute SQL on the opened database. Note, you must call `openDatabase` first, and
|
||||||
* ensure it resolved and successfully opened the database.
|
* ensure it resolved and successfully opened the database.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```typescript
|
||||||
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
||||||
* // Access the items through resultSet.rows
|
* // Access the items through resultSet.rows
|
||||||
* // resultSet.rows.item(i)
|
* // resultSet.rows.item(i)
|
||||||
* }, (err) => {})
|
* }, (err) => {})
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
executeSql (statement: string, params: any): Promise<any> {return; }
|
executeSql(statement: string, params: any): Promise<any> { return; }
|
||||||
|
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
addSatement (sql, values): Promise<any> {return; }
|
addStatement(sql, values): Promise<any> { return; }
|
||||||
|
|
||||||
@CordovaInstance()
|
@CordovaInstance()
|
||||||
sqlBatch (sqlStatements: any): Promise<any> {return; }
|
sqlBatch(sqlStatements: any): Promise<any> { return; }
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
abortallPendingTransactions (): void {}
|
abortallPendingTransactions(): void { }
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
handleStatementSuccess (handler, response): void {}
|
handleStatementSuccess(handler, response): void { }
|
||||||
|
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
handleStatementFailure (handler, response): void {}
|
handleStatementFailure(handler, response): void { }
|
||||||
|
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
run (): void {}
|
run(): void { }
|
||||||
|
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
abort (txFailure): void {}
|
abort(txFailure): void { }
|
||||||
|
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
finish (): void {}
|
finish(): void { }
|
||||||
|
|
||||||
|
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
abortFromQ (sqlerror): void {}
|
abortFromQ(sqlerror): void { }
|
||||||
|
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static echoTest (): Promise<any> {return; }
|
static echoTest(): Promise<any> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static deleteDatabase (first): Promise<any> {return; }
|
static deleteDatabase(first): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova, CordovaProperty} from './plugin';
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var window;
|
declare var window;
|
||||||
|
|
||||||
@ -10,12 +11,11 @@ declare var window;
|
|||||||
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
|
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {StatusBar} from 'ionic-native';
|
* import { StatusBar } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* ...
|
|
||||||
*
|
*
|
||||||
* StatuBar.overlaysWebView(true); // let status var overlay webview
|
* StatusBar.overlaysWebView(true); // let status var overlay webview
|
||||||
*
|
*
|
||||||
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
|
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
|
||||||
* ```
|
* ```
|
||||||
@ -37,7 +37,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static overlaysWebView(doesOverlay: boolean) {};
|
static overlaysWebView(doesOverlay: boolean) { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the default statusbar (dark text, for light backgrounds).
|
* Use the default statusbar (dark text, for light backgrounds).
|
||||||
@ -45,7 +45,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static styleDefault() {};
|
static styleDefault() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the lightContent statusbar (light text, for dark backgrounds).
|
* Use the lightContent statusbar (light text, for dark backgrounds).
|
||||||
@ -53,7 +53,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static styleLightContent() {};
|
static styleLightContent() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
|
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
|
||||||
@ -61,7 +61,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static styleBlackTranslucent() {};
|
static styleBlackTranslucent() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the blackOpaque statusbar (light text, for dark backgrounds).
|
* Use the blackOpaque statusbar (light text, for dark backgrounds).
|
||||||
@ -69,7 +69,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static styleBlackOpaque() {};
|
static styleBlackOpaque() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the status bar to a specific named color. Valid options:
|
* Set the status bar to a specific named color. Valid options:
|
||||||
@ -82,7 +82,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static backgroundColorByName(colorName: string) {};
|
static backgroundColorByName(colorName: string) { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the status bar to a specific hex color (CSS shorthand supported!).
|
* Set the status bar to a specific hex color (CSS shorthand supported!).
|
||||||
@ -94,7 +94,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static backgroundColorByHexString(hexString: string) {};
|
static backgroundColorByHexString(hexString: string) { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the StatusBar
|
* Hide the StatusBar
|
||||||
@ -102,7 +102,7 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static hide() {};
|
static hide() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the StatusBar
|
* Show the StatusBar
|
||||||
@ -110,11 +110,12 @@ export class StatusBar {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static show() {};
|
static show() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the StatusBar is currently visible or not.
|
* Whether the StatusBar is currently visible or not.
|
||||||
*/
|
*/
|
||||||
@CordovaProperty
|
@CordovaProperty
|
||||||
static get isVisible() { return window.StatusBar.isVisible; }
|
static get isVisible() { return window.StatusBar.isVisible; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
47
src/plugins/text-to-speech.ts
Normal file
47
src/plugins/text-to-speech.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
|
||||||
|
export interface TTSOptions {
|
||||||
|
/** text to speak */
|
||||||
|
text: string;
|
||||||
|
/** a string like 'en-US', 'zh-CN', etc */
|
||||||
|
locale?: string;
|
||||||
|
/** speed rate, 0 ~ 1 */
|
||||||
|
rate?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name TTS
|
||||||
|
* @description
|
||||||
|
* Text to Speech plugin
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {TTS} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* TTS.speak('Hello World')
|
||||||
|
* .then(() => console.log('Success'))
|
||||||
|
* .catch((reason: any) => console.log(reason));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-tts',
|
||||||
|
pluginRef: 'TTS',
|
||||||
|
repo: 'https://github.com/vilic/cordova-plugin-tts'
|
||||||
|
})
|
||||||
|
export class TextToSpeech {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function speaks
|
||||||
|
* @param options {string | TTSOptions} Text to speak or TTSOptions
|
||||||
|
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
successIndex: 1,
|
||||||
|
errorIndex: 2
|
||||||
|
})
|
||||||
|
static speak(options: string | TTSOptions): Promise<any> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
export interface ToastOptions {
|
export interface ToastOptions {
|
||||||
/**
|
/**
|
||||||
@ -42,12 +43,11 @@ export interface ToastOptions {
|
|||||||
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
|
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {Toast} from 'ionic-native';
|
* import { Toast } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
* Toast.show("I'm a toast", '5000', 'center').subscribe(
|
||||||
* Toast.show("I'm a toast", "5000", "center").subscribe(
|
|
||||||
* toast => {
|
* toast => {
|
||||||
* console.log(toast);
|
* console.log(toast);
|
||||||
* }
|
* }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name TouchID
|
* @name TouchID
|
||||||
@ -7,6 +8,29 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
*
|
*
|
||||||
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
|
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
|
||||||
*
|
*
|
||||||
|
* @usage
|
||||||
|
* ### Import Touch ID Plugin into Project
|
||||||
|
* ```typescript
|
||||||
|
* import { TouchID } from 'ionic-native';
|
||||||
|
* ```
|
||||||
|
* ### Check for Touch ID Availability
|
||||||
|
* ```typescript
|
||||||
|
* TouchID.isAvailable()
|
||||||
|
* .then(
|
||||||
|
* res => console.log('TouchID is available!'),
|
||||||
|
* err => console.error('TouchID is not available', err)
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
* ### Invoke Touch ID w/ Custom Message
|
||||||
|
*
|
||||||
|
* ```typescript
|
||||||
|
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
||||||
|
* .then(
|
||||||
|
* res => console.log('Ok', res),
|
||||||
|
* err => console.error('Error', err)
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* ### Error Codes
|
* ### Error Codes
|
||||||
*
|
*
|
||||||
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
|
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
|
||||||
@ -19,25 +43,6 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
* - `-4` - The scan was cancelled by the system (Home button for example)
|
* - `-4` - The scan was cancelled by the system (Home button for example)
|
||||||
* - `-6` - TouchID is not Available
|
* - `-6` - TouchID is not Available
|
||||||
* - `-8` - TouchID is locked out from too many tries
|
* - `-8` - TouchID is locked out from too many tries
|
||||||
* @usage
|
|
||||||
* ```js
|
|
||||||
* import {TouchID} from 'ionic-native';
|
|
||||||
*
|
|
||||||
* ...
|
|
||||||
*
|
|
||||||
* TouchID.isAvailable()
|
|
||||||
* .then(
|
|
||||||
* res => console.log("TouchID is available!"),
|
|
||||||
* err => console.error("TouchID isn't available", err)
|
|
||||||
* );
|
|
||||||
*
|
|
||||||
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
|
||||||
* .then(
|
|
||||||
* res => console.log("Ok", res),
|
|
||||||
* err => console.error("Error", err)
|
|
||||||
* );
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-touch-id',
|
plugin: 'cordova-plugin-touch-id',
|
||||||
@ -48,7 +53,7 @@ import {Plugin, Cordova} from './plugin';
|
|||||||
export class TouchID {
|
export class TouchID {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether TouchID is available or not.
|
* Checks Whether TouchID is available or not.
|
||||||
*
|
*
|
||||||
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
|
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
|
||||||
*/
|
*/
|
||||||
@ -82,4 +87,5 @@ export class TouchID {
|
|||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return; }
|
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
73
src/plugins/twitter-connect.ts
Normal file
73
src/plugins/twitter-connect.ts
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Twitter Connect
|
||||||
|
* @description
|
||||||
|
* Plugin to use Twitter Single Sign On
|
||||||
|
* Uses Twitter's Fabric SDK
|
||||||
|
* ```typescript
|
||||||
|
* import {TwitterConnect} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* function onSuccess(response) {
|
||||||
|
* console.log(response);
|
||||||
|
*
|
||||||
|
* // Will console log something like:
|
||||||
|
* // {
|
||||||
|
* // userName: 'myuser',
|
||||||
|
* // userId: '12358102',
|
||||||
|
* // secret: 'tokenSecret'
|
||||||
|
* // token: 'accessTokenHere'
|
||||||
|
* // }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TwitterConnect.login().then(onSuccess, onError);
|
||||||
|
*
|
||||||
|
* TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'twitter-connect-plugin',
|
||||||
|
pluginRef: 'TwitterConnect',
|
||||||
|
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
|
||||||
|
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
|
||||||
|
})
|
||||||
|
export class TwitterConnect {
|
||||||
|
/**
|
||||||
|
* Logs in
|
||||||
|
* @return {Promise<TwitterConnectResponse>} returns a promise that resolves if logged in and rejects if failed to login
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static login(): Promise<TwitterConnectResponse> {return; }
|
||||||
|
/**
|
||||||
|
* Logs out
|
||||||
|
* @return {Promise<any>} returns a promise that resolves if logged out and rejects if failed to logout
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static logout(): Promise<any> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns user's profile information
|
||||||
|
* @return {Promise<any>} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static showUser(): Promise<any> {return; }
|
||||||
|
}
|
||||||
|
export interface TwitterConnectResponse {
|
||||||
|
/**
|
||||||
|
* Twitter Username
|
||||||
|
*/
|
||||||
|
userName: string;
|
||||||
|
/**
|
||||||
|
* Twitter User ID
|
||||||
|
*/
|
||||||
|
userId: string;
|
||||||
|
/**
|
||||||
|
* Twitter OAuth Secret
|
||||||
|
*/
|
||||||
|
secret: string;
|
||||||
|
/**
|
||||||
|
* Twitter OAuth Token
|
||||||
|
*/
|
||||||
|
token: string;
|
||||||
|
}
|
@ -1,14 +1,16 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Vibration
|
* @name Vibration
|
||||||
* @description Vibrates the device
|
* @description Vibrates the device
|
||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```typescript
|
||||||
* import {Vibration} from 'ionic-native';
|
* import { Vibration } from 'ionic-native';
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* // Vibrate the device for a second
|
* // Vibrate the device for a second
|
||||||
|
* // Duration is ignored on iOS.
|
||||||
* Vibration.vibrate(1000);
|
* Vibration.vibrate(1000);
|
||||||
*
|
*
|
||||||
* // Vibrate 2 seconds
|
* // Vibrate 2 seconds
|
||||||
@ -37,6 +39,6 @@ export class Vibration {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
sync: true
|
sync: true
|
||||||
})
|
})
|
||||||
static vibrate(time: number|Array<number>) {}
|
static vibrate(time: number | Array<number>) { }
|
||||||
|
|
||||||
}
|
}
|
200
src/plugins/video-editor.ts
Normal file
200
src/plugins/video-editor.ts
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
import {Plugin, Cordova} from './plugin';
|
||||||
|
|
||||||
|
export interface TranscodeOptions {
|
||||||
|
|
||||||
|
/** The path to the video on the device. */
|
||||||
|
fileUri: string;
|
||||||
|
|
||||||
|
/** The file name for the transcoded video */
|
||||||
|
outputFileName: string;
|
||||||
|
|
||||||
|
/** Instructions on how to encode the video. Android is always mp4 */
|
||||||
|
outputFileType?: number;
|
||||||
|
|
||||||
|
/** Should the video be processed with quailty or speed in mind. iOS only */
|
||||||
|
optimizeForNetworkUse?: number;
|
||||||
|
|
||||||
|
/** Save the new video the library. Not supported in windows. Defaults to true */
|
||||||
|
saveToLibrary?: boolean;
|
||||||
|
|
||||||
|
/** Delete the original video. Android only. Defaults to false */
|
||||||
|
deleteInputFile?: boolean;
|
||||||
|
|
||||||
|
/** iOS only. Defaults to true */
|
||||||
|
maintainAspectRatio?: boolean;
|
||||||
|
|
||||||
|
/** Width of the result */
|
||||||
|
width?: number;
|
||||||
|
|
||||||
|
/** Height of the result */
|
||||||
|
height?: number;
|
||||||
|
|
||||||
|
/** Bitrate in bits. Defaults to 1 megabit (1000000). */
|
||||||
|
videoBitrate?: number;
|
||||||
|
|
||||||
|
/** Frames per second of the result. Android only. Defaults to 24. */
|
||||||
|
fps?: number;
|
||||||
|
|
||||||
|
/** Number of audio channels. iOS only. Defaults to 2. */
|
||||||
|
audioChannels?: number;
|
||||||
|
|
||||||
|
/** Sample rate for the audio. iOS only. Defaults to 44100*/
|
||||||
|
audioSampleRate?: number;
|
||||||
|
|
||||||
|
/** Sample rate for the audio. iOS only. Defaults to 128 kilobits (128000). */
|
||||||
|
audioBitrate?: number;
|
||||||
|
|
||||||
|
/** Not supported in windows, progress on the transcode. info will be a number from 0 to 100 */
|
||||||
|
progress?: (info: number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TrimOptions {
|
||||||
|
|
||||||
|
/** Path to input video. */
|
||||||
|
fileUri: string;
|
||||||
|
|
||||||
|
/** Time to start trimming in seconds */
|
||||||
|
trimStart: number;
|
||||||
|
|
||||||
|
/** Time to end trimming in seconds */
|
||||||
|
trimEnd: number;
|
||||||
|
|
||||||
|
/** Output file name */
|
||||||
|
outputFileName: string;
|
||||||
|
|
||||||
|
/** Progress on transcode. info will be a number from 0 to 100 */
|
||||||
|
progress?: (info: any) => void;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateThumbnailOptions {
|
||||||
|
|
||||||
|
/** The path to the video on the device */
|
||||||
|
fileUri: string;
|
||||||
|
|
||||||
|
/** The file name for the JPEG image */
|
||||||
|
outputFileName: string;
|
||||||
|
|
||||||
|
/** Location in the video to create the thumbnail (in seconds) */
|
||||||
|
atTime?: number;
|
||||||
|
|
||||||
|
/** Width of the thumbnail. */
|
||||||
|
width?: number;
|
||||||
|
|
||||||
|
/** Height of the thumbnail. */
|
||||||
|
height?: number;
|
||||||
|
|
||||||
|
/** Quality of the thumbnail (between 1 and 100). */
|
||||||
|
quality?: number;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetVideoInfoOptions {
|
||||||
|
|
||||||
|
/** The path to the video on the device. */
|
||||||
|
fileUri: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VideoInfo {
|
||||||
|
|
||||||
|
/** Width of the video in pixels. */
|
||||||
|
width: number;
|
||||||
|
|
||||||
|
/** Height of the video in pixels. */
|
||||||
|
height: number;
|
||||||
|
|
||||||
|
/** Orientation of the video. Will be either portrait or landscape. */
|
||||||
|
orientation: 'portrait' | 'landscape';
|
||||||
|
|
||||||
|
/** Duration of the video in seconds. */
|
||||||
|
duration: number;
|
||||||
|
|
||||||
|
/** Size of the video in bytes. */
|
||||||
|
size: number;
|
||||||
|
|
||||||
|
/** Bitrate of the video in bits per second. */
|
||||||
|
bitrate: number;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name VideoEditor
|
||||||
|
* @description Edit videos using native device APIs
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {VideoEditor} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* VideoEditor.transcodeVideo({
|
||||||
|
* fileUri: '/path/to/input.mov',
|
||||||
|
* outputFileName: 'output.mp4',
|
||||||
|
* outputFileType: VideoEditor.OutputFileType.MPEG4
|
||||||
|
* })
|
||||||
|
* .then((fileUri: string) => console.log('video transcode success', fileUri))
|
||||||
|
* .catch((error: any) => console.log('video transcode error', error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-video-editor',
|
||||||
|
pluginRef: 'VideoEditor',
|
||||||
|
repo: 'https://github.com/jbavari/cordova-plugin-video-editor',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||||
|
})
|
||||||
|
export class VideoEditor {
|
||||||
|
|
||||||
|
static OptimizeForNetworkUse = {
|
||||||
|
NO: 0,
|
||||||
|
YES: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
static OutputFileType = {
|
||||||
|
M4V: 0,
|
||||||
|
MPEG4: 1,
|
||||||
|
M4A: 2,
|
||||||
|
QUICK_TIME: 3
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transcode a video
|
||||||
|
* @param options {TranscodeOptions} Options
|
||||||
|
* @return {Promise<string>} Returns a promise that resolves to the path of the transcoded video
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static transcodeVideo(options: TranscodeOptions): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim a video
|
||||||
|
* @param options {TrimOptions} Options
|
||||||
|
* @return {Promise<string>} Returns a promise that resolves to the path of the trimmed video
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse',
|
||||||
|
platforms: ['iOS']
|
||||||
|
})
|
||||||
|
static trim(options: TrimOptions): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a JPEG thumbnail from a video
|
||||||
|
* @param options {CreateThumbnailOptions} Options
|
||||||
|
* @return {Promise<string>} Returns a promise that resolves to the path to the jpeg image on the device
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static createThumbnail(options: CreateThumbnailOptions): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get info on a video (width, height, orientation, duration, size, & bitrate)
|
||||||
|
* @param options {GetVideoInfoOptions} Options
|
||||||
|
* @return {Promise<VideoInfo>} Returns a promise that resolves to an object containing info on the video
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
callbackOrder: 'reverse'
|
||||||
|
})
|
||||||
|
static getVideoInfo(options: GetVideoInfoOptions): Promise<VideoInfo> { return; }
|
||||||
|
|
||||||
|
}
|
62
src/plugins/video-player.ts
Normal file
62
src/plugins/video-player.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the video playback using the `play` function.
|
||||||
|
*/
|
||||||
|
export interface VideoOptions {
|
||||||
|
/**
|
||||||
|
* Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%.
|
||||||
|
* For example: for a volume of 30% set the value to 0.3.
|
||||||
|
*/
|
||||||
|
volume?: number;
|
||||||
|
/**
|
||||||
|
* There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
|
||||||
|
* These strings are the only ones which can be passed as option.
|
||||||
|
*/
|
||||||
|
scalingMode?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name VideoPlayer
|
||||||
|
* @description
|
||||||
|
* A Codova plugin that simply allows you to immediately play a video in fullscreen mode.
|
||||||
|
*
|
||||||
|
* Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer).
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { VideoPlayer } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // Playing a video.
|
||||||
|
* VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
|
||||||
|
* console.log('video completed');
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-videoplayer',
|
||||||
|
pluginRef: 'VideoPlayer',
|
||||||
|
repo: 'https://github.com/moust/cordova-plugin-videoplayer',
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
export class VideoPlayer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays the video from the passed url.
|
||||||
|
* @param fileUrl {string} File url to the video.
|
||||||
|
* @param options {VideoOptions?} Optional video playback settings. See options above.
|
||||||
|
* @returns {Promise<any>} Resolves promise when the video was played successfully.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static play(fileUrl: string, options?: VideoOptions): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the video playback immediatly.
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static close(): void { }
|
||||||
|
}
|
@ -1,10 +1,20 @@
|
|||||||
import {Cordova, CordovaProperty, Plugin} from './plugin';
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
declare var window;
|
declare var window;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name WebIntent
|
* @name WebIntent
|
||||||
* @description
|
* @description
|
||||||
* @usage
|
* @usage
|
||||||
* For usage information please refer to the plugin's Github repo.
|
* For usage information please refer to the plugin's Github repo.
|
||||||
|
*
|
||||||
|
* ```typescript
|
||||||
|
* import {WebIntent} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* WebIntent.startActivity(options).then(onSuccess, onError);
|
||||||
|
*
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'https://github.com/Initsogar/cordova-webintent.git',
|
plugin: 'https://github.com/Initsogar/cordova-webintent.git',
|
||||||
@ -15,31 +25,31 @@ declare var window;
|
|||||||
export class WebIntent {
|
export class WebIntent {
|
||||||
|
|
||||||
@CordovaProperty
|
@CordovaProperty
|
||||||
static get ACTION_VIEW () {
|
static get ACTION_VIEW() {
|
||||||
return window.plugins.webintent.ACTION_VIEW;
|
return window.plugins.webintent.ACTION_VIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@CordovaProperty
|
@CordovaProperty
|
||||||
static get EXTRA_TEXT () {
|
static get EXTRA_TEXT() {
|
||||||
return window.plugins.webintent.EXTRA_TEXT;
|
return window.plugins.webintent.EXTRA_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static startActivity (options: {action: any, url: string}): Promise<any> {return; }
|
static startActivity(options: { action: any, url: string }): Promise<any> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static hasExtra (extra: any): Promise<any> {return; }
|
static hasExtra(extra: any): Promise<any> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getExtra (extra: any): Promise<any> {return; }
|
static getExtra(extra: any): Promise<any> { return; }
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getUri (): Promise<string> {return; };
|
static getUri(): Promise<string> { return; };
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static onNewIntent(): Promise<string> {return; };
|
static onNewIntent(): Promise<string> { return; };
|
||||||
|
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static sendBroadcast(options: {action: string, extras?: {option: boolean}}): Promise<any> {return; }
|
static sendBroadcast(options: { action: string, extras?: { option: boolean } }): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
39
src/plugins/zip.ts
Normal file
39
src/plugins/zip.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Zip
|
||||||
|
* @description
|
||||||
|
* A Cordova plugin to unzip files in Android and iOS.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {Zip} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
|
||||||
|
* .then((result) => {
|
||||||
|
* if(result === 0) console.log('SUCCESS');
|
||||||
|
* if(result === -1) console.log('FAILED');
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-zip',
|
||||||
|
pluginRef: 'zip',
|
||||||
|
repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip',
|
||||||
|
})
|
||||||
|
export class Zip {
|
||||||
|
/**
|
||||||
|
* Extracts files from a ZIP archive
|
||||||
|
* @param sourceZip {string} Source ZIP file
|
||||||
|
* @param destUrl {string} Destination folder
|
||||||
|
* @param onProgress {Function} optional callback to be called on progress update
|
||||||
|
* @return {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
successIndex: 2,
|
||||||
|
errorIndex: 4
|
||||||
|
})
|
||||||
|
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; }
|
||||||
|
|
||||||
|
}
|
61
tslint.json
61
tslint.json
@ -1,62 +1,3 @@
|
|||||||
{
|
{
|
||||||
"rulesDirectory": "node_modules/tslint-eslint-rules/dist/rules",
|
"extends": "tslint-ionic-rules"
|
||||||
"rules": {
|
|
||||||
"class-name": true,
|
|
||||||
"comment-format": [
|
|
||||||
true,
|
|
||||||
"check-space"
|
|
||||||
],
|
|
||||||
"indent": [
|
|
||||||
true,
|
|
||||||
"spaces"
|
|
||||||
],
|
|
||||||
"no-duplicate-variable": true,
|
|
||||||
"no-eval": true,
|
|
||||||
"no-internal-module": true,
|
|
||||||
"no-trailing-whitespace": true,
|
|
||||||
"no-var-keyword": false,
|
|
||||||
"one-line": [
|
|
||||||
true,
|
|
||||||
"check-open-brace",
|
|
||||||
"check-whitespace"
|
|
||||||
],
|
|
||||||
"quotemark": [
|
|
||||||
true,
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"semicolon": [
|
|
||||||
true,
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"triple-equals": [
|
|
||||||
true,
|
|
||||||
"allow-null-check"
|
|
||||||
],
|
|
||||||
"typedef-whitespace": [
|
|
||||||
true,
|
|
||||||
{
|
|
||||||
"call-signature": "nospace",
|
|
||||||
"index-signature": "nospace",
|
|
||||||
"parameter": "nospace",
|
|
||||||
"property-declaration": "nospace",
|
|
||||||
"variable-declaration": "nospace"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"variable-name": [
|
|
||||||
true,
|
|
||||||
"ban-keywords"
|
|
||||||
],
|
|
||||||
"whitespace": [
|
|
||||||
true,
|
|
||||||
"check-branch",
|
|
||||||
"check-decl",
|
|
||||||
"check-operator",
|
|
||||||
"check-separator",
|
|
||||||
"check-type"
|
|
||||||
],
|
|
||||||
"no-inner-declarations": [
|
|
||||||
true,
|
|
||||||
"functions"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user