mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
179 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b060345d2 | ||
|
|
1784036ef7 | ||
|
|
7a8577007c | ||
|
|
7c6e6d8b6b | ||
|
|
c5fd83ddb6 | ||
|
|
7b2fe69c7c | ||
|
|
f0961c7b23 | ||
|
|
35c8bbd49e | ||
|
|
1a343c1ea5 | ||
|
|
4fef8ff326 | ||
|
|
13681756ae | ||
|
|
4a798281e4 | ||
|
|
79670b7878 | ||
|
|
720084578d | ||
|
|
3dd6a92ccf | ||
|
|
7d1686ef93 | ||
|
|
b40b0fff98 | ||
|
|
4dba0580ac | ||
|
|
11653ce752 | ||
|
|
d3e6f3ba41 | ||
|
|
2c6cc37a5f | ||
|
|
4c7defb2ec | ||
|
|
2da02e6d46 | ||
|
|
7a91c87a72 | ||
|
|
598f8a9e7c | ||
|
|
6f0f02bb66 | ||
|
|
e4bde77bd4 | ||
|
|
c24b331866 | ||
|
|
4ac348bd0f | ||
|
|
f0026572e7 | ||
|
|
e30ccabf7b | ||
|
|
6b286db51a | ||
|
|
d79d62bfa0 | ||
|
|
2bdd3a3868 | ||
|
|
09d481e1d6 | ||
|
|
6f23bef5d1 | ||
|
|
84f54d64aa | ||
|
|
c9ddec3bb5 | ||
|
|
f62e1081e1 | ||
|
|
7dba41cbe1 | ||
|
|
77b0277290 | ||
|
|
40325cad9f | ||
|
|
ab5bbae2f6 | ||
|
|
5da746d2fc | ||
|
|
72a694a5e1 | ||
|
|
1ab0d2f915 | ||
|
|
083118aff4 | ||
|
|
ad373c93ae | ||
|
|
ac301c284f | ||
|
|
1e0509da98 | ||
|
|
ad3bef2e5a | ||
|
|
bbbbb3e8d0 | ||
|
|
0bc73e525d | ||
|
|
7ababc4d67 | ||
|
|
6ff8f03ef0 | ||
|
|
010a6ea304 | ||
|
|
973c80b264 | ||
|
|
b5f9ba588a | ||
|
|
c5724fdc4e | ||
|
|
ebda055444 | ||
|
|
7cf9bd8e5e | ||
|
|
ce710117f7 | ||
|
|
fcda04acf1 | ||
|
|
83ac4c7bbe | ||
|
|
2be7872cd6 | ||
|
|
97a7f1a4e7 | ||
|
|
e9e37f33f9 | ||
|
|
344ce11a3e | ||
|
|
7fcd1f85a3 | ||
|
|
5d13ba03d8 | ||
|
|
a99b753d2d | ||
|
|
8f26f4b3ef | ||
|
|
624bc1d9b5 | ||
|
|
0a07bef2d2 | ||
|
|
96bb4d38dc | ||
|
|
58a99a14d5 | ||
|
|
66e9e46458 | ||
|
|
d6060a95d7 | ||
|
|
80ff2f3bfa | ||
|
|
16f05c3b0d | ||
|
|
2ed84b1b71 | ||
|
|
8d21f5f225 | ||
|
|
be2c198259 | ||
|
|
dde011c8f6 | ||
|
|
47112c7c24 | ||
|
|
1b87af86bf | ||
|
|
d45a2b5407 | ||
|
|
49bf9b7cc5 | ||
|
|
79f0a3fc7b | ||
|
|
60b7c7469a | ||
|
|
c377489aba | ||
|
|
8bb22fb576 | ||
|
|
310e0942fd | ||
|
|
df06a24746 | ||
|
|
b9151bc062 | ||
|
|
972d63b2d2 | ||
|
|
440786a4f7 | ||
|
|
3a6ec05bef | ||
|
|
c5733326a9 | ||
|
|
f36b1c03cb | ||
|
|
3266d21ba4 | ||
|
|
62f1504514 | ||
|
|
f60d08b7a4 | ||
|
|
a092a31a1e | ||
|
|
6407518892 | ||
|
|
e7e45f608c | ||
|
|
c175badab6 | ||
|
|
05783be9ac | ||
|
|
6948eabc96 | ||
|
|
48196da281 | ||
|
|
a0b6b1084b | ||
|
|
4292959c87 | ||
|
|
e50b961bf9 | ||
|
|
0ba3957e8a | ||
|
|
c33842f8f0 | ||
|
|
f87237852f | ||
|
|
bfb63a77a2 | ||
|
|
b1ca6af2c3 | ||
|
|
2f20deacf2 | ||
|
|
de1086b894 | ||
|
|
6a19c8cf48 | ||
|
|
b6b0359fcf | ||
|
|
bb0d81a4e9 | ||
|
|
4014972feb | ||
|
|
3903fee2bf | ||
|
|
31706867c7 | ||
|
|
808a75e41c | ||
|
|
919e8dae30 | ||
|
|
763ad1bdb0 | ||
|
|
281575b961 | ||
|
|
42d1bbc7a8 | ||
|
|
a28667e751 | ||
|
|
505ff189d9 | ||
|
|
35c37c2d9e | ||
|
|
efbd11676f | ||
|
|
abf3335415 | ||
|
|
c83b0437fa | ||
|
|
23fc908eb6 | ||
|
|
9d35567cb5 | ||
|
|
7f77b8f069 | ||
|
|
410b3d261f | ||
|
|
d8baf3a814 | ||
|
|
c36b0a6b3f | ||
|
|
3385a46648 | ||
|
|
550b8289c9 | ||
|
|
2aa998f66f | ||
|
|
dff034a5b6 | ||
|
|
c407b6d4f0 | ||
|
|
58c9439a32 | ||
|
|
c75f89894a | ||
|
|
a566240266 | ||
|
|
d03d70ff0b | ||
|
|
7910493a6c | ||
|
|
c76de34b97 | ||
|
|
ddae67913d | ||
|
|
4f9716415b | ||
|
|
caf2d67443 | ||
|
|
393e9d0e00 | ||
|
|
bbbd0d52e9 | ||
|
|
26dead93ff | ||
|
|
1facde3966 | ||
|
|
d5513db9bb | ||
|
|
d135dc26e2 | ||
|
|
2dc68a4785 | ||
|
|
2f706deb26 | ||
|
|
54460e2362 | ||
|
|
1db1374226 | ||
|
|
3917a3f7b9 | ||
|
|
210346e1e3 | ||
|
|
f4efe1f6eb | ||
|
|
04b24d255e | ||
|
|
e34c25b490 | ||
|
|
ea36333497 | ||
|
|
f93f958d66 | ||
|
|
8f3d36f4bc | ||
|
|
51364f8edd | ||
|
|
cb176aae90 | ||
|
|
9d573a92ce | ||
|
|
877ac27868 |
247
CHANGELOG.md
247
CHANGELOG.md
@@ -1,3 +1,210 @@
|
||||
<a name="2.2.0"></a>
|
||||
# [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11)
|
||||
|
||||
|
||||
## BREAKING CHANGES
|
||||
|
||||
### OneSignal
|
||||
The wrapper for this plugin has been updated to the match latest version of the plugin (2.x). If you are still using and older version of the plugin (1.x), you should use ionic-native v.2.1.x.
|
||||
|
||||
### ThemeableBrowser
|
||||
The wrapper for this plugin (and related interfaces) has been refactored to replace "Themable" with "Themeable". Please fix your existing code to match the new class and interfaces names.
|
||||
|
||||
----
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd))
|
||||
* **onesignal:** update to match latest api ([#671](https://github.com/driftyco/ionic-native/issues/671)) ([7c6e6d8](https://github.com/driftyco/ionic-native/commit/7c6e6d8)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
|
||||
* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **http:** add cordovaHTTP wrapper ([#674](https://github.com/driftyco/ionic-native/issues/674)) ([f0961c7](https://github.com/driftyco/ionic-native/commit/f0961c7))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.9"></a>
|
||||
## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.8...v2.1.9) (2016-10-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845))
|
||||
* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.8"></a>
|
||||
## [2.1.8](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.8) (2016-10-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.7"></a>
|
||||
## [2.1.7](https://github.com/driftyco/ionic-native/compare/v2.1.6...v2.1.7) (2016-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **paypal:** fixed currency code not found issue ([#653](https://github.com/driftyco/ionic-native/issues/653)) ([598f8a9](https://github.com/driftyco/ionic-native/commit/598f8a9))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.6"></a>
|
||||
## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.5...v2.1.6) (2016-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.5"></a>
|
||||
## [2.1.5](https://github.com/driftyco/ionic-native/compare/v2.1.4...v2.1.5) (2016-10-06)
|
||||
|
||||
|
||||
|
||||
<a name="2.1.4"></a>
|
||||
## [2.1.4](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.4) (2016-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.3"></a>
|
||||
## [2.1.3](https://github.com/driftyco/ionic-native/compare/v2.1.2...v2.1.3) (2016-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-analytics:** add missing methods, fix return types ([77b0277](https://github.com/driftyco/ionic-native/commit/77b0277))
|
||||
* **google-analytics:** add newSession param ([f62e108](https://github.com/driftyco/ionic-native/commit/f62e108))
|
||||
* **google-analytics:** fix depreciated plugin reference ([40325ca](https://github.com/driftyco/ionic-native/commit/40325ca))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.2"></a>
|
||||
## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.1...v2.1.2) (2016-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** add missing properties ([72a694a](https://github.com/driftyco/ionic-native/commit/72a694a)), closes [#642](https://github.com/driftyco/ionic-native/issues/642)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **zBar:** add zBar barcode scanner plugin ([#634](https://github.com/driftyco/ionic-native/issues/634)) ([bbbbb3e](https://github.com/driftyco/ionic-native/commit/bbbbb3e))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.1"></a>
|
||||
## [2.1.1](https://github.com/driftyco/ionic-native/compare/v2.1.0...v2.1.1) (2016-10-03)
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **calendar:** fixed modifyEventWithOptions and related interface ([80ff2f3](https://github.com/driftyco/ionic-native/commit/80ff2f3))
|
||||
* **googlemaps:** CameraPosition target can now be GoogleMapsLatLng[] ([#587](https://github.com/driftyco/ionic-native/issues/587)) ([8d21f5f](https://github.com/driftyco/ionic-native/commit/8d21f5f))
|
||||
* **googlemaps:** typo in GoogleMapsTileOverlayOptions ([#589](https://github.com/driftyco/ionic-native/issues/589)) ([be2c198](https://github.com/driftyco/ionic-native/commit/be2c198))
|
||||
* **isdebug:** export IsDebug class ([#578](https://github.com/driftyco/ionic-native/issues/578)) ([c573332](https://github.com/driftyco/ionic-native/commit/c573332))
|
||||
* **media:** add status as a parmeter instead of property of instance ([58a99a1](https://github.com/driftyco/ionic-native/commit/58a99a1))
|
||||
* **paypal:** fix typings, add PayPalItem and PayPalPaymentDetails ([5d13ba0](https://github.com/driftyco/ionic-native/commit/5d13ba0))
|
||||
* **power-management:** fix repo and pluginref ([#603](https://github.com/driftyco/ionic-native/issues/603)) ([d6060a9](https://github.com/driftyco/ionic-native/commit/d6060a9))
|
||||
* **push:** Add support for passing notification id into finish ([#600](https://github.com/driftyco/ionic-native/issues/600)) ([16f05c3](https://github.com/driftyco/ionic-native/commit/16f05c3))
|
||||
* **social-sharing:** shareWithOptions method signature ([#598](https://github.com/driftyco/ionic-native/issues/598)) ([2ed84b1](https://github.com/driftyco/ionic-native/commit/2ed84b1)), closes [/github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209](https://github.com//github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java/issues/L209)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ble:** add startScanWithOptions ([79f0a3f](https://github.com/driftyco/ionic-native/commit/79f0a3f)), closes [#539](https://github.com/driftyco/ionic-native/issues/539)
|
||||
* **googlemaps:** support bounds in Geocoder ([#599](https://github.com/driftyco/ionic-native/issues/599)) ([66e9e46](https://github.com/driftyco/ionic-native/commit/66e9e46))
|
||||
* **location-accuracy:** add location accuracy plugin ([#583](https://github.com/driftyco/ionic-native/issues/583)) ([60b7c74](https://github.com/driftyco/ionic-native/commit/60b7c74)), closes [#484](https://github.com/driftyco/ionic-native/issues/484)
|
||||
* **plugin:** add getPlugin to plugin interface. Fixes [#582](https://github.com/driftyco/ionic-native/issues/582) ([d45a2b5](https://github.com/driftyco/ionic-native/commit/d45a2b5))
|
||||
* **plugin:** checkInstall w/ warning msg ([47112c7](https://github.com/driftyco/ionic-native/commit/47112c7))
|
||||
* **stepcounter:** add stepcounter plugin ([#607](https://github.com/driftyco/ionic-native/issues/607)) ([a99b753](https://github.com/driftyco/ionic-native/commit/a99b753))
|
||||
* **themable-browser:** add ThemableBrowser plugin ([b9151bc](https://github.com/driftyco/ionic-native/commit/b9151bc)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
|
||||
* **themable-browser:** add ThemableBrowser plugin ([972d63b](https://github.com/driftyco/ionic-native/commit/972d63b)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
|
||||
|
||||
|
||||
|
||||
<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 +309,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 +326,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 +516,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 +546,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 +553,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)
|
||||
|
||||
|
||||
|
||||
|
||||
23
LICENSE
Normal file
23
LICENSE
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright 2015-present Drifty Co.
|
||||
http://drifty.com/
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,8 +1,8 @@
|
||||
[](https://circleci.com/gh/driftyco/ionic-native) [](http://commitizen.github.io/cz-cli/)
|
||||
[](https://www.npmjs.com/package/ionic-native-playground)
|
||||
[](https://www.npmjs.com/package/ionic-native)
|
||||
|
||||
[](https://nodei.co/npm/ionic-native/)
|
||||
|
||||
[](https://nodei.co/npm/ionic-native/)
|
||||
|
||||
# Ionic Native
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
11
gulpfile.js
11
gulpfile.js
@@ -2,7 +2,7 @@ var gulp = require('gulp');
|
||||
var minimist = require('minimist');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require("gulp-rename");
|
||||
var tslint = require('ionic-gulp-tslint');
|
||||
var tslint = require('gulp-tslint');
|
||||
var decamelize = require('decamelize');
|
||||
var replace = require('gulp-replace');
|
||||
|
||||
@@ -28,12 +28,17 @@ gulp.task("minify:dist", function(){
|
||||
});
|
||||
|
||||
gulp.task('lint', function() {
|
||||
tslint({src: 'src/**/*.ts'});
|
||||
gulp.src('src/**/*.ts')
|
||||
.pipe(tslint({
|
||||
formatter: "verbose",
|
||||
configuration: 'tslint.json'
|
||||
}))
|
||||
.pipe(tslint.report())
|
||||
});
|
||||
|
||||
gulp.task('plugin:create', function(){
|
||||
if(flags.n && flags.n !== ''){
|
||||
var src = flags.m?'./TEMPLATE-MIN':'./TEMPLATE';
|
||||
var src = flags.m?'./scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl';
|
||||
return gulp.src(src)
|
||||
.pipe(replace('PluginName', flags.n))
|
||||
.pipe(rename(decamelize(flags.n, '-') + '.ts'))
|
||||
|
||||
60
karma.conf.ts
Normal file
60
karma.conf.ts
Normal 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
|
||||
});
|
||||
};
|
||||
42
package.json
42
package.json
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "1.3.20",
|
||||
"version": "2.2.0",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/index.js",
|
||||
"main": "dist/es5/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
"typings": "dist/es5/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
@@ -19,32 +21,43 @@
|
||||
"decamelize": "^1.2.0",
|
||||
"dgeni": "^0.4.2",
|
||||
"dgeni-packages": "^0.10.18",
|
||||
"es6-shim": "~0.35.1",
|
||||
"glob": "^6.0.4",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-tslint": "^5.0.0",
|
||||
"gulp-tslint": "^6.1.2",
|
||||
"gulp-uglify": "^1.5.4",
|
||||
"ionic-gulp-tslint": "^1.0.0",
|
||||
"jasmine-core": "~2.5.0",
|
||||
"karma": "~1.2.0",
|
||||
"karma-browserify": "~5.1.0",
|
||||
"karma-jasmine": "~1.0.2",
|
||||
"karma-phantomjs-launcher": "~1.0.2",
|
||||
"lodash": "3.10.1",
|
||||
"minimist": "^1.1.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
"node-html-encoder": "0.0.2",
|
||||
"q": "1.4.1",
|
||||
"semver": "^5.0.1",
|
||||
"tslint": "^3.8.1",
|
||||
"tsify": "~1.0.4",
|
||||
"tslint": "^3.15.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",
|
||||
"build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify",
|
||||
"build:js": "./node_modules/.bin/tsc",
|
||||
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
|
||||
"build:minify": "./node_modules/.bin/gulp minify:dist",
|
||||
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"test": "karma start",
|
||||
"test:watch": "npm test -- --watch",
|
||||
"start": "npm run test:watch",
|
||||
"lint": "gulp lint",
|
||||
"watch": "tsc -w",
|
||||
"build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify",
|
||||
"build:js": "tsc -p tsconfig-es5.json",
|
||||
"build:esm": "tsc -p tsconfig-esm.json",
|
||||
"build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js",
|
||||
"build:minify": "gulp minify:dist",
|
||||
"shipit": "npm run build && npm publish && bash ./scripts/bower.sh",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"plugin:create": "gulp plugin:create"
|
||||
},
|
||||
"repository": {
|
||||
@@ -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"
|
||||
|
||||
@@ -31,12 +31,37 @@ module.exports = function(currentVersion) {
|
||||
// $runBefore: ['rendering-docs'],
|
||||
// $process: function(docs){
|
||||
// docs.forEach(function(doc){
|
||||
// if (doc.members && doc.name == "IonicApp"){
|
||||
// doc.members.forEach(function(method){
|
||||
// if (method.name === "load") {
|
||||
// console.log(method);
|
||||
// }
|
||||
// })
|
||||
// if (doc.name == "Camera"){
|
||||
//
|
||||
// // console.log(doc.tags);
|
||||
// // doc.tags.forEach(function(tag){
|
||||
// // if(tag.tagName == 'classes'){
|
||||
// //
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
// // doc.moduleDoc.exports.forEach(function(d,i){
|
||||
// // if(d.name === 'CameraOptions') {
|
||||
// // console.log('Name: ' + d.name);
|
||||
// // console.log('Type: ' + d.docType);
|
||||
// // console.log('First member: ', d.members[0]);
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
//
|
||||
// // var exports = doc.exportSymbol.parent.exports;
|
||||
// // for(var p in exports) {
|
||||
// // if(p == 'CameraOptions')
|
||||
// // {
|
||||
// // var x = exports[p];
|
||||
// // console.log(x.members.quality);
|
||||
// // }
|
||||
// // }
|
||||
// // doc.members.forEach(function(method){
|
||||
// // if (method.name === "getPicture") {
|
||||
// // console.log(method);
|
||||
// // }
|
||||
// // })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module.exports = [
|
||||
{'name': 'advanced'},
|
||||
{'name': 'demo'},
|
||||
{'name': 'usage'}
|
||||
{'name': 'usage'},
|
||||
{'name': 'classes'}, // related classes
|
||||
{'name': 'interfaces'} // related interfaces
|
||||
];
|
||||
|
||||
232
scripts/docs/templates/common.template.html
vendored
232
scripts/docs/templates/common.template.html
vendored
@@ -11,6 +11,39 @@ doc: "<$ doc.name $>"
|
||||
docType: "<$ doc.docType $>"
|
||||
---
|
||||
|
||||
<@ macro interfaceTable(interface) @>
|
||||
<@ for export in doc.moduleDoc.exports -@>
|
||||
<@ if export.name == interface @>
|
||||
<table class="table param-table" style="margin:0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<@ for param in export.members @>
|
||||
<tr>
|
||||
<td>
|
||||
<$ param.name $>
|
||||
<@ if param.optional @><div><em>(optional)</em></div><@ endif @>
|
||||
</td>
|
||||
<td>
|
||||
<$ param.returnType | escape $>
|
||||
</td>
|
||||
<td>
|
||||
<$ param.description | marked $>
|
||||
</td>
|
||||
</tr>
|
||||
<@ endfor @>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@ endmacro @>
|
||||
|
||||
<@ macro paramList(paramData) -@>
|
||||
<@- if paramData -@><span class="params">(
|
||||
<@- for param in paramData -@>
|
||||
@@ -73,15 +106,81 @@ docType: "<$ doc.docType $>"
|
||||
<$ typeList(fn.typeList) $> <$ fn.description $>
|
||||
<@- endmacro -@>
|
||||
|
||||
|
||||
|
||||
<@ macro documentClass(doc) @>
|
||||
<@- if doc.statics.length -@>
|
||||
<h2>Static Members</h2>
|
||||
<@ for method in doc.statics -@>
|
||||
<@ if not method.internal @>
|
||||
<div id="<$ method.name $>"></div>
|
||||
<h3><$ functionSyntax(method) $></h3>
|
||||
<@- if method.decorators @>
|
||||
<@ for prop in method.decorators[0].argumentInfo @>
|
||||
<@ if prop.platforms @>
|
||||
<p>
|
||||
<b>Platforms:</b>
|
||||
<@- for platform in prop.platforms @>
|
||||
<code><$ platform $></code>
|
||||
<@ endfor -@>
|
||||
</p>
|
||||
<@ endif @>
|
||||
<@ endfor @>
|
||||
<@- endif @>
|
||||
|
||||
<$ method.description $>
|
||||
|
||||
<@ if method.params @>
|
||||
<$ paramTable(method.params) $>
|
||||
<@ endif @>
|
||||
|
||||
<@ if method.this -@>
|
||||
<h4> Method's `this`
|
||||
<$ method.this $>
|
||||
</h4>
|
||||
<@- endif @>
|
||||
|
||||
<@ if method.returns @>
|
||||
<div class="return-value" markdown="1">
|
||||
<i class="icon ion-arrow-return-left"></i>
|
||||
<b>Returns:</b> <$ typeInfo(method.returns) $>
|
||||
</div>
|
||||
<@ endif @>
|
||||
<@ endif @>
|
||||
<@ endfor -@>
|
||||
<@ endif @>
|
||||
|
||||
<!-- methods on the class -->
|
||||
<@- if doc.members and doc.members.length @>
|
||||
|
||||
<h2>Instance Members</h2>
|
||||
<@ for method in doc.members -@>
|
||||
<div id="<$ method.name $>"></div>
|
||||
<h3>
|
||||
<$ functionSyntax(method) $>
|
||||
</h3>
|
||||
<$ method.description $>
|
||||
<@ if method.params -@>
|
||||
<$ paramTable(method.params) $>
|
||||
<@- endif @>
|
||||
<@ if method.this -@>
|
||||
<h4> Method's `this`
|
||||
<$ method.this $>
|
||||
</h4>
|
||||
<@- endif @>
|
||||
<@ if method.returns -@>
|
||||
<div class="return-value" markdown="1">
|
||||
<i class="icon ion-arrow-return-left"></i>
|
||||
<b>Returns:</b> <$ typeInfo(method.returns) $>
|
||||
</div>
|
||||
<@- endif @>
|
||||
<@- endfor @>
|
||||
<@- endif -@>
|
||||
<@ endmacro @>
|
||||
<@ block body @>
|
||||
|
||||
|
||||
<@ block content @>
|
||||
|
||||
<@ block header @>
|
||||
|
||||
<h1 class="api-title">
|
||||
|
||||
<@ if doc.docType == "directive" @>
|
||||
<$ doc.name | dashCase $>
|
||||
<@ else @>
|
||||
@@ -108,10 +207,6 @@ docType: "<$ doc.docType $>"
|
||||
Improve this doc
|
||||
</a>
|
||||
|
||||
<@ if doc.codepen @>
|
||||
{% include codepen.html id="<$ doc.codepen $>" %}
|
||||
<@ endif @>
|
||||
|
||||
<@ endblock @>
|
||||
|
||||
<!-- decorators -->
|
||||
@@ -141,9 +236,9 @@ docType: "<$ doc.docType $>"
|
||||
<h2>Supported platforms</h2>
|
||||
<@ block platforms @>
|
||||
<ul>
|
||||
<@- for platform in prop.platforms @>
|
||||
<@ for platform in prop.platforms -@>
|
||||
<li><$ platform $></li>
|
||||
<@ endfor -@>
|
||||
<@- endfor @>
|
||||
</ul>
|
||||
<@ endblock @>
|
||||
<!-- @platforms tag end -->
|
||||
@@ -181,12 +276,11 @@ docType: "<$ doc.docType $>"
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<@ for prop in doc.properties @>
|
||||
<@ for prop in doc.properties -@>
|
||||
<tr>
|
||||
<td>
|
||||
<$ prop.name $>
|
||||
</td>
|
||||
|
||||
<@ if hasTypes @>
|
||||
<td>
|
||||
<$ prop.type.name $>
|
||||
@@ -197,86 +291,12 @@ docType: "<$ doc.docType $>"
|
||||
<$ prop.description $>
|
||||
</td>
|
||||
</tr>
|
||||
<@ endfor @>
|
||||
<@- endfor @>
|
||||
</tbody>
|
||||
</table>
|
||||
<@ endif @>
|
||||
|
||||
<@- if doc.statics.length -@>
|
||||
<h2>Static Members</h2>
|
||||
<@- for method in doc.statics @><@ if not method.internal @>
|
||||
<div id="<$ method.name $>"></div>
|
||||
<h3><$ functionSyntax(method) $></h3>
|
||||
|
||||
<@- if method.decorators @>
|
||||
<@ for prop in method.decorators[0].argumentInfo @>
|
||||
<@ if prop.platforms @>
|
||||
<p>
|
||||
<b>Platforms:</b>
|
||||
<@- for platform in prop.platforms @>
|
||||
<code><$ platform $></code>
|
||||
<@ endfor -@>
|
||||
</p>
|
||||
<@ endif @>
|
||||
<@ endfor @>
|
||||
<@ endif -@>
|
||||
|
||||
<$ method.description $>
|
||||
|
||||
<@ if method.params @>
|
||||
<$ paramTable(method.params) $>
|
||||
<@ endif @>
|
||||
|
||||
<@ if method.this @>
|
||||
<h4> Method's `this`
|
||||
<$ method.this $>
|
||||
</h4>
|
||||
<@ endif @>
|
||||
|
||||
<@ if method.returns @>
|
||||
<div class="return-value" markdown="1">
|
||||
<i class="icon ion-arrow-return-left"></i>
|
||||
<b>Returns:</b> <$ typeInfo(method.returns) $>
|
||||
</div>
|
||||
<@ endif @>
|
||||
<@ endif @>
|
||||
<@ endfor -@>
|
||||
<@ endif @>
|
||||
|
||||
<!-- methods on the class -->
|
||||
<@- if doc.members and doc.members.length @>
|
||||
|
||||
<h2>Instance Members</h2>
|
||||
<@- for method in doc.members @>
|
||||
|
||||
<div id="<$ method.name $>"></div>
|
||||
|
||||
<h3>
|
||||
<$ functionSyntax(method) $>
|
||||
</h3>
|
||||
|
||||
<$ method.description $>
|
||||
|
||||
<@ if method.params @>
|
||||
<$ paramTable(method.params) $>
|
||||
<@ endif @>
|
||||
|
||||
<@ if method.this @>
|
||||
<h4> Method's `this`
|
||||
<$ method.this $>
|
||||
</h4>
|
||||
<@ endif @>
|
||||
|
||||
<@ if method.returns @>
|
||||
<div class="return-value" markdown="1">
|
||||
<i class="icon ion-arrow-return-left"></i>
|
||||
<b>Returns:</b> <$ typeInfo(method.returns) $>
|
||||
</div>
|
||||
<@ endif @>
|
||||
|
||||
<@ endfor -@>
|
||||
|
||||
<@- endif -@>
|
||||
<$ documentClass(doc) $>
|
||||
|
||||
<@ block advanced @>
|
||||
<@- if doc.advanced -@>
|
||||
@@ -285,6 +305,40 @@ docType: "<$ doc.docType $>"
|
||||
<@- endif -@>
|
||||
<@ endblock @>
|
||||
|
||||
<!-- other classes -->
|
||||
<@ for tag in doc.tags.tags -@>
|
||||
<@ if tag.tagName == 'classes' -@>
|
||||
<h2><a class="anchor" name="related-classes" href="#related-classes"></a>Related Classes</h2>
|
||||
<@ set classes = tag.description.split('\n') @>
|
||||
<@ for item in classes -@>
|
||||
<@ if item.length > 1 @>
|
||||
<@ for export in doc.moduleDoc.exports -@>
|
||||
<@ if export.name == item @>
|
||||
<h3><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h3>
|
||||
<$ documentClass(export) $>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@- endif @>
|
||||
<@- endfor @>
|
||||
<!-- end other classes -->
|
||||
|
||||
<!-- interfaces -->
|
||||
<@ for tag in doc.tags.tags -@>
|
||||
<@ if tag.tagName == 'interfaces' @>
|
||||
<h2><a class="anchor" name="interfaces" href="#interfaces"></a>Interfaces</h2>
|
||||
<@ set interfaces = tag.description.split('\n') @>
|
||||
<@ for item in interfaces -@>
|
||||
<@ if item.length > 1 @>
|
||||
<h3><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h3>
|
||||
<$ interfaceTable(item) $>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<!-- end interfaces -->
|
||||
|
||||
<!-- related link -->
|
||||
<@- if doc.see @>
|
||||
|
||||
|
||||
@@ -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';
|
||||
*
|
||||
*
|
||||
* ```
|
||||
@@ -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))
|
||||
149
src/index.ts
149
src/index.ts
@@ -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';
|
||||
@@ -65,6 +64,7 @@ import { IsDebug } from './plugins/is-debug';
|
||||
import { Keyboard } from './plugins/keyboard';
|
||||
import { LaunchNavigator } from './plugins/launchnavigator';
|
||||
import { LocalNotifications } from './plugins/localnotifications';
|
||||
import { LocationAccuracy } from './plugins/location-accuracy';
|
||||
import { MediaCapture } from './plugins/media-capture';
|
||||
import { NativeAudio } from './plugins/native-audio';
|
||||
import { NativePageTransitions } from './plugins/native-page-transitions';
|
||||
@@ -94,127 +94,128 @@ import { SpinnerDialog } from './plugins/spinnerdialog';
|
||||
import { Splashscreen } from './plugins/splashscreen';
|
||||
import { SQLite } from './plugins/sqlite';
|
||||
import { StatusBar } from './plugins/statusbar';
|
||||
import { Stepcounter } from './plugins/stepcounter';
|
||||
import { StreamingMedia } from './plugins/streaming-media';
|
||||
import { ThreeDeeTouch } from './plugins/3dtouch';
|
||||
import { Toast } from './plugins/toast';
|
||||
import { TouchID } from './plugins/touchid';
|
||||
import { TextToSpeech } from './plugins/text-to-speech';
|
||||
import { ThemeableBrowser } from './plugins/themeable-browser';
|
||||
import { TwitterConnect } from './plugins/twitter-connect';
|
||||
import { Vibration } from './plugins/vibration';
|
||||
import { VideoEditor } from './plugins/video-editor';
|
||||
import { VideoPlayer } from './plugins/video-player';
|
||||
import { WebIntent } from './plugins/webintent';
|
||||
import { YoutubeVideoPlayer } from './plugins/youtube-video-player';
|
||||
import { ZBar } from './plugins/z-bar';
|
||||
import { Zip } from './plugins/zip';
|
||||
export * from './plugins/3dtouch';
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/admob';
|
||||
export * from './plugins/android-fingerprint-auth';
|
||||
export * from './plugins/appavailability';
|
||||
export * from './plugins/apprate';
|
||||
export * from './plugins/appversion';
|
||||
export * from './plugins/background-geolocation';
|
||||
export * from './plugins/backgroundmode';
|
||||
export * from './plugins/badge';
|
||||
export * from './plugins/barcodescanner';
|
||||
export * from './plugins/base64togallery';
|
||||
export * from './plugins/batterystatus';
|
||||
export * from './plugins/ble';
|
||||
export * from './plugins/bluetoothserial';
|
||||
export * from './plugins/brightness';
|
||||
export * from './plugins/calendar';
|
||||
export * from './plugins/call-number';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/camera-preview';
|
||||
export * from './plugins/card-io';
|
||||
export * from './plugins/clipboard';
|
||||
export * from './plugins/code-push';
|
||||
export * from './plugins/contacts';
|
||||
export * from './plugins/crop';
|
||||
export * from './plugins/datepicker';
|
||||
export * from './plugins/dbmeter';
|
||||
export * from './plugins/deeplinks';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/deviceaccounts';
|
||||
export * from './plugins/devicemotion';
|
||||
export * from './plugins/deviceorientation';
|
||||
export * from './plugins/diagnostic';
|
||||
export * from './plugins/dialogs';
|
||||
export * from './plugins/emailcomposer';
|
||||
export * from './plugins/estimote-beacons';
|
||||
export * from './plugins/facebook';
|
||||
export * from './plugins/file';
|
||||
export * from './plugins/file-chooser';
|
||||
export * from './plugins/file-opener';
|
||||
export * from './plugins/filetransfer';
|
||||
export * from './plugins/flashlight';
|
||||
export * from './plugins/geofence';
|
||||
export * from './plugins/geolocation';
|
||||
export * from './plugins/globalization';
|
||||
export * from './plugins/google-plus';
|
||||
export * from './plugins/googleanalytics';
|
||||
export * from './plugins/googlemaps';
|
||||
export * from './plugins/hotspot';
|
||||
export * from './plugins/http';
|
||||
export * from './plugins/httpd';
|
||||
export * from './plugins/ibeacon';
|
||||
export * from './plugins/imagepicker';
|
||||
export * from './plugins/imageresizer';
|
||||
export * from './plugins/inappbrowser';
|
||||
export * from './plugins/inapppurchase';
|
||||
export * from './plugins/insomnia';
|
||||
export * from './plugins/instagram';
|
||||
export * from './plugins/is-debug';
|
||||
export * from './plugins/keyboard';
|
||||
export * from './plugins/launchnavigator';
|
||||
export * from './plugins/localnotifications';
|
||||
export * from './plugins/nfc';
|
||||
export * from './plugins/location-accuracy';
|
||||
export * from './plugins/market';
|
||||
export * from './plugins/media';
|
||||
export * from './plugins/media-capture';
|
||||
export * from './plugins/mixpanel';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/music-controls';
|
||||
export * from './plugins/native-audio';
|
||||
export * from './plugins/native-page-transitions';
|
||||
export * from './plugins/nativestorage';
|
||||
export * from './plugins/network';
|
||||
export * from './plugins/nfc';
|
||||
export * from './plugins/onesignal';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/photo-viewer';
|
||||
export * from './plugins/pin-dialog';
|
||||
export * from './plugins/plugin';
|
||||
export * from './plugins/power-management';
|
||||
export * from './plugins/printer';
|
||||
export * from './plugins/push';
|
||||
export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/screen-orientation';
|
||||
export * from './plugins/screenshot';
|
||||
export * from './plugins/securestorage';
|
||||
export * from './plugins/shake';
|
||||
export * from './plugins/sim';
|
||||
export * from './plugins/sms';
|
||||
export * from './plugins/socialsharing';
|
||||
export * from './plugins/spinnerdialog';
|
||||
export * from './plugins/splashscreen';
|
||||
export * from './plugins/sqlite';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/stepcounter';
|
||||
export * from './plugins/streaming-media';
|
||||
export * from './plugins/text-to-speech';
|
||||
export * from './plugins/themeable-browser';
|
||||
export * from './plugins/toast';
|
||||
export * from './plugins/touchid';
|
||||
export * from './plugins/twitter-connect';
|
||||
export * from './plugins/vibration';
|
||||
export * from './plugins/video-editor';
|
||||
export * from './plugins/video-player';
|
||||
export {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
AndroidFingerprintAuth,
|
||||
AppAvailability,
|
||||
AppRate,
|
||||
AppVersion,
|
||||
Badge,
|
||||
BarcodeScanner,
|
||||
Base64ToGallery,
|
||||
BatteryStatus,
|
||||
Brightness,
|
||||
BLE,
|
||||
BluetoothSerial,
|
||||
CallNumber,
|
||||
CanvasCamera,
|
||||
CameraPreview,
|
||||
Clipboard,
|
||||
CodePush,
|
||||
Crop,
|
||||
DBMeter,
|
||||
Deeplinks,
|
||||
DeviceAccounts,
|
||||
Dialogs,
|
||||
Diagnostic,
|
||||
EmailComposer,
|
||||
EstimoteBeacons,
|
||||
File,
|
||||
FileChooser,
|
||||
FileOpener,
|
||||
Flashlight,
|
||||
Geofence,
|
||||
Globalization,
|
||||
GooglePlus,
|
||||
GoogleAnalytics,
|
||||
Hotspot,
|
||||
InAppPurchase,
|
||||
Insomnia,
|
||||
Instagram,
|
||||
Keyboard,
|
||||
MusicControls,
|
||||
NativeAudio,
|
||||
NativeStorage,
|
||||
Network,
|
||||
Market,
|
||||
OneSignal,
|
||||
PhotoViewer,
|
||||
ScreenOrientation,
|
||||
PinDialog,
|
||||
PowerManagement,
|
||||
Screenshot,
|
||||
SecureStorage,
|
||||
Shake,
|
||||
SocialSharing,
|
||||
Sim,
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
Vibration,
|
||||
WebIntent,
|
||||
YoutubeVideoPlayer,
|
||||
Zip
|
||||
}
|
||||
|
||||
export * from './plugins/plugin';
|
||||
export * from './plugins/webintent';
|
||||
export * from './plugins/youtube-video-player';
|
||||
export * from './plugins/z-bar';
|
||||
export * from './plugins/zip';
|
||||
|
||||
// Window export to use outside of a module loading system
|
||||
window['IonicNative'] = {
|
||||
@@ -235,7 +236,6 @@ window['IonicNative'] = {
|
||||
BluetoothSerial,
|
||||
Calendar,
|
||||
CallNumber,
|
||||
CanvasCamera,
|
||||
Camera,
|
||||
CameraPreview,
|
||||
CardIO,
|
||||
@@ -272,11 +272,13 @@ window['IonicNative'] = {
|
||||
ImageResizer,
|
||||
InAppBrowser,
|
||||
InAppPurchase,
|
||||
Insomnia,
|
||||
Instagram,
|
||||
IsDebug,
|
||||
Keyboard,
|
||||
LaunchNavigator,
|
||||
LocalNotifications,
|
||||
LocationAccuracy,
|
||||
Market,
|
||||
MediaCapture,
|
||||
MediaPlugin,
|
||||
@@ -306,18 +308,21 @@ window['IonicNative'] = {
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
Stepcounter,
|
||||
StreamingMedia,
|
||||
ThreeDeeTouch,
|
||||
Toast,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
ThemeableBrowser,
|
||||
TwitterConnect,
|
||||
VideoEditor,
|
||||
VideoPlayer,
|
||||
Vibration,
|
||||
WebIntent,
|
||||
YoutubeVideoPlayer,
|
||||
ZBar,
|
||||
Zip
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
@@ -198,6 +267,9 @@ export interface Config {
|
||||
* BackgroundGeolocation.stop();
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* Location
|
||||
* Config
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-mauron85-background-geolocation',
|
||||
@@ -207,13 +279,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 +343,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 +350,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 +363,6 @@ export class BackgroundGeolocation {
|
||||
@Cordova()
|
||||
static finish() { }
|
||||
|
||||
|
||||
/**
|
||||
* Force the plugin to enter "moving" or "stationary" state
|
||||
* NOTE: IOS, WP only
|
||||
@@ -254,7 +370,6 @@ export class BackgroundGeolocation {
|
||||
@Cordova()
|
||||
static changePace(isMoving: boolean) { }
|
||||
|
||||
|
||||
/**
|
||||
* Setup configuration
|
||||
*/
|
||||
@@ -286,11 +401,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 +441,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 +461,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; }
|
||||
}
|
||||
|
||||
@@ -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; };
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -207,6 +207,19 @@ export class BLE {
|
||||
})
|
||||
static startScan(services: string[]): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
|
||||
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
|
||||
* @param options {any}
|
||||
* @return Returns an Observable that notifies of each peripheral discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopScan',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop a scan started by `startScan`.
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @private
|
||||
*/
|
||||
export interface CalendarOptions {
|
||||
id?: string;
|
||||
firstReminderMinutes?: number;
|
||||
secondReminderMinutes?: number;
|
||||
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly'
|
||||
@@ -52,7 +53,7 @@ export class Calendar {
|
||||
* - You're using Android < 6, or
|
||||
* - You've already granted permission
|
||||
*
|
||||
* If this returns false, you should call `requestReadWritePermissions` function
|
||||
* If this returns false, you should call the `requestReadWritePermission` function
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -336,7 +337,8 @@ export class Calendar {
|
||||
* @param {string} [newNotes] The new event notes
|
||||
* @param {Date} [newStartDate] The new event start date
|
||||
* @param {Date} [newEndDate] The new event end date
|
||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||
* @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions`
|
||||
* @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -351,8 +353,9 @@ export class Calendar {
|
||||
newNotes?: string,
|
||||
newStartDate?: Date,
|
||||
newEndDate?: Date,
|
||||
options?: CalendarOptions
|
||||
) { return; }
|
||||
filterOptions?: CalendarOptions,
|
||||
newOptions?: CalendarOptions
|
||||
): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete an event.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,59 @@ export interface CameraPreviewSize {
|
||||
* @description
|
||||
* Showing camera preview in HTML
|
||||
*
|
||||
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/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',
|
||||
pluginRef: 'cordova.plugins.camerapreview',
|
||||
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
|
||||
repo: 'https://github.com/westonganger/cordova-plugin-camera-preview',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class CameraPreview {
|
||||
@@ -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.
|
||||
@@ -95,14 +139,6 @@ export class CameraPreview {
|
||||
})
|
||||
static hide(): void { };
|
||||
|
||||
/**
|
||||
* Set the default mode for the Flash.
|
||||
*/
|
||||
// @Cordova({
|
||||
// sync: true
|
||||
// })
|
||||
// static setFlashMode(mode: number): void { };
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
*/
|
||||
@@ -110,15 +146,4 @@ export class CameraPreview {
|
||||
sync: true
|
||||
})
|
||||
static setColorEffect(effect: string): void { };
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static FlashMode = {
|
||||
OFF: 0,
|
||||
ON: 1,
|
||||
AUTO: 2
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ export interface CameraOptions {
|
||||
/**
|
||||
* Choose the format of the return value.
|
||||
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
||||
* DATA_URL : 0, Return image as base64-encoded string
|
||||
* FILE_URI : 1, Return image file URI
|
||||
* DATA_URL : 0, Return image as base64-encoded string,
|
||||
* FILE_URI : 1, Return image file URI,
|
||||
* NATIVE_URI : 2 Return image native URI
|
||||
* (e.g., assets-library:// on iOS or content:// on Android)
|
||||
*/
|
||||
@@ -105,6 +105,9 @@ export interface CameraPopoverOptions {
|
||||
* // Handle error
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
* CameraOptions
|
||||
* CameraPopoverOptions
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-camera',
|
||||
@@ -204,6 +207,6 @@ export class Camera {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static cleanup() { };
|
||||
static cleanup(): Promise<any> { return; };
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface IContactProperties {
|
||||
/** A globally unique identifier. */
|
||||
id?: string;
|
||||
@@ -75,6 +77,9 @@ export class Contact implements IContactProperties {
|
||||
save(): Promise<any> { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
interface IContactError {
|
||||
/** Error code */
|
||||
code: number;
|
||||
@@ -82,6 +87,9 @@ interface IContactError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
declare var ContactError: {
|
||||
new (code: number): IContactError;
|
||||
UNKNOWN_ERROR: number;
|
||||
@@ -186,13 +194,21 @@ export class ContactAddress implements IContactAddress {
|
||||
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
|
||||
}
|
||||
|
||||
/** Set to true if this ContactAddress contains the user's preferred value. */
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
/** A string indicating what type of field this is, home for example. */
|
||||
@InstanceProperty get type(): string { return; }
|
||||
/** The full address formatted for display. */
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
/** The full street address. */
|
||||
@InstanceProperty get streetAddress(): string { return; }
|
||||
/** The city or locality. */
|
||||
@InstanceProperty get locality(): string { return; }
|
||||
/** The state or region. */
|
||||
@InstanceProperty get region(): string { return; }
|
||||
/** The zip code or postal code. */
|
||||
@InstanceProperty get postalCode(): string { return; }
|
||||
/** The country name. */
|
||||
@InstanceProperty get country(): string { return; }
|
||||
}
|
||||
|
||||
@@ -217,10 +233,15 @@ export class ContactOrganization implements IContactOrganization {
|
||||
constructor() {
|
||||
this._objectInstance = new window.ContactOrganization();
|
||||
}
|
||||
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
/** A string that indicates what type of field this is, home for example. */
|
||||
@InstanceProperty get type(): string { return; }
|
||||
/** The name of the organization. */
|
||||
@InstanceProperty get name(): string { return; }
|
||||
/** The department the contract works for. */
|
||||
@InstanceProperty get department(): string { return; }
|
||||
/** The contact's title at the organization. */
|
||||
@InstanceProperty get title(): string { return; }
|
||||
}
|
||||
|
||||
@@ -232,6 +253,10 @@ export interface IContactFindOptions {
|
||||
multiple?: boolean;
|
||||
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
|
||||
desiredFields?: string[];
|
||||
/**
|
||||
* (Android only): Filters the search to only return contacts with a phone number informed.
|
||||
*/
|
||||
hasPhoneNumber?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,9 +269,24 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
this._objectInstance = new window.ContactFindOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* The search string used to find navigator.contacts. (Default: "")
|
||||
*/
|
||||
@InstanceProperty get filter(): string { return; }
|
||||
|
||||
/**
|
||||
* Determines if the find operation returns multiple navigator.contacts. (Default: false)
|
||||
*/
|
||||
@InstanceProperty get multiple(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields.
|
||||
*/
|
||||
@InstanceProperty get desiredFields(): any { return; }
|
||||
|
||||
/**
|
||||
* (Android only): Filters the search to only return contacts with a phone number informed.
|
||||
*/
|
||||
@InstanceProperty get hasPhoneNumber(): boolean { return; }
|
||||
}
|
||||
|
||||
@@ -268,8 +308,12 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
* (error: any) => console.error('Error saving contact.', error)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @interfaces
|
||||
* IContactProperties
|
||||
* @classes
|
||||
* ContactFindOptions
|
||||
* ContactOrganization
|
||||
* ContactAddress
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
@@ -277,6 +321,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();
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ declare var cordova: any;
|
||||
* @name Email Composer
|
||||
* @description
|
||||
*
|
||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
|
||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/hypery2k/cordova-email-plugin).
|
||||
*
|
||||
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
|
||||
* A good alternative to this plugin is the social sharing plugin.
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ export class EstimoteBeacons {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||
* console.log(JSON.stringify(info));
|
||||
* });
|
||||
@@ -280,7 +280,7 @@ export class EstimoteBeacons {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @return Returns an Observable that notifies of each beacon discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -288,14 +288,14 @@ export class EstimoteBeacons {
|
||||
clearFunction: 'stopRangingBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
|
||||
static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||
* console.log(JSON.stringify(info));
|
||||
* });
|
||||
@@ -303,11 +303,11 @@ export class EstimoteBeacons {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging secure beacons. Available on iOS.
|
||||
@@ -321,7 +321,7 @@ export class EstimoteBeacons {
|
||||
clearFunction: 'stopRangingSecureBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
|
||||
static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging secure beacons. Available on iOS.
|
||||
@@ -329,19 +329,19 @@ export class EstimoteBeacons {
|
||||
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingSecureBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
|
||||
* console.log('Region state: ' + JSON.stringify(state));
|
||||
* });
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
|
||||
* are inside a region when the user turns display on, see
|
||||
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
|
||||
@@ -355,21 +355,21 @@ export class EstimoteBeacons {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring secure beacons. Available on iOS.
|
||||
@@ -378,6 +378,8 @@ export class EstimoteBeacons {
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
* @see {@link EstimoteBeacons.startMonitoringForRegion}
|
||||
* @param region {EstimoteBeaconRegion} Region
|
||||
* @param notifyEntryStateOnDisplay {boolean}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
@@ -386,16 +388,17 @@ export class EstimoteBeacons {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startSecureMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
static startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Stop monitoring secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* {@link EstimoteBeacons.stopMonitoringForRegion}.
|
||||
* @param region {EstimoteBeaconRegion} Region
|
||||
*/
|
||||
@Cordova()
|
||||
static stopSecureMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Connect to Estimote Beacon. Available on Android.
|
||||
@@ -473,7 +476,7 @@ export class EstimoteBeacons {
|
||||
|
||||
}
|
||||
|
||||
export interface BeaconRegion {
|
||||
export interface EstimoteBeaconRegion {
|
||||
state?: string;
|
||||
major: number;
|
||||
minor: number;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name FileOpener
|
||||
* @description
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -109,14 +121,22 @@ export interface GeolocationOptions {
|
||||
* Geolocation.getCurrentPosition().then((resp) => {
|
||||
* // resp.coords.latitude
|
||||
* // resp.coords.longitude
|
||||
* })
|
||||
* }).catch((error) => {
|
||||
* console.log('Error getting location', error);
|
||||
* });
|
||||
*
|
||||
* let watch = Geolocation.watchPosition();
|
||||
* watch.subscribe((data) => {
|
||||
* // data can be a set of coordinates, or an error (if an error occurred).
|
||||
* // data.coords.latitude
|
||||
* // data.coords.longitude
|
||||
* })
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
* Coordinates
|
||||
* Geoposition
|
||||
* PositionError
|
||||
* GeolocationOptions
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-geolocation',
|
||||
@@ -140,7 +160,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 +173,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);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@ declare var window;
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-google-analytics',
|
||||
pluginRef: 'analytics',
|
||||
pluginRef: 'ga',
|
||||
repo: 'https://github.com/danwilson/google-analytics-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@@ -23,45 +23,128 @@ export class GoogleAnalytics {
|
||||
* In your 'deviceready' handler, set up your Analytics tracker.
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/
|
||||
* @param {string} id Your Google Analytics Mobile App property
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static startTrackerWithId(id: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
||||
* @param allow {boolean}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAllowIDFACollection(allow: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a UserId
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
|
||||
* @param {string} id User ID
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setUserId(id: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a anonymize Ip address
|
||||
* @param anonymize {boolean} Set to true to anonymize the IP Address
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the app version
|
||||
* @param appVersion {string} App version
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAppVersion(appVersion: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set OptOut
|
||||
* @param optout {boolean}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setOptOut(optout: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable verbose logging
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static debugMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track custom metric
|
||||
* @param key {string}
|
||||
* @param value {any}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static trackMetric(key: string, value?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track a screen
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
|
||||
*
|
||||
* @param {string} title Screen title
|
||||
* @param {string} campaignUrl Campaign url for measuring referrals
|
||||
* @param title {string} Screen title
|
||||
* @param campaignUrl {string} Campaign url for measuring referrals
|
||||
* @param newSession {boolean} Set to true to create a new session
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 3,
|
||||
errorIndex: 4
|
||||
})
|
||||
static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Add a Custom Dimension
|
||||
* https://developers.google.com/analytics/devguides/platform/customdimsmets
|
||||
* @param key {string}
|
||||
* @param value {string}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackView(title: string, campaignUrl?: string): Promise<any> { return; }
|
||||
static addCustomDimension(key: number, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track an event
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
||||
* @param {string} category
|
||||
* @param {string} action
|
||||
* @param {string} label
|
||||
* @param {number} value
|
||||
* @param category {string}
|
||||
* @param action {string}
|
||||
* @param label {string}
|
||||
* @param value {number}
|
||||
* @param newSession {boolean} Set to true to create a new session
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return; }
|
||||
@Cordova({
|
||||
successIndex: 5,
|
||||
errorIndex: 6
|
||||
})
|
||||
static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track an exception
|
||||
* @param {string} description
|
||||
* @param {boolean} fatal
|
||||
* @param description {string}
|
||||
* @param fatal {boolean}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackException(description: string, fatal: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track User Timing (App Speed)
|
||||
* @param {string} category
|
||||
* @param {number} intervalInMilliseconds
|
||||
* @param {string} variable
|
||||
* @param {string} label
|
||||
* @param category {string}
|
||||
* @param intervalInMilliseconds {number}
|
||||
* @param variable {string}
|
||||
* @param label {string}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
|
||||
@@ -69,12 +152,13 @@ export class GoogleAnalytics {
|
||||
/**
|
||||
* Add a Transaction (Ecommerce)
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
|
||||
* @param {string} id
|
||||
* @param {string} affiliation
|
||||
* @param {number} revenue
|
||||
* @param {number} tax
|
||||
* @param {number} shipping
|
||||
* @param {string} currencyCode
|
||||
* @param id {string}
|
||||
* @param affiliation {string}
|
||||
* @param revenue {number}
|
||||
* @param tax {number}
|
||||
* @param shipping {number}
|
||||
* @param currencyCode {string}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
|
||||
@@ -89,57 +173,15 @@ export class GoogleAnalytics {
|
||||
* @param {number} price
|
||||
* @param {number} quantity
|
||||
* @param {string} currencyCode
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Add a Custom Dimension
|
||||
* https://developers.google.com/analytics/devguides/platform/customdimsmets
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
*/
|
||||
@Cordova()
|
||||
static addCustomDimension(key: number, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a UserId
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
|
||||
* @param {string} id
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setUserId(id: string): void { }
|
||||
|
||||
/**
|
||||
* Sets the app version
|
||||
* @param appVersion
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setAppVersion(appVersion: string): void { }
|
||||
|
||||
/**
|
||||
* Set a anonymize Ip address
|
||||
* @param anonymize
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setAnonymizeIp(anonymize: boolean): void { }
|
||||
|
||||
/**
|
||||
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
||||
* @param allow
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setAllowIDFACollection(allow: boolean): void { }
|
||||
|
||||
/**
|
||||
* Enable verbose logging
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static debugMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable/disable automatic reporting of uncaught exceptions
|
||||
* @param {boolean} shouldEnable
|
||||
* @param shouldEnable {boolean}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -155,10 +155,10 @@ export class Hotspot {
|
||||
static isWifiDirectSupported(): Promise<boolean> { return; }
|
||||
|
||||
@Cordova()
|
||||
static scanWifi(): Promise<Array<Network>> { return; }
|
||||
static scanWifi(): Promise<Array<HotspotNetwork>> { return; }
|
||||
|
||||
@Cordova()
|
||||
static scanWifiByLevel(): Promise<Array<Network>> { return; }
|
||||
static scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
|
||||
|
||||
@Cordova()
|
||||
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
|
||||
@@ -167,7 +167,7 @@ export class Hotspot {
|
||||
static stopWifiPeriodicallyScan(): Promise<any> { return; }
|
||||
|
||||
@Cordova()
|
||||
static getNetConfig(): Promise<NetworkConfig> { return; }
|
||||
static getNetConfig(): Promise<HotspotNetworkConfig> { return; }
|
||||
|
||||
@Cordova()
|
||||
static getConnectionInfo(): Promise<ConnectionInfo> { return; }
|
||||
@@ -217,90 +217,90 @@ export class Hotspot {
|
||||
|
||||
export interface ConnectionInfo {
|
||||
/**
|
||||
* @property {string} SSID
|
||||
* SSID
|
||||
* The service set identifier (SSID) of the current 802.11 network.
|
||||
*/
|
||||
SSID: string;
|
||||
/**
|
||||
* @property {string} BSSID
|
||||
* BSSID
|
||||
* The basic service set identifier (BSSID) of the current access point.
|
||||
*/
|
||||
BSSID: string;
|
||||
/**
|
||||
* @property {string} linkSpeed
|
||||
* linkSpeed
|
||||
* The current link speed in Mbps
|
||||
*/
|
||||
linkSpeed: string;
|
||||
/**
|
||||
* @property {string} IPAddress
|
||||
* IPAddress
|
||||
* The IP Address
|
||||
*/
|
||||
IPAddress: string;
|
||||
/**
|
||||
* @property {string} networkID
|
||||
* networkID
|
||||
* Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.
|
||||
*/
|
||||
networkID: string;
|
||||
}
|
||||
|
||||
export interface Network {
|
||||
export interface HotspotNetwork {
|
||||
/**
|
||||
* @property {string} SSID
|
||||
* SSID
|
||||
* Human readable network name
|
||||
*/
|
||||
SSID: string;
|
||||
/**
|
||||
* @property {string} BSSID
|
||||
* BSSID
|
||||
* MAC Address of the access point
|
||||
*/
|
||||
BSSID: string;
|
||||
/**
|
||||
* @property {number (int)} frequency
|
||||
* frequency
|
||||
* The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.
|
||||
*/
|
||||
frequency: number;
|
||||
/**
|
||||
* @property {number} level
|
||||
* level
|
||||
* The detected signal level in dBm, also known as the RSSI.
|
||||
*/
|
||||
level: number;
|
||||
/**
|
||||
* @property {number} timestamp
|
||||
* timestamp
|
||||
* Timestamp in microseconds (since boot) when this result was last seen.
|
||||
*/
|
||||
timestamp: number;
|
||||
/**
|
||||
* @property {string} capabilities
|
||||
* capabilities
|
||||
* Describes the authentication, key management, and encryption schemes supported by the access point.
|
||||
*/
|
||||
capabilities: string;
|
||||
}
|
||||
export interface NetworkConfig {
|
||||
export interface HotspotNetworkConfig {
|
||||
/**
|
||||
* @property {string} deviceIPAddress - Device IP Address
|
||||
* deviceIPAddress - Device IP Address
|
||||
*/
|
||||
deviceIPAddress: string;
|
||||
/**
|
||||
* @property {string} deviceMacAddress - Device MAC Address
|
||||
* deviceMacAddress - Device MAC Address
|
||||
*/
|
||||
deviceMacAddress: string;
|
||||
/**
|
||||
* @property {string} gatewayIPAddress - Gateway IP Address
|
||||
* gatewayIPAddress - Gateway IP Address
|
||||
*/
|
||||
gatewayIPAddress: string;
|
||||
/**
|
||||
* @property {string} gatewayMacAddress - Gateway MAC Address
|
||||
* gatewayMacAddress - Gateway MAC Address
|
||||
*/
|
||||
gatewayMacAddress: string;
|
||||
}
|
||||
export interface HotspotDevice {
|
||||
/**
|
||||
* @property {string} ip
|
||||
* ip
|
||||
* Hotspot IP Address
|
||||
*/
|
||||
ip: string;
|
||||
/**
|
||||
* @property {string} mac
|
||||
* mac
|
||||
* Hotspot MAC Address
|
||||
*/
|
||||
mac: string;
|
||||
|
||||
158
src/plugins/http.ts
Normal file
158
src/plugins/http.ts
Normal file
@@ -0,0 +1,158 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
/**
|
||||
* @name HTTP
|
||||
* @description
|
||||
* Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
|
||||
*
|
||||
* Advantages over Javascript requests:
|
||||
* - Background threading - all requests are done in a background thread
|
||||
* - SSL Pinning
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { HTTP } from 'ionic-native';
|
||||
*
|
||||
* HTTP.get('http://ionic.io', {}, {})
|
||||
* .then(data => {
|
||||
*
|
||||
* console.log(data.status);
|
||||
* console.log(data.data); // data received by server
|
||||
* console.log(data.headers);
|
||||
*
|
||||
* })
|
||||
* .catch(error => {
|
||||
*
|
||||
* console.log(error.status);
|
||||
* console.log(error.error); // error message as string
|
||||
* console.log(error.headers);
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* HTTPResponse
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-http',
|
||||
pluginRef: 'cordovaHTTP',
|
||||
repo: 'https://github.com/wymsee/cordova-HTTP'
|
||||
})
|
||||
export class HTTP {
|
||||
|
||||
/**
|
||||
* This returns an object representing a basic HTTP Authorization header of the form.
|
||||
* @param username {string} Username
|
||||
* @param password {string} Password
|
||||
* @return {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
|
||||
|
||||
/**
|
||||
* This sets up all future requests to use Basic HTTP authentication with the given username and password.
|
||||
* @param username {string} Username
|
||||
* @param password {string} Password
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static useBasicAuth(username: string, password: string): void { }
|
||||
|
||||
/**
|
||||
* Set a header for all future requests. Takes a header and a value.
|
||||
* @param header {string} The name of the header
|
||||
* @param value {string} The value of the header
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static setHeader(header: string, value: string): void { }
|
||||
|
||||
/**
|
||||
* Enable or disable SSL Pinning. This defaults to false.
|
||||
*
|
||||
* To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this stackoverflow answer. You want to convert it to a DER encoded certificate with a .cer extension.
|
||||
*
|
||||
* As an alternative, you can store your .cer files in the www/certificates folder.
|
||||
* @param enable {boolean} Set to true to enable
|
||||
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static enableSSLPinning(enable: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
|
||||
* @param accept {boolean} Set to true to accept
|
||||
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static acceptAllCerts(accept: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Whether or not to validate the domain name in the certificate. This defaults to true.
|
||||
* @param validate {boolean} Set to true to validate
|
||||
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static validateDomainName(validate: boolean): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Make a POST request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @param filePath {string} The local path of the file to upload
|
||||
* @param fileParameter {string} The name of the parameter to pass the file along as
|
||||
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static uploadFile(url: string, body: any, headers: any, filePath: string, fileParameter: string): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @param filePath {string} The path to donwload the file to, including the file name.
|
||||
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface HTTPResponse {
|
||||
/**
|
||||
* The status number of the response
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* The data that is in the response. This property usually exists when a promise returned by a request method resolves.
|
||||
*/
|
||||
data?: any;
|
||||
/**
|
||||
* The headers of the response
|
||||
*/
|
||||
headers: any;
|
||||
/**
|
||||
* Error response from the server. This property usually exists when a promise returned by a request method rejects.
|
||||
*/
|
||||
error?: string;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Plugin, CordovaInstance } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Instagram
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name IsDebug
|
||||
|
||||
@@ -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
|
||||
|
||||
66
src/plugins/location-accuracy.ts
Normal file
66
src/plugins/location-accuracy.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
/**
|
||||
* @name LocationAccuracy
|
||||
* @description
|
||||
* This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { LocationAccuracy } from 'ionic-native';
|
||||
*
|
||||
* LocationAccuracy.canRequest().then((canRequest: boolean) => {
|
||||
*
|
||||
* if(canRequest) {
|
||||
* // the accuracy option will be ignored by iOS
|
||||
* LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
|
||||
* () => console.log('Request successful'),
|
||||
* error => console.log('Error requesting location permissions', error)
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-request-location-accuracy',
|
||||
pluginRef: 'cordova.plugins.locationAccuracy',
|
||||
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy'
|
||||
})
|
||||
export class LocationAccuracy {
|
||||
/**
|
||||
* Indicates if you can request accurate location
|
||||
* @returns {Promise<boolean>} Returns a promise that resovles with a boolean that indicates if you can request accurate location
|
||||
*/
|
||||
@Cordova()
|
||||
static canRequest(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Indicates if a request is currently in progress
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates if a request is currently in progress
|
||||
*/
|
||||
@Cordova()
|
||||
static isRequesting(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Requests accurate location
|
||||
* @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
static request(accuracy: string): Promise<any> { return; }
|
||||
|
||||
static REQUEST_PRIORITY_NO_POWER = 0;
|
||||
static REQUEST_PRIORITY_LOW_POWER = 1;
|
||||
static REQUEST_PRIORITY_BALANCED_POWER_ACCURACY = 2;
|
||||
static REQUEST_PRIORITY_HIGH_ACCURACY = 3;
|
||||
static SUCCESS_SETTINGS_SATISFIED = 0;
|
||||
static SUCCESS_USER_AGREED = 1;
|
||||
static ERROR_ALREADY_REQUESTING = -1;
|
||||
static ERROR_INVALID_ACTION = 0;
|
||||
static ERROR_INVALID_ACCURACY = 1;
|
||||
static ERROR_EXCEPTION = 1;
|
||||
static ERROR_CANNOT_CHANGE_ACCURACY = 3;
|
||||
static ERROR_USER_DISAGREED = 4;
|
||||
static ERROR_GOOGLE_API_CONNECTION_FAILED = 4;
|
||||
|
||||
}
|
||||
@@ -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'
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { CordovaInstance, Plugin, getPlugin, pluginWarn } from './plugin';
|
||||
|
||||
declare var Media: any;
|
||||
|
||||
@@ -69,59 +67,91 @@ export interface MediaError {
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
let pluginMeta = {
|
||||
repo: 'https://github.com/apache/cordova-plugin-media',
|
||||
plugin: 'cordova-plugin-media',
|
||||
pluginRef: 'Media'
|
||||
})
|
||||
};
|
||||
@Plugin(pluginMeta)
|
||||
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
|
||||
private _objectInstance: any;
|
||||
status: Observable<any>;
|
||||
init: Promise<any>;
|
||||
|
||||
// Methods
|
||||
/**
|
||||
* Open a media file
|
||||
* @param src {string} A URI containing the audio content.
|
||||
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
|
||||
*/
|
||||
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._objectInstance = new Media(src, res, rej, next);
|
||||
constructor(src: string, onStatusUpdate?: Function) {
|
||||
if (!!getPlugin('Media')) {
|
||||
this.init = new Promise<any>((resolve, reject) => {
|
||||
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
|
||||
});
|
||||
} else {
|
||||
pluginWarn(pluginMeta);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +187,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
|
||||
|
||||
@@ -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; };
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -81,6 +81,9 @@ export interface TransitionOptions {
|
||||
iosdelay?: number;
|
||||
androiddelay?: number;
|
||||
winphonedelay?: number;
|
||||
fixedPixelsTops?: number;
|
||||
fixedPixelsTop?: number;
|
||||
fixedPixelsBottom?: number;
|
||||
action?: string;
|
||||
origin?: string;
|
||||
href?: string;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,13 +14,19 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```typescript
|
||||
* import { OneSignal } from 'ionic-native';
|
||||
*
|
||||
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
|
||||
* {googleProjectNumber: '703322744261'})
|
||||
* .subscribe(jsonData => {
|
||||
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
|
||||
* });
|
||||
* OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
|
||||
*
|
||||
* OneSignal.enableInAppAlertNotification(true);
|
||||
*
|
||||
* OneSignal.handleNotificationReceived().subscribe(() => {
|
||||
* // do something when notification is received
|
||||
* });
|
||||
*
|
||||
* OneSignal.handleNotificationOpened().subscribe(() => {
|
||||
* // do something when a notification is opened
|
||||
* });
|
||||
*
|
||||
* OneSignal.endInit();
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@@ -32,19 +38,107 @@ import { Observable } from 'rxjs/Observable';
|
||||
export class OneSignal {
|
||||
|
||||
/**
|
||||
* Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
|
||||
*
|
||||
* @param {appId} Your AppId from your OneSignal app
|
||||
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
|
||||
* @returns {Observable} when a notification is received. Handle your notification action here.
|
||||
* @private
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
static init(appId: string,
|
||||
options: {
|
||||
googleProjectNumber: string,
|
||||
autoRegister: boolean
|
||||
}): Observable<any> { return; }
|
||||
static OSInFocusDisplayOption = {
|
||||
None: 0,
|
||||
InAppAlert : 1,
|
||||
Notification : 2
|
||||
};
|
||||
|
||||
/**
|
||||
* Start the initialization process. Once you are done configuring OneSignal, call the endInit function.
|
||||
*
|
||||
* @param {string} appId Your AppId from your OneSignal app
|
||||
* @param {string} googleProjectNumber The Google Project Number (which you can get from the Google Developer Portal) and the autoRegister option.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static startInit(appId: string, googleProjectNumber: string): any { return; }
|
||||
|
||||
/**
|
||||
* Callback to run when a notification is received
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static handleNotificationReceived(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Callback to run when a notification is opened
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static handleNotificationOpened(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param settings
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static iOSSettings(settings: {
|
||||
kOSSettingsKeyInAppLaunchURL: boolean;
|
||||
kOSSettingsKeyAutoPrompt: boolean;
|
||||
}): any { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static endInit(): any { return; }
|
||||
|
||||
/**
|
||||
* Retrieve a list of tags that have been set on the user from the OneSignal server.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
|
||||
*/
|
||||
@Cordova()
|
||||
static getTags(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Lets you retrieve the OneSignal user id and device token.
|
||||
* Your handler is called after the device is successfully registered with OneSignal.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
|
||||
* It returns a JSON with `userId`and `pushToken`.
|
||||
*/
|
||||
@Cordova()
|
||||
static getIds(): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
||||
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
||||
*
|
||||
* @param {string} Key of your choosing to create or update.
|
||||
* @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static sendTag(key: string, value: string): void { }
|
||||
|
||||
/**
|
||||
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
||||
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
||||
*
|
||||
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static sendTags(json: any): void { }
|
||||
|
||||
/**
|
||||
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
|
||||
*
|
||||
* @param {string} Key to remove.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static deleteTag(key: string): void { }
|
||||
|
||||
/**
|
||||
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
|
||||
*
|
||||
* @param {Array<string>} Keys to remove.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static deleteTags(keys: string[]): void { }
|
||||
|
||||
/**
|
||||
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
|
||||
@@ -53,60 +147,6 @@ export class OneSignal {
|
||||
@Cordova({ sync: true })
|
||||
static registerForPushNotifications(): void { }
|
||||
|
||||
|
||||
/**
|
||||
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
||||
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
||||
*
|
||||
* @param {key} Key of your choosing to create or update.
|
||||
* @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static sendTag(key: string, value: string): void { }
|
||||
|
||||
/**
|
||||
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
|
||||
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
|
||||
*
|
||||
* @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static sendTags(json: any): void { }
|
||||
|
||||
/**
|
||||
* Retrieve a list of tags that have been set on the user from the OneSignal server.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
|
||||
*/
|
||||
@Cordova()
|
||||
static getTags(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
|
||||
*
|
||||
* @param {key} Key to remove.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static deleteTag(key: string): void { }
|
||||
|
||||
/**
|
||||
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
|
||||
*
|
||||
* @param {keys} Keys to remove.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static deleteTags(keys: string[]): void { }
|
||||
|
||||
/**
|
||||
* Lets you retrieve the OneSignal user id and device token.
|
||||
* Your handler is called after the device is successfully registered with OneSignal.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
|
||||
* It returns a JSON with `userId`and `pushToken`.
|
||||
*/
|
||||
@Cordova()
|
||||
static getIds(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Warning:
|
||||
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
|
||||
@@ -114,7 +154,7 @@ export class OneSignal {
|
||||
* By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
|
||||
* Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.
|
||||
*
|
||||
* @param {enable} false to disable vibrate, true to re-enable it.
|
||||
* @param {boolean} false to disable vibrate, true to re-enable it.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static enableVibrate(enable: boolean): void { }
|
||||
@@ -126,7 +166,7 @@ export class OneSignal {
|
||||
* By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
|
||||
* Passing false means that the device will only vibrate unless the device is set to a total silent mode.
|
||||
*
|
||||
* @param {enable} false to disable sound, true to re-enable it.
|
||||
* @param {boolean} false to disable sound, true to re-enable it.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static enableSound(enable: boolean): void { }
|
||||
@@ -138,26 +178,17 @@ export class OneSignal {
|
||||
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
|
||||
* If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
|
||||
*
|
||||
* @param {enable} enable
|
||||
* @param {boolean} enable
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static enableNotificationsWhenActive(enable: boolean): void { }
|
||||
|
||||
/**
|
||||
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
|
||||
* If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
|
||||
* The notificationOpenedCallback is then fired after the alert box is closed.
|
||||
*
|
||||
* @param {enable} enable
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static enableInAppAlertNotification(enable: boolean): void { }
|
||||
|
||||
/**
|
||||
* You can call this method with false to opt users out of receiving all notifications through OneSignal.
|
||||
* You can pass true later to opt users back into notifications.
|
||||
*
|
||||
* @param {enable} enable
|
||||
* @param {boolean} enable
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static setSubscription(enable: boolean): void { }
|
||||
@@ -168,68 +199,7 @@ export class OneSignal {
|
||||
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
|
||||
*/
|
||||
@Cordova()
|
||||
static postNotification(notificationObj: {
|
||||
app_id: string,
|
||||
contents: any,
|
||||
headings?: any,
|
||||
isIos?: boolean,
|
||||
isAndroid?: boolean,
|
||||
isWP?: boolean,
|
||||
isWP_WNS?: boolean,
|
||||
isAdm?: boolean,
|
||||
isChrome?: boolean,
|
||||
isChromeWeb?: boolean,
|
||||
isSafari?: boolean,
|
||||
isAnyWeb?: boolean,
|
||||
included_segments?: string[],
|
||||
excluded_segments?: string[],
|
||||
include_player_ids?: string[],
|
||||
include_ios_tokens?: string[],
|
||||
include_android_reg_ids?: string[],
|
||||
include_wp_uris?: string[],
|
||||
include_wp_wns_uris?: string[],
|
||||
include_amazon_reg_ids?: string[],
|
||||
include_chrome_reg_ids?: string[],
|
||||
include_chrome_web_reg_ids?: string[],
|
||||
app_ids?: string[];
|
||||
tags?: any[],
|
||||
ios_badgeType?: string,
|
||||
ios_badgeCount?: number,
|
||||
ios_sound?: string,
|
||||
android_sound?: string,
|
||||
adm_sound?: string,
|
||||
wp_sound?: string,
|
||||
wp_wns_sound?: string,
|
||||
data?: any,
|
||||
buttons?: any,
|
||||
small_icon?: string,
|
||||
large_icon?: string,
|
||||
big_picture?: string,
|
||||
adm_small_icon?: string,
|
||||
adm_large_icon?: string,
|
||||
adm_big_picture?: string,
|
||||
chrome_icon?: string,
|
||||
chrome_big_picture?: string,
|
||||
chrome_web_icon?: string,
|
||||
firefox_icon?: string,
|
||||
url?: string,
|
||||
send_after?: string,
|
||||
delayed_option?: string,
|
||||
delivery_time_of_day?: string,
|
||||
android_led_color?: string,
|
||||
android_accent_color?: string,
|
||||
android_visibility?: number,
|
||||
content_available?: boolean,
|
||||
amazon_background_data?: boolean,
|
||||
template_id?: string,
|
||||
android_group?: string,
|
||||
android_group_message?: any,
|
||||
adm_group?: string,
|
||||
adm_group_message?: any,
|
||||
ttl?: number,
|
||||
priority?: number,
|
||||
ios_category?: string
|
||||
}): Promise<any> { return; }
|
||||
static postNotification(notificationObj: OneSignalNotification): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
|
||||
@@ -237,6 +207,13 @@ export class OneSignal {
|
||||
@Cordova({ sync: true })
|
||||
static promptLocation(): void { }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param email {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static syncHashedEmail(email: string): void { }
|
||||
|
||||
/**
|
||||
* Enable logging to help debug if you run into an issue setting up OneSignal.
|
||||
* The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
|
||||
@@ -252,3 +229,66 @@ export class OneSignal {
|
||||
}): void { }
|
||||
|
||||
}
|
||||
|
||||
export interface OneSignalNotification {
|
||||
app_id: string;
|
||||
contents: any;
|
||||
headings?: any;
|
||||
isIos?: boolean;
|
||||
isAndroid?: boolean;
|
||||
isWP?: boolean;
|
||||
isWP_WNS?: boolean;
|
||||
isAdm?: boolean;
|
||||
isChrome?: boolean;
|
||||
isChromeWeb?: boolean;
|
||||
isSafari?: boolean;
|
||||
isAnyWeb?: boolean;
|
||||
included_segments?: string[];
|
||||
excluded_segments?: string[];
|
||||
include_player_ids?: string[];
|
||||
include_ios_tokens?: string[];
|
||||
include_android_reg_ids?: string[];
|
||||
include_wp_uris?: string[];
|
||||
include_wp_wns_uris?: string[];
|
||||
include_amazon_reg_ids?: string[];
|
||||
include_chrome_reg_ids?: string[];
|
||||
include_chrome_web_reg_ids?: string[];
|
||||
app_ids?: string[];
|
||||
tags?: any[];
|
||||
ios_badgeType?: string;
|
||||
ios_badgeCount?: number;
|
||||
ios_sound?: string;
|
||||
android_sound?: string;
|
||||
adm_sound?: string;
|
||||
wp_sound?: string;
|
||||
wp_wns_sound?: string;
|
||||
data?: any;
|
||||
buttons?: any;
|
||||
small_icon?: string;
|
||||
large_icon?: string;
|
||||
big_picture?: string;
|
||||
adm_small_icon?: string;
|
||||
adm_large_icon?: string;
|
||||
adm_big_picture?: string;
|
||||
chrome_icon?: string;
|
||||
chrome_big_picture?: string;
|
||||
chrome_web_icon?: string;
|
||||
firefox_icon?: string;
|
||||
url?: string;
|
||||
send_after?: string;
|
||||
delayed_option?: string;
|
||||
delivery_time_of_day?: string;
|
||||
android_led_color?: string;
|
||||
android_accent_color?: string;
|
||||
android_visibility?: number;
|
||||
content_available?: boolean;
|
||||
amazon_background_data?: boolean;
|
||||
template_id?: string;
|
||||
android_group?: string;
|
||||
android_group_message?: any;
|
||||
adm_group?: string;
|
||||
adm_group_message?: any;
|
||||
ttl?: number;
|
||||
priority?: number;
|
||||
ios_category?: string;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name PayPal
|
||||
* @description
|
||||
@@ -6,16 +6,56 @@ import {Plugin, Cordova} from './plugin';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {PayPal} from 'ionic-native';
|
||||
* import {PayPal, PayPalPayment, PayPalConfiguration} from "ionic-native";
|
||||
*
|
||||
* PayPal.init({
|
||||
* "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
|
||||
"PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
|
||||
})
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
* "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
|
||||
* "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
|
||||
* }).then(() => {
|
||||
* // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
|
||||
* PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
|
||||
* // Only needed if you get an "Internal Service Error" after PayPal login!
|
||||
* //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
|
||||
* })).then(() => {
|
||||
* let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
|
||||
* PayPal.renderSinglePaymentUI(payment).then(() => {
|
||||
* // Successfully paid
|
||||
*
|
||||
* // Example sandbox response
|
||||
* //
|
||||
* // {
|
||||
* // "client": {
|
||||
* // "environment": "sandbox",
|
||||
* // "product_name": "PayPal iOS SDK",
|
||||
* // "paypal_sdk_version": "2.16.0",
|
||||
* // "platform": "iOS"
|
||||
* // },
|
||||
* // "response_type": "payment",
|
||||
* // "response": {
|
||||
* // "id": "PAY-1AB23456CD789012EF34GHIJ",
|
||||
* // "state": "approved",
|
||||
* // "create_time": "2016-10-03T13:33:33Z",
|
||||
* // "intent": "sale"
|
||||
* // }
|
||||
* // }
|
||||
* }, () => {
|
||||
* // Error or render dialog closed without being successful
|
||||
* });
|
||||
* }, () => {
|
||||
* // Error in configuration
|
||||
* });
|
||||
* }, () => {
|
||||
* // Error in initialization, maybe PayPal isn't supported or something else
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
* PayPalEnvironment
|
||||
* PayPalConfigurationOptions
|
||||
* @classes
|
||||
* PayPalPayment
|
||||
* PayPalItem
|
||||
* PayPalPaymentDetails
|
||||
* PayPalShippingAddress
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'com.paypal.cordova.mobilesdk',
|
||||
@@ -23,30 +63,40 @@ import {Plugin, Cordova} from './plugin';
|
||||
repo: 'https://github.com/paypal/PayPal-Cordova-Plugin'
|
||||
})
|
||||
export class PayPal {
|
||||
/**
|
||||
* Retrieve the version of the PayPal iOS SDK library. Useful when contacting support.
|
||||
*/
|
||||
@Cordova()
|
||||
static version(): Promise<string> {return; }
|
||||
|
||||
/**
|
||||
* You must preconnect to PayPal to prepare the device for processing payments.
|
||||
* This improves the user experience, by making the presentation of the
|
||||
* UI faster. The preconnect is valid for a limited time, so
|
||||
* the recommended time to preconnect is on page load.
|
||||
*
|
||||
* @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox"
|
||||
* @param {PayPalConfiguration} configuration: For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set
|
||||
* @param {PayPalEnvironment} clientIdsForEnvironments: set of client ids for environments
|
||||
*/
|
||||
@Cordova()
|
||||
static init(environment: PayPalEnvironment, configuration?: PayPalConfiguration): Promise<any> {return; }
|
||||
static init(clientIdsForEnvironments: PayPalEnvironment): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Retreive the version of PayPal iOS SDK Library.
|
||||
*/
|
||||
* You must preconnect to PayPal to prepare the device for processing payments.
|
||||
* This improves the user experience, by making the presentation of the UI faster.
|
||||
* The preconnect is valid for a limited time, so the recommended time to preconnect is on page load.
|
||||
*
|
||||
* @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox"
|
||||
* @param {PayPalConfiguration} configuration: PayPalConfiguration object, for Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set
|
||||
**/
|
||||
@Cordova()
|
||||
static version(): Promise<string> {return; }
|
||||
static prepareToRender(environment: string, configuration: PayPalConfiguration): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Start PayPal UI to collect payment from the user.
|
||||
* See https://developer.paypal.com/webapps/developer/docs/integration/mobile/ios-integration-guide/
|
||||
* for more documentation of the params.
|
||||
*
|
||||
* @param {PayPalPayment} payment: PayPalPayment object
|
||||
* @param {PayPalPayment} payment PayPalPayment object
|
||||
*/
|
||||
@Cordova()
|
||||
static renderSinglePaymentUI(payment: PayPalPayment): Promise<any> {return; }
|
||||
@@ -72,113 +122,341 @@ export class PayPal {
|
||||
/**
|
||||
* Please Read Docs on Profile Sharing at https://github.com/paypal/PayPal-iOS-SDK#profile-sharing
|
||||
*
|
||||
* @param {Array<string>} scopes: scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes
|
||||
* @param {Array<string>} scopes scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes
|
||||
* See https://developer.paypal.com/docs/integration/direct/identity/attributes/ for more details
|
||||
**/
|
||||
@Cordova()
|
||||
static renderProfileSharingUI(scopes: string[]): Promise<any> {return; }
|
||||
|
||||
}
|
||||
|
||||
export interface PayPalEnvironment {
|
||||
PayPalEnvironmentProduction: string;
|
||||
PayPalEnvironmentSandbox: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare class PayPalPayment {
|
||||
/**
|
||||
* Convenience constructor.
|
||||
* Returns a PayPalPayment with the specified amount, currency code, and short description.
|
||||
* @param {String} amount: The amount of the payment.
|
||||
* @param {String} currencyCode: The ISO 4217 currency for the payment.
|
||||
* @param {String} shortDescription: A short descripton of the payment.
|
||||
* @param {String} intent: "Sale" for an immediate payment.
|
||||
*/
|
||||
new(amount: string, currencyCode: string, shortDescription: string, intent: string);
|
||||
export class PayPalPayment {
|
||||
constructor(amount: string, currency: string, shortDescription: string, intent: string, details?: PayPalPaymentDetails) {
|
||||
this.amount = amount;
|
||||
this.currency = currency;
|
||||
this.shortDescription = shortDescription;
|
||||
this.intent = intent;
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional invoice number, for your tracking purposes. (up to 256 characters)
|
||||
* @param {String} invoiceNumber: The invoice number for the payment.
|
||||
* The amount of the payment.
|
||||
*/
|
||||
invoiceNumber(invoiceNumber: string): void;
|
||||
|
||||
amount: string;
|
||||
/**
|
||||
* Optional text, for your tracking purposes. (up to 256 characters)
|
||||
* @param {String} custom: The custom text for the payment.
|
||||
* The ISO 4217 currency for the payment.
|
||||
*/
|
||||
custom(custom: string): void;
|
||||
|
||||
currency: string;
|
||||
/**
|
||||
* Optional text which will appear on the customer's credit card statement. (up to 22 characters)
|
||||
* @param {String} softDescriptor: credit card text for payment
|
||||
* A short description of the payment.
|
||||
*/
|
||||
softDescriptor(softDescriptor: string): void;
|
||||
|
||||
shortDescription: string;
|
||||
/**
|
||||
* "Sale" for an immediate payment.
|
||||
*/
|
||||
intent: string;
|
||||
/**
|
||||
* Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com,
|
||||
* for your tracking purposes.
|
||||
* @param {String} bnCode: bnCode for payment
|
||||
*/
|
||||
bnCode(bnCode: string): void;
|
||||
bnCode: string = 'PhoneGap_SP';
|
||||
/**
|
||||
* Optional invoice number, for your tracking purposes. (up to 256 characters)
|
||||
*/
|
||||
invoiceNumber: string;
|
||||
|
||||
/**
|
||||
* Optional array of PayPalItem objects. @see PayPalItem
|
||||
* @note If you provide one or more items, be sure that the various prices correctly
|
||||
* sum to the payment `amount` or to `paymentDetails.subtotal`.
|
||||
* @param items {Array<PayPalItem>} Optional
|
||||
* Optional text, for your tracking purposes. (up to 256 characters)
|
||||
*/
|
||||
items(items?: any): void;
|
||||
custom: string;
|
||||
|
||||
/**
|
||||
* Optional text which will appear on the customer's credit card statement. (up to 22 characters)
|
||||
*/
|
||||
softDescriptor: string;
|
||||
|
||||
/**
|
||||
* Optional array of PayPalItem objects.
|
||||
*/
|
||||
items: string;
|
||||
|
||||
/**
|
||||
* Optional customer shipping address, if your app wishes to provide this to the SDK.
|
||||
* @note make sure to set `payPalShippingAddressOption` in PayPalConfiguration to 1 or 3.
|
||||
* @param {PayPalShippingAddress} shippingAddress: PayPalShippingAddress object
|
||||
*/
|
||||
shippingAddress(shippingAddress: PayPalShippingAddress): void;
|
||||
shippingAddress: string;
|
||||
|
||||
/**
|
||||
* Optional PayPalPaymentDetails object
|
||||
*/
|
||||
details: PayPalPaymentDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class PayPalItem {
|
||||
/**
|
||||
* The PayPalItem class defines an optional itemization for a payment.
|
||||
* @see https://developer.paypal.com/docs/api/#item-object for more details.
|
||||
* @param {String} name: Name of the item. 127 characters max
|
||||
* @param {Number} quantity: Number of units. 10 characters max.
|
||||
* @param {String} price: Unit price for this item 10 characters max.
|
||||
* May be negative for "coupon" etc
|
||||
* @param {String} currency: ISO standard currency code.
|
||||
* @param {String} sku: The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
constructor(name: string, quantity: number, price: string, currency: string, sku: string) {
|
||||
this.name = name;
|
||||
this.quantity = quantity;
|
||||
this.price = price;
|
||||
this.currency = currency;
|
||||
this.sku = sku;
|
||||
}
|
||||
/**
|
||||
* Name of the item. 127 characters max
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Number of units. 10 characters max.
|
||||
*/
|
||||
quantity: number;
|
||||
/**
|
||||
* Unit price for this item 10 characters max.
|
||||
*/
|
||||
price: string;
|
||||
/**
|
||||
* ISO standard currency code.
|
||||
*/
|
||||
currency: string;
|
||||
/**
|
||||
* The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
sku: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class PayPalPaymentDetails {
|
||||
/**
|
||||
* The PayPalPaymentDetails class defines optional amount details.
|
||||
* @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
|
||||
* @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places.
|
||||
* @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
constructor(subtotal: string, shipping: string, tax: string) {
|
||||
this.subtotal = subtotal;
|
||||
this.shipping = shipping;
|
||||
this.tax = tax;
|
||||
}
|
||||
/**
|
||||
* Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
subtotal: string;
|
||||
/**
|
||||
* Amount charged for shipping. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
shipping: string;
|
||||
/**
|
||||
* Amount charged for tax. 10 characters max with support for 2 decimal places.
|
||||
*/
|
||||
tax: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PayPalConfigurationOptions {
|
||||
/**
|
||||
* Will be overridden by email used in most recent PayPal login.
|
||||
*/
|
||||
defaultUserEmail?: string;
|
||||
/**
|
||||
* Will be overridden by phone country code used in most recent PayPal login
|
||||
*/
|
||||
defaultUserPhoneCountryCode?: string;
|
||||
/**
|
||||
* Will be overridden by phone number used in most recent PayPal login.
|
||||
*/
|
||||
defaultUserPhoneNumber?: string;
|
||||
/**
|
||||
* Your company name, as it should be displayed to the user when requesting consent via a PayPalFuturePaymentViewController.
|
||||
*/
|
||||
merchantName?: string;
|
||||
merchantPrivacyPolicyUrl?: string;
|
||||
merchantUserAgreementUrl?: string;
|
||||
/**
|
||||
* URL of your company's privacy policy, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController.
|
||||
*/
|
||||
merchantPrivacyPolicyURL?: string;
|
||||
/**
|
||||
* URL of your company's user agreement, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController.
|
||||
*/
|
||||
merchantUserAgreementURL?: string;
|
||||
/**
|
||||
* If set to NO, the SDK will only support paying with PayPal, not with credit cards.
|
||||
* This applies only to single payments (via PayPalPaymentViewController).
|
||||
* Future payments (via PayPalFuturePaymentViewController) always use PayPal.
|
||||
* Defaults to true
|
||||
*/
|
||||
acceptCreditCards?: boolean;
|
||||
/**
|
||||
* For single payments, options for the shipping address.
|
||||
* - 0 - PayPalShippingAddressOptionNone: no shipping address applies.
|
||||
* - 1 - PayPalShippingAddressOptionProvided: shipping address will be provided by your app,
|
||||
* in the shippingAddress property of PayPalPayment.
|
||||
* - 2 - PayPalShippingAddressOptionPayPal: user will choose from shipping addresses on file
|
||||
* for their PayPal account.
|
||||
* - 3 - PayPalShippingAddressOptionBoth: user will choose from the shipping address provided by your app,
|
||||
* in the shippingAddress property of PayPalPayment, plus the shipping addresses on file for the user's PayPal account.
|
||||
* Defaults to 0 (PayPalShippingAddressOptionNone).
|
||||
*/
|
||||
payPalShippingAddressOption?: number;
|
||||
/**
|
||||
* If set to YES, then if the user pays via their PayPal account,
|
||||
* the SDK will remember the user's PayPal username or phone number;
|
||||
* if the user pays via their credit card, then the SDK will remember
|
||||
* the PayPal Vault token representing the user's credit card.
|
||||
*
|
||||
* If set to NO, then any previously-remembered username, phone number, or
|
||||
* credit card token will be erased, and subsequent payment information will
|
||||
* not be remembered.
|
||||
*
|
||||
* Defaults to YES.
|
||||
*/
|
||||
rememberUser?: boolean;
|
||||
/**
|
||||
* If not set, or if set to nil, defaults to the device's current language setting.
|
||||
*
|
||||
* Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.).
|
||||
* If the library does not contain localized strings for a specified locale, then will fall back to the language. E.g., "es_CO" -> "es".
|
||||
* If the library does not contain localized strings for a specified language, then will fall back to American English.
|
||||
*
|
||||
* If you specify only a language code, and that code matches the device's currently preferred language,
|
||||
* then the library will attempt to use the device's current region as well.
|
||||
* E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB".
|
||||
*/
|
||||
languageOrLocale?: string;
|
||||
/**
|
||||
* Normally, the SDK blurs the screen when the app is backgrounded,
|
||||
* to obscure credit card or PayPal account details in the iOS-saved screenshot.
|
||||
* If your app already does its own blurring upon backgrounding, you might choose to disable this.
|
||||
* Defaults to NO.
|
||||
*/
|
||||
disableBlurWhenBackgrounding?: boolean;
|
||||
/**
|
||||
* If you will present the SDK's view controller within a popover, then set this property to YES.
|
||||
* Defaults to NO. (iOS only)
|
||||
*/
|
||||
presentingInPopover?: boolean;
|
||||
/**
|
||||
* Sandbox credentials can be difficult to type on a mobile device. Setting this flag to YES will
|
||||
* cause the sandboxUserPassword and sandboxUserPin to always be pre-populated into login fields.
|
||||
*/
|
||||
forceDefaultsInSandbox?: boolean;
|
||||
sandboxUserPAssword?: string;
|
||||
/**
|
||||
* Password to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPassword?: string;
|
||||
/**
|
||||
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPin?: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare class PayPalConfiguration {
|
||||
export class PayPalConfiguration implements PayPalConfigurationOptions {
|
||||
/**
|
||||
* You use a PayPalConfiguration object to configure many aspects of how the SDK behaves.
|
||||
* see defaults for options available
|
||||
*/
|
||||
new(options: PayPalConfigurationOptions);
|
||||
constructor(options?: PayPalConfigurationOptions) {
|
||||
|
||||
let defaults: PayPalConfigurationOptions = {
|
||||
defaultUserEmail: null,
|
||||
defaultUserPhoneCountryCode: null,
|
||||
defaultUserPhoneNumber: null,
|
||||
merchantName: null,
|
||||
merchantPrivacyPolicyURL: null,
|
||||
merchantUserAgreementURL: null,
|
||||
acceptCreditCards: true,
|
||||
payPalShippingAddressOption: 0,
|
||||
rememberUser: true,
|
||||
languageOrLocale: null,
|
||||
disableBlurWhenBackgrounding: false,
|
||||
presentingInPopover: false,
|
||||
forceDefaultsInSandbox: false,
|
||||
sandboxUserPassword: null,
|
||||
sandboxUserPin: null
|
||||
};
|
||||
|
||||
if (options && typeof options === 'object') {
|
||||
for (var i in options) {
|
||||
if (defaults.hasOwnProperty(i)) {
|
||||
defaults[i] = options[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return defaults;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare class PayPalShippingAddress {
|
||||
export class PayPalShippingAddress {
|
||||
/**
|
||||
* See the documentation of the individual properties for more detail.
|
||||
* @param {String} recipientName: Name of the recipient at this address. 50 characters max.
|
||||
* @param {String} line1: Line 1 of the address (e.g., Number, street, etc). 100 characters max.
|
||||
* @param {String} Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
* @param {String} line2: Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
* @param {String} city: City name. 50 characters max.
|
||||
* @param {String} state: 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries.
|
||||
* @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries.
|
||||
* @param {String} countryCode: 2-letter country code. 2 characters max.
|
||||
*/
|
||||
new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string);
|
||||
constructor(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string) {
|
||||
this.recipientName = recipientName;
|
||||
this.line1 = line1;
|
||||
this.line2 = line2;
|
||||
this.city = city;
|
||||
this.state = state;
|
||||
this.postalCode = postalCode;
|
||||
this.countryCode = countryCode;
|
||||
}
|
||||
/**
|
||||
* Name of the recipient at this address. 50 characters max.
|
||||
*/
|
||||
recipientName: string;
|
||||
/**
|
||||
* Line 1 of the address (e.g., Number, street, etc). 100 characters max.
|
||||
*/
|
||||
line1: string;
|
||||
/**
|
||||
* Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
*/
|
||||
line2: string;
|
||||
/**
|
||||
* City name. 50 characters max.
|
||||
*/
|
||||
city: string;
|
||||
/**
|
||||
* 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries.
|
||||
*/
|
||||
state: string;
|
||||
/**
|
||||
* ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries.
|
||||
*/
|
||||
postalCode: string;
|
||||
/**
|
||||
* 2-letter country code. 2 characters max.
|
||||
*/
|
||||
countryCode: string;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
declare var $q;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -20,7 +18,7 @@ export const getPlugin = function(pluginRef: string): any {
|
||||
* @param pluginObj
|
||||
* @param method
|
||||
*/
|
||||
export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
export const pluginWarn = function(pluginObj: any, method?: string) {
|
||||
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
@@ -43,6 +41,11 @@ export const cordovaWarn = function(pluginName: string, method: string) {
|
||||
}
|
||||
};
|
||||
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
||||
// ignore resolve and reject in case sync
|
||||
if (opts.sync) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// If the plugin method expects myMethod(success, err, options)
|
||||
if (opts.callbackOrder === 'reverse') {
|
||||
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
||||
@@ -63,7 +66,12 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
args.push(obj);
|
||||
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
// If we've specified a success/error index
|
||||
args.splice(opts.successIndex, 0, resolve);
|
||||
|
||||
if (opts.successIndex > args.length) {
|
||||
args[opts.successIndex] = resolve;
|
||||
} else {
|
||||
args.splice(opts.successIndex, 0, resolve);
|
||||
}
|
||||
|
||||
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
|
||||
if (opts.errorIndex > args.length) {
|
||||
@@ -107,17 +115,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 +240,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
|
||||
@@ -270,10 +332,24 @@ export function Plugin(config) {
|
||||
cls[k] = config[k];
|
||||
}
|
||||
|
||||
cls['installed'] = function() {
|
||||
cls['installed'] = function(printWarning?: boolean) {
|
||||
return !!getPlugin(config.pluginRef);
|
||||
};
|
||||
|
||||
cls['getPlugin'] = function() {
|
||||
return getPlugin(config.pluginRef);
|
||||
};
|
||||
|
||||
cls['checkInstall'] = function() {
|
||||
let pluginInstance = getPlugin(config.pluginRef);
|
||||
|
||||
if (!pluginInstance) {
|
||||
pluginWarn(cls);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
return cls;
|
||||
};
|
||||
}
|
||||
@@ -353,3 +429,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);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name PowerManagement
|
||||
* @description
|
||||
@@ -17,8 +17,8 @@ import {Plugin, Cordova} from './plugin';
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-powermanagement-orig',
|
||||
pluginRef: 'https://github.com/Viras-/cordova-plugin-powermanagement',
|
||||
repo: 'powerManagement'
|
||||
pluginRef: 'powerManagement',
|
||||
repo: 'https://github.com/Viras-/cordova-plugin-powermanagement'
|
||||
})
|
||||
export class PowerManagement {
|
||||
/**
|
||||
|
||||
@@ -55,6 +55,7 @@ export interface NotificationEventAdditionalData {
|
||||
*/
|
||||
foreground?: boolean;
|
||||
collapse_key?: string;
|
||||
coldstart?: boolean;
|
||||
from?: string;
|
||||
notId?: string;
|
||||
}
|
||||
@@ -133,8 +134,9 @@ export interface PushNotification {
|
||||
* successHandler gets called when background push processing is successfully completed.
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
* @param id
|
||||
*/
|
||||
finish(successHandler: () => any, errorHandler: () => any): void;
|
||||
finish(successHandler: () => any, errorHandler: () => any, id?: string): void;
|
||||
}
|
||||
|
||||
export interface IOSPushOptions {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
|
||||
declare var cordova: any;
|
||||
/**
|
||||
* @name Secure Storage
|
||||
|
||||
@@ -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,28 +45,39 @@ 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']
|
||||
})
|
||||
static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
static shareWithOptions(options: { message?: string, subject?: string, files?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* 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; }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
* ```
|
||||
|
||||
73
src/plugins/stepcounter.ts
Normal file
73
src/plugins/stepcounter.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name Stepcounter
|
||||
* @description
|
||||
* Cordova plugin for using device's stepcounter on Android (API > 19)
|
||||
*
|
||||
* Use to
|
||||
* - start and stop stepcounter service
|
||||
* - read device's stepcounter data
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Stepcounter } from 'ionic-native';
|
||||
*
|
||||
* let startingOffset = 0;
|
||||
* Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure));
|
||||
*
|
||||
* Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
pluginRef: 'stepcounter',
|
||||
repo: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class Stepcounter {
|
||||
|
||||
/**
|
||||
* Start the step counter
|
||||
*
|
||||
* @param startingOffset {number} will be added to the total steps counted in this session
|
||||
* @return {Promise} Returns a Promise that resolves on success or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static start(startingOffset: number): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Stop the step counter
|
||||
* @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Get the amount of steps for today (or -1 if it no data given)
|
||||
* @return {Promise} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static getTodayStepCount(): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Get the amount of steps since the start command has been called
|
||||
* @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static getStepCount(): Promise<number | any> { return; }
|
||||
|
||||
/**
|
||||
* Returns true/false if Android device is running >API level 19 && has the step counter API available
|
||||
* @return {Promise} Returns a Promise that resolves on success, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static deviceCanCountSteps(): Promise<boolean | any> { return; }
|
||||
|
||||
/**
|
||||
* Get the step history (JavaScript object)
|
||||
* @return {Promise} Returns a Promise that resolves on success, or rejects on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static getHistory(): Promise<any> { return; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name StreamingMedia
|
||||
* @description
|
||||
|
||||
@@ -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));
|
||||
*
|
||||
|
||||
202
src/plugins/themeable-browser.ts
Normal file
202
src/plugins/themeable-browser.ts
Normal file
@@ -0,0 +1,202 @@
|
||||
import { Plugin, CordovaInstance } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { InAppBrowserEvent } from './inappbrowser';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface ThemeableBrowserButton {
|
||||
wwwImage?: string;
|
||||
image?: string;
|
||||
wwwImagePressed?: string;
|
||||
imagePressed?: string;
|
||||
wwwImageDensity?: number;
|
||||
align?: string;
|
||||
event?: string;
|
||||
}
|
||||
|
||||
export interface ThemeableBrowserOptions {
|
||||
statusbar?: { color: string; };
|
||||
toolbar?: {
|
||||
height?: number;
|
||||
color?: string;
|
||||
};
|
||||
title?: { color: string; };
|
||||
backButton?: ThemeableBrowserButton;
|
||||
forwardButton?: ThemeableBrowserButton;
|
||||
closeButton?: ThemeableBrowserButton;
|
||||
customButtons?: ThemeableBrowserButton[];
|
||||
menu?: {
|
||||
image?: string;
|
||||
imagePressed?: string;
|
||||
title?: string;
|
||||
cancel?: string;
|
||||
align?: string;
|
||||
items?: {
|
||||
event: string;
|
||||
label: string;
|
||||
}[];
|
||||
};
|
||||
backButtonCanClose?: boolean;
|
||||
|
||||
// inAppBrowser options
|
||||
location?: string;
|
||||
hidden?: string;
|
||||
clearcache?: string;
|
||||
clearsessioncache?: string;
|
||||
zoom?: string;
|
||||
hardwareback?: string;
|
||||
mediaPlaybackRequiresUserAction?: string;
|
||||
shouldPauseOnSuspsend?: string;
|
||||
closebuttoncaption?: string;
|
||||
disallowoverscroll?: string;
|
||||
enableViewportScale?: string;
|
||||
allowInlineMediaPlayback?: string;
|
||||
keyboardDisplayRequiresUserAction?: string;
|
||||
suppressesIncrementalRendering?: string;
|
||||
presentationstyle?: string;
|
||||
transitionstyle?: string;
|
||||
toolbarposition?: string;
|
||||
fullscreen?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ThemeableBrowser
|
||||
* @description
|
||||
* In-app browser that allows styling.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { ThemeableBrowser } from 'ionic-native';
|
||||
*
|
||||
* // can add options from the original InAppBrowser in a JavaScript object form (not string)
|
||||
* // This options object also takes additional parameters introduced by the ThemeableBrowser plugin
|
||||
* // This example only shows the additional parameters for ThemeableBrowser
|
||||
* // Note that that `image` and `imagePressed` values refer to resources that are stored in your app
|
||||
* let options = {
|
||||
* statusbar: {
|
||||
* color: '#ffffffff'
|
||||
* },
|
||||
* toolbar: {
|
||||
* height: 44,
|
||||
* color: '#f0f0f0ff'
|
||||
* },
|
||||
* title: {
|
||||
* color: '#003264ff',
|
||||
* showPageTitle: true
|
||||
* },
|
||||
* backButton: {
|
||||
* image: 'back',
|
||||
* imagePressed: 'back_pressed',
|
||||
* align: 'left',
|
||||
* event: 'backPressed'
|
||||
* },
|
||||
* forwardButton: {
|
||||
* image: 'forward',
|
||||
* imagePressed: 'forward_pressed',
|
||||
* align: 'left',
|
||||
* event: 'forwardPressed'
|
||||
* },
|
||||
* closeButton: {
|
||||
* image: 'close',
|
||||
* imagePressed: 'close_pressed',
|
||||
* align: 'left',
|
||||
* event: 'closePressed'
|
||||
* },
|
||||
* customButtons: [
|
||||
* {
|
||||
* image: 'share',
|
||||
* imagePressed: 'share_pressed',
|
||||
* align: 'right',
|
||||
* event: 'sharePressed'
|
||||
* }
|
||||
* ],
|
||||
* menu: {
|
||||
* image: 'menu',
|
||||
* imagePressed: 'menu_pressed',
|
||||
* title: 'Test',
|
||||
* cancel: 'Cancel',
|
||||
* align: 'right',
|
||||
* items: [
|
||||
* {
|
||||
* event: 'helloPressed',
|
||||
* label: 'Hello World!'
|
||||
* },
|
||||
* {
|
||||
* event: 'testPressed',
|
||||
* label: 'Test!'
|
||||
* }
|
||||
* ]
|
||||
* },
|
||||
* backButtonCanClose: true
|
||||
* };
|
||||
*
|
||||
* let browser = new ThemeableBrowser('https://ionic.io', '_blank', options);
|
||||
*
|
||||
* ```
|
||||
* We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here.
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-themeablebrowser',
|
||||
pluginRef: 'cordova.ThemeableBrowser',
|
||||
repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser'
|
||||
})
|
||||
export class ThemeableBrowser {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(url: string, target: string, styleOptions: ThemeableBrowserOptions) {
|
||||
try {
|
||||
this._objectInstance = cordova.ThemeableBrowser.open(url, target, styleOptions);
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
console.warn('Native: ThemeableBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an browser window that was opened hidden. Calling this has no effect
|
||||
* if the browser was already visible.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Closes the browser window.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Reloads the current page
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
reload(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the browser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the browser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined`
|
||||
* @param event Event name
|
||||
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
*/
|
||||
on(event: string): Observable<InAppBrowserEvent> {
|
||||
return new Observable<InAppBrowserEvent>((observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
export interface TranscodeOptions {
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name YoutubeVideoPlayer
|
||||
* @description
|
||||
|
||||
91
src/plugins/z-bar.ts
Normal file
91
src/plugins/z-bar.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name ZBar
|
||||
* @description
|
||||
* The ZBar Scanner Plugin allows you to scan 2d barcodes.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { ZBar } from 'ionic-native';
|
||||
*
|
||||
* let zBarOptions = {
|
||||
* flash: "off",
|
||||
* drawSight: false
|
||||
* };
|
||||
*
|
||||
* ZBar.scan(zBarOptions)
|
||||
* .then(result => {
|
||||
* console.log(result); // Scanned code
|
||||
* })
|
||||
* .catch(error => {
|
||||
* console.log(error); // Error message
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
* zBar options
|
||||
*
|
||||
* | Option | Type | Values | Defaults |
|
||||
* |--------------------|-----------|-----------------------------------------------------------------------------------------|
|
||||
* | text_title |`string?` | | `"Scan QR Code"` (Android only) |
|
||||
* | text_instructions |`string?` | | `"Please point your camera at the QR code."` (Android only) |
|
||||
* | camera |`string?` | `"front"`, `"back"`, | `"back"` |
|
||||
* | flash |`string?` | `"on"`, `"off"`, `"auto"` | `"auto"` |
|
||||
* | drawSight |`boolean?` | `true`, `false` | `true` (Draws red line in center of scanner) |
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-cszbar',
|
||||
pluginRef: 'cloudSky.zBar',
|
||||
repo: 'https://github.com/tjwoon/csZBar',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class ZBar {
|
||||
|
||||
/**
|
||||
* Open the scanner
|
||||
* @param options { ZBarOptions } Scan options
|
||||
* @return Returns a Promise that resolves with the scanned string, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static scan(options: ZBarOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface ZBarOptions {
|
||||
/**
|
||||
* A string representing the title text (Android only).
|
||||
* Default: "Scan QR Code"
|
||||
*/
|
||||
text_title?: string;
|
||||
|
||||
/**
|
||||
* A string representing the instruction text (Android only).
|
||||
* Default: "Please point your camera at the QR code."
|
||||
*/
|
||||
text_instructions?: string;
|
||||
|
||||
/**
|
||||
* A string defining the active camera when opening the scanner.
|
||||
* Possible values: "front", "back"
|
||||
* Default: "back"
|
||||
*/
|
||||
camera?: string;
|
||||
|
||||
/**
|
||||
* A string defining the state of the flash.
|
||||
* Possible values: "on", "off", "auto"
|
||||
* Default: "auto"
|
||||
*/
|
||||
flash?: string;
|
||||
|
||||
/**
|
||||
* A boolean to show or hide a line in the center of the scanner.
|
||||
* Default: true
|
||||
*/
|
||||
drawSight?: boolean;
|
||||
}
|
||||
141
test/plugin.spec.ts
Normal file
141
test/plugin.spec.ts
Normal 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');
|
||||
|
||||
});
|
||||
|
||||
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
15
tsconfig-es5.json
Normal 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
15
tsconfig-esm.json
Normal 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"
|
||||
]
|
||||
}
|
||||
@@ -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
5
typings.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"globalDevDependencies": {
|
||||
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255"
|
||||
}
|
||||
}
|
||||
502
typings/globals/jasmine/index.d.ts
vendored
Normal file
502
typings/globals/jasmine/index.d.ts
vendored
Normal 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;
|
||||
}
|
||||
8
typings/globals/jasmine/typings.json
Normal file
8
typings/globals/jasmine/typings.json
Normal 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
1
typings/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference path="globals/jasmine/index.d.ts" />
|
||||
Reference in New Issue
Block a user