Compare commits

..

79 Commits

Author SHA1 Message Date
Max Lynch
3266d21ba4 chore(changelog): update changelog 2016-09-24 17:33:37 -05:00
Max Lynch
62f1504514 vBump 2016-09-24 17:30:07 -05:00
Max Lynch
f60d08b7a4 feat(plugin): cordova function override. fixes #437 2016-09-24 17:26:23 -05:00
Max Lynch
a092a31a1e feat(emailcomposer): use new supported plugin. #568 2016-09-24 16:00:44 -05:00
Max Lynch
6407518892 Add back erroneous exports 2016-09-24 15:44:28 -05:00
Max Lynch
e7e45f608c feat(npm): typescript 2.0.2 2016-09-24 15:41:07 -05:00
Max Lynch
c175badab6 Merge pull request #561 from krizroring/master
Extension of the BackgroundGeolocation plugin
2016-09-24 15:40:59 -05:00
Max Lynch
05783be9ac Merge pull request #574 from ramonornela/fix_style
style(inapppurchase): fix angular style
2016-09-24 15:36:48 -05:00
Ramon Ornelas
6948eabc96 style(inapppurchase): fix angular style 2016-09-24 09:39:31 -03:00
Max Lynch
48196da281 feat(push): add coldstart property. Fixes #559 2016-09-22 20:43:51 -05:00
Max Lynch
a0b6b1084b fix(webintent): add type param. Fixes #564 2016-09-22 20:37:36 -05:00
Max Lynch
4292959c87 fix(plugins): export VideoPlayer. Fixes #563 2016-09-22 20:35:19 -05:00
Max Lynch
e50b961bf9 fix(npm): duplicate typings 2016-09-22 15:10:44 -05:00
Max Lynch
0ba3957e8a chore(npm): proper 2.0.0 typescript 2016-09-22 13:59:20 -05:00
Max Lynch
c33842f8f0 chore(npm): proper 2.0.0 typescript 2016-09-22 13:58:57 -05:00
Max Lynch
f87237852f chore(npm): bump to 1.3.27 2016-09-22 13:39:51 -05:00
Max Lynch
bfb63a77a2 chore(npm): bump to 1.3.26 2016-09-22 13:37:01 -05:00
Max Lynch
b1ca6af2c3 add typings for old release 2016-09-22 13:36:38 -05:00
Max Lynch
2f20deacf2 Revert "Bump to 2.0.0 typescript"
This reverts commit de1086b894.
2016-09-22 13:36:27 -05:00
Max Lynch
de1086b894 Bump to 2.0.0 typescript 2016-09-22 13:25:16 -05:00
Max Lynch
6a19c8cf48 fix(ts): use old ts version for 1.3.x #567 2016-09-22 13:11:56 -05:00
Max Lynch
b6b0359fcf fixing package.json publish 2016-09-21 15:12:27 -05:00
Max Lynch
bb0d81a4e9 vBump 2016-09-21 15:10:44 -05:00
Max Lynch
4014972feb feat(build): Support ES2015 modules 2016-09-21 15:04:46 -05:00
Max Lynch
3903fee2bf feat(scripts): publish script with npm and bower. Fixes #448 2016-09-21 11:02:32 -05:00
Christian Roring
31706867c7 feat(BackgroundGeolocation): code cleanup 2016-09-20 14:00:57 +02:00
Christian Roring
808a75e41c feat(BackgroundGeolocation): Update to the latest version 2016-09-20 13:07:01 +02:00
Christian Roring
919e8dae30 feat(BackgroundGeolocation): Update to the latest version 2016-09-20 12:36:56 +02:00
Ibrahim Hadeed
763ad1bdb0 fix(call-number): number should be a string
closes #545
2016-09-19 18:20:51 -04:00
Ibrahim Hadeed
281575b961 feat(background-geolocation): add showAppSettings function
closes #548
2016-09-19 18:18:53 -04:00
Ibrahim Hadeed
42d1bbc7a8 docs(camera): add return type to cleanup
closes #550
2016-09-19 18:14:51 -04:00
Jay Cambron
a28667e751 docs(background-geolocation): add notice (#534) 2016-09-19 18:00:58 -04:00
Attila Oláh
505ff189d9 chore(market): add missing plugin name (#557) 2016-09-19 17:58:37 -04:00
Daniel Imhoff
35c37c2d9e chore(build): rename to more explicit tsconfig-es5.json 2016-09-14 14:13:14 -05:00
Daniel Imhoff
efbd11676f put tsc output into dist/es5, not just dist/ 2016-09-14 13:35:45 -05:00
Daniel Imhoff
abf3335415 'npm run' runs with node_modules/.bin in path 2016-09-14 13:25:50 -05:00
Andrew Mitchell
c83b0437fa feat(localNotifications): added register and has permission functions (#536) 2016-09-13 08:10:14 -04:00
Ibrahim Hadeed
23fc908eb6 fix(googlemaps): CameraPosition target can now be LatLngBounds
closes #547
2016-09-13 06:17:07 -04:00
Daniel Imhoff
9d35567cb5 Fix import to use @reactivex/rxjs 2016-09-09 14:45:24 -05:00
Max Lynch
7f77b8f069 Package 2016-09-09 09:50:13 -05:00
mhartington
410b3d261f docs(localNotification): update docs 2016-09-07 12:44:35 -04:00
Max Lynch
d8baf3a814 Merge pull request #524 from mattlewis92/ng1-promise-tweak
fix(ng1): fail gracefully when angular 1 promises can't be retrieved
2016-09-07 10:07:53 -05:00
Ibrahim Hadeed
c36b0a6b3f chore(): update changelog 2016-09-06 23:38:15 -04:00
Ibrahim Hadeed
3385a46648 1.3.21 2016-09-06 23:37:58 -04:00
Ibrahim Hadeed
550b8289c9 reafractor(file): add types to promises 2016-09-06 23:33:51 -04:00
Ibrahim Hadeed
2aa998f66f docs(googlemaps): improve usage 2016-09-06 23:23:51 -04:00
Ibrahim Hadeed
dff034a5b6 feat(googlemaps): can pass HTMLElement to constructor 2016-09-06 23:23:06 -04:00
Ibrahim Hadeed
c407b6d4f0 docs(googlemaps): improve usage 2016-09-06 23:21:29 -04:00
Ibrahim Hadeed
58c9439a32 docs(camera-preview): add usage
closes #363
2016-09-06 23:12:35 -04:00
Ibrahim Hadeed
c75f89894a fix(): remove CanvasCamera plugin 2016-09-06 23:04:53 -04:00
Ibrahim Hadeed
a566240266 fix(media): nest the constructor logic 2016-09-06 23:02:46 -04:00
Ibrahim Hadeed
d03d70ff0b fix(googlemaps): moveCamera and animateCamera now return a Promise
closes #511
2016-09-06 22:28:56 -04:00
Ibrahim Hadeed
7910493a6c fix(file): set exclusive to true when replace is false
closes #516
2016-09-06 22:24:34 -04:00
Ibrahim Hadeed
c76de34b97 fix(social-sharing): shareViaEmail now resolves/rejects when not providing optional args 2016-09-06 22:22:38 -04:00
Ibrahim Hadeed
ddae67913d chore(): lint 2016-09-06 21:59:58 -04:00
Ramon Henrique Ornelas
4f9716415b fix(social-sharing): various fixes (#520)
* feat(socialsharing): add method shareVia()

* docs(socialsharing): fix docs params Types

* docs(socialsharing): fix docs param Type method canShareVia

* docs(socialsharing): shareVia()

* fix(socialsharing): fix order callback, because params is optional

* feat(socialsharing): add params optionals canShareVia()

* docs(socialsharing): add returns Promise
2016-09-06 21:58:04 -04:00
Nicolas Perraut
caf2d67443 docs(statusbar): fix typo (#526) 2016-09-06 21:54:57 -04:00
Ramon Henrique Ornelas
393e9d0e00 feat(file): allows writeFile and writeExistingFile to accept Blob (#527) 2016-09-06 21:54:35 -04:00
Sergii Stotskyi
bbbd0d52e9 feat(file): adds chunked blob writing (#529)
This prevents devices crashing when user picks a big file to write
2016-09-06 21:53:42 -04:00
Barry Rowe
26dead93ff fix(geolocation): retain Observable even during an error condition (#532)
The way this was setup previously, if an error occurred on the watchPosition observable, the observer was sent an error, which would have to be caught. This also has the side effect of completing the observable, which means anything down stream that would be subscribed would be unsubscribed and no longer receive updates.

Instead of using binding the error callback to ```observer.error``` this change just binds the error callback to ```observer.next``` and lets the subscriber filter out results that match ```PositionError``` rather than having to manage re-subscribing (which could just immediately fail and enter a loop of catch/retry)
2016-09-06 21:52:43 -04:00
Matt Lewis
1facde3966 test(): add initial test suite (#523) 2016-09-06 21:42:29 -04:00
mhartington
d5513db9bb doc(media): improve docs 2016-09-06 15:48:53 -04:00
Matt Lewis
d135dc26e2 fix(ng1): fail gracefully when angular 1 promises can't be retrieved 2016-09-02 18:19:56 +01:00
Max Lynch
2dc68a4785 fix(ng1): grab injector from app. #451 2016-09-01 13:37:43 -05:00
Ramon Henrique Ornelas
2f706deb26 style(): fix Angular style TEMPLATE (#517)
* style(TEMPLATE): fix angular style

* docs(TEMPLATE): fix angular style docs template
2016-09-01 01:32:14 -04:00
Ramon Henrique Ornelas
54460e2362 style(): fix angular styles (#512)
* style(canva-camera): fix angular style

* style(crop): fix angular style

* style(file-chooser): fix angular style

* style(file-opener): fix angular style

* style(file): fix angular style

* style(inappbrowser): fix angular style

* style(instagram): fix angular style

* style(is-debug): fix angular style

* style(native-page-transitions): fix angular style

* style(market): fix angular style

* style(music-controls): fix angular style

* style(nfc): fix angular style

* style(pay-pal): fix angular style

* style(power-management): fix angular style

* style(securestorage): fix angular style

* style(streaming-media): fix angular style

* style(video-editor): fix angular style

* style(youtube-video-player): fix angular style
2016-08-31 17:02:15 -04:00
Ramon Henrique Ornelas
1db1374226 fix(base64togallery): fixes callbacks (#513) 2016-08-31 17:01:50 -04:00
Dominique Rau
3917a3f7b9 docs(tts): fix plugin name (#514) 2016-08-31 16:59:41 -04:00
Ibrahim Hadeed
210346e1e3 fix(diagnostics): fixes constants and other minor issues
fix(diagnostic): Some fixes regarding objects
2016-08-30 23:51:43 -04:00
Ibrahim Hadeed
f4efe1f6eb docs(contacts): document create method
Docs Contants.create()
2016-08-30 23:49:58 -04:00
Ibrahim Hadeed
04b24d255e docs(file): fix methods private exposed (#509) 2016-08-30 23:49:20 -04:00
Ramon Ornelas
e34c25b490 docs(file): fix methods private exposed 2016-08-30 14:45:52 -03:00
Ramon Ornelas
ea36333497 docs(contacts): add docs basic create() 2016-08-30 14:29:17 -03:00
Guille
f93f958d66 fix(diagnostic): Fix typo 2016-08-29 23:18:24 +02:00
Guille
8f3d36f4bc fix(diagnostic): Fix permissionStatus object 2016-08-29 16:58:58 +02:00
Guillermo
51364f8edd fix(mixpanel): Make eventProperties optional (#501)
* fix(mixpanel): Make eventProperties optional

* style(mixpanel): Match editorconfig
2016-08-29 10:58:00 -04:00
Guille
cb176aae90 fix(diagnostic): Fix diagnostic objects 2016-08-29 16:50:28 +02:00
Guille
9d573a92ce fix(diagnostic): Add DENIED_ALWAYS to permissionStatus, also some code formatting 2016-08-29 14:59:43 +02:00
Guillermo
877ac27868 fix(install-instructions): This fixes install instructions for deeplinks, facebook and googlemaps (#499) 2016-08-27 15:20:51 -04:00
58 changed files with 1651 additions and 409 deletions

View File

@@ -1,3 +1,65 @@
<a name="2.0.3"></a>
## [2.0.3](https://github.com/driftyco/ionic-native/compare/v1.3.21...v2.0.3) (2016-09-24)
### Bug Fixes
* **call-number:** number should be a string ([763ad1b](https://github.com/driftyco/ionic-native/commit/763ad1b)), closes [#545](https://github.com/driftyco/ionic-native/issues/545)
* **googlemaps:** CameraPosition target can now be LatLngBounds ([23fc908](https://github.com/driftyco/ionic-native/commit/23fc908)), closes [#547](https://github.com/driftyco/ionic-native/issues/547)
* **npm:** duplicate typings ([e50b961](https://github.com/driftyco/ionic-native/commit/e50b961))
* **plugins:** export VideoPlayer. Fixes [#563](https://github.com/driftyco/ionic-native/issues/563) ([4292959](https://github.com/driftyco/ionic-native/commit/4292959))
* **ts:** use old ts version for 1.3.x [#567](https://github.com/driftyco/ionic-native/issues/567) ([6a19c8c](https://github.com/driftyco/ionic-native/commit/6a19c8c))
* **webintent:** add type param. Fixes [#564](https://github.com/driftyco/ionic-native/issues/564) ([a0b6b10](https://github.com/driftyco/ionic-native/commit/a0b6b10))
### Features
* **background-geolocation:** add showAppSettings function ([281575b](https://github.com/driftyco/ionic-native/commit/281575b)), closes [#548](https://github.com/driftyco/ionic-native/issues/548)
* **BackgroundGeolocation:** code cleanup ([3170686](https://github.com/driftyco/ionic-native/commit/3170686))
* **BackgroundGeolocation:** Update to the latest version ([808a75e](https://github.com/driftyco/ionic-native/commit/808a75e))
* **BackgroundGeolocation:** Update to the latest version ([919e8da](https://github.com/driftyco/ionic-native/commit/919e8da))
* **build:** Support ES2015 modules ([4014972](https://github.com/driftyco/ionic-native/commit/4014972))
* **emailcomposer:** use new supported plugin. [#568](https://github.com/driftyco/ionic-native/issues/568) ([a092a31](https://github.com/driftyco/ionic-native/commit/a092a31))
* **localNotifications:** added register and has permission functions ([#536](https://github.com/driftyco/ionic-native/issues/536)) ([c83b043](https://github.com/driftyco/ionic-native/commit/c83b043))
* **npm:** typescript 2.0.2 ([e7e45f6](https://github.com/driftyco/ionic-native/commit/e7e45f6))
* **plugin:** cordova function override. fixes [#437](https://github.com/driftyco/ionic-native/issues/437) ([f60d08b](https://github.com/driftyco/ionic-native/commit/f60d08b))
* **push:** add coldstart property. Fixes [#559](https://github.com/driftyco/ionic-native/issues/559) ([48196da](https://github.com/driftyco/ionic-native/commit/48196da))
* **scripts:** publish script with npm and bower. Fixes [#448](https://github.com/driftyco/ionic-native/issues/448) ([3903fee](https://github.com/driftyco/ionic-native/commit/3903fee))
<a name="1.3.21"></a>
## [1.3.21](https://github.com/driftyco/ionic-native/compare/v1.3.20...v1.3.21) (2016-09-07)
### Bug Fixes
* **base64togallery:** fixes callbacks ([#513](https://github.com/driftyco/ionic-native/issues/513)) ([1db1374](https://github.com/driftyco/ionic-native/commit/1db1374))
* **diagnostic:** Add DENIED_ALWAYS to permissionStatus, also some code formatting ([9d573a9](https://github.com/driftyco/ionic-native/commit/9d573a9))
* **diagnostic:** Fix diagnostic objects ([cb176aa](https://github.com/driftyco/ionic-native/commit/cb176aa))
* **diagnostic:** Fix permissionStatus object ([8f3d36f](https://github.com/driftyco/ionic-native/commit/8f3d36f))
* **diagnostic:** Fix typo ([f93f958](https://github.com/driftyco/ionic-native/commit/f93f958))
* **file:** set exclusive to true when replace is false ([7910493](https://github.com/driftyco/ionic-native/commit/7910493)), closes [#516](https://github.com/driftyco/ionic-native/issues/516)
* **geolocation:** retain Observable even during an error condition ([#532](https://github.com/driftyco/ionic-native/issues/532)) ([26dead9](https://github.com/driftyco/ionic-native/commit/26dead9))
* **googlemaps:** moveCamera and animateCamera now return a Promise ([d03d70f](https://github.com/driftyco/ionic-native/commit/d03d70f)), closes [#511](https://github.com/driftyco/ionic-native/issues/511)
* **install-instructions:** This fixes install instructions for deeplinks, facebook and googlemaps ([#499](https://github.com/driftyco/ionic-native/issues/499)) ([877ac27](https://github.com/driftyco/ionic-native/commit/877ac27))
* **media:** nest the constructor logic ([a566240](https://github.com/driftyco/ionic-native/commit/a566240))
* **mixpanel:** Make eventProperties optional ([#501](https://github.com/driftyco/ionic-native/issues/501)) ([51364f8](https://github.com/driftyco/ionic-native/commit/51364f8))
* **ng1:** fail gracefully when angular 1 promises can't be retrieved ([d135dc2](https://github.com/driftyco/ionic-native/commit/d135dc2))
* **ng1:** grab injector from app. [#451](https://github.com/driftyco/ionic-native/issues/451) ([2dc68a4](https://github.com/driftyco/ionic-native/commit/2dc68a4))
* remove CanvasCamera plugin ([c75f898](https://github.com/driftyco/ionic-native/commit/c75f898))
* **social-sharing:** shareViaEmail now resolves/rejects when not providing optional args ([c76de34](https://github.com/driftyco/ionic-native/commit/c76de34))
* **social-sharing:** various fixes ([#520](https://github.com/driftyco/ionic-native/issues/520)) ([4f97164](https://github.com/driftyco/ionic-native/commit/4f97164))
### Features
* **file:** adds chunked blob writing ([#529](https://github.com/driftyco/ionic-native/issues/529)) ([bbbd0d5](https://github.com/driftyco/ionic-native/commit/bbbd0d5))
* **file:** allows writeFile and writeExistingFile to accept Blob ([#527](https://github.com/driftyco/ionic-native/issues/527)) ([393e9d0](https://github.com/driftyco/ionic-native/commit/393e9d0))
* **googlemaps:** can pass HTMLElement to constructor ([dff034a](https://github.com/driftyco/ionic-native/commit/dff034a))
<a name="1.3.20"></a>
## [1.3.20](https://github.com/driftyco/ionic-native/compare/v1.3.19...v1.3.20) (2016-08-27)
@@ -102,12 +164,13 @@
<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)
## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.14) (2016-08-15)
### Bug Fixes
* **datepicker:** date now accepts Date, string, or number ([#428](https://github.com/driftyco/ionic-native/issues/428)) ([aaddd9e](https://github.com/driftyco/ionic-native/commit/aaddd9e)), closes [#354](https://github.com/driftyco/ionic-native/issues/354)
* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
### Features
@@ -118,25 +181,24 @@
<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)
<a name="1.3.12"></a>
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.11...v1.3.12) (2016-08-13)
### Bug Fixes
* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866))
<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)
<a name="1.3.11"></a>
## [1.3.11](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.11) (2016-08-11)
### Bug Fixes
* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681))
* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7))
* **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))
@@ -309,12 +371,28 @@
<a name="1.3.1"></a>
## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26)
## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.1) (2016-06-26)
### Bug Fixes
* **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232)
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3))
### Features
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
<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)
* **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))
@@ -323,7 +401,6 @@
* **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e))
* **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164)
* **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f))
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3))
### Features
@@ -331,13 +408,6 @@
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
* **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115)
* **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed))
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
<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)

View File

@@ -10,8 +10,8 @@
* - Remove this note
*
*/
import {Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty} from './plugin';
import {Observable} from 'rxjs/Observable';
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name PluginName
@@ -20,7 +20,7 @@ import {Observable} from 'rxjs/Observable';
*
* @usage
* ```
* import {PluginName} from 'ionic-native';
* import { PluginName } from 'ionic-native';
*
* PluginName.functionName('Hello', 123)
* .then((something: any) => doSomething(something))

View File

@@ -1,11 +1,11 @@
import {Plugin} from './plugin';
import { Plugin } from './plugin';
/**
* @name PluginName
* @description
*
* @usage
* ```
* import {PluginName} from 'ionic-native';
* import { PluginName } from 'ionic-native';
*
*
* ```

View File

@@ -17,7 +17,7 @@ dependencies:
test:
override:
- echo "No tests are written at the moment. But we will attempt to build the library with the latest changes."
- npm test
- npm run build
deployment:

60
karma.conf.ts Normal file
View File

@@ -0,0 +1,60 @@
const WATCH = process.argv.indexOf('--watch') > -1;
module.exports = config => {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'browserify'],
// list of files / patterns to load in the browser
files: [
'test/**/*.spec.ts'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/**/*.spec.ts': ['browserify']
},
browserify: {
plugin: [ 'tsify' ],
extensions: ['.js', '.ts']
},
phantomjsLauncher: {
// Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
exitOnResourceError: true
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: WATCH,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: !WATCH
});
};

View File

@@ -1,8 +1,10 @@
{
"name": "ionic-native",
"version": "1.3.20",
"version": "2.0.3",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"main": "dist/es5/index.js",
"typings": "dist/es5/index.d.ts",
"module": "dist/esm/index.js",
"files": [
"dist"
],
@@ -19,6 +21,7 @@
"decamelize": "^1.2.0",
"dgeni": "^0.4.2",
"dgeni-packages": "^0.10.18",
"es6-shim": "~0.35.1",
"glob": "^6.0.4",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
@@ -26,25 +29,35 @@
"gulp-tslint": "^5.0.0",
"gulp-uglify": "^1.5.4",
"ionic-gulp-tslint": "^1.0.0",
"jasmine-core": "~2.5.0",
"karma": "~1.2.0",
"karma-browserify": "~5.1.0",
"karma-jasmine": "~1.0.2",
"karma-phantomjs-launcher": "~1.0.2",
"lodash": "3.10.1",
"minimist": "^1.1.3",
"mkdirp": "^0.5.1",
"node-html-encoder": "0.0.2",
"q": "1.4.1",
"semver": "^5.0.1",
"tsify": "~1.0.4",
"tslint": "^3.8.1",
"tslint-ionic-rules": "0.0.5",
"typescript": "^1.8.10"
"typescript": "^2.0.1",
"watchify": "~3.7.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "./node_modules/.bin/gulp lint",
"watch": "./node_modules/.bin/tsc -w",
"test": "karma start",
"test:watch": "npm test -- --watch",
"start": "npm run test:watch",
"lint": "gulp lint",
"watch": "tsc -w",
"build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify",
"build:js": "./node_modules/.bin/tsc",
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
"build:minify": "./node_modules/.bin/gulp minify:dist",
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"build:js": "tsc",
"build:bundle": "browserify dist/index.js > dist/ionic.native.js",
"build:minify": "gulp minify:dist",
"shipit": "npm run build && npm publish && bash ./scripts/bower.sh",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"plugin:create": "gulp plugin:create"
},
"repository": {
@@ -56,7 +69,6 @@
"url": "https://github.com/driftyco/ionic-native/issues"
},
"homepage": "https://github.com/driftyco/ionic-native",
"typings": "./dist/index.d.ts",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"

View File

@@ -21,7 +21,6 @@ import { BLE } from './plugins/ble';
import { BluetoothSerial } from './plugins/bluetoothserial';
import { Calendar } from './plugins/calendar';
import { CallNumber } from './plugins/call-number';
import { CanvasCamera } from './plugins/canvas-camera';
import { Camera } from './plugins/camera';
import { CameraPreview } from './plugins/camera-preview';
import { CardIO } from './plugins/card-io';
@@ -162,7 +161,6 @@ Brightness,
BLE,
BluetoothSerial,
CallNumber,
CanvasCamera,
CameraPreview,
Clipboard,
CodePush,
@@ -209,6 +207,7 @@ TouchID,
Transfer,
TextToSpeech,
Vibration,
VideoPlayer,
WebIntent,
YoutubeVideoPlayer,
Zip
@@ -235,7 +234,6 @@ window['IonicNative'] = {
BluetoothSerial,
Calendar,
CallNumber,
CanvasCamera,
Camera,
CameraPreview,
CardIO,

View File

@@ -7,14 +7,15 @@ declare var window;
*/
export function initAngular1(plugins) {
if (window.angular) {
window.angular.module('ionic.native', []);
const ngModule = window.angular.module('ionic.native', []);
for (var name in plugins) {
let serviceName = '$cordova' + name;
let cls = plugins[name];
(function(serviceName, cls, name) {
window.angular.module('ionic.native').service(serviceName, [function() {
ngModule.service(serviceName, [function() {
var funcs = window.angular.copy(cls);
funcs.prototype['name'] = name;
return funcs;

View File

@@ -1,8 +1,7 @@
import { Cordova, Plugin } from './plugin';
import {Cordova, Plugin} from './plugin';
declare var window;
export interface Location {
/**
@@ -104,6 +103,22 @@ export interface Config {
*/
stopOnTerminate?: boolean;
/**
* ANDROID ONLY
* Start background service on device boot.
*
* Defaults to false
*/
startOnBoot?: boolean;
/**
* ANDROID ONLY
* If false location service will not be started in foreground and no notification will be shown.
*
* Defaults to true
*/
startForeground?: boolean;
/**
* ANDROID, WP8 ONLY
* The minimum time interval between location updates in seconds.
@@ -131,12 +146,19 @@ export interface Config {
*/
notificationIconColor?: string;
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
*/
notificationIcon?: string;
notificationIconLarge?: string;
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
*/
notificationIconSmall?: string;
/**
* ANDROID ONLY
@@ -152,6 +174,52 @@ export interface Config {
*/
activityType?: string;
/**
* IOS ONLY
* Pauses location updates when app is paused
*
* Defaults to true
*/
pauseLocationUpdates?: boolean;
/**
* Server url where to send HTTP POST with recorded locations
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
*/
url?: string;
/**
* Server url where to send fail to post locations
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
*/
syncUrl?: string;
/**
* Specifies how many previously failed locations will be sent to server at once
*
* Defaults to 100
*/
syncThreshold?: number;
/**
* Optional HTTP headers sent along in HTTP request
*/
httpHeaders?: any;
/**
* IOS ONLY
* Switch to less accurate significant changes and region monitory when in background (default)
*
* Defaults to 100
*/
saveBatteryOnBackground?: boolean;
/**
* Limit maximum number of locations stored into db
*
* Defaults to 10000
*/
maxLocations?: number;
}
/**
@@ -168,7 +236,8 @@ export interface Config {
*
* // When device is ready :
* platform.ready().then(() => {
*
* // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
*
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
* let config = {
* desiredAccuracy: 10,
@@ -207,13 +276,61 @@ export interface Config {
})
export class BackgroundGeolocation {
/**
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
*
* Possible values:
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
* ANDROID_ACTIVITY_PROVIDER: 1
*
* @enum {number}
*/
static LocationProvider: any = {
ANDROID_DISTANCE_FILTER_PROVIDER: 0,
ANDROID_ACTIVITY_PROVIDER: 1
};
/**
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
* 1000 results in lowest power drain and least accurate readings.
*
* Possible values:
* HIGH: 0
* MEDIUM: 10
* LOW: 100
* PASSIVE: 1000
*
* enum {number}
*/
static Accuracy: any = {
HIGH: 0,
MEDIUM: 10,
LOW: 100,
PASSIVE: 1000
};
/**
* Used in the switchMode function
*
* Possible values:
* BACKGROUND: 0
* FOREGROUND: 1
*
* @enum {number}
*/
static Mode: any = {
BACKGROUND: 0,
FOREGROUND: 1
};
/**
* Configure the plugin.
*
*
* @param {Function} Success callback will be called when background location is determined.
* @param {Function} Fail callback to be executed every time a geolocation error occurs.
* @param {Object} An object of type Config
*
*
* @return Location object, which tries to mimic w3c Coordinates interface.
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
* Callback to be executed every time a geolocation is recorded in the background.
@@ -223,7 +340,6 @@ export class BackgroundGeolocation {
})
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
/**
* Turn ON the background-geolocation system.
* The user will be tracked whenever they suspend the app.
@@ -231,14 +347,12 @@ export class BackgroundGeolocation {
@Cordova()
static start(): Promise<any> { return; }
/**
* Turn OFF background-tracking
*/
@Cordova()
static stop(): Promise<any> { return; }
/**
* Inform the native plugin that you're finished, the background-task may be completed
* NOTE: IOS, WP only
@@ -246,7 +360,6 @@ export class BackgroundGeolocation {
@Cordova()
static finish() { }
/**
* Force the plugin to enter "moving" or "stationary" state
* NOTE: IOS, WP only
@@ -254,7 +367,6 @@ export class BackgroundGeolocation {
@Cordova()
static changePace(isMoving: boolean) { }
/**
* Setup configuration
*/
@@ -286,11 +398,17 @@ export class BackgroundGeolocation {
@Cordova()
static isLocationEnabled(): Promise<number> { return; }
/**
* Display app settings to change permissions
*/
@Cordova({sync: true})
static showAppSettings(): void { }
/**
* Display device location settings
*/
@Cordova()
static showLocationSettings() { }
@Cordova({sync: true})
static showLocationSettings(): void { }
/**
* Method can be used to detect user changes in location services settings.
@@ -320,6 +438,12 @@ export class BackgroundGeolocation {
@Cordova()
static getLocations(): Promise<any> { return; }
/**
* Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
*/
@Cordova()
static getValidLocations(): Promise<any> { return; }
/**
* Delete stored location by given locationId.
* NOTE: ANDROID only
@@ -334,4 +458,29 @@ export class BackgroundGeolocation {
@Cordova()
static deleteAllLocations(): Promise<any> { return; }
/**
* Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself.
* Calling switchMode you can override plugin behavior and force plugin to switch into other mode.
*
* In FOREGROUND mode plugin uses iOS local manager to receive locations and behavior is affected by option.desiredAccuracy and option.distanceFilter.
* In BACKGROUND mode plugin uses significant changes and region monitoring to receive locations and uses option.stationaryRadius only.
*
* BackgroundGeolocation.Mode.FOREGROUND
* BackgroundGeolocation.Mode.BACKGROUND
*
* NOTE: iOS only
*
* @param {number} See above.
*/
@Cordova()
static switchMode(modeId: number): Promise<any> { return; }
/**
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
* @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
*
* @param {number} Limits the number of entries
*/
@Cordova()
static getLogEntries(limit: number): Promise<any> { return; }
}

View File

@@ -1,4 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Cordova, CordovaFunctionOverride, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name Background Mode
@@ -80,17 +82,25 @@ export class BackgroundMode {
@Cordova({
platforms: ['Android']
})
static update(options?: Configure): void { }
static configure(options?: Configure): void { }
/**
* Sets a callback for a specific event
* Can be used to get notified or run function when the background mode has been activated, deactivated or failed.
* @param {string} eventName The name of the event. Available events: activate, deactivate, failure
* Called when background mode is activated.
*/
@Cordova({
sync: true
})
static on(eventName: string, callback: any): void { }
@CordovaFunctionOverride()
static onactivate(): Observable<any> { return; };
/**
* Called when background mode is deactivated.
*/
@CordovaFunctionOverride()
static ondeactivate(): Observable<any> { return; };
/**
* Called when background mode fails
*/
@CordovaFunctionOverride()
static onfailure(): Observable<any> { return; };
}

View File

@@ -27,7 +27,10 @@ export class Base64ToGallery {
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
* @returns {Promise} returns a promise that resolves when the image is saved.
*/
@Cordova()
@Cordova({
successIndex: 2,
errorIndex: 3
})
static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
return;
}

View File

@@ -24,13 +24,13 @@ import { Plugin, Cordova } from './plugin';
export class CallNumber {
/**
* Calls a phone number
* @param numberToCall {number} The phone number to call
* @param numberToCall {string} The phone number to call as a string
* @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer
*/
@Cordova({
callbackOrder: 'reverse'
})
static callNumber(numberToCall: number, bypassAppChooser: boolean): Promise<any> {
static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
return;
}
}

View File

@@ -21,6 +21,52 @@ export interface CameraPreviewSize {
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
* @usage
* ```
* import { CameraPreview } from 'ionic-native';
*
* // camera options (Size and location)
* let cameraRect: CameraPreviewRect = {
* x: 100,
* y: 100,
* width: 200,
* height: 200
* };
*
*
* // start camera
* CameraPreview.startCamera(
* cameraRect, // position and size of preview
* 'front', // default camera
* true, // tape to take picture
* false, // disable drag
* true // send the preview to the back of the screen so we can add overlaying elements
* );
*
* // Set the handler to run every time we take a picture
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
* console.log(result);
* // do something with the result
* });
*
*
* // take a picture
* CameraPreview.takePicture({
* maxWidth: 640,
* maxHeight: 640
* });
*
* // Switch camera
* CameraPreview.switchCamera();
*
* // set color effect to negative
* CameraPreview.setColorEffect('negative');
*
* // Stop the camera preview
* CameraPreview.stopCamera();
*
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-camera-preview',
@@ -42,9 +88,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void {
};
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { };
/**
* Stops the camera preview instance.

View File

@@ -204,6 +204,6 @@ export class Camera {
@Cordova({
platforms: ['iOS']
})
static cleanup() { };
static cleanup(): Promise<any> { return; };
}

View File

@@ -1,94 +0,0 @@
import {Plugin, Cordova} from './plugin';
/**
* @name CanvasCamera
* @description
*
* @usage
* ```
* import {CanvasCamera} from 'ionic-native';
*
* let object = document.getElementById('myDiv');
* // or
* @ViewChild('myDiv') object;
*
* CanvasCamera.initialize(object);
*
* CanvasCamera.start();
*
* CanvasCamera.takePicture().then(picture => { });
*
* ```
*/
@Plugin({
plugin: 'com.keith.cordova.plugin.canvascamera',
pluginRef: 'CanvasCamera',
repo: 'https://github.com/donaldp24/CanvasCameraPlugin'
})
export class CanvasCamera {
static DestinationType = {
DATA_URL: 0,
FILE_URI: 1
};
static PictureSourceType = {
PHOTOLIBRARY : 0,
CAMERA : 1,
SAVEDPHOTOALBUM : 2
};
static EncodingType = {
JPEG : 0,
PNG : 1
};
static CameraPosition = {
BACK : 0,
FRONT : 1
};
static FlashMode = {
OFF : 0,
ON : 1,
AUTO : 2
};
/**
* Initialize the Camera
* @param htmlElement {HTMLElement} The HTML Element to preview the camera in
*/
@Cordova({sync: true})
static initialize(htmlElement: HTMLElement): void { }
/**
* Start capture video as images from camera to preview camera on web page.
* @param options
*/
@Cordova({sync: true})
static start(options?: {
quality?: number;
sourceType?: number;
destinationType?: number;
allowEdit?: boolean;
correctOrientation?: boolean;
saveToPhotoAlbum?: boolean;
encodingType?: number;
width?: number;
height?: number;
}): void { }
/**
* Takes a photo
* @returns {Promise<any>}
*/
@Cordova()
static takePicture(): Promise<any> {return; }
/**
* Sets the flash mode
* @param flashMode {number} Flash mode, use CanvasCamera.FlashMode constant to set
*/
@Cordova({sync: true})
static setFlashMode(flashMode: number): void { }
/**
* Set camera position
* @param cameraPosition {number} Camera Position, use CanvasCamera.CameraPosition constant
*/
@Cordova({sync: true})
static setCameraPosition(cameraPosition: number): void {}
}

View File

@@ -277,6 +277,10 @@ export class ContactFindOptions implements IContactFindOptions {
repo: 'https://github.com/apache/cordova-plugin-contacts'
})
export class Contacts {
/**
* Create a single contact.
* @return Returns a object Contact
*/
static create(): Contact {
return new Contact();
}

View File

@@ -1,4 +1,4 @@
import {Cordova, Plugin} from './plugin';
import { Cordova, Plugin } from './plugin';
/**
* @name Crop
* @description Crops images
@@ -30,5 +30,5 @@ export class Crop {
@Cordova({
callbackOrder: 'reverse'
})
static crop(pathToImage: string, options?: {quality: number}): Promise<string> {return; }
static crop(pathToImage: string, options?: {quality: number}): Promise<string> { return; }
}

View File

@@ -36,7 +36,8 @@ export interface DeeplinkMatch {
plugin: 'ionic-plugin-deeplinks',
pluginRef: 'IonicDeeplink',
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
platforms: ['iOS', 'Android']
platforms: ['iOS', 'Android'],
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
})
export class Deeplinks {

View File

@@ -1,4 +1,4 @@
import {Cordova, Plugin} from './plugin';
import { Cordova, Plugin } from './plugin';
/**
* @name Diagnostic
@@ -19,7 +19,7 @@ import {Cordova, Plugin} from './plugin';
*
* Diagnostic.getBluetoothState()
* .then((state) => {
* if(state == Diagnostic.bluetoothStates.POWERED_ON){
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
* // do something
* } else {
* // do something else
@@ -36,68 +36,74 @@ import {Cordova, Plugin} from './plugin';
export class Diagnostic {
static permission = {
'READ_CALENDAR': 'READ_CALENDAR',
'WRITE_CALENDAR': 'WRITE_CALENDAR',
'CAMERA': 'CAMERA',
'READ_CONTACTS': 'READ_CONTACTS',
'WRITE_CONTACTS': 'WRITE_CONTACTS',
'GET_ACCOUNTS': 'GET_ACCOUNTS',
'ACCESS_FINE_LOCATION': 'ACCESS_FINE_LOCATION',
'ACCESS_COARSE_LOCATION': 'ACCESS_COARSE_LOCATION',
'RECORD_AUDIO': 'RECORD_AUDIO',
'READ_PHONE_STATE': 'READ_PHONE_STATE',
'CALL_PHONE': 'CALL_PHONE',
'ADD_VOICEMAIL': 'ADD_VOICEMAIL',
'USE_SIP': 'USE_SIP',
'PROCESS_OUTGOING_CALLS': 'PROCESS_OUTGOING_CALLS',
'READ_CALL_LOG': 'READ_CALL_LOG',
'WRITE_CALL_LOG': 'WRITE_CALL_LOG',
'SEND_SMS': 'SEND_SMS',
'RECEIVE_SMS': 'RECEIVE_SMS',
'READ_SMS': 'READ_SMS',
'RECEIVE_WAP_PUSH': 'RECEIVE_WAP_PUSH',
'RECEIVE_MMS': 'RECEIVE_MMS',
'WRITE_EXTERNAL_STORAGE': 'WRITE_EXTERNAL_STORAGE',
'READ_EXTERNAL_STORAGE': 'READ_EXTERNAL_STORAGE',
'BODY_SENSORS': 'BODY_SENSORS'
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'
GRANTED: 'GRANTED',
GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS
RESTRICTED: 'RESTRICTED', // iOS
DENIED: 'DENIED',
DENIED_ALWAYS: 'DENIED_ALWAYS', // android
NOT_REQUESTED: 'NOT_REQUESTED'
};
static locationAuthorizationMode = {
'ALWAYS': 'always',
'WHEN_IN_USE': 'when_in_use'
ALWAYS: 'ALWAYS',
WHEN_IN_USE: 'WHEN_IN_USE'
};
static permissionGroups = {
'GRANTED': 'GRANTED',
'DENIED': 'DENIED',
'NOT_REQUESTED': 'NOT_REQUESTED',
'DENIED_ALWAYS': 'DENIED_ALWAYS'
CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
CAMERA: ['CAMERA'],
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
MICROPHONE: ['RECORD_AUDIO'],
PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
SENSORS: ['BODY_SENSORS'],
SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
};
static locationMode = {
'HIGH_ACCURACY': 'high_accuracy',
'DEVICE_ONLY': 'device_only',
'BATTERY_SAVING': 'battery_saving',
'LOCATION_OFF': 'location_off'
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'
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'
};
@@ -135,32 +141,32 @@ export class Diagnostic {
/**
* Displays the device location settings to allow user to enable location services/change location mode.
*/
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
@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']})
@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']})
@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']})
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToWifiSettings(): void { }
/**
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'Windows 10']})
@Cordova({ platforms: ['Android', 'Windows 10'] })
static isWifiEnabled(): Promise<boolean> { return; }
/**
@@ -168,7 +174,7 @@ export class Diagnostic {
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
* @param state {boolean}
*/
@Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']})
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setWifiState(state: boolean): Promise<any> { return; }
/**
@@ -176,15 +182,15 @@ export class Diagnostic {
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
* @param state {boolean}
*/
@Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']})
@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.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static isLocationEnabled(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android', 'iOS'] })
static isLocationEnabled(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use location.
@@ -198,8 +204,8 @@ export class Diagnostic {
* Returns the location authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static getLocationAuthorizationStatus(): Promise<any> {return; }
@Cordova({ platforms: ['Android', 'iOS'] })
static getLocationAuthorizationStatus(): Promise<any> { return; }
/**
* Returns the location authorization status for the application.
@@ -208,14 +214,14 @@ export class Diagnostic {
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
/**
* Checks if camera hardware is present on device.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraPresent(): Promise<any> { return; }
/**
@@ -223,63 +229,63 @@ export class Diagnostic {
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraAuthorized(): Promise<any> { return; }
/**
* Returns the camera authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getCameraAuthorizationStatus(): Promise<any> { return; }
/**
* Requests camera authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCameraAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the microphone.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isMicrophoneAuthorized(): Promise<boolean> { return; }
/**
* Returns the microphone authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
/**
* Requests microphone authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestMicrophoneAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use contacts (address book).
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isContactsAuthorized(): Promise<boolean> { return; }
/**
* Returns the contacts authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getContactsAuthroizationStatus(): Promise<any> { return; }
/**
* Requests contacts authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestContactsAuthorization(): Promise<any> { return; }
/**
@@ -292,7 +298,7 @@ export class Diagnostic {
* - This relates to Calendar Events (not Calendar Reminders)
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isCalendarAuthorized(): Promise<boolean> { return; }
/**
@@ -306,7 +312,7 @@ export class Diagnostic {
*
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getCalendarAuthorizationStatus(): Promise<any> { return; }
/**
@@ -323,7 +329,7 @@ export class Diagnostic {
*
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCalendarAuthorization(): Promise<any> { return; }
/**
@@ -332,28 +338,28 @@ export class Diagnostic {
* 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.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static switchToSettings(): Promise<any> {return; }
@Cordova({ platforms: ['Android', 'iOS'] })
static switchToSettings(): Promise<any> { return; }
/**
* Returns the state of Bluetooth on the device.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static getBluetoothState(): Promise<any> {return; }
@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})
@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})
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerLocationStateChangeHandler(handler: Function): void { }
/**
@@ -361,8 +367,8 @@ export class Diagnostic {
* 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.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android']})
static isGpsLocationAvailable(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static isGpsLocationAvailable(): Promise<boolean> { return; }
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
@@ -370,7 +376,7 @@ export class Diagnostic {
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova({platforms: ['Android']})
@Cordova({ platforms: ['Android'] })
static isGpsLocationEnabled(): Promise<any> { return; }
/**
@@ -378,8 +384,8 @@ export class Diagnostic {
* 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.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android']})
static isNetworkLocationAvailable(): Promise<any> {return; }
@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.
@@ -388,15 +394,15 @@ export class Diagnostic {
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android']})
@Cordova({ platforms: ['Android'] })
static isNetworkLocationEnabled(): Promise<any> { return; }
/**
* Returns the current location mode setting for the device.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android']})
static getLocationMode(): Promise<any> {return; }
@Cordova({ platforms: ['Android'] })
static getLocationMode(): Promise<any> { return; }
/**
* Returns the current authorisation status for a given permission.
@@ -404,8 +410,8 @@ export class Diagnostic {
* @param permission
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
static getPermissionAuthorizationStatus(permission: any): Promise<any> {return; }
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
/**
* Returns the current authorisation status for multiple permissions.
@@ -413,8 +419,8 @@ export class Diagnostic {
* @param permissions
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> {return; }
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
/**
* Requests app to be granted authorisation for a runtime permission.
@@ -422,8 +428,8 @@ export class Diagnostic {
* @param permission
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
static requestRuntimePermission(permission: any): Promise<any> {return; }
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static requestRuntimePermission(permission: any): Promise<any> { return; }
/**
* Requests app to be granted authorisation for multiple runtime permissions.
@@ -431,51 +437,51 @@ export class Diagnostic {
* @param permissions
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
static requestRuntimePermissions(permissions: any[]): Promise<any> {return; }
@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
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static isBluetoothEnabled(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static isBluetoothEnabled(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static hasBluetoothSupport(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static hasBluetoothSupport(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static hasBluetoothLESupport(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static hasBluetoothLESupport(): Promise<boolean> { return; }
/**
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static hasBluetoothLEPeripheralSupport(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isCameraRollAuthorized(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isCameraRollAuthorized(): Promise<boolean> { return; }
/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static getCameraRollAuthorizationStatus(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
/**
* Requests camera roll authorization for the application.
@@ -483,64 +489,64 @@ export class Diagnostic {
* Calling it when in any other state will have no effect.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static requestCameraRollAuthorization(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static requestCameraRollAuthorization(): Promise<any> { return; }
/**
* Checks if remote (push) notifications are enabled.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isRemoteNotificationsEnabled(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isRemoteNotificationsEnabled(): Promise<boolean> { return; }
/**
* Indicates if the app is registered for remote (push) notifications on the device.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isRegisteredForRemoteNotifications(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
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.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static getRemoteNotificationTypes(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static getRemoteNotificationTypes(): Promise<any> { return; }
/**
* Checks if the application is authorized to use reminders.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isRemindersAuthorized(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isRemindersAuthorized(): Promise<boolean> { return; }
/**
* Returns the reminders authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static getRemindersAuthorizationStatus(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static getRemindersAuthorizationStatus(): Promise<any> { return; }
/**
* Requests reminders authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static requestRemindersAuthorization(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static requestRemindersAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized for background refresh.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isBackgroundRefreshAuthorized(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
/**
* Returns the background refresh authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static getBackgroundRefreshStatus(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static getBackgroundRefreshStatus(): Promise<any> { return; }
}

View File

@@ -44,10 +44,10 @@ declare var cordova: any;
* ```
*/
@Plugin({
plugin: 'cordova-plugin-email-composer',
plugin: 'cordova-plugin-email',
pluginRef: 'cordova.plugins.email',
repo: 'https://github.com/katzer/cordova-plugin-email-composer.git',
platforms: ['Android', 'iOS', 'Windows Phone 8']
repo: 'https://github.com/hypery2k/cordova-email-plugin',
platforms: ['Android', 'iOS']
})
export class EmailComposer {

View File

@@ -81,7 +81,7 @@ import { Cordova, Plugin } from './plugin';
plugin: 'cordova-plugin-facebook4',
pluginRef: 'facebookConnectPlugin',
repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
install: 'cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"'
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"'
})
export class Facebook {

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name FileChooser
* @description
@@ -26,5 +26,5 @@ export class FileChooser {
* Open a file
*/
@Cordova()
static open(): Promise<string> {return; }
static open(): Promise<string> { return; }
}

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name FileOpener
* @description

View File

@@ -1,4 +1,5 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
declare var window: any;
declare var cordova: any;
@@ -429,7 +430,7 @@ export class File {
create: true
};
if (replace) {
if (!replace) {
options.exclusive = true;
}
@@ -657,12 +658,12 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string} text content to write
* @param {string | Blob} text content or blob to write
* @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information.
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeFile(path: string, fileName: string,
text: string, replaceOrOptions: boolean | WriteOptions): Promise<void> {
text: string | Blob, replaceOrOptions: boolean | WriteOptions): Promise<void> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -700,10 +701,10 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string} text content to write
* @param {string | Blob} text content or blob to write
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeExistingFile(path: string, fileName: string, text: string): Promise<void> {
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -742,7 +743,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -783,7 +784,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -825,7 +826,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -866,7 +867,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -950,13 +951,18 @@ export class File {
// these private methods help avoid cascading error handling
// in the public ones, primarily simply wrapping callback
// operations to return Promises that can then be chained.
/**
* @private
*/
private static fillErrorMessage(err: FileError): void {
err.message = File.cordovaFileError[err.code];
}
/**
* @private
*/
private static resolveLocalFilesystemUrl(furl: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
try {
window.resolveLocalFileSystemURL(furl, (entry) => {
resolve(entry);
@@ -971,6 +977,9 @@ export class File {
});
}
/**
* @private
*/
private static resolveDirectoryUrl(durl: string): Promise<DirectoryEntry> {
return File.resolveLocalFilesystemUrl(durl)
.then((de) => {
@@ -984,8 +993,11 @@ export class File {
});
}
/**
* @private
*/
private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise<DirectoryEntry> {
return new Promise((resolve, reject) => {
return new Promise<DirectoryEntry>((resolve, reject) => {
try {
fse.getDirectory(dn, flags, (de) => {
resolve(de);
@@ -1000,8 +1012,11 @@ export class File {
});
}
/**
* @private
*/
private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise<FileEntry> {
return new Promise((resolve, reject) => {
return new Promise<FileEntry>((resolve, reject) => {
try {
fse.getFile(fn, flags, (fe) => {
resolve(fe);
@@ -1016,8 +1031,11 @@ export class File {
});
}
/**
* @private
*/
private static remove(fe: Entry): Promise<RemoveResult> {
return new Promise((resolve, reject) => {
return new Promise<RemoveResult>((resolve, reject) => {
fe.remove(() => {
resolve({success: true, fileRemoved: fe});
}, (err) => {
@@ -1027,8 +1045,11 @@ export class File {
});
}
/**
* @private
*/
private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
srce.moveTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
@@ -1038,8 +1059,11 @@ export class File {
});
}
/**
* @private
*/
private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
srce.copyTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
@@ -1049,8 +1073,11 @@ export class File {
});
}
/**
* @private
*/
private static readEntries(dr: DirectoryReader): Promise<Entry[]> {
return new Promise((resolve, reject) => {
return new Promise<Entry[]>((resolve, reject) => {
dr.readEntries((entries) => {
resolve(entries);
}, (err) => {
@@ -1060,8 +1087,11 @@ export class File {
});
}
/**
* @private
*/
private static rimraf(de: DirectoryEntry): Promise<RemoveResult> {
return new Promise((resolve, reject) => {
return new Promise<RemoveResult>((resolve, reject) => {
de.removeRecursively(() => {
resolve({success: true, fileRemoved: de});
}, (err) => {
@@ -1071,8 +1101,11 @@ export class File {
});
}
/**
* @private
*/
private static createWriter(fe: FileEntry): Promise<FileWriter> {
return new Promise((resolve, reject) => {
return new Promise<FileWriter>((resolve, reject) => {
fe.createWriter((writer) => {
resolve(writer);
}, (err) => {
@@ -1082,7 +1115,14 @@ export class File {
});
}
private static write(writer: FileWriter, gu: string | Blob): Promise<void> {
/**
* @private
*/
private static write(writer: FileWriter, gu: string | Blob): Promise<any> {
if (gu instanceof Blob) {
return this.writeFileInChunks(writer, gu);
}
return new Promise<void>((resolve, reject) => {
writer.onwriteend = (evt) => {
if (writer.error) {
@@ -1094,4 +1134,32 @@ export class File {
writer.write(gu);
});
}
/**
* @private
*/
private static writeFileInChunks(writer: FileWriter, file: Blob) {
const BLOCK_SIZE = 1024 * 1024;
let writtenSize = 0;
function writeNextChunk() {
const size = Math.min(BLOCK_SIZE, file.size - writtenSize);
const chunk = file.slice(writtenSize, writtenSize + size);
writtenSize += size;
writer.write(chunk);
}
return new Promise<any>((resolve, reject) => {
writer.onerror = reject;
writer.onwrite = () => {
if (writtenSize < file.size) {
writeNextChunk();
} else {
resolve();
}
};
writeNextChunk();
});
}
}

View File

@@ -62,6 +62,18 @@ export interface Geoposition {
timestamp: number;
}
export interface PositionError {
/**
* A code that indicates the error that occurred
*/
code: number;
/**
* A message that can describe the error that occurred
*/
message: string;
}
export interface GeolocationOptions {
/**
* Is a positive long value indicating the maximum age in milliseconds of a
@@ -140,7 +152,9 @@ export class Geolocation {
* Observable changes.
*
* ```typescript
* var subscription = Geolocation.watchPosition().subscribe(position => {
* var subscription = Geolocation.watchPosition()
* .filter((p) => p.code === undefined) //Filter Out Errors
* .subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
* });
*
@@ -151,10 +165,10 @@ export class Geolocation {
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
*/
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
static watchPosition(options?: GeolocationOptions): Observable<Geoposition | PositionError> {
return new Observable<Geoposition>(
(observer: any) => {
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.error.bind(observer), options);
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options);
return () => navigator.geolocation.clearWatch(watchId);
}
);

View File

@@ -48,20 +48,51 @@ export const GoogleMapsAnimation = {
* ```
* import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
*
* ...
* // create a new map using element ID
* let map = new GoogleMap('elementID');
*
* // somewhere in your component
* let map = new GoogleMap('elementID', {
* // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions
});
* // or create a new map by passing HTMLElement
* let element: HTMLElement = document.getElementById('elementID');
*
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
* // In Angular 2 or Ionic 2, if we have this element in html: <div #map></div>
* // then we can use @ViewChild to find the element and pass it to GoogleMaps
* @ViewChild('map') mapElement;
* let map = new GoogleMap(mapElement);
*
* // listen to MAP_READY event
* map.one(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
*
*
* // create LatLng object
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
*
* // create CameraPosition
* let position: CameraPosition = {
* target: ionic,
* zoom: 18,
* tilt: 30
* };
*
* // move the map's camera to position
* map.moveCamera(position);
*
* // create new marker
* let markerOptions: GoogleMapsMarkerOptions = {
* position: ionic,
* title: 'Ionic'
* };
*
* map.addMarker(markerOptions)
* .then((marker: GoogleMapsMarker) => {
* marker.showInfoWindow();
* });
* ```
*/
@Plugin({
pluginRef: 'plugin.google.maps.Map',
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps'
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"'
})
export class GoogleMap {
_objectInstance: any;
@@ -76,8 +107,9 @@ export class GoogleMap {
return;
}
constructor(elementId: string, options?: any) {
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
constructor(element: string|HTMLElement, options?: any) {
if (typeof element === 'string') element = document.getElementById(<string>element);
this._objectInstance = plugin.google.maps.Map.getMap(element, options);
}
/**
@@ -172,13 +204,11 @@ export class GoogleMap {
setTilt(tiltLevel: number): void {
}
@CordovaInstance({ sync: true })
animateCamera(animateCameraOptions: AnimateCameraOptions): void {
}
@CordovaInstance()
animateCamera(animateCameraOptions: AnimateCameraOptions): Promise<any> { return; }
@CordovaInstance({ sync: true })
moveCamera(cameraPosition: CameraPosition): void {
}
@CordovaInstance()
moveCamera(cameraPosition: CameraPosition): Promise<any> { return; }
@CordovaInstance({ sync: true })
setMyLocationEnabled(enabled: boolean): void {
@@ -366,7 +396,7 @@ export interface AnimateCameraOptions {
* @private
*/
export interface CameraPosition {
target?: GoogleMapsLatLng;
target?: GoogleMapsLatLng | GoogleMapsLatLngBounds;
zoom?: number;
tilt?: number;
bearing?: number;

View File

@@ -1,5 +1,6 @@
import { Plugin, CordovaInstance } from './plugin';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
export interface InAppBrowserEvent extends Event {

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name Instagram

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name IsDebug

View File

@@ -72,12 +72,14 @@ export class LocalNotifications {
/**
* Clears single or multiple notifications
* @param notificationId A single notification id, or an array of notification ids.
* @returns {Promise} Returns a promise when the notification had been cleared
*/
@Cordova()
static clear(notificationId: any): Promise<any> { return; }
/**
* Clears all notifications
* @returns {Promise} Returns a promise when all notifications have cleared
*/
@Cordova({
successIndex: 0,
@@ -88,12 +90,14 @@ export class LocalNotifications {
/**
* Cancels single or multiple notifications
* @param notificationId A single notification id, or an array of notification ids.
* @returns {Promise} Returns a promise when the notification is canceled
*/
@Cordova()
static cancel(notificationId: any): Promise<any> { return; }
/**
* Cancels all notifications
* @returns {Promise} Returns a promise when all notifications are canceled
*/
@Cordova({
successIndex: 0,
@@ -104,6 +108,7 @@ export class LocalNotifications {
/**
* Checks presence of a notification
* @param notificationId
* @returns {Promise} Returns a promise
*/
@Cordova()
static isPresent(notificationId: number): Promise<boolean> { return; }
@@ -111,6 +116,7 @@ export class LocalNotifications {
/**
* Checks is a notification is scheduled
* @param notificationId
* @returns {Promise} Returns a promise
*/
@Cordova()
static isScheduled(notificationId: number): Promise<boolean> { return; }
@@ -118,24 +124,28 @@ export class LocalNotifications {
/**
* Checks if a notification is triggered
* @param notificationId
* @returns {Promise} Returns a promise
*/
@Cordova()
static isTriggered(notificationId: number): Promise<boolean> { return; }
/**
* Get all the notification ids
* @returns {Promise} Returns a promise
*/
@Cordova()
static getAllIds(): Promise<Array<number>> { return; }
/**
* Get the ids of triggered notifications
* @returns {Promise} Returns a promise
*/
@Cordova()
static getTriggeredIds(): Promise<Array<number>> { return; }
/**
* Get the ids of scheduled notifications
* @returns {Promise} Returns a promise
*/
@Cordova()
static getScheduledIds(): Promise<Array<number>> { return; }
@@ -143,6 +153,7 @@ export class LocalNotifications {
/**
* Get a notification object
* @param notificationId The id of the notification to get
* @returns {Promise} Returns a promise
*/
@Cordova()
static get(notificationId: any): Promise<Notification> { return; }
@@ -150,6 +161,7 @@ export class LocalNotifications {
/**
* Get a scheduled notification object
* @param notificationId The id of the notification to get
* @returns {Promise} Returns a promise
*/
@Cordova()
static getScheduled(notificationId: any): Promise<Notification> { return; }
@@ -157,28 +169,46 @@ export class LocalNotifications {
/**
* Get a triggered notification object
* @param notificationId The id of the notification to get
* @returns {Promise} Returns a promise
*/
@Cordova()
static getTriggered(notificationId: any): Promise<Notification> { return; }
/**
* Get all notification objects
* @returns {Promise} Returns a promise
*/
@Cordova()
static getAll(): Promise<Array<Notification>> { return; }
/**
* Get all scheduled notification objects
* @returns {Promise} Returns a promise
*/
@Cordova()
static getAllScheduled(): Promise<Array<Notification>> { return; }
/**
* Get all triggered notification objects
* @returns {Promise} Returns a promise
*/
@Cordova()
static getAllTriggered(): Promise<Array<Notification>> { return; }
/**
* Register permission to show notifications if not already granted.
* @returns {Promise} Returns a promise
*/
@Cordova()
static registerPermission(): Promise<boolean> { return; }
/**
* Informs if the app has the permission to show notifications.
* @returns {Promise} Returns a promise
*/
@Cordova()
static hasPermission(): Promise<boolean> { return; }
/**
* Sets a callback for a specific event

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name Market
* @description
@@ -13,7 +13,7 @@ import {Plugin, Cordova} from './plugin';
* ```
*/
@Plugin({
plugin: '',
plugin: 'cordova-plugin-market',
pluginRef: 'plugins.market',
repo: 'https://github.com/xmartlabs/cordova-plugin-market'
})

View File

@@ -1,5 +1,5 @@
import { Cordova, CordovaProperty, Plugin } from './plugin';
import { Observable } from 'rxjs/Rx';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;

View File

@@ -77,16 +77,43 @@ export interface MediaError {
export class MediaPlugin {
// Constants
/**
* @private
*/
static MEDIA_NONE: number = 0;
/**
* @private
*/
static MEDIA_STARTING: number = 1;
/**
* @private
*/
static MEDIA_RUNNING: number = 2;
/**
* @private
*/
static MEDIA_PAUSED: number = 3;
/**
* @private
*/
static MEDIA_STOPPED: number = 4;
// error codes
/**
* @private
*/
static MEDIA_ERR_ABORTED: number = 1;
/**
* @private
*/
static MEDIA_ERR_NETWORK: number = 2;
/**
* @private
*/
static MEDIA_ERR_DECODE: number = 3;
/**
* @private
*/
static MEDIA_ERR_NONE_SUPPORTED: number = 4;
// Properties
@@ -100,28 +127,30 @@ export class MediaPlugin {
* @param src {string} A URI containing the audio content.
*/
constructor(src: string) {
let res, rej, next;
this.init = new Promise<any>((resolve, reject) => { res = resolve; rej = reject; });
this.status = new Observable((observer) => {
next = data => observer.next(data);
this.init = new Promise<any>((resolve, reject) => {
this.status = new Observable((observer) => {
this._objectInstance = new Media(src, resolve, reject, observer.next.bind(observer));
});
});
this._objectInstance = new Media(src, res, rej, next);
}
/**
* Returns the current amplitude of the current recording.
* Get the current amplitude of the current recording.
* @returns {Promise} Returns a promise with the amplitude of the current recording
*/
@CordovaInstance()
getCurrentAmplitude(): Promise<any> { return; }
/**
* Returns the current position within an audio file. Also updates the Media object's position parameter.
* Get the current position within an audio file. Also updates the Media object's position parameter.
* @returns {Promise} Returns a promise with the position of the current recording
*/
@CordovaInstance()
getCurrentPosition(): Promise<any> { return; }
/**
* Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
* Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
* @returns {Promise} Returns a promise with the duration of the current recording
*/
@CordovaInstance({
sync: true
@@ -157,7 +186,7 @@ export class MediaPlugin {
/**
* Sets the current position within an audio file.
* @param milliseconds
* @param {number} milliseconds The time position you want to set for the current audio file
*/
@CordovaInstance({
sync: true

View File

@@ -1,5 +1,8 @@
import {Plugin, Cordova, CordovaProperty} from './plugin';
import { Cordova, CordovaProperty, Plugin } from './plugin';
declare var mixpanel: any;
/**
* @name Mixpanel
* @description
@@ -28,20 +31,20 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static alias(aliasId: string, originalId: string): Promise<any> {return; }
static alias(aliasId: string, originalId: string): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static distinctId(): Promise<any> {return; }
static distinctId(): Promise<any> { return; }
/**
*
*/
@Cordova()
static flush(): Promise<any> {return; }
static flush(): Promise<any> { return; }
/**
*
@@ -49,7 +52,7 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static identify(distinctId): Promise<any> {return; }
static identify(distinctId): Promise<any> { return; }
/**
*
@@ -57,7 +60,7 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static init(token: string): Promise<any> {return; }
static init(token: string): Promise<any> { return; }
/**
*
@@ -65,14 +68,14 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static registerSuperProperties(superProperties: any): Promise<any> {return; }
static registerSuperProperties(superProperties: any): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static reset(): Promise<any> {return; }
static reset(): Promise<any> { return; }
/**
*
@@ -80,21 +83,21 @@ export class Mixpanel {
* @param eventProperties
*/
@Cordova()
static track(eventName: string, eventProperties: any): Promise<any> {return; }
static track(eventName: string, eventProperties?: any): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static showSurvey(): Promise<any> {return; }
static showSurvey(): Promise<any> { return; }
/**
*
* @returns {MixpanelPeople}
*/
@CordovaProperty
static get people(): MixpanelPeople {return mixpanel.people; };
static get people(): MixpanelPeople { return mixpanel.people; };
}
/**

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name MusicControls
* @description

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name NativePageTransitions
* @description
@@ -38,21 +38,21 @@ export class NativePageTransitions {
* @param options {TransitionOptions} Options for the transition
*/
@Cordova()
static slide(options: TransitionOptions): Promise<any> {return; }
static slide(options: TransitionOptions): Promise<any> { return; }
/**
* Perform a flip animation
* @param options {TransitionOptions} Options for the transition
*/
@Cordova()
static flip(options: TransitionOptions): Promise<any> {return; }
static flip(options: TransitionOptions): Promise<any> { return; }
/**
* Perform a fade animation
* @param options {TransitionOptions} Options for the transition
*/
@Cordova({platforms: ['iOS', 'Android']})
static fade(options: TransitionOptions): Promise<any> {return; }
static fade(options: TransitionOptions): Promise<any> { return; }
/**
@@ -60,7 +60,7 @@ export class NativePageTransitions {
* @param options {TransitionOptions} Options for the transition
*/
@Cordova({platforms: ['iOS', 'Android']})
static drawer(options: TransitionOptions): Promise<any> {return; }
static drawer(options: TransitionOptions): Promise<any> { return; }
@@ -69,7 +69,7 @@ export class NativePageTransitions {
* @param options {TransitionOptions} Options for the transition
*/
@Cordova({platforms: ['iOS']})
static curl(options: TransitionOptions): Promise<any> {return; }
static curl(options: TransitionOptions): Promise<any> { return; }
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name NFC
* @description

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name PayPal
* @description

View File

@@ -3,8 +3,6 @@ import { Observable } from 'rxjs/Observable';
declare var window;
declare var Promise;
declare var $q;
/**
* @private
@@ -107,17 +105,30 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
}
function getPromise(cb) {
const tryNativePromise = () => {
if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
}
};
if (window.angular) {
let $q = window.angular.injector(['ng']).get('$q');
return $q((resolve, reject) => {
cb(resolve, reject);
});
} else if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
let injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector();
if (injector) {
let $q = injector.get('$q');
return $q((resolve, reject) => {
cb(resolve, reject);
});
} else {
console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.');
return tryNativePromise();
}
} 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.');
return tryNativePromise();
}
}
@@ -219,6 +230,47 @@ function wrapEventObservable(event: string): Observable<any> {
});
}
/**
* Certain plugins expect the user to override methods in the plugin. For example,
* window.cordova.plugins.backgroundMode.onactivate = function() { ... }.
*
* Unfortunately, this is brittle and would be better wrapped as an Observable. overrideFunction
* does just this.
*/
function overrideFunction(pluginObj: any, methodName: string, args: any[], opts: any = {}): Observable<any> {
return new Observable(observer => {
let pluginInstance = getPlugin(pluginObj.pluginRef);
if (!pluginInstance) {
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
if (!window.cordova) {
cordovaWarn(pluginObj.name, methodName);
observer.error({
error: 'cordova_not_available'
});
}
pluginWarn(pluginObj, methodName);
observer.error({
error: 'plugin_not_installed'
});
return;
}
let method = pluginInstance[methodName];
if (!method) {
observer.error({
error: 'no_such_method'
});
observer.complete();
return;
}
pluginInstance[methodName] = observer.next.bind(observer);
});
}
/**
* @private
* @param pluginObj
@@ -353,3 +405,19 @@ export function InstanceProperty(target: any, key: string, descriptor: TypedProp
return descriptor;
}
/**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export function CordovaFunctionOverride(opts: any = {}) {
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
return {
value: function(...args: any[]) {
return overrideFunction(this, methodName, opts);
}
};
};
}

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name PowerManagement
* @description

View File

@@ -55,6 +55,7 @@ export interface NotificationEventAdditionalData {
*/
foreground?: boolean;
collapse_key?: string;
coldstart?: boolean;
from?: string;
notId?: string;
}

View File

@@ -1,4 +1,5 @@
import { CordovaInstance, Plugin } from './plugin';
declare var cordova: any;
/**
* @name Secure Storage

View File

@@ -37,6 +37,7 @@ export class SocialSharing {
* @param subject {string} The subject
* @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
* @returns {Promise}
*/
@Cordova()
static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise<any> { return; }
@@ -44,6 +45,7 @@ export class SocialSharing {
/**
* Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
* @param options {object} The options object with the message, subject, files, url and chooserTitle properties.
* @returns {Promise}
*/
@Cordova({
platforms: ['iOS', 'Android']
@@ -52,20 +54,30 @@ export class SocialSharing {
/**
* Checks if you can share via a specific app.
* @param appName App name or package name. Examples: instagram or com.apple.social.facebook
* @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
* @param message {string}
* @param subject {string}
* @param image {string}
* @param url {string}
* @returns {Promise}
*/
@Cordova({
successIndex: 5,
errorIndex: 6,
platforms: ['iOS', 'Android']
})
static canShareVia(appName: string): Promise<any> { return; }
static canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise<any> { return; }
/**
* Shares directly to Twitter
* @param message
* @param image
* @param url
* @param message {string}
* @param image {string}
* @param url {string}
* @returns {Promise}
*/
@Cordova({
successIndex: 3,
errorIndex: 4,
platforms: ['iOS', 'Android']
})
static shareViaTwitter(message: string, image?: string, url?: string): Promise<any> { return; }
@@ -75,8 +87,11 @@ export class SocialSharing {
* @param message {string}
* @param image {string}
* @param url {string}
* @returns {Promise}
*/
@Cordova({
successIndex: 3,
errorIndex: 4,
platforms: ['iOS', 'Android']
})
static shareViaFacebook(message: string, image?: string, url?: string): Promise<any> { return; }
@@ -88,8 +103,11 @@ export class SocialSharing {
* @param image {string}
* @param url {string}
* @param pasteMessageHint {string}
* @returns {Promise}
*/
@Cordova({
successIndex: 4,
errorIndex: 5,
platforms: ['iOS', 'Android']
})
static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any> { return; }
@@ -98,6 +116,7 @@ export class SocialSharing {
* Shares directly to Instagram
* @param message {string}
* @param image {string}
* @returns {Promise}
*/
@Cordova({
platforms: ['iOS', 'Android']
@@ -109,8 +128,11 @@ export class SocialSharing {
* @param message {string}
* @param image {string}
* @param url {string}
* @returns {Promise}
*/
@Cordova({
successIndex: 3,
errorIndex: 4,
platforms: ['iOS', 'Android']
})
static shareViaWhatsApp(message: string, image?: string, url?: string): Promise<any> { return; }
@@ -121,8 +143,11 @@ export class SocialSharing {
* @param message {string} Message to send
* @param image {string} Image to send (does not work on iOS
* @param url {string} Link to send
* @returns {Promise}
*/
@Cordova({
successIndex: 4,
errorIndex: 5,
platforms: ['iOS', 'Android']
})
static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise<any> { return; }
@@ -131,6 +156,7 @@ export class SocialSharing {
* Share via SMS
* @param messge {string} message to send
* @param phoneNumber {string} Number or multiple numbers seperated by commas
* @returns {Promise}
*/
@Cordova({
platforms: ['iOS', 'Android']
@@ -139,6 +165,7 @@ export class SocialSharing {
/**
* Checks if you can share via email
* @returns {Promise}
*/
@Cordova({
platforms: ['iOS', 'Android']
@@ -150,13 +177,31 @@ export class SocialSharing {
* @param message {string}
* @param subject {string}
* @param to {string[]}
* @param cc {string[]}
* @param bcc {string[]}
* @param files {string|string[]} URL or local path to file(s) to attach
* @param cc {string[]} Optional
* @param bcc {string[]} Optional
* @param files {string|string[]} Optional URL or local path to file(s) to attach
* @returns {Promise}
*/
@Cordova({
platforms: ['iOS', 'Android'],
successIndex: 6,
errorIndex: 7
})
static shareViaEmail(message: string, subject: string, to: string[], cc?: string[], bcc?: string[], files?: string|string[]): Promise<any> { return; }
/**
* Share via AppName
* @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
* @param message {string}
* @param subject {string}
* @param image {string}
* @param url {string}
* @returns {Promise}
*/
@Cordova({
successIndex: 5,
errorIndex: 6,
platforms: ['iOS', 'Android']
})
static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise<any> { return; }
static shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise<any> { return; }
}

View File

@@ -15,7 +15,7 @@ declare var window;
* import { StatusBar } from 'ionic-native';
*
*
* StatusBar.overlaysWebView(true); // let status var overlay webview
* StatusBar.overlaysWebView(true); // let status bar overlay webview
*
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
* ```

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name StreamingMedia
* @description

View File

@@ -10,15 +10,15 @@ export interface TTSOptions {
}
/**
* @name TTS
* @name TextToSpeech
* @description
* Text to Speech plugin
*
* @usage
* ```
* import {TTS} from 'ionic-native';
* import {TextToSpeech} from 'ionic-native';
*
* TTS.speak('Hello World')
* TextToSpeech.speak('Hello World')
* .then(() => console.log('Success'))
* .catch((reason: any) => console.log(reason));
*

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
export interface TranscodeOptions {

View File

@@ -35,7 +35,7 @@ export class WebIntent {
}
@Cordova()
static startActivity(options: { action: any, url: string }): Promise<any> { return; }
static startActivity(options: { action: any, url: string, type?: string }): Promise<any> { return; }
@Cordova()
static hasExtra(extra: any): Promise<any> { return; }

View File

@@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from './plugin';
/**
* @name YoutubeVideoPlayer
* @description

141
test/plugin.spec.ts Normal file
View File

@@ -0,0 +1,141 @@
/// <reference path="./../typings/index.d.ts" />
import 'es6-shim';
import {Plugin, Cordova} from './../src/plugins/plugin';
declare const window: any;
window.plugins = {
test: {}
};
const testPluginMeta = {
plugin: 'cordova-plugin-test',
pluginRef: 'plugins.test',
repo: 'https://github.com/apache/cordova-plugin-test',
platforms: ['Android', 'iOS']
};
describe('plugin', () => {
it('sync method', () => {
window.plugins.test.syncMethod = () => {
return 'syncResult';
};
@Plugin(testPluginMeta)
class Test {
@Cordova({
sync: true
})
static syncMethod(arg: any): boolean { return; };
}
const spy = spyOn(window.plugins.test, 'syncMethod').and.callThrough();
const result = Test.syncMethod('foo');
expect(result).toEqual('syncResult');
expect(spy).toHaveBeenCalledWith('foo', undefined, undefined);
});
it('normal order callback', done => {
window.plugins.test.normalOrderCallback = (args, success, error) => {
success('normalOrderCallback');
};
@Plugin(testPluginMeta)
class Test {
@Cordova()
static normalOrderCallback(args: any): Promise<any> { return; }
}
const spy = spyOn(window.plugins.test, 'normalOrderCallback').and.callThrough();
Test.normalOrderCallback('foo').then(result => {
expect(result).toEqual('normalOrderCallback');
done();
});
expect(spy.calls.mostRecent().args[0]).toEqual('foo');
});
it('reverse order callback', done => {
window.plugins.test.reverseOrderCallback = (success, error, args) => {
success('reverseOrderCallback');
};
@Plugin(testPluginMeta)
class Test {
@Cordova({
callbackOrder: 'reverse'
})
static reverseOrderCallback(args: any): Promise<any> { return; }
}
const spy = spyOn(window.plugins.test, 'reverseOrderCallback').and.callThrough();
Test.reverseOrderCallback('foo').then(result => {
expect(result).toEqual('reverseOrderCallback');
done();
});
expect(spy.calls.mostRecent().args[2]).toEqual('foo');
});
it('node style callback', done => {
window.plugins.test.nodeStyleCallback = (args, done) => {
done(null, 'nodeStyleCallback');
};
@Plugin(testPluginMeta)
class Test {
@Cordova({
callbackStyle: 'node'
})
static nodeStyleCallback(args: any): Promise<any> { return; }
}
const spy = spyOn(window.plugins.test, 'nodeStyleCallback').and.callThrough();
Test.nodeStyleCallback('foo').then(result => {
expect(result).toEqual('nodeStyleCallback');
done();
});
expect(spy.calls.mostRecent().args[0]).toEqual('foo');
});
it('object style callback', done => {
window.plugins.test.objectStyleCallback = (args, {success}) => {
success('objectStyleCallback');
};
@Plugin(testPluginMeta)
class Test {
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'error'
})
static objectStyleCallback(args: any): Promise<any> { return; }
}
const spy = spyOn(window.plugins.test, 'objectStyleCallback').and.callThrough();
Test.objectStyleCallback('foo').then(result => {
expect(result).toEqual('objectStyleCallback');
done();
});
expect(spy.calls.mostRecent().args[0]).toEqual('foo');
});
});

15
tsconfig-es5.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"sourceMap": true,
"declaration": true,
"experimentalDecorators": true,
"outDir": "dist/es5",
"moduleResolution": "node"
},
"files": [
"typings/es6-shim/es6-shim.d.ts",
"src/index.ts"
]
}

15
tsconfig-esm.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "es2015",
"target": "ES5",
"sourceMap": true,
"declaration": true,
"experimentalDecorators": true,
"outDir": "dist/esm",
"moduleResolution": "node"
},
"files": [
"typings/es6-shim/es6-shim.d.ts",
"src/index.ts"
]
}

View File

@@ -5,7 +5,8 @@
"sourceMap": true,
"declaration": true,
"experimentalDecorators": true,
"outDir": "dist"
"outDir": "dist",
"moduleResolution": "node"
},
"files": [
"typings/es6-shim/es6-shim.d.ts",

5
typings.json Normal file
View File

@@ -0,0 +1,5 @@
{
"globalDevDependencies": {
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255"
}
}

502
typings/globals/jasmine/index.d.ts vendored Normal file
View File

@@ -0,0 +1,502 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts
declare function describe(description: string, specDefinitions: () => void): void;
declare function fdescribe(description: string, specDefinitions: () => void): void;
declare function xdescribe(description: string, specDefinitions: () => void): void;
declare function it(expectation: string, assertion?: () => void, timeout?: number): void;
declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
declare function fit(expectation: string, assertion?: () => void, timeout?: number): void;
declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
declare function xit(expectation: string, assertion?: () => void, timeout?: number): void;
declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
declare function pending(reason?: string): void;
declare function beforeEach(action: () => void, timeout?: number): void;
declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void;
declare function afterEach(action: () => void, timeout?: number): void;
declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void;
declare function beforeAll(action: () => void, timeout?: number): void;
declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void;
declare function afterAll(action: () => void, timeout?: number): void;
declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void;
declare function expect(spy: Function): jasmine.Matchers;
declare function expect(actual: any): jasmine.Matchers;
declare function fail(e?: any): void;
/** Action method that should be called when the async work is complete */
interface DoneFn extends Function {
(): void;
/** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */
fail: (message?: Error|string) => void;
}
declare function spyOn(object: any, method: string): jasmine.Spy;
declare function runs(asyncMethod: Function): void;
declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void;
declare function waits(timeout?: number): void;
declare namespace jasmine {
var clock: () => Clock;
function any(aclass: any): Any;
function anything(): Any;
function arrayContaining(sample: any[]): ArrayContaining;
function objectContaining(sample: any): ObjectContaining;
function createSpy(name: string, originalFn?: Function): Spy;
function createSpyObj(baseName: string, methodNames: any[]): any;
function createSpyObj<T>(baseName: string, methodNames: any[]): T;
function pp(value: any): string;
function getEnv(): Env;
function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
function addMatchers(matchers: CustomMatcherFactories): void;
function stringMatching(str: string): Any;
function stringMatching(str: RegExp): Any;
interface Any {
new (expectedClass: any): any;
jasmineMatches(other: any): boolean;
jasmineToString(): string;
}
// taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
interface ArrayLike<T> {
length: number;
[n: number]: T;
}
interface ArrayContaining {
new (sample: any[]): any;
asymmetricMatch(other: any): boolean;
jasmineToString(): string;
}
interface ObjectContaining {
new (sample: any): any;
jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
jasmineToString(): string;
}
interface Block {
new (env: Env, func: SpecFunction, spec: Spec): any;
execute(onComplete: () => void): void;
}
interface WaitsBlock extends Block {
new (env: Env, timeout: number, spec: Spec): any;
}
interface WaitsForBlock extends Block {
new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any;
}
interface Clock {
install(): void;
uninstall(): void;
/** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
tick(ms: number): void;
mockDate(date?: Date): void;
}
interface CustomEqualityTester {
(first: any, second: any): boolean;
}
interface CustomMatcher {
compare<T>(actual: T, expected: T): CustomMatcherResult;
compare(actual: any, expected: any): CustomMatcherResult;
}
interface CustomMatcherFactory {
(util: MatchersUtil, customEqualityTesters: Array<CustomEqualityTester>): CustomMatcher;
}
interface CustomMatcherFactories {
[index: string]: CustomMatcherFactory;
}
interface CustomMatcherResult {
pass: boolean;
message?: string;
}
interface MatchersUtil {
equals(a: any, b: any, customTesters?: Array<CustomEqualityTester>): boolean;
contains<T>(haystack: ArrayLike<T> | string, needle: any, customTesters?: Array<CustomEqualityTester>): boolean;
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array<any>): string;
}
interface Env {
setTimeout: any;
clearTimeout: void;
setInterval: any;
clearInterval: void;
updateInterval: number;
currentSpec: Spec;
matchersClass: Matchers;
version(): any;
versionString(): string;
nextSpecId(): number;
addReporter(reporter: Reporter): void;
execute(): void;
describe(description: string, specDefinitions: () => void): Suite;
// ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these
beforeEach(beforeEachFunction: () => void): void;
beforeAll(beforeAllFunction: () => void): void;
currentRunner(): Runner;
afterEach(afterEachFunction: () => void): void;
afterAll(afterAllFunction: () => void): void;
xdescribe(desc: string, specDefinitions: () => void): XSuite;
it(description: string, func: () => void): Spec;
// iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these
xit(desc: string, func: () => void): XSpec;
compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
contains_(haystack: any, needle: any): boolean;
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
addMatchers(matchers: CustomMatcherFactories): void;
specFilter(spec: Spec): boolean;
throwOnExpectationFailure(value: boolean): void;
}
interface FakeTimer {
new (): any;
reset(): void;
tick(millis: number): void;
runFunctionsWithinRange(oldMillis: number, nowMillis: number): void;
scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void;
}
interface HtmlReporter {
new (): any;
}
interface HtmlSpecFilter {
new (): any;
}
interface Result {
type: string;
}
interface NestedResults extends Result {
description: string;
totalCount: number;
passedCount: number;
failedCount: number;
skipped: boolean;
rollupCounts(result: NestedResults): void;
log(values: any): void;
getItems(): Result[];
addResult(result: Result): void;
passed(): boolean;
}
interface MessageResult extends Result {
values: any;
trace: Trace;
}
interface ExpectationResult extends Result {
matcherName: string;
passed(): boolean;
expected: any;
actual: any;
message: string;
trace: Trace;
}
interface Trace {
name: string;
message: string;
stack: any;
}
interface PrettyPrinter {
new (): any;
format(value: any): void;
iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void;
emitScalar(value: any): void;
emitString(value: string): void;
emitArray(array: any[]): void;
emitObject(obj: any): void;
append(value: any): void;
}
interface StringPrettyPrinter extends PrettyPrinter {
}
interface Queue {
new (env: any): any;
env: Env;
ensured: boolean[];
blocks: Block[];
running: boolean;
index: number;
offset: number;
abort: boolean;
addBefore(block: Block, ensure?: boolean): void;
add(block: any, ensure?: boolean): void;
insertNext(block: any, ensure?: boolean): void;
start(onComplete?: () => void): void;
isRunning(): boolean;
next_(): void;
results(): NestedResults;
}
interface Matchers {
new (env: Env, actual: any, spec: Env, isNot?: boolean): any;
env: Env;
actual: any;
spec: Env;
isNot?: boolean;
message(): any;
toBe(expected: any, expectationFailOutput?: any): boolean;
toEqual(expected: any, expectationFailOutput?: any): boolean;
toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean;
toBeDefined(expectationFailOutput?: any): boolean;
toBeUndefined(expectationFailOutput?: any): boolean;
toBeNull(expectationFailOutput?: any): boolean;
toBeNaN(): boolean;
toBeTruthy(expectationFailOutput?: any): boolean;
toBeFalsy(expectationFailOutput?: any): boolean;
toHaveBeenCalled(): boolean;
toHaveBeenCalledWith(...params: any[]): boolean;
toHaveBeenCalledTimes(expected: number): boolean;
toContain(expected: any, expectationFailOutput?: any): boolean;
toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
toBeCloseTo(expected: number, precision?: any, expectationFailOutput?: any): boolean;
toThrow(expected?: any): boolean;
toThrowError(message?: string | RegExp): boolean;
toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean;
not: Matchers;
Any: Any;
}
interface Reporter {
reportRunnerStarting(runner: Runner): void;
reportRunnerResults(runner: Runner): void;
reportSuiteResults(suite: Suite): void;
reportSpecStarting(spec: Spec): void;
reportSpecResults(spec: Spec): void;
log(str: string): void;
}
interface MultiReporter extends Reporter {
addReporter(reporter: Reporter): void;
}
interface Runner {
new (env: Env): any;
execute(): void;
beforeEach(beforeEachFunction: SpecFunction): void;
afterEach(afterEachFunction: SpecFunction): void;
beforeAll(beforeAllFunction: SpecFunction): void;
afterAll(afterAllFunction: SpecFunction): void;
finishCallback(): void;
addSuite(suite: Suite): void;
add(block: Block): void;
specs(): Spec[];
suites(): Suite[];
topLevelSuites(): Suite[];
results(): NestedResults;
}
interface SpecFunction {
(spec?: Spec): void;
}
interface SuiteOrSpec {
id: number;
env: Env;
description: string;
queue: Queue;
}
interface Spec extends SuiteOrSpec {
new (env: Env, suite: Suite, description: string): any;
suite: Suite;
afterCallbacks: SpecFunction[];
spies_: Spy[];
results_: NestedResults;
matchersClass: Matchers;
getFullName(): string;
results(): NestedResults;
log(arguments: any): any;
runs(func: SpecFunction): Spec;
addToQueue(block: Block): void;
addMatcherResult(result: Result): void;
expect(actual: any): any;
waits(timeout: number): Spec;
waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
fail(e?: any): void;
getMatchersClass_(): Matchers;
addMatchers(matchersPrototype: CustomMatcherFactories): void;
finishCallback(): void;
finish(onComplete?: () => void): void;
after(doAfter: SpecFunction): void;
execute(onComplete?: () => void): any;
addBeforesAndAftersToQueue(): void;
explodes(): void;
spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy;
removeAllSpies(): void;
}
interface XSpec {
id: number;
runs(): void;
}
interface Suite extends SuiteOrSpec {
new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any;
parentSuite: Suite;
getFullName(): string;
finish(onComplete?: () => void): void;
beforeEach(beforeEachFunction: SpecFunction): void;
afterEach(afterEachFunction: SpecFunction): void;
beforeAll(beforeAllFunction: SpecFunction): void;
afterAll(afterAllFunction: SpecFunction): void;
results(): NestedResults;
add(suiteOrSpec: SuiteOrSpec): void;
specs(): Spec[];
suites(): Suite[];
children(): any[];
execute(onComplete?: () => void): void;
}
interface XSuite {
execute(): void;
}
interface Spy {
(...params: any[]): any;
identity: string;
and: SpyAnd;
calls: Calls;
mostRecentCall: { args: any[]; };
argsForCall: any[];
wasCalled: boolean;
}
interface SpyAnd {
/** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
callThrough(): Spy;
/** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
returnValue(val: any): Spy;
/** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */
returnValues(...values: any[]): Spy;
/** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
callFake(fn: Function): Spy;
/** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
throwError(msg: string): Spy;
/** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
stub(): Spy;
}
interface Calls {
/** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/
any(): boolean;
/** By chaining the spy with calls.count(), will return the number of times the spy was called **/
count(): number;
/** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/
argsFor(index: number): any[];
/** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/
allArgs(): any[];
/** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/
all(): CallInfo[];
/** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/
mostRecent(): CallInfo;
/** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/
first(): CallInfo;
/** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
reset(): void;
}
interface CallInfo {
/** The context (the this) for the call */
object: any;
/** All arguments passed to the call */
args: any[];
/** The return value of the call */
returnValue: any;
}
interface Util {
inherit(childClass: Function, parentClass: Function): any;
formatException(e: any): any;
htmlEscape(str: string): string;
argsToArray(args: any): any;
extend(destination: any, source: any): any;
}
interface JsApiReporter extends Reporter {
started: boolean;
finished: boolean;
result: any;
messages: any;
new (): any;
suites(): Suite[];
summarize_(suiteOrSpec: SuiteOrSpec): any;
results(): any;
resultsForSpec(specId: any): any;
log(str: any): any;
resultsForSpecs(specIds: any): any;
summarizeResult_(result: any): any;
}
interface Jasmine {
Spec: Spec;
clock: Clock;
util: Util;
}
export var HtmlReporter: HtmlReporter;
export var HtmlSpecFilter: HtmlSpecFilter;
export var DEFAULT_TIMEOUT_INTERVAL: number;
}

View File

@@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts",
"raw": "registry:dt/jasmine#2.2.0+20160621224255",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts"
}
}

1
typings/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference path="globals/jasmine/index.d.ts" />