mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
400 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ef96d4558 | ||
|
|
e39810b7d0 | ||
|
|
f211da7280 | ||
|
|
c1398eb54b | ||
|
|
1e1aaad7aa | ||
|
|
54ef50178b | ||
|
|
6f7171d26b | ||
|
|
cf75a53438 | ||
|
|
8ab1d13fb3 | ||
|
|
dd250a6d17 | ||
|
|
9082c5efbf | ||
|
|
b19f6d1ccd | ||
|
|
abc90f2e6a | ||
|
|
717c1438c4 | ||
|
|
67e0713f18 | ||
|
|
693d344dea | ||
|
|
914d1442b6 | ||
|
|
c4acbfe095 | ||
|
|
a26b8879f3 | ||
|
|
2e82320b4c | ||
|
|
e6700a360e | ||
|
|
82e7bd65a6 | ||
|
|
9ab73602af | ||
|
|
9f557bee8a | ||
|
|
9c8259f659 | ||
|
|
bb321057d2 | ||
|
|
853f425383 | ||
|
|
7cb3bc7542 | ||
|
|
3da2831779 | ||
|
|
1072ab115b | ||
|
|
efb2ee7880 | ||
|
|
5b98a80828 | ||
|
|
785646800b | ||
|
|
8d6c2dfb9a | ||
|
|
b7a562053a | ||
|
|
d76ad8803e | ||
|
|
13216d1f04 | ||
|
|
00e68ca990 | ||
|
|
c987a06f91 | ||
|
|
87049e9582 | ||
|
|
fd0ac37ffc | ||
|
|
b64d61828a | ||
|
|
08d66ead9b | ||
|
|
9bd8997a31 | ||
|
|
156328c9de | ||
|
|
78b3ec5b1f | ||
|
|
f07431a14c | ||
|
|
8439faf6b8 | ||
|
|
51ab03d097 | ||
|
|
abd910de67 | ||
|
|
24184a5a6a | ||
|
|
0b39ff8b7d | ||
|
|
6ad54ecf86 | ||
|
|
3dd863cb49 | ||
|
|
b719a0372b | ||
|
|
bdef1daba5 | ||
|
|
695099b2b0 | ||
|
|
28f4680575 | ||
|
|
40a7b138e2 | ||
|
|
fa624df1da | ||
|
|
5577c51dbc | ||
|
|
1ab76ae693 | ||
|
|
98bd5cee38 | ||
|
|
f6903cdcdf | ||
|
|
b5cc14c546 | ||
|
|
8988fad713 | ||
|
|
7b8b2d7136 | ||
|
|
dd2ccef0c7 | ||
|
|
e46f10878e | ||
|
|
2dacec0cb5 | ||
|
|
0c5fadee86 | ||
|
|
01b30c68e1 | ||
|
|
e5b0365d0c | ||
|
|
867400d1ac | ||
|
|
88f6ecf250 | ||
|
|
e6beaa49a4 | ||
|
|
fa03fa544f | ||
|
|
c22747fa2e | ||
|
|
fd8f80e92b | ||
|
|
17f2fcb829 | ||
|
|
6a412155a3 | ||
|
|
489d860264 | ||
|
|
ca43394185 | ||
|
|
b3eed47cbb | ||
|
|
71916a85dd | ||
|
|
0669ba5222 | ||
|
|
bec0eac122 | ||
|
|
00e63d9fc8 | ||
|
|
ac181c5439 | ||
|
|
8fbf1f2b34 | ||
|
|
685ac5c7a0 | ||
|
|
634843e1b2 | ||
|
|
d5310b0f73 | ||
|
|
a72cd59b99 | ||
|
|
6f4737190b | ||
|
|
c98b4f4c85 | ||
|
|
8f5532eb74 | ||
|
|
4340597fc9 | ||
|
|
7324246e6a | ||
|
|
55b6ab9c54 | ||
|
|
a5e591cfa6 | ||
|
|
48e5d46f1e | ||
|
|
62d8645468 | ||
|
|
0388ac3f6b | ||
|
|
24752652b7 | ||
|
|
eb03de96ba | ||
|
|
0317d4455f | ||
|
|
757d0961b9 | ||
|
|
693ba01137 | ||
|
|
fa0175d248 | ||
|
|
04d01ac1b3 | ||
|
|
77c7b9d00a | ||
|
|
ee4cfadff1 | ||
|
|
49d8348db3 | ||
|
|
6e445b1beb | ||
|
|
970eb755b6 | ||
|
|
1a803e70be | ||
|
|
6982a2d35f | ||
|
|
0660a3bc67 | ||
|
|
96776567eb | ||
|
|
d09018d2d4 | ||
|
|
0649d8ca8c | ||
|
|
41abaeb7c9 | ||
|
|
4dc82383a0 | ||
|
|
799e2f0b2e | ||
|
|
b95f88c165 | ||
|
|
bbda6e22a2 | ||
|
|
3edfafb6f9 | ||
|
|
99c1d499f7 | ||
|
|
37ed9a097a | ||
|
|
db3d5b63c6 | ||
|
|
6521e1833c | ||
|
|
debe6834ef | ||
|
|
292c8801ea | ||
|
|
b031ceed99 | ||
|
|
82d4ec2738 | ||
|
|
9c55358620 | ||
|
|
51bc5ef542 | ||
|
|
74a252b324 | ||
|
|
43c8592b40 | ||
|
|
babfb0dca3 | ||
|
|
ceb4217415 | ||
|
|
798625698d | ||
|
|
5cfb3b033b | ||
|
|
95d666c348 | ||
|
|
276d61bf3a | ||
|
|
397a209ad2 | ||
|
|
d2f42ef33a | ||
|
|
fe46907aaa | ||
|
|
5c92455ee9 | ||
|
|
046cbe7fca | ||
|
|
32f09275aa | ||
|
|
542ff4cf95 | ||
|
|
5710eb78a8 | ||
|
|
842a80d493 | ||
|
|
c2d4f1c0da | ||
|
|
e28e5b0f5f | ||
|
|
bff4862979 | ||
|
|
6bcef44d42 | ||
|
|
69c9b6f555 | ||
|
|
7f38cb5a16 | ||
|
|
cf7abe110d | ||
|
|
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 | ||
|
|
9c8321d3b4 | ||
|
|
e8bfb77b3d | ||
|
|
87ab8980b2 | ||
|
|
13de69080a | ||
|
|
8d439ff0cf | ||
|
|
f6d5ac4621 | ||
|
|
f37a40e138 | ||
|
|
21d8122257 | ||
|
|
0cf7d6aca1 | ||
|
|
94a7dae863 | ||
|
|
4e9bc95fff | ||
|
|
ad57733daf | ||
|
|
f4acc35cba | ||
|
|
f2cf1d4e03 | ||
|
|
b91740a91a | ||
|
|
a006cdb77b | ||
|
|
c93d95132d | ||
|
|
dd0c9baffd | ||
|
|
661276467c | ||
|
|
cf8e3420c0 | ||
|
|
9fe5c196aa | ||
|
|
76aa8a6494 | ||
|
|
9bcc4ed80f | ||
|
|
cd82a5393e | ||
|
|
00d87dba98 | ||
|
|
759f8ef910 | ||
|
|
841b242fb9 | ||
|
|
ae03d7237e | ||
|
|
ff64c6e363 | ||
|
|
820e4d78bf | ||
|
|
c7a5f7d023 | ||
|
|
a4798b81a8 | ||
|
|
48334aa4cd | ||
|
|
8b2d47587a | ||
|
|
c04379af19 | ||
|
|
d26bc886cf | ||
|
|
905f988d43 | ||
|
|
eff7841ec2 | ||
|
|
8526e89e12 | ||
|
|
bde47eb37b | ||
|
|
61716467df | ||
|
|
efa222fb55 | ||
|
|
abfa8a5f0f | ||
|
|
a438967336 | ||
|
|
47a9b34ea2 | ||
|
|
c4110eedf4 | ||
|
|
27218cda86 | ||
|
|
8c059fc1d0 | ||
|
|
dd39ba8c48 | ||
|
|
aa76fac3af | ||
|
|
e4f198ae42 | ||
|
|
dfdaa157a4 | ||
|
|
ea58a78f62 | ||
|
|
af39282191 | ||
|
|
f2bf2b5626 | ||
|
|
1e300ae35f | ||
|
|
080c5a19e6 | ||
|
|
1da35968de | ||
|
|
f1988f67f5 |
15
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
15
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
@@ -1,18 +1,19 @@
|
||||
# Contributing to Ionic Native
|
||||
|
||||
|
||||
## Feature request?
|
||||
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
|
||||
|
||||
Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
|
||||
|
||||
## Have an issue?
|
||||
#### There are no rules, but here are a few things to consider:
|
||||
###### Before you submit an issue:
|
||||
* Do a quick search to see if there are similar issues
|
||||
* Check that you are using the latest version of `ionic-native`
|
||||
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/v2/api/platform/Platform/#ready).
|
||||
* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save ionic-native@latest`
|
||||
|
||||
###### Still having problems? submit an issue with the following details:
|
||||
* Short description of the issue
|
||||
* Steps to reproduce
|
||||
* Stack trace (if available)
|
||||
|
||||
|
||||
## Feature request?
|
||||
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
|
||||
|
||||
Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
|
||||
446
CHANGELOG.md
446
CHANGELOG.md
@@ -1,3 +1,386 @@
|
||||
<a name="2.2.10"></a>
|
||||
## [2.2.10](https://github.com/driftyco/ionic-native/compare/v2.2.9...v2.2.10) (2016-12-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **contacts:** fix few bugs in Contacts ([#846](https://github.com/driftyco/ionic-native/issues/846)) ([b19f6d1](https://github.com/driftyco/ionic-native/commit/b19f6d1))
|
||||
* **sqlite:** add static constructor, and fix resolve type ([#697](https://github.com/driftyco/ionic-native/issues/697)) ([9082c5e](https://github.com/driftyco/ionic-native/commit/9082c5e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **actionsheet:** add ActionSheetOptions interface ([f211da7](https://github.com/driftyco/ionic-native/commit/f211da7))
|
||||
* **googlemap:** add disableAutoPan to GoogleMapsMarkerOptions ([cf75a53](https://github.com/driftyco/ionic-native/commit/cf75a53)), closes [#844](https://github.com/driftyco/ionic-native/issues/844)
|
||||
* **googlemaps:** add markerClick and infoClick to MarkerOptions ([6f7171d](https://github.com/driftyco/ionic-native/commit/6f7171d))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.9"></a>
|
||||
## [2.2.9](https://github.com/driftyco/ionic-native/compare/v2.2.8...v2.2.9) (2016-12-01)
|
||||
|
||||
|
||||
|
||||
<a name="2.2.8"></a>
|
||||
## [2.2.8](https://github.com/driftyco/ionic-native/compare/v2.2.7...v2.2.8) (2016-12-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **card-io:** fix typo in options ([e6700a3](https://github.com/driftyco/ionic-native/commit/e6700a3))
|
||||
* **globalization:** add missing parameter to numberToString function ([1072ab1](https://github.com/driftyco/ionic-native/commit/1072ab1)), closes [#835](https://github.com/driftyco/ionic-native/issues/835)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **card-io:** add typing for response ([2e82320](https://github.com/driftyco/ionic-native/commit/2e82320))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.7"></a>
|
||||
## [2.2.7](https://github.com/driftyco/ionic-native/compare/v2.2.5...v2.2.7) (2016-11-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **3dTouch:** fixes onHomeIconPressed ([#813](https://github.com/driftyco/ionic-native/issues/813)) ([695099b](https://github.com/driftyco/ionic-native/commit/695099b))
|
||||
* **camera-preview:** formatting. Closes [#790](https://github.com/driftyco/ionic-native/issues/790) ([5577c51](https://github.com/driftyco/ionic-native/commit/5577c51))
|
||||
* **datepicker:** fix allowOldDates option ([#761](https://github.com/driftyco/ionic-native/issues/761)) ([fa03fa5](https://github.com/driftyco/ionic-native/commit/fa03fa5))
|
||||
* **diagnostics:** fix [#776](https://github.com/driftyco/ionic-native/issues/776) ([#777](https://github.com/driftyco/ionic-native/issues/777)) ([01b30c6](https://github.com/driftyco/ionic-native/commit/01b30c6))
|
||||
* **file:** correct writeFile flags ([9bd8997](https://github.com/driftyco/ionic-native/commit/9bd8997)), closes [#789](https://github.com/driftyco/ionic-native/issues/789)
|
||||
* **googlemap:** fix typoe googledesic to geodesic ([78b3ec5](https://github.com/driftyco/ionic-native/commit/78b3ec5)), closes [#765](https://github.com/driftyco/ionic-native/issues/765)
|
||||
* **native-audio:** completeCallback is optional on play method ([b719a03](https://github.com/driftyco/ionic-native/commit/b719a03)), closes [#792](https://github.com/driftyco/ionic-native/issues/792)
|
||||
* **nfc:** don't bind to name field, fix [#740](https://github.com/driftyco/ionic-native/issues/740) ([#749](https://github.com/driftyco/ionic-native/issues/749)) ([ca43394](https://github.com/driftyco/ionic-native/commit/ca43394))
|
||||
* **plugin:** don't bind to name field. Fixes [#740](https://github.com/driftyco/ionic-native/issues/740) ([71916a8](https://github.com/driftyco/ionic-native/commit/71916a8))
|
||||
* **video-player:** scalingMode is number ([f07431a](https://github.com/driftyco/ionic-native/commit/f07431a)), closes [#774](https://github.com/driftyco/ionic-native/issues/774)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **camera-preview:** add disable method ([6ad54ec](https://github.com/driftyco/ionic-native/commit/6ad54ec))
|
||||
* **google-analytics:** new interval period parameter ([abd910d](https://github.com/driftyco/ionic-native/commit/abd910d)), closes [#816](https://github.com/driftyco/ionic-native/issues/816)
|
||||
* **google-map:** add get and set methods to Marker class ([51ab03d](https://github.com/driftyco/ionic-native/commit/51ab03d)), closes [#798](https://github.com/driftyco/ionic-native/issues/798)
|
||||
|
||||
|
||||
|
||||
<a name="2.2.5"></a>
|
||||
## [2.2.5](https://github.com/driftyco/ionic-native/compare/v2.2.4...v2.2.5) (2016-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **3dtouch:** add missing property ([#739](https://github.com/driftyco/ionic-native/issues/739)) ([757d096](https://github.com/driftyco/ionic-native/commit/757d096))
|
||||
* **geolocation:** fix watchPosition return type ([d5310b0](https://github.com/driftyco/ionic-native/commit/d5310b0)), closes [#741](https://github.com/driftyco/ionic-native/issues/741)
|
||||
* **nfc:** fix Ndef class ([ac181c5](https://github.com/driftyco/ionic-native/commit/ac181c5)), closes [#713](https://github.com/driftyco/ionic-native/issues/713)
|
||||
* **sqlite:** check if plugin exists before opening database ([6f47371](https://github.com/driftyco/ionic-native/commit/6f47371))
|
||||
* **sqlite:** check if plugin exists before opening database ([c98b4f4](https://github.com/driftyco/ionic-native/commit/c98b4f4))
|
||||
* **sqlite:** fix callback issue with transaction method ([a72cd59](https://github.com/driftyco/ionic-native/commit/a72cd59)), closes [#732](https://github.com/driftyco/ionic-native/issues/732)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **diagnostic:** add missing functions ([eb03de9](https://github.com/driftyco/ionic-native/commit/eb03de9)), closes [#743](https://github.com/driftyco/ionic-native/issues/743)
|
||||
* **filepath:** add cordova-plugin-filepath ([#714](https://github.com/driftyco/ionic-native/issues/714)) ([0660a3b](https://github.com/driftyco/ionic-native/commit/0660a3b))
|
||||
* **plugins:** add name field ([9677656](https://github.com/driftyco/ionic-native/commit/9677656))
|
||||
* **sms:** add hasPermission method ([8fbf1f2](https://github.com/driftyco/ionic-native/commit/8fbf1f2)), closes [#721](https://github.com/driftyco/ionic-native/issues/721)
|
||||
|
||||
|
||||
|
||||
<a name="2.2.4"></a>
|
||||
## [2.2.4](https://github.com/driftyco/ionic-native/compare/v2.2.3...v2.2.4) (2016-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **sqlite:** fix callback order for transaction ([#700](https://github.com/driftyco/ionic-native/issues/700)) ([799e2f0](https://github.com/driftyco/ionic-native/commit/799e2f0))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **device-feedback:** add DeviceFeedback plugin ([#696](https://github.com/driftyco/ionic-native/issues/696)) ([bbda6e2](https://github.com/driftyco/ionic-native/commit/bbda6e2))
|
||||
* **image-picker:** add new android methods ([3edfafb](https://github.com/driftyco/ionic-native/commit/3edfafb))
|
||||
* **mixpanel:** MixpanelPeople returns promises ([#681](https://github.com/driftyco/ionic-native/issues/681)) ([b95f88c](https://github.com/driftyco/ionic-native/commit/b95f88c)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
|
||||
|
||||
|
||||
|
||||
<a name="2.2.3"></a>
|
||||
## [2.2.3](https://github.com/driftyco/ionic-native/compare/v2.2.2...v2.2.3) (2016-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** Expose 'type' property in GoogleMapsLatLngBounds [#693](https://github.com/driftyco/ionic-native/issues/693) ([#694](https://github.com/driftyco/ionic-native/issues/694)) ([74a252b](https://github.com/driftyco/ionic-native/commit/74a252b))
|
||||
* **onesignal:** update to match latest API version ([#691](https://github.com/driftyco/ionic-native/issues/691)) ([babfb0d](https://github.com/driftyco/ionic-native/commit/babfb0d))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.2"></a>
|
||||
## [2.2.2](https://github.com/driftyco/ionic-native/compare/v2.2.1...v2.2.2) (2016-10-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file:** getFreeDiskSpace now works ([d2f42ef](https://github.com/driftyco/ionic-native/commit/d2f42ef))
|
||||
* **file:** read methods can accept Blobs too ([276d61b](https://github.com/driftyco/ionic-native/commit/276d61b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **file:** getFile and getDirectory are now public ([5c92455](https://github.com/driftyco/ionic-native/commit/5c92455)), closes [#657](https://github.com/driftyco/ionic-native/issues/657)
|
||||
|
||||
|
||||
|
||||
<a name="2.2.1"></a>
|
||||
## [2.2.1](https://github.com/driftyco/ionic-native/compare/v2.2.0...v2.2.1) (2016-10-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **diagnostic:** misspelled getContactsAuthorizationStatus method ([#678](https://github.com/driftyco/ionic-native/issues/678)) ([bff4862](https://github.com/driftyco/ionic-native/commit/bff4862))
|
||||
* **file:** fix writeFile method ([842a80d](https://github.com/driftyco/ionic-native/commit/842a80d))
|
||||
* **file:** last parameter for writeFile now only accepts options ([5710eb7](https://github.com/driftyco/ionic-native/commit/5710eb7))
|
||||
* **http:** export via window.IonicNative ([#675](https://github.com/driftyco/ionic-native/issues/675)) ([cf7abe1](https://github.com/driftyco/ionic-native/commit/cf7abe1))
|
||||
* **location-accuracy:** accuracy param is number ([c2d4f1c](https://github.com/driftyco/ionic-native/commit/c2d4f1c)), closes [#676](https://github.com/driftyco/ionic-native/issues/676)
|
||||
* **themeablebrowser:** add missed options ([#680](https://github.com/driftyco/ionic-native/issues/680)) ([e28e5b0](https://github.com/driftyco/ionic-native/commit/e28e5b0))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **file:** resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods ([542ff4c](https://github.com/driftyco/ionic-native/commit/542ff4c)), closes [#657](https://github.com/driftyco/ionic-native/issues/657)
|
||||
|
||||
|
||||
|
||||
<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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd))
|
||||
* **onesignal:** update to match latest api ([#671](https://github.com/driftyco/ionic-native/issues/671)) ([7c6e6d8](https://github.com/driftyco/ionic-native/commit/7c6e6d8)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **http:** add cordovaHTTP wrapper ([#674](https://github.com/driftyco/ionic-native/issues/674)) ([f0961c7](https://github.com/driftyco/ionic-native/commit/f0961c7))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.9"></a>
|
||||
## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.9) (2016-10-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce))
|
||||
* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845))
|
||||
* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92))
|
||||
* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175))
|
||||
|
||||
|
||||
|
||||
<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.3...v2.1.6) (2016-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef))
|
||||
* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657))
|
||||
|
||||
|
||||
|
||||
<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.0...v2.1.2) (2016-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** add missing properties ([72a694a](https://github.com/driftyco/ionic-native/commit/72a694a)), closes [#642](https://github.com/driftyco/ionic-native/issues/642)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **zBar:** add zBar barcode scanner plugin ([#634](https://github.com/driftyco/ionic-native/issues/634)) ([bbbbb3e](https://github.com/driftyco/ionic-native/commit/bbbbb3e))
|
||||
|
||||
|
||||
|
||||
<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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **GoogleMaps:** Fixes [#452](https://github.com/driftyco/ionic-native/issues/452) ([#498](https://github.com/driftyco/ionic-native/issues/498)) ([f6d5ac4](https://github.com/driftyco/ionic-native/commit/f6d5ac4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **canvas-camera:** add CanvasCamera support ([ad57733](https://github.com/driftyco/ionic-native/commit/ad57733))
|
||||
* **file-chooser:** add file chooser plugin support ([#495](https://github.com/driftyco/ionic-native/issues/495)) ([94a7dae](https://github.com/driftyco/ionic-native/commit/94a7dae))
|
||||
* **file-opener:** add file opener support ([#497](https://github.com/driftyco/ionic-native/issues/497)) ([21d8122](https://github.com/driftyco/ionic-native/commit/21d8122)), closes [#295](https://github.com/driftyco/ionic-native/issues/295)
|
||||
* **music-controls:** add music controls plugin support ([#494](https://github.com/driftyco/ionic-native/issues/494)) ([4e9bc95](https://github.com/driftyco/ionic-native/commit/4e9bc95))
|
||||
* **youtube:** add Youtube video player plugin support ([#496](https://github.com/driftyco/ionic-native/issues/496)) ([0cf7d6a](https://github.com/driftyco/ionic-native/commit/0cf7d6a))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.19"></a>
|
||||
## [1.3.19](https://github.com/driftyco/ionic-native/compare/v1.3.18...v1.3.19) (2016-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **mixpanel:** implement CordovaProperty correctly ([dd0c9ba](https://github.com/driftyco/ionic-native/commit/dd0c9ba))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **call-number:** add support for CallNumber plugin ([#487](https://github.com/driftyco/ionic-native/issues/487)) ([759f8ef](https://github.com/driftyco/ionic-native/commit/759f8ef))
|
||||
* **market:** add Market plugin support ([#490](https://github.com/driftyco/ionic-native/issues/490)) ([9bcc4ed](https://github.com/driftyco/ionic-native/commit/9bcc4ed))
|
||||
* **mixpanel:** add mixpanel support ([#492](https://github.com/driftyco/ionic-native/issues/492)) ([cf8e342](https://github.com/driftyco/ionic-native/commit/cf8e342))
|
||||
* **native-page-transitions:** add support for Native Page Transitions plugin ([#488](https://github.com/driftyco/ionic-native/issues/488)) ([00d87db](https://github.com/driftyco/ionic-native/commit/00d87db))
|
||||
* **nfc:** add nfc support ([#493](https://github.com/driftyco/ionic-native/issues/493)) ([76aa8a6](https://github.com/driftyco/ionic-native/commit/76aa8a6))
|
||||
* **paypal:** add PayPal support ([#491](https://github.com/driftyco/ionic-native/issues/491)) ([9fe5c19](https://github.com/driftyco/ionic-native/commit/9fe5c19))
|
||||
* **power-management:** add power management support ([#489](https://github.com/driftyco/ionic-native/issues/489)) ([cd82a53](https://github.com/driftyco/ionic-native/commit/cd82a53))
|
||||
* **streaming-media:** add streaming media support ([#486](https://github.com/driftyco/ionic-native/issues/486)) ([841b242](https://github.com/driftyco/ionic-native/commit/841b242))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.18"></a>
|
||||
## [1.3.18](https://github.com/driftyco/ionic-native/compare/v1.3.17...v1.3.18) (2016-08-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **facebook:** export interfaces ([c4110ee](https://github.com/driftyco/ionic-native/commit/c4110ee))
|
||||
* **File:** fixed readFileAs ([#479](https://github.com/driftyco/ionic-native/issues/479)) ([eff7841](https://github.com/driftyco/ionic-native/commit/eff7841))
|
||||
* **geofence:** fix event listeners ([efa222f](https://github.com/driftyco/ionic-native/commit/efa222f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **code-push:** add wrapper for cordova-plugin-code-push ([#420](https://github.com/driftyco/ionic-native/issues/420)) ([905f988](https://github.com/driftyco/ionic-native/commit/905f988))
|
||||
* **diagnostic:** add full plugin functionality ([#424](https://github.com/driftyco/ionic-native/issues/424)) ([47a9b34](https://github.com/driftyco/ionic-native/commit/47a9b34)), closes [#224](https://github.com/driftyco/ionic-native/issues/224)
|
||||
* **geofence:** Adds geofence plugin ([#442](https://github.com/driftyco/ionic-native/issues/442)) ([a438967](https://github.com/driftyco/ionic-native/commit/a438967))
|
||||
* **inAppPurchase:** add inAppPurhcase plugin ([#423](https://github.com/driftyco/ionic-native/issues/423)) ([8526e89](https://github.com/driftyco/ionic-native/commit/8526e89))
|
||||
* **IsDebug:** add the IsDebug plugin ([#475](https://github.com/driftyco/ionic-native/issues/475)) ([dd39ba8](https://github.com/driftyco/ionic-native/commit/dd39ba8))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.17"></a>
|
||||
## [1.3.17](https://github.com/driftyco/ionic-native/compare/v1.3.16...v1.3.17) (2016-08-23)
|
||||
|
||||
@@ -6,7 +389,7 @@
|
||||
|
||||
* add the reject function at the expected errorIndex position in the args array ([#436](https://github.com/driftyco/ionic-native/issues/436)) ([4e87ac7](https://github.com/driftyco/ionic-native/commit/4e87ac7))
|
||||
* **camera-preview:** changes implementation to match Cordova plugin ([#441](https://github.com/driftyco/ionic-native/issues/441)) ([55ba65a](https://github.com/driftyco/ionic-native/commit/55ba65a))
|
||||
* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3)), closes [#459](https://github.com/driftyco/ionic-native/issues/459)
|
||||
* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3))
|
||||
* **file:** initialize writeFile options ([#468](https://github.com/driftyco/ionic-native/issues/468)) ([16628a4](https://github.com/driftyco/ionic-native/commit/16628a4))
|
||||
* **nativeaudio:** fix plugin reference ([2510c5f](https://github.com/driftyco/ionic-native/commit/2510c5f))
|
||||
|
||||
@@ -40,12 +423,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
|
||||
@@ -56,27 +440,26 @@
|
||||
|
||||
|
||||
|
||||
<a name="1.3.13"></a>
|
||||
## [1.3.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.12"></a>
|
||||
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13)
|
||||
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.11...v1.3.12) (2016-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)), closes [#331](https://github.com/driftyco/ionic-native/issues/331)
|
||||
* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)), closes [#413](https://github.com/driftyco/ionic-native/issues/413) [#417](https://github.com/driftyco/ionic-native/issues/417)
|
||||
* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866))
|
||||
|
||||
|
||||
|
||||
<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))
|
||||
* **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0))
|
||||
* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)), closes [#357](https://github.com/driftyco/ionic-native/issues/357)
|
||||
* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd))
|
||||
|
||||
|
||||
### Features
|
||||
@@ -107,7 +490,7 @@
|
||||
### Features
|
||||
|
||||
* **crop:** add crop plugin ([#284](https://github.com/driftyco/ionic-native/issues/284)) ([41c9adf](https://github.com/driftyco/ionic-native/commit/41c9adf))
|
||||
* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
|
||||
* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b))
|
||||
|
||||
|
||||
|
||||
@@ -134,7 +517,7 @@
|
||||
### Bug Fixes
|
||||
|
||||
* **base64togallery:** update plugin wrapper to match latest version ([d4bee49](https://github.com/driftyco/ionic-native/commit/d4bee49)), closes [#335](https://github.com/driftyco/ionic-native/issues/335)
|
||||
* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70)), closes [#324](https://github.com/driftyco/ionic-native/issues/324)
|
||||
* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70))
|
||||
|
||||
|
||||
### Features
|
||||
@@ -192,6 +575,7 @@
|
||||
### Features
|
||||
|
||||
* **googlemaps:** add Geocoder class ([#292](https://github.com/driftyco/ionic-native/issues/292)) ([2996da6](https://github.com/driftyco/ionic-native/commit/2996da6)), closes [#280](https://github.com/driftyco/ionic-native/issues/280)
|
||||
* **inAppPurchase:** add inAppPurchase ([f1988f6](https://github.com/driftyco/ionic-native/commit/f1988f6))
|
||||
* **media-capture:** add media capture plugin ([#293](https://github.com/driftyco/ionic-native/issues/293)) ([daa6d4c](https://github.com/driftyco/ionic-native/commit/daa6d4c)), closes [#272](https://github.com/driftyco/ionic-native/issues/272)
|
||||
* **nativestorage:** add NativeStorage plugin wrapper ([af5d4ad](https://github.com/driftyco/ionic-native/commit/af5d4ad))
|
||||
* **pin-dialog:** add pin dialog plugin ([#291](https://github.com/driftyco/ionic-native/issues/291)) ([2fe37c4](https://github.com/driftyco/ionic-native/commit/2fe37c4))
|
||||
@@ -246,12 +630,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))
|
||||
@@ -260,7 +660,6 @@
|
||||
* **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e))
|
||||
* **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164)
|
||||
* **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f))
|
||||
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
|
||||
|
||||
|
||||
### Features
|
||||
@@ -268,13 +667,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:
|
||||
|
||||
12
gulpfile.js
12
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,18 @@ 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 !== ''){
|
||||
return gulp.src('./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'))
|
||||
.pipe(gulp.dest('./src/plugins/'));
|
||||
|
||||
61
karma.conf.ts
Normal file
61
karma.conf.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
const WATCH = process.argv.indexOf('--watch') > -1;
|
||||
|
||||
module.exports = config => {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: './',
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['jasmine', 'browserify'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'test/**/*.spec.ts'
|
||||
],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'test/**/*.spec.ts': ['browserify']
|
||||
},
|
||||
|
||||
browserify: {
|
||||
debug: true,
|
||||
plugin: [ 'tsify' ],
|
||||
extensions: ['.js', '.ts']
|
||||
},
|
||||
|
||||
phantomjsLauncher: {
|
||||
// Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
|
||||
exitOnResourceError: true
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['dots'],
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: WATCH,
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: !WATCH
|
||||
});
|
||||
};
|
||||
42
package.json
42
package.json
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "1.3.17",
|
||||
"version": "2.2.10",
|
||||
"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);
|
||||
// // }
|
||||
// // })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
@@ -21,13 +21,17 @@ function run {
|
||||
./git/clone.sh --repository="ionic-site" \
|
||||
--directory="$SITE_DIR" \
|
||||
--branch="master"
|
||||
ls -al $SITE_DIR
|
||||
cd $SITE_DIR
|
||||
ls -al
|
||||
else
|
||||
echo "using existing"
|
||||
cd $SITE_DIR
|
||||
git reset --hard
|
||||
git pull origin master
|
||||
fi
|
||||
|
||||
git rm -rf docs/v2/native/*/
|
||||
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc.sh
|
||||
|
||||
@@ -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>
|
||||
<code><$ param.returnType | escape $></code>
|
||||
</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 @>
|
||||
<h2><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h2>
|
||||
<$ 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 @>
|
||||
<h2><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h2>
|
||||
<$ interfaceTable(item) $>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<!-- end interfaces -->
|
||||
|
||||
<!-- related link -->
|
||||
<@- if doc.see @>
|
||||
|
||||
|
||||
@@ -23,10 +23,8 @@ function run {
|
||||
# CD in to the site dir to commit updated docs
|
||||
cd $SITE_DIR
|
||||
|
||||
CHANGES=$(git status --porcelain)
|
||||
|
||||
# if no changes, don't commit
|
||||
if [[ "$CHANGES" == "" ]]; then
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
echo "-- No changes detected for the following commit, docs not updated."
|
||||
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
else
|
||||
|
||||
20
scripts/templates/wrap-min.tmpl
Normal file
20
scripts/templates/wrap-min.tmpl
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Plugin } from './plugin';
|
||||
/**
|
||||
* @name PluginName
|
||||
* @description
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { PluginName } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PluginName',
|
||||
plugin: '',
|
||||
pluginRef: '',
|
||||
repo: ''
|
||||
})
|
||||
export class PluginName {
|
||||
}
|
||||
@@ -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))
|
||||
@@ -29,6 +29,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PluginName',
|
||||
plugin: '', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: '', // the github repository URL for the plugin
|
||||
264
src/index.ts
264
src/index.ts
@@ -20,51 +20,70 @@ import { Brightness } from './plugins/brightness';
|
||||
import { BLE } from './plugins/ble';
|
||||
import { BluetoothSerial } from './plugins/bluetoothserial';
|
||||
import { Calendar } from './plugins/calendar';
|
||||
import { CallNumber } from './plugins/call-number';
|
||||
import { Camera } from './plugins/camera';
|
||||
import { CameraPreview } from './plugins/camera-preview';
|
||||
import { CardIO } from './plugins/card-io';
|
||||
import { Clipboard } from './plugins/clipboard';
|
||||
import { CodePush } from './plugins/code-push';
|
||||
import { Contacts } from './plugins/contacts';
|
||||
import { Crop } from './plugins/crop';
|
||||
import { DatePicker } from './plugins/datepicker';
|
||||
import { DBMeter } from './plugins/dbmeter';
|
||||
import { Deeplinks } from './plugins/deeplinks';
|
||||
import { Device } from './plugins/device';
|
||||
import { DeviceFeedback } from './plugins/device-feedback';
|
||||
import { DeviceAccounts } from './plugins/deviceaccounts';
|
||||
import { DeviceMotion } from './plugins/devicemotion';
|
||||
import { DeviceOrientation } from './plugins/deviceorientation';
|
||||
import { Diagnostic } from './plugins/diagnostic';
|
||||
import { Dialogs } from './plugins/dialogs';
|
||||
import { EmailComposer } from './plugins/emailcomposer';
|
||||
import { EstimoteBeacons } from './plugins/estimote-beacons';
|
||||
import { Facebook } from './plugins/facebook';
|
||||
import { File } from './plugins/file';
|
||||
import { FileChooser } from './plugins/file-chooser';
|
||||
import { FileOpener } from './plugins/file-opener';
|
||||
import { FilePath } from './plugins/filepath';
|
||||
import { Transfer } from './plugins/filetransfer';
|
||||
import { Flashlight } from './plugins/flashlight';
|
||||
import { Geofence } from './plugins/geofence';
|
||||
import { Geolocation } from './plugins/geolocation';
|
||||
import { Globalization } from './plugins/globalization';
|
||||
import { GooglePlus } from './plugins/google-plus';
|
||||
import { GoogleMap } from './plugins/googlemaps';
|
||||
import { GoogleMap } from './plugins/googlemap';
|
||||
import { GoogleAnalytics } from './plugins/googleanalytics';
|
||||
import { Hotspot } from './plugins/hotspot';
|
||||
import { HTTP } from './plugins/http';
|
||||
import { Httpd } from './plugins/httpd';
|
||||
import { IBeacon } from './plugins/ibeacon';
|
||||
import { ImagePicker } from './plugins/imagepicker';
|
||||
import { ImageResizer } from './plugins/imageresizer';
|
||||
import { InAppBrowser } from './plugins/inappbrowser';
|
||||
import { InAppPurchase } from './plugins/inapppurchase';
|
||||
import { Insomnia } from './plugins/insomnia';
|
||||
import { Instagram } from './plugins/instagram';
|
||||
import { IsDebug } from './plugins/is-debug';
|
||||
import { Keyboard } from './plugins/keyboard';
|
||||
import { LaunchNavigator } from './plugins/launchnavigator';
|
||||
import { LocalNotifications } from './plugins/localnotifications';
|
||||
import { LocationAccuracy } from './plugins/location-accuracy';
|
||||
import { MediaCapture } from './plugins/media-capture';
|
||||
import { NativeAudio } from './plugins/native-audio';
|
||||
import { NativePageTransitions } from './plugins/native-page-transitions';
|
||||
import { NativeStorage } from './plugins/nativestorage';
|
||||
import { Market } from './plugins/market';
|
||||
import { MediaPlugin } from './plugins/media';
|
||||
import { Mixpanel } from './plugins/mixpanel';
|
||||
import { MusicControls } from './plugins/music-controls';
|
||||
import { Network } from './plugins/network';
|
||||
import { NFC } from './plugins/nfc';
|
||||
import { OneSignal } from './plugins/onesignal';
|
||||
import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||
import { PayPal } from './plugins/pay-pal';
|
||||
import { PinDialog } from './plugins/pin-dialog';
|
||||
import { PowerManagement } from './plugins/power-management';
|
||||
import { Printer } from './plugins/printer';
|
||||
import { Push } from './plugins/push';
|
||||
import { SafariViewController } from './plugins/safari-view-controller';
|
||||
@@ -78,51 +97,133 @@ import { SpinnerDialog } from './plugins/spinnerdialog';
|
||||
import { Splashscreen } from './plugins/splashscreen';
|
||||
import { SQLite } from './plugins/sqlite';
|
||||
import { StatusBar } from './plugins/statusbar';
|
||||
import { Stepcounter } from './plugins/stepcounter';
|
||||
import { StreamingMedia } from './plugins/streaming-media';
|
||||
import { ThreeDeeTouch } from './plugins/3dtouch';
|
||||
import { Toast } from './plugins/toast';
|
||||
import { TouchID } from './plugins/touchid';
|
||||
import { TextToSpeech } from './plugins/text-to-speech';
|
||||
import { ThemeableBrowser } from './plugins/themeable-browser';
|
||||
import { TwitterConnect } from './plugins/twitter-connect';
|
||||
import { Vibration } from './plugins/vibration';
|
||||
import { VideoEditor } from './plugins/video-editor';
|
||||
import { VideoPlayer } from './plugins/video-player';
|
||||
import { WebIntent } from './plugins/webintent';
|
||||
import { YoutubeVideoPlayer } from './plugins/youtube-video-player';
|
||||
import { ZBar } from './plugins/z-bar';
|
||||
import { Zip } from './plugins/zip';
|
||||
export * from './plugins/3dtouch';
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/admob';
|
||||
export * from './plugins/android-fingerprint-auth';
|
||||
export * from './plugins/appavailability';
|
||||
export * from './plugins/apprate';
|
||||
export * from './plugins/appversion';
|
||||
export * from './plugins/background-geolocation';
|
||||
export * from './plugins/backgroundmode';
|
||||
export * from './plugins/badge';
|
||||
export * from './plugins/barcodescanner';
|
||||
export * from './plugins/base64togallery';
|
||||
export * from './plugins/batterystatus';
|
||||
export * from './plugins/ble';
|
||||
export * from './plugins/bluetoothserial';
|
||||
export * from './plugins/brightness';
|
||||
export * from './plugins/calendar';
|
||||
export * from './plugins/call-number';
|
||||
export * from './plugins/camera';
|
||||
export * from './plugins/camera-preview';
|
||||
export * from './plugins/card-io';
|
||||
export * from './plugins/clipboard';
|
||||
export * from './plugins/code-push';
|
||||
export * from './plugins/contacts';
|
||||
export * from './plugins/crop';
|
||||
export * from './plugins/datepicker';
|
||||
export * from './plugins/dbmeter';
|
||||
export * from './plugins/deeplinks';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/device-feedback';
|
||||
export * from './plugins/deviceaccounts';
|
||||
export * from './plugins/devicemotion';
|
||||
export * from './plugins/deviceorientation';
|
||||
export * from './plugins/diagnostic';
|
||||
export * from './plugins/dialogs';
|
||||
export * from './plugins/emailcomposer';
|
||||
export * from './plugins/estimote-beacons';
|
||||
export * from './plugins/facebook';
|
||||
export * from './plugins/file';
|
||||
export * from './plugins/file-chooser';
|
||||
export * from './plugins/file-opener';
|
||||
export * from './plugins/filetransfer';
|
||||
export * from './plugins/filepath';
|
||||
export * from './plugins/flashlight';
|
||||
export * from './plugins/geofence';
|
||||
export * from './plugins/geolocation';
|
||||
export * from './plugins/googlemaps';
|
||||
export * from './plugins/globalization';
|
||||
export * from './plugins/google-plus';
|
||||
export * from './plugins/googleanalytics';
|
||||
export * from './plugins/googlemap';
|
||||
export * from './plugins/hotspot';
|
||||
export * from './plugins/http';
|
||||
export * from './plugins/httpd';
|
||||
export * from './plugins/ibeacon';
|
||||
export * from './plugins/imagepicker';
|
||||
export * from './plugins/imageresizer';
|
||||
export * from './plugins/inappbrowser';
|
||||
export * from './plugins/inapppurchase';
|
||||
export * from './plugins/insomnia';
|
||||
export * from './plugins/instagram';
|
||||
export * from './plugins/is-debug';
|
||||
export * from './plugins/keyboard';
|
||||
export * from './plugins/launchnavigator';
|
||||
export * from './plugins/localnotifications';
|
||||
export * from './plugins/location-accuracy';
|
||||
export * from './plugins/market';
|
||||
export * from './plugins/media';
|
||||
export * from './plugins/media-capture';
|
||||
export * from './plugins/mixpanel';
|
||||
export * from './plugins/music-controls';
|
||||
export * from './plugins/native-audio';
|
||||
export * from './plugins/native-page-transitions';
|
||||
export * from './plugins/nativestorage';
|
||||
export * from './plugins/network';
|
||||
export * from './plugins/nfc';
|
||||
export * from './plugins/onesignal';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/photo-viewer';
|
||||
export * from './plugins/pin-dialog';
|
||||
export * from './plugins/plugin';
|
||||
export * from './plugins/power-management';
|
||||
export * from './plugins/printer';
|
||||
export * from './plugins/push';
|
||||
export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/screen-orientation';
|
||||
export * from './plugins/screenshot';
|
||||
export * from './plugins/securestorage';
|
||||
export * from './plugins/shake';
|
||||
export * from './plugins/sim';
|
||||
export * from './plugins/sms';
|
||||
export * from './plugins/socialsharing';
|
||||
export * from './plugins/spinnerdialog';
|
||||
export * from './plugins/splashscreen';
|
||||
export * from './plugins/sqlite';
|
||||
export * from './plugins/statusbar';
|
||||
export * from './plugins/stepcounter';
|
||||
export * from './plugins/streaming-media';
|
||||
export * from './plugins/text-to-speech';
|
||||
export * from './plugins/themeable-browser';
|
||||
export * from './plugins/toast';
|
||||
export * from './plugins/touchid';
|
||||
export * from './plugins/twitter-connect';
|
||||
export * from './plugins/vibration';
|
||||
export * from './plugins/video-editor';
|
||||
export * from './plugins/video-player';
|
||||
export {
|
||||
export * from './plugins/webintent';
|
||||
export * from './plugins/youtube-video-player';
|
||||
export * from './plugins/z-bar';
|
||||
export * from './plugins/zip';
|
||||
|
||||
// Window export to use outside of a module loading system
|
||||
window['IonicNative'] = {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
AndroidFingerprintAuth,
|
||||
@@ -130,140 +231,107 @@ export {
|
||||
AppRate,
|
||||
AppVersion,
|
||||
Badge,
|
||||
BackgroundGeolocation,
|
||||
BackgroundMode,
|
||||
BarcodeScanner,
|
||||
Base64ToGallery,
|
||||
BatteryStatus,
|
||||
Brightness,
|
||||
BLE,
|
||||
BluetoothSerial,
|
||||
Calendar,
|
||||
CallNumber,
|
||||
Camera,
|
||||
CameraPreview,
|
||||
CardIO,
|
||||
Clipboard,
|
||||
CodePush,
|
||||
Contacts,
|
||||
Crop,
|
||||
DatePicker,
|
||||
DBMeter,
|
||||
Deeplinks,
|
||||
Device,
|
||||
DeviceFeedback,
|
||||
DeviceAccounts,
|
||||
DeviceMotion,
|
||||
DeviceOrientation,
|
||||
Dialogs,
|
||||
Diagnostic,
|
||||
EmailComposer,
|
||||
EstimoteBeacons,
|
||||
Facebook,
|
||||
File,
|
||||
FileChooser,
|
||||
FileOpener,
|
||||
FilePath,
|
||||
Flashlight,
|
||||
Geofence,
|
||||
Geolocation,
|
||||
Globalization,
|
||||
GooglePlus,
|
||||
GoogleMap,
|
||||
GoogleAnalytics,
|
||||
Hotspot,
|
||||
HTTP,
|
||||
Httpd,
|
||||
IBeacon,
|
||||
ImagePicker,
|
||||
ImageResizer,
|
||||
InAppBrowser,
|
||||
InAppPurchase,
|
||||
Insomnia,
|
||||
Instagram,
|
||||
IsDebug,
|
||||
Keyboard,
|
||||
LaunchNavigator,
|
||||
LocalNotifications,
|
||||
LocationAccuracy,
|
||||
Market,
|
||||
MediaCapture,
|
||||
MediaPlugin,
|
||||
Mixpanel,
|
||||
MusicControls,
|
||||
NativeAudio,
|
||||
NativePageTransitions,
|
||||
NativeStorage,
|
||||
Network,
|
||||
PayPal,
|
||||
NFC,
|
||||
Printer,
|
||||
Push,
|
||||
OneSignal,
|
||||
PhotoViewer,
|
||||
ScreenOrientation,
|
||||
PinDialog,
|
||||
PowerManagement,
|
||||
SafariViewController,
|
||||
Screenshot,
|
||||
SecureStorage,
|
||||
Shake,
|
||||
SocialSharing,
|
||||
Sim,
|
||||
SMS,
|
||||
SocialSharing,
|
||||
SpinnerDialog,
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
Stepcounter,
|
||||
StreamingMedia,
|
||||
ThreeDeeTouch,
|
||||
Toast,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
ThemeableBrowser,
|
||||
TwitterConnect,
|
||||
VideoEditor,
|
||||
VideoPlayer,
|
||||
Vibration,
|
||||
WebIntent,
|
||||
YoutubeVideoPlayer,
|
||||
ZBar,
|
||||
Zip
|
||||
}
|
||||
|
||||
export * from './plugins/plugin';
|
||||
|
||||
// Window export to use outside of a module loading system
|
||||
window['IonicNative'] = {
|
||||
ActionSheet: ActionSheet,
|
||||
AdMob: AdMob,
|
||||
AndroidFingerprintAuth: AndroidFingerprintAuth,
|
||||
AppAvailability: AppAvailability,
|
||||
AppRate: AppRate,
|
||||
AppVersion: AppVersion,
|
||||
Badge: Badge,
|
||||
BackgroundGeolocation: BackgroundGeolocation,
|
||||
BackgroundMode: BackgroundMode,
|
||||
BarcodeScanner: BarcodeScanner,
|
||||
Base64ToGallery: Base64ToGallery,
|
||||
BatteryStatus: BatteryStatus,
|
||||
Brightness: Brightness,
|
||||
BLE: BLE,
|
||||
BluetoothSerial: BluetoothSerial,
|
||||
Calendar: Calendar,
|
||||
Camera: Camera,
|
||||
CameraPreview: CameraPreview,
|
||||
CardIO: CardIO,
|
||||
Clipboard: Clipboard,
|
||||
Contacts: Contacts,
|
||||
Crop: Crop,
|
||||
DatePicker: DatePicker,
|
||||
DBMeter: DBMeter,
|
||||
Deeplinks: Deeplinks,
|
||||
Device: Device,
|
||||
DeviceAccounts: DeviceAccounts,
|
||||
DeviceMotion: DeviceMotion,
|
||||
DeviceOrientation: DeviceOrientation,
|
||||
Dialogs: Dialogs,
|
||||
Diagnostic: Diagnostic,
|
||||
EmailComposer: EmailComposer,
|
||||
Facebook: Facebook,
|
||||
File: File,
|
||||
Flashlight: Flashlight,
|
||||
Geolocation: Geolocation,
|
||||
Globalization: Globalization,
|
||||
GooglePlus: GooglePlus,
|
||||
GoogleMap : GoogleMap,
|
||||
GoogleAnalytics: GoogleAnalytics,
|
||||
Hotspot: Hotspot,
|
||||
Httpd: Httpd,
|
||||
IBeacon: IBeacon,
|
||||
ImagePicker: ImagePicker,
|
||||
ImageResizer: ImageResizer,
|
||||
InAppBrowser: InAppBrowser,
|
||||
Instagram: Instagram,
|
||||
Keyboard: Keyboard,
|
||||
LaunchNavigator: LaunchNavigator,
|
||||
LocalNotifications: LocalNotifications,
|
||||
MediaCapture: MediaCapture,
|
||||
MediaPlugin: MediaPlugin,
|
||||
NativeAudio: NativeAudio,
|
||||
NativeStorage: NativeStorage,
|
||||
Network: Network,
|
||||
Printer: Printer,
|
||||
Push: Push,
|
||||
OneSignal: OneSignal,
|
||||
PhotoViewer: PhotoViewer,
|
||||
ScreenOrientation: ScreenOrientation,
|
||||
PinDialog: PinDialog,
|
||||
SafariViewController: SafariViewController,
|
||||
Screenshot: Screenshot,
|
||||
SecureStorage: SecureStorage,
|
||||
Shake: Shake,
|
||||
Sim: Sim,
|
||||
SMS: SMS,
|
||||
SocialSharing: SocialSharing,
|
||||
SpinnerDialog: SpinnerDialog,
|
||||
Splashscreen: Splashscreen,
|
||||
SQLite: SQLite,
|
||||
StatusBar: StatusBar,
|
||||
ThreeDeeTouch: ThreeDeeTouch,
|
||||
Toast: Toast,
|
||||
TouchID: TouchID,
|
||||
Transfer: Transfer,
|
||||
TextToSpeech: TextToSpeech,
|
||||
TwitterConnect: TwitterConnect,
|
||||
VideoEditor: VideoEditor,
|
||||
VideoPlayer: VideoPlayer,
|
||||
Vibration: Vibration,
|
||||
WebIntent: WebIntent,
|
||||
Zip: Zip
|
||||
};
|
||||
|
||||
initAngular1(window['IonicNative']);
|
||||
@@ -272,16 +340,16 @@ initAngular1(window['IonicNative']);
|
||||
// log an error if it didn't fire in a reasonable amount of time. Generally,
|
||||
// when this happens, developers should remove and reinstall plugins, since
|
||||
// an inconsistent plugin is often the culprit.
|
||||
let before = +new Date;
|
||||
const before = Date.now();
|
||||
|
||||
let didFireReady = false;
|
||||
document.addEventListener('deviceready', function() {
|
||||
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
|
||||
document.addEventListener('deviceready', () => {
|
||||
console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
|
||||
didFireReady = true;
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(() => {
|
||||
if (!didFireReady && window.cordova) {
|
||||
console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.');
|
||||
console.warn(`Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
|
||||
}
|
||||
}, DEVICE_READY_TIMEOUT);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -54,7 +54,7 @@ declare var window: any;
|
||||
* ];
|
||||
* ThreeDeeTouch.configureQuickActions(actions);
|
||||
*
|
||||
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
|
||||
* ThreeDeeTouch.onHomeIconPressed().subscribe(
|
||||
* (payload) => {
|
||||
* // returns an object that is the button you presed
|
||||
* console.log('Pressed the ${payload.title} button')
|
||||
@@ -65,6 +65,7 @@ declare var window: any;
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ThreeDeeTouch',
|
||||
plugin: 'cordova-plugin-3dtouch',
|
||||
pluginRef: 'ThreeDeeTouch',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
|
||||
@@ -94,6 +95,7 @@ export class ThreeDeeTouch {
|
||||
* @param {string} title Title for your action
|
||||
* @param {string} subtitle (optional) A short description for your action
|
||||
* @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update
|
||||
* @param {string} iconTemplate (optional) Can be used to provide your own icon
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
@@ -106,7 +108,7 @@ export class ThreeDeeTouch {
|
||||
*/
|
||||
static onHomeIconPressed(): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) {
|
||||
if (window.ThreeDeeTouch) {
|
||||
window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
|
||||
} else {
|
||||
observer.error('3dTouch plugin is not available.');
|
||||
@@ -139,6 +141,7 @@ export interface ThreeDeeTouchQuickAction {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
iconType?: string;
|
||||
iconTemplate?: string;
|
||||
}
|
||||
|
||||
export interface ThreeDeeTouchForceTouch {
|
||||
|
||||
@@ -12,7 +12,6 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```typescript
|
||||
* import { ActionSheet } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||
* ActionSheet.show({
|
||||
* 'title': 'What do you want with this image?',
|
||||
@@ -23,24 +22,11 @@ import { Cordova, Plugin } from './plugin';
|
||||
* console.log('Button pressed: ' + buttonIndex);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
* ActionSheet options
|
||||
*
|
||||
* | Option | Type | Description |
|
||||
* |-------------------------------|-----------|----------------------------------------------|
|
||||
* | title |`string` | The title for the actionsheet |
|
||||
* | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
|
||||
* | androidTheme |`number` | Theme to be used on Android |
|
||||
* | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
|
||||
* | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
|
||||
* | addCancelButtonWithLabel |`string` | Add a cancel button with text |
|
||||
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
|
||||
* | position |`number[]` | On an iPad, set the X,Y position |
|
||||
*
|
||||
*
|
||||
* @interfaces
|
||||
* ActionSheetOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ActionSheet',
|
||||
plugin: 'cordova-plugin-actionsheet',
|
||||
pluginRef: 'plugins.actionsheet',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
|
||||
@@ -50,28 +36,54 @@ export class ActionSheet {
|
||||
|
||||
/**
|
||||
* Show a native ActionSheet component. See below for options.
|
||||
* @param {options} Options See table below
|
||||
* @returns {Promise} Returns a Promise that resolves with the index of the
|
||||
* @param options {ActionSheetOptions} Options See table below
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the index of the
|
||||
* button pressed (1 based, so 1, 2, 3, etc.)
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options?: {
|
||||
buttonLabels: string[],
|
||||
title?: string,
|
||||
androidTheme?: number,
|
||||
androidEnableCancelButton?: boolean,
|
||||
winphoneEnableCancelButton?: boolean,
|
||||
addCancelButtonWithLabel?: string,
|
||||
addDestructiveButtonWithLabel?: string,
|
||||
position?: number[]
|
||||
}): Promise<any> { return; }
|
||||
static show(options?: ActionSheetOptions): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Progamtically hide the native ActionSheet
|
||||
* @returns {Promise} Returns a Promise that resolves when the actionsheet is closed
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the actionsheet is closed
|
||||
*/
|
||||
@Cordova()
|
||||
static hide(options?: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface ActionSheetOptions {
|
||||
/**
|
||||
* The labels for the buttons. Uses the index x
|
||||
*/
|
||||
buttonLabels: string[];
|
||||
/**
|
||||
* The title for the actionsheet
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Theme to be used on Android
|
||||
*/
|
||||
androidTheme?: number;
|
||||
/**
|
||||
* Enable a cancel on Android
|
||||
*/
|
||||
androidEnableCancelButton?: boolean;
|
||||
/**
|
||||
* Enable a cancel on Windows Phone
|
||||
*/
|
||||
winphoneEnableCancelButton?: boolean;
|
||||
/**
|
||||
* Add a cancel button with text
|
||||
*/
|
||||
addCancelButtonWithLabel?: string;
|
||||
/**
|
||||
* Add a destructive button with text
|
||||
*/
|
||||
addDestructiveButtonWithLabel?: string;
|
||||
/**
|
||||
* On an iPad, set the X,Y position
|
||||
*/
|
||||
position?: number[];
|
||||
}
|
||||
|
||||
@@ -5,9 +5,24 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @name AdMob
|
||||
* @description Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AdMob } from 'ionic-native';
|
||||
*
|
||||
* ionViewDidLoad() {
|
||||
* AdMob.onBannerDismiss()
|
||||
* .subscribe(() => { console.log('User returned from interstitial'); });
|
||||
* }
|
||||
*
|
||||
* public onClick() {
|
||||
* AdMob.prepareInterstitial('YOUR_ADID')
|
||||
* .then(() => { AdMob.showInterstitial(); });
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
* Please refer the the plugin's original repository for detailed usage.
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AdMob',
|
||||
plugin: 'cordova-plugin-admobpro',
|
||||
pluginRef: 'AdMob',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
|
||||
@@ -20,6 +35,7 @@ export class AdMob {
|
||||
/**
|
||||
*
|
||||
* @param adIdOrOptions
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the banner is created
|
||||
*/
|
||||
@Cordova()
|
||||
static createBanner(adIdOrOptions: any): Promise<any> { return; }
|
||||
@@ -62,6 +78,7 @@ export class AdMob {
|
||||
/**
|
||||
*
|
||||
* @param adIdOrOptions
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when interstitial is prepared
|
||||
*/
|
||||
@Cordova()
|
||||
static prepareInterstitial(adIdOrOptions: any): Promise<any> { return; }
|
||||
@@ -76,6 +93,7 @@ export class AdMob {
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the interstitial is ready
|
||||
*/
|
||||
@Cordova()
|
||||
static isInterstitialReady(): Promise<boolean> { return; }
|
||||
@@ -83,6 +101,7 @@ export class AdMob {
|
||||
/**
|
||||
* Prepare a reward video ad
|
||||
* @param adIdOrOptions
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the ad is prepared
|
||||
*/
|
||||
@Cordova()
|
||||
static prepareRewardVideoAd(adIdOrOptions: any): Promise<any> { return; }
|
||||
@@ -98,6 +117,7 @@ export class AdMob {
|
||||
/**
|
||||
* Sets the values for configuration and targeting
|
||||
* @param options Returns a promise that resolves if the options are set successfully
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when the options have been set
|
||||
*/
|
||||
@Cordova()
|
||||
static setOptions(options: any): Promise<any> { return; }
|
||||
|
||||
@@ -30,6 +30,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AndroidFingerprintAuth',
|
||||
plugin: 'cordova-plugin-android-fingerprint-auth',
|
||||
pluginRef: 'FingerprintAuth',
|
||||
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
|
||||
@@ -70,6 +71,7 @@ export class AndroidFingerprintAuth {
|
||||
|
||||
/**
|
||||
* Check if service is available
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if fingerprint auth is available on the device
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<{isAvailable: boolean}> {return; }
|
||||
|
||||
@@ -28,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppAvailability',
|
||||
plugin: 'cordova-plugin-appavailability',
|
||||
pluginRef: 'appAvailability',
|
||||
repo: 'https://github.com/ohh2ahh/AppAvailability',
|
||||
|
||||
@@ -19,7 +19,7 @@ declare var window;
|
||||
* android: 'market://details?id=<package_name>',
|
||||
* };
|
||||
*
|
||||
* AppRate.promptForRating();
|
||||
* AppRate.promptForRating(false);
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
@@ -44,6 +44,7 @@ declare var window;
|
||||
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppRate',
|
||||
plugin: 'cordova-plugin-apprate',
|
||||
pluginRef: 'AppRate',
|
||||
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
|
||||
@@ -56,7 +57,7 @@ export class AppRate {
|
||||
* See table below for options
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get preferences() { return window.AppRate.preferences; }
|
||||
static preferences;
|
||||
|
||||
/**
|
||||
* Prompts the user for rating
|
||||
|
||||
@@ -19,6 +19,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppVersion',
|
||||
plugin: 'cordova-plugin-app-version',
|
||||
pluginRef: 'cordova.getAppVersion',
|
||||
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
|
||||
@@ -27,28 +28,28 @@ import { Cordova, Plugin } from './plugin';
|
||||
export class AppVersion {
|
||||
/**
|
||||
* Returns the name of the app
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAppName(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the package name of the app
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getPackageName(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the build identifier of the app
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getVersionCode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the version of the app
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getVersionNumber(): Promise<any> { return; }
|
||||
|
||||
@@ -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,6 +236,7 @@ export interface Config {
|
||||
*
|
||||
* // When device is ready :
|
||||
* platform.ready().then(() => {
|
||||
* // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
|
||||
*
|
||||
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
|
||||
* let config = {
|
||||
@@ -188,20 +257,22 @@ export interface Config {
|
||||
|
||||
* }, (error) => {
|
||||
* console.log('BackgroundGeolocation error');
|
||||
* }, {
|
||||
* //options
|
||||
* });
|
||||
* }, config);
|
||||
*
|
||||
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
|
||||
* BackgroundGeolocation.start();
|
||||
* }
|
||||
* })
|
||||
*
|
||||
* // If you wish to turn OFF background-tracking, call the #stop method.
|
||||
* BackgroundGeolocation.stop();
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* Location
|
||||
* Config
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundGeolocation',
|
||||
plugin: 'cordova-plugin-mauron85-background-geolocation',
|
||||
pluginRef: 'backgroundGeolocation',
|
||||
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
|
||||
@@ -209,37 +280,84 @@ export interface Config {
|
||||
})
|
||||
export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
|
||||
*
|
||||
* Possible values:
|
||||
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
|
||||
* ANDROID_ACTIVITY_PROVIDER: 1
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
static LocationProvider: any = {
|
||||
ANDROID_DISTANCE_FILTER_PROVIDER: 0,
|
||||
ANDROID_ACTIVITY_PROVIDER: 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
|
||||
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
|
||||
* 1000 results in lowest power drain and least accurate readings.
|
||||
*
|
||||
* Possible values:
|
||||
* HIGH: 0
|
||||
* MEDIUM: 10
|
||||
* LOW: 100
|
||||
* PASSIVE: 1000
|
||||
*
|
||||
* enum {number}
|
||||
*/
|
||||
static Accuracy: any = {
|
||||
HIGH: 0,
|
||||
MEDIUM: 10,
|
||||
LOW: 100,
|
||||
PASSIVE: 1000
|
||||
};
|
||||
|
||||
/**
|
||||
* Used in the switchMode function
|
||||
*
|
||||
* Possible values:
|
||||
* BACKGROUND: 0
|
||||
* FOREGROUND: 1
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
static Mode: any = {
|
||||
BACKGROUND: 0,
|
||||
FOREGROUND: 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Configure the plugin.
|
||||
* Success callback will be called with one argument - Location object, which tries to mimic w3c Coordinates interface.
|
||||
*
|
||||
* @param {Function} callback callback will be called when background location is determined.
|
||||
* @param {Function} errorCallback callback to be executed every time a geolocation error occurs.
|
||||
* @param {Config} options An object of type Config
|
||||
* @return Location object, which tries to mimic w3c Coordinates interface.
|
||||
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
|
||||
* Callback to be executed every time a geolocation is recorded in the background.
|
||||
*
|
||||
* Fail callback to be executed every time a geolocation error occurs.
|
||||
*
|
||||
* Options a json object of type Config
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
|
||||
|
||||
static configure(callback: Function, errorCallback: Function, options: Config): any { return; }
|
||||
|
||||
/**
|
||||
* Turn ON the background-geolocation system.
|
||||
* The user will be tracked whenever they suspend the app.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static start(): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Turn OFF background-tracking
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Inform the native plugin that you're finished, the background-task may be completed
|
||||
* NOTE: IOS, WP only
|
||||
@@ -247,7 +365,6 @@ export class BackgroundGeolocation {
|
||||
@Cordova()
|
||||
static finish() { }
|
||||
|
||||
|
||||
/**
|
||||
* Force the plugin to enter "moving" or "stationary" state
|
||||
* NOTE: IOS, WP only
|
||||
@@ -255,9 +372,9 @@ export class BackgroundGeolocation {
|
||||
@Cordova()
|
||||
static changePace(isMoving: boolean) { }
|
||||
|
||||
|
||||
/**
|
||||
* Setup configuration
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -267,6 +384,7 @@ export class BackgroundGeolocation {
|
||||
/**
|
||||
* Returns current stationaryLocation if available. null if not
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<Location>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getStationaryLocation(): Promise<Location> { return; }
|
||||
@@ -275,6 +393,7 @@ export class BackgroundGeolocation {
|
||||
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
|
||||
* your #success callback will be executed with #location param containing #radius of region
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static onStationary(): Promise<any> { return; }
|
||||
@@ -287,17 +406,24 @@ 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.
|
||||
* If user enable or disable location services then success callback will be executed.
|
||||
* In case or error (SettingNotFoundException) fail callback will be executed.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static watchLocationMode(): Promise<boolean> { return; }
|
||||
@@ -317,13 +443,22 @@ export class BackgroundGeolocation {
|
||||
* or
|
||||
* - option.debug is true
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getValidLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete stored location by given locationId.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteLocation(locationId: number): Promise<any> { return; }
|
||||
@@ -331,8 +466,36 @@ export class BackgroundGeolocation {
|
||||
/**
|
||||
* Delete all stored locations.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getLogEntries(limit: number): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Cordova, CordovaFunctionOverride, Plugin } from './plugin';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name Background Mode
|
||||
* @description
|
||||
* Cordova plugin to prevent the app from going to sleep while in background.
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
|
||||
*@usage
|
||||
* ```typescript
|
||||
* import { BackgroundMode } from 'ionic-native';
|
||||
@@ -26,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundMode',
|
||||
plugin: 'cordova-plugin-background-mode',
|
||||
pluginRef: 'cordova.plugins.backgroundMode',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
|
||||
@@ -46,18 +49,18 @@ export class BackgroundMode {
|
||||
* Once the background mode has been disabled, the app will be paused when in background.
|
||||
*/
|
||||
@Cordova()
|
||||
static disable(): void { }
|
||||
static disable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if background mode is enabled or not.
|
||||
* @returns {boolean} returns a true of false if the background mode is enabled.
|
||||
* @returns {Promise<boolean>} returns a promise that resolves with boolean that indicates if the background mode is enabled.
|
||||
*/
|
||||
@Cordova()
|
||||
static isEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Can be used to get the information if the background mode is active.
|
||||
* @returns {boolean} returns tru or flase if the background mode is active.
|
||||
* @returns {Promise<boolean>} returns a promise that resolves with boolean that indicates if the background mode is active.
|
||||
*/
|
||||
@Cordova()
|
||||
static isActive(): Promise<boolean> { return; }
|
||||
@@ -70,7 +73,7 @@ export class BackgroundMode {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static setDefaults(options?: Configure): void { }
|
||||
static setDefaults(options?: Configure): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Modify the displayed information.
|
||||
@@ -80,17 +83,28 @@ export class BackgroundMode {
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static update(options?: Configure): void { }
|
||||
static configure(options?: Configure): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets a callback for a specific event
|
||||
* Can be used to get notified or run function when the background mode has been activated, deactivated or failed.
|
||||
* @param eventName The name of the event. Available events: activate, deactivate, failure
|
||||
* Called when background mode is activated.
|
||||
* @returns {Observable<any>} returns an observable that emits 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.
|
||||
* @returns {Observable<any>} returns an observable that emits when background mode is deactivated
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
static ondeactivate(): Observable<any> { return; };
|
||||
|
||||
/**
|
||||
* Called when background mode fails
|
||||
* @returns {Observable<any>} returns an observable that emits when background mode fails
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
static onfailure(): Observable<any> { return; };
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Badge',
|
||||
plugin: 'cordova-plugin-badge',
|
||||
pluginRef: 'cordova.plugins.notification.badge',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-badge',
|
||||
@@ -27,6 +28,7 @@ export class Badge {
|
||||
|
||||
/**
|
||||
* Clear the badge of the app icon.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static clear(): Promise<boolean> { return; }
|
||||
@@ -34,14 +36,14 @@ export class Badge {
|
||||
/**
|
||||
* Set the badge of the app icon.
|
||||
* @param {number} badgeNumber The new badge number.
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static set(badgeNumber: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the badge of the app icon.
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static get(): Promise<any> { return; }
|
||||
@@ -49,7 +51,7 @@ export class Badge {
|
||||
/**
|
||||
* Increase the badge number.
|
||||
* @param {number} increaseBy Count to add to the current badge number
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static increase(increaseBy: number): Promise<any> { return; }
|
||||
@@ -57,20 +59,21 @@ export class Badge {
|
||||
/**
|
||||
* Decrease the badge number.
|
||||
* @param {number} decreaseBy Count to subtract from the current badge number
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static decrease(decreaseBy: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Determine if the app has permission to show badges.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Register permission to set badge notifications
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static registerPermission(): Promise<any> { return; }
|
||||
|
||||
@@ -20,6 +20,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BarcodeScanner',
|
||||
plugin: 'phonegap-plugin-barcodescanner',
|
||||
pluginRef: 'cordova.plugins.barcodeScanner',
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
|
||||
@@ -39,7 +40,7 @@ export class BarcodeScanner {
|
||||
/**
|
||||
* Open the barcode scanner.
|
||||
* @param options {Object} Optional options to pass to the scanner
|
||||
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -51,6 +52,7 @@ export class BarcodeScanner {
|
||||
* NOTE: not well supported on Android
|
||||
* @param type {string} Type of encoding
|
||||
* @param data {any} Data to encode
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static encode(type: string, data: any): Promise<any> { return; }
|
||||
|
||||
@@ -14,6 +14,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Base64ToGallery',
|
||||
plugin: 'cordova-base64-to-gallery',
|
||||
pluginRef: 'cordova',
|
||||
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
|
||||
@@ -24,10 +25,13 @@ export class Base64ToGallery {
|
||||
/**
|
||||
* Converts a base64 string to an image file in the device gallery
|
||||
* @param {string} data The actual base64 string that you want to save
|
||||
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
|
||||
* @returns {Promise} returns a promise that resolves when the image is saved.
|
||||
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
|
||||
* @returns {Promise<any>} 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;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BatteryStatus',
|
||||
plugin: 'cordova-plugin-battery-status',
|
||||
repo: 'https://github.com/apache/cordova-plugin-battery-status',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
||||
@@ -32,7 +33,7 @@ export class BatteryStatus {
|
||||
|
||||
/**
|
||||
* Watch the change in battery level
|
||||
* @returns {Observable} Returns an observable that pushes a status object
|
||||
* @returns {Observable<StatusObject>} Returns an observable that pushes a status object
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
|
||||
@@ -160,6 +160,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BLE',
|
||||
plugin: 'cordova-plugin-ble-central',
|
||||
pluginRef: 'ble',
|
||||
repo: 'https://github.com/don/cordova-plugin-ble-central',
|
||||
@@ -177,7 +178,7 @@ export class BLE {
|
||||
* ```
|
||||
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
|
||||
* @param {number} seconds Number of seconds to run discovery
|
||||
* @return Returns an Observable that notifies of each peripheral that is discovered during the specified time.
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each peripheral that is discovered during the specified time.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
@@ -198,7 +199,7 @@ export class BLE {
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
|
||||
* @return Returns an Observable that notifies of each peripheral discovered.
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each peripheral discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
@@ -207,6 +208,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}
|
||||
* @returns {Observable<any>} 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`.
|
||||
*
|
||||
@@ -359,7 +373,7 @@ export class BLE {
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
* @param {string} serviceUUID UUID of the BLE service
|
||||
* @param {string} characteristicUUID UUID of the BLE characteristic
|
||||
* @return Returns a Promise.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopNotification(
|
||||
@@ -379,7 +393,7 @@ export class BLE {
|
||||
* );
|
||||
* ```
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
* @return Returns a Promise.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isConnected(deviceId: string): Promise<any> { return; }
|
||||
@@ -387,22 +401,15 @@ export class BLE {
|
||||
/**
|
||||
* Report if bluetooth is enabled.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* BLE.isEnabled().then(
|
||||
* () => { console.log('enabled'); },
|
||||
* () => { console.log('not enabled'); }
|
||||
* );
|
||||
* ```
|
||||
* @return Returns a Promise.
|
||||
* @returns {Promise<void>} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled.
|
||||
*/
|
||||
@Cordova()
|
||||
static isEnabled(): Promise<any> { return; }
|
||||
static isEnabled(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Open System Bluetooth settings (Android only).
|
||||
*
|
||||
* @return Returns a Promise.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static showBluetoothSettings(): Promise<any> { return; }
|
||||
@@ -410,7 +417,7 @@ export class BLE {
|
||||
/**
|
||||
* Enable Bluetooth on the device (Android only).
|
||||
*
|
||||
* @return Returns a Promise.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enable(): Promise<any> { return; }
|
||||
|
||||
@@ -28,6 +28,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BluetoothSerial',
|
||||
repo: 'https://github.com/don/BluetoothSerial',
|
||||
plugin: 'cordova-plugin-bluetooth-serial',
|
||||
pluginRef: 'bluetoothSerial',
|
||||
@@ -38,7 +39,7 @@ export class BluetoothSerial {
|
||||
/**
|
||||
* Connect to a Bluetooth device
|
||||
* @param {string} macAddress_or_uuid Identifier of the remote device
|
||||
* @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
|
||||
* @returns {Observable<any>} Subscribe to connect, unsubscribe to disconnect.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone'],
|
||||
@@ -50,7 +51,7 @@ export class BluetoothSerial {
|
||||
/**
|
||||
* Connect insecurely to a Bluetooth device
|
||||
* @param {string} macAddress Identifier of the remote device
|
||||
* @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
|
||||
* @returns {Observable<any>} Subscribe to connect, unsubscribe to disconnect.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
@@ -62,7 +63,7 @@ export class BluetoothSerial {
|
||||
/**
|
||||
* Writes data to the serial port
|
||||
* @param {any} data ArrayBuffer of data
|
||||
* @returns {Promise} returns a promise when data has been written
|
||||
* @returns {Promise<any>} returns a promise when data has been written
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -71,7 +72,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Gets the number of bytes of data available
|
||||
* @returns {Promise} returns a promise that contains the available bytes
|
||||
* @returns {Promise<any>} returns a promise that contains the available bytes
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -79,7 +80,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Reads data from the buffer
|
||||
* @returns {Promise} returns a promise with data from the buffer
|
||||
* @returns {Promise<any>} returns a promise with data from the buffer
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -89,7 +90,7 @@ export class BluetoothSerial {
|
||||
/**
|
||||
* Reads data from the buffer until it reaches a delimiter
|
||||
* @param {string} delimiter string that you want to search until
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -99,7 +100,7 @@ export class BluetoothSerial {
|
||||
/**
|
||||
* Subscribe to be notified when data is received
|
||||
* @param {string} delimiter the string you want to watch for
|
||||
* @returns {Observable} returns an observable.
|
||||
* @returns {Observable<any>} returns an observable.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone'],
|
||||
@@ -110,7 +111,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Subscribe to be notified when data is received
|
||||
* @returns {Observable} returns an observable
|
||||
* @returns {Observable<any>} returns an observable
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone'],
|
||||
@@ -121,7 +122,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Clears data in buffer
|
||||
* @returns {Promise} returns a promise when completed
|
||||
* @returns {Promise<any>} returns a promise when completed
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -130,7 +131,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Lists bonded devices
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -139,7 +140,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Reports if bluetooth is enabled
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -148,7 +149,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Reports the connection status
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -157,7 +158,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Reads the RSSI from the connected peripheral
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -166,7 +167,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Show the Bluetooth settings on the device
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -175,7 +176,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Enable Bluetooth on the device
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -184,7 +185,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Discover unpaired devices
|
||||
* @returns {Promise} returns a promise
|
||||
* @returns {Promise<any>} returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
@@ -193,7 +194,7 @@ export class BluetoothSerial {
|
||||
|
||||
/**
|
||||
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
|
||||
* @returns {Observable} Returns an observable
|
||||
* @returns {Observable<any>} Returns an observable
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS', 'Windows Phone'],
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Brightness',
|
||||
plugin: 'cordova-plugin-brightness',
|
||||
pluginRef: 'cordova.plugins.brightness',
|
||||
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
|
||||
@@ -29,7 +30,7 @@ export class Brightness {
|
||||
* Sets the brightness of the display.
|
||||
*
|
||||
* @param {value} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
|
||||
* @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if setting brightness was successful.
|
||||
*/
|
||||
@Cordova()
|
||||
static setBrightness(value: number): Promise<any> { return; }
|
||||
@@ -37,7 +38,7 @@ export class Brightness {
|
||||
/**
|
||||
* Reads the current brightness of the device display.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that resolves with the
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the
|
||||
* brightness value of the device display (floating number between 0 and 1).
|
||||
*/
|
||||
@Cordova()
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @private
|
||||
*/
|
||||
export interface CalendarOptions {
|
||||
id?: string;
|
||||
firstReminderMinutes?: number;
|
||||
secondReminderMinutes?: number;
|
||||
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly'
|
||||
@@ -37,6 +38,7 @@ export interface CalendarOptions {
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Calendar',
|
||||
plugin: 'cordova-plugin-calendar',
|
||||
pluginRef: 'plugins.calendar',
|
||||
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
|
||||
@@ -52,7 +54,7 @@ export class Calendar {
|
||||
* - You're using Android < 6, or
|
||||
* - You've already granted permission
|
||||
*
|
||||
* If this returns false, you should call `requestReadWritePermissions` function
|
||||
* If this returns false, you should call the `requestReadWritePermission` function
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -97,7 +99,7 @@ export class Calendar {
|
||||
* Create a calendar. (iOS only)
|
||||
*
|
||||
* @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
|
||||
* @return {Promise} Returns a Promise
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createCalendar(
|
||||
@@ -107,7 +109,7 @@ export class Calendar {
|
||||
/**
|
||||
* Delete a calendar. (iOS only)
|
||||
* @param {string} name Name of the calendar to delete.
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteCalendar(name: string): Promise<any> { return; }
|
||||
@@ -148,7 +150,7 @@ export class Calendar {
|
||||
* @param {string} [notes] The event notes
|
||||
* @param {Date} [startDate] The event start date
|
||||
* @param {Date} [endDate] The event end date
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createEvent(
|
||||
@@ -168,7 +170,7 @@ export class Calendar {
|
||||
* @param {Date} [startDate] The event start date
|
||||
* @param {Date} [endDate] The event end date
|
||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createEventWithOptions(
|
||||
@@ -188,7 +190,7 @@ export class Calendar {
|
||||
* @param {string} [notes] The event notes
|
||||
* @param {Date} [startDate] The event start date
|
||||
* @param {Date} [endDate] The event end date
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createEventInteractively(
|
||||
@@ -208,7 +210,7 @@ export class Calendar {
|
||||
* @param {Date} [startDate] The event start date
|
||||
* @param {Date} [endDate] The event end date
|
||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static createEventInteractivelyWithOptions(
|
||||
@@ -239,7 +241,7 @@ export class Calendar {
|
||||
* @param {string} [notes] The event notes
|
||||
* @param {Date} [startDate] The event start date
|
||||
* @param {Date} [endDate] The event end date
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static findEvent(
|
||||
@@ -258,7 +260,7 @@ export class Calendar {
|
||||
* @param {Date} [startDate] The event start date
|
||||
* @param {Date} [endDate] The event end date
|
||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||
* @return Returns a Promise that resolves with the event, or rejects with an error.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the event, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static findEventWithOptions(
|
||||
@@ -275,21 +277,21 @@ export class Calendar {
|
||||
*
|
||||
* @param {Date} [startDate] The start date
|
||||
* @param {Date} [endDate] The end date
|
||||
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a list of all calendars.
|
||||
* @return A Promise that resolves with the list of calendars, or rejects with an error.
|
||||
* @returns {Promise<any>} A Promise that resolves with the list of calendars, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static listCalendars(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a list of all future events in the specified calendar. (iOS only)
|
||||
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
|
||||
@@ -336,7 +338,8 @@ export class Calendar {
|
||||
* @param {string} [newNotes] The new event notes
|
||||
* @param {Date} [newStartDate] The new event start date
|
||||
* @param {Date} [newEndDate] The new event end date
|
||||
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
|
||||
* @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions`
|
||||
* @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -351,8 +354,9 @@ export class Calendar {
|
||||
newNotes?: string,
|
||||
newStartDate?: Date,
|
||||
newEndDate?: Date,
|
||||
options?: CalendarOptions
|
||||
) { return; }
|
||||
filterOptions?: CalendarOptions,
|
||||
newOptions?: CalendarOptions
|
||||
): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete an event.
|
||||
|
||||
38
src/plugins/call-number.ts
Normal file
38
src/plugins/call-number.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name CallNumber
|
||||
* @description
|
||||
* Call a number directly from your Cordova/Ionic application.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {CallNumber} from 'ionic-native';
|
||||
*
|
||||
* CallNumber.callNumber(18001010101, true)
|
||||
* .then(() => console.log('Launched dialer!'))
|
||||
* .catch(() => console.log('Error launching dialer'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CallNumber',
|
||||
plugin: 'call-number',
|
||||
pluginRef: 'plugins.CallNumber',
|
||||
repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
export class CallNumber {
|
||||
/**
|
||||
* Calls a phone number
|
||||
* @param numberToCall {string} The phone number to call as a string
|
||||
* @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,56 @@ export interface CameraPreviewSize {
|
||||
*
|
||||
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { CameraPreview, CameraPreviewRect } from 'ionic-native';
|
||||
*
|
||||
* // camera options (Size and location)
|
||||
* let cameraRect: CameraPreviewRect = {
|
||||
* x: 100,
|
||||
* y: 100,
|
||||
* width: 200,
|
||||
* height: 200
|
||||
* };
|
||||
*
|
||||
*
|
||||
* // start camera
|
||||
* CameraPreview.startCamera(
|
||||
* cameraRect, // position and size of preview
|
||||
* 'front', // default camera
|
||||
* true, // tap to take picture
|
||||
* false, // disable drag
|
||||
* false, // keep preview in front. Set to true (back of the screen) to apply overlaying elements
|
||||
* 1 // set the preview alpha
|
||||
* );
|
||||
*
|
||||
* // Set the handler to run every time we take a picture
|
||||
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
|
||||
* console.log(result);
|
||||
* // do something with the result
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // take a picture
|
||||
* CameraPreview.takePicture({
|
||||
* maxWidth: 640,
|
||||
* maxHeight: 640
|
||||
* });
|
||||
*
|
||||
* // Switch camera
|
||||
* CameraPreview.switchCamera();
|
||||
*
|
||||
* // set color effect to negative
|
||||
* CameraPreview.setColorEffect('negative');
|
||||
*
|
||||
* // Stop the camera preview
|
||||
* CameraPreview.stopCamera();
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CameraPreview',
|
||||
plugin: 'cordova-plugin-camera-preview',
|
||||
pluginRef: 'cordova.plugins.camerapreview',
|
||||
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
|
||||
@@ -42,9 +90,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.
|
||||
@@ -52,7 +98,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static stopCamera(): void { };
|
||||
static stopCamera(): void { }
|
||||
|
||||
/**
|
||||
* Take the picture, the parameter size is optional
|
||||
@@ -61,15 +107,16 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static takePicture(size: CameraPreviewSize): void { };
|
||||
static takePicture(size: CameraPreviewSize): void { }
|
||||
|
||||
/**
|
||||
* Register a callback function that receives the original picture and the image captured from the preview box.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static setOnPictureTakenHandler(): Observable<any> { return; };
|
||||
static setOnPictureTakenHandler(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Switch from the rear camera and front camera, if available.
|
||||
@@ -77,7 +124,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static switchCamera(): void { };
|
||||
static switchCamera(): void { }
|
||||
|
||||
/**
|
||||
* Show the camera preview box.
|
||||
@@ -85,7 +132,7 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static show(): void { };
|
||||
static show(): void { }
|
||||
|
||||
/**
|
||||
* Hide the camera preview box.
|
||||
@@ -93,15 +140,15 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static hide(): void { };
|
||||
static hide(): void { }
|
||||
|
||||
/**
|
||||
* Set the default mode for the Flash.
|
||||
* Disables the camera preview
|
||||
*/
|
||||
// @Cordova({
|
||||
// sync: true
|
||||
// })
|
||||
// static setFlashMode(mode: number): void { };
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static disable(): void { }
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
@@ -109,16 +156,5 @@ export class CameraPreview {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static setColorEffect(effect: string): void { };
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static FlashMode = {
|
||||
OFF: 0,
|
||||
ON: 1,
|
||||
AUTO: 2
|
||||
};
|
||||
|
||||
static setColorEffect(effect: string): void { }
|
||||
}
|
||||
|
||||
@@ -6,16 +6,16 @@ export interface CameraOptions {
|
||||
quality?: number;
|
||||
/**
|
||||
* Choose the format of the return value.
|
||||
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
||||
* DATA_URL : 0, Return image as base64-encoded string
|
||||
* FILE_URI : 1, Return image file URI
|
||||
* Defined in Camera.DestinationType. Default is FILE_URI.
|
||||
* DATA_URL : 0, Return image as base64-encoded string,
|
||||
* FILE_URI : 1, Return image file URI,
|
||||
* NATIVE_URI : 2 Return image native URI
|
||||
* (e.g., assets-library:// on iOS or content:// on Android)
|
||||
*/
|
||||
destinationType?: number;
|
||||
/**
|
||||
* Set the source of the picture.
|
||||
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
|
||||
* Defined in Camera.PictureSourceType. Default is CAMERA.
|
||||
* PHOTOLIBRARY : 0,
|
||||
* CAMERA : 1,
|
||||
* SAVEDPHOTOALBUM : 2
|
||||
@@ -25,7 +25,7 @@ export interface CameraOptions {
|
||||
allowEdit?: boolean;
|
||||
/**
|
||||
* Choose the returned image file's encoding.
|
||||
* Defined in navigator.camera.EncodingType. Default is JPEG
|
||||
* Defined in Camera.EncodingType. Default is JPEG
|
||||
* JPEG : 0 Return JPEG encoded image
|
||||
* PNG : 1 Return PNG encoded image
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ export interface CameraOptions {
|
||||
targetHeight?: number;
|
||||
/**
|
||||
* Set the type of media to select from. Only works when PictureSourceType
|
||||
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
|
||||
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in Camera.MediaType
|
||||
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
|
||||
* Will return format specified via DestinationType
|
||||
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
||||
@@ -55,9 +55,9 @@ export interface CameraOptions {
|
||||
saveToPhotoAlbum?: boolean;
|
||||
/**
|
||||
* Choose the camera to use (front- or back-facing).
|
||||
* Defined in navigator.camera.Direction. Default is BACK.
|
||||
* FRONT: 0
|
||||
* BACK: 1
|
||||
* Defined in Camera.Direction. Default is BACK.
|
||||
* BACK: 0
|
||||
* FRONT: 1
|
||||
*/
|
||||
cameraDirection?: number;
|
||||
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
|
||||
@@ -105,8 +105,12 @@ export interface CameraPopoverOptions {
|
||||
* // Handle error
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
* CameraOptions
|
||||
* CameraPopoverOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Camera',
|
||||
plugin: 'cordova-plugin-camera',
|
||||
pluginRef: 'navigator.camera',
|
||||
repo: 'https://github.com/apache/cordova-plugin-camera',
|
||||
@@ -117,7 +121,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
public static DestinationType = {
|
||||
static DestinationType = {
|
||||
/** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
|
||||
DATA_URL: 0,
|
||||
/** Return file uri (content://media/external/images/media/2 for Android) */
|
||||
@@ -130,7 +134,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
public static EncodingType = {
|
||||
static EncodingType = {
|
||||
/** Return JPEG encoded image */
|
||||
JPEG: 0,
|
||||
/** Return PNG encoded image */
|
||||
@@ -140,7 +144,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
public static MediaType = {
|
||||
static MediaType = {
|
||||
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
|
||||
PICTURE: 0,
|
||||
/** Allow selection of video only, ONLY RETURNS URL */
|
||||
@@ -153,7 +157,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
public static PictureSourceType = {
|
||||
static PictureSourceType = {
|
||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||
PHOTOLIBRARY: 0,
|
||||
/** Take picture from camera */
|
||||
@@ -167,7 +171,7 @@ export class Camera {
|
||||
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
|
||||
* @enum {number}
|
||||
*/
|
||||
public static PopoverArrowDirection = {
|
||||
static PopoverArrowDirection = {
|
||||
ARROW_UP: 1,
|
||||
ARROW_DOWN: 2,
|
||||
ARROW_LEFT: 4,
|
||||
@@ -179,7 +183,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
public static Direction = {
|
||||
static Direction = {
|
||||
/** Use the back-facing camera */
|
||||
BACK: 0,
|
||||
/** Use the front-facing camera */
|
||||
@@ -188,8 +192,8 @@ export class Camera {
|
||||
|
||||
/**
|
||||
* Take a picture or video, or load one from the library.
|
||||
* @param {CameraOptions?} options Options that you want to pass to the camera. Encoding type, quality, etc. Optional
|
||||
* @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
|
||||
* @param {CameraOptions?} options optional. Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-).
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -199,11 +203,11 @@ export class Camera {
|
||||
/**
|
||||
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
|
||||
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static cleanup() { };
|
||||
static cleanup(): Promise<any> { return; };
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CardIO',
|
||||
plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
||||
pluginRef: 'CardIO',
|
||||
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
||||
@@ -35,6 +36,7 @@ export class CardIO {
|
||||
* Check whether card scanning is currently available. (May vary by
|
||||
* device, OS version, network connectivity, etc.)
|
||||
*
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static canScan(): Promise<boolean> { return; }
|
||||
@@ -42,12 +44,14 @@ export class CardIO {
|
||||
/**
|
||||
* Scan a credit card with card.io.
|
||||
* @param {CardIOOptions} options Options for configuring the plugin
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static scan(options?: CardIOOptions): Promise<any> { return; }
|
||||
static scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
|
||||
|
||||
/**
|
||||
* Retrieve the version of the card.io library. Useful when contacting support.
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static version(): Promise<string> { return; }
|
||||
@@ -56,7 +60,7 @@ export class CardIO {
|
||||
|
||||
export interface CardIOOptions {
|
||||
requireExpiry?: boolean;
|
||||
requireCCV?: boolean;
|
||||
requireCVV?: boolean;
|
||||
requirePostalCode?: boolean;
|
||||
supressManual?: boolean;
|
||||
restrictPostalCodeToNumericOnly?: boolean;
|
||||
@@ -72,3 +76,14 @@ export interface CardIOOptions {
|
||||
useCardIOLogo?: boolean;
|
||||
supressScan?: boolean;
|
||||
}
|
||||
|
||||
export interface CardIOResponse {
|
||||
cardType: string;
|
||||
redactedCardNumber: string;
|
||||
cardNumber: string;
|
||||
expiryMonth: number;
|
||||
expiryYear: number;
|
||||
cvv: string;
|
||||
postalCode: string;
|
||||
cardholderName: string;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Clipboard',
|
||||
plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
|
||||
pluginRef: 'cordova.plugins.clipboard',
|
||||
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
|
||||
@@ -38,14 +39,14 @@ export class Clipboard {
|
||||
/**
|
||||
* Copies the given text
|
||||
* @param {string} text Text that gets copied on the system clipboard
|
||||
* @returns {Promise<T>} Returns a promise after the text has been copied
|
||||
* @returns {Promise<any>} Returns a promise after the text has been copied
|
||||
*/
|
||||
@Cordova()
|
||||
static copy(text: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Pastes the text stored in clipboard
|
||||
* @returns {Promise<T>} Returns a promise after the text has been pasted
|
||||
* @returns {Promise<any>} Returns a promise after the text has been pasted
|
||||
*/
|
||||
@Cordova()
|
||||
static paste(): Promise<any> { return; }
|
||||
|
||||
524
src/plugins/code-push.ts
Normal file
524
src/plugins/code-push.ts
Normal file
@@ -0,0 +1,524 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
// below are taken from
|
||||
// https://raw.githubusercontent.com/Microsoft/cordova-plugin-code-push/master/typings/codePush.d.ts
|
||||
// and adjusted to remove warnings and access control
|
||||
|
||||
namespace Http {
|
||||
export const enum Verb {
|
||||
GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
|
||||
}
|
||||
|
||||
export interface Response {
|
||||
statusCode: number;
|
||||
body?: string;
|
||||
}
|
||||
|
||||
export interface Requester {
|
||||
request(verb: Verb, url: string, callback: Callback<Response>): void;
|
||||
request(verb: Verb, url: string, requestBody: string, callback: Callback<Response>): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app,
|
||||
* in which case only the appVersion is compulsory.
|
||||
*
|
||||
* !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
|
||||
*/
|
||||
export interface IPackage {
|
||||
deploymentKey: string;
|
||||
description: string;
|
||||
label: string;
|
||||
appVersion: string;
|
||||
isMandatory: boolean;
|
||||
packageHash: string;
|
||||
packageSize: number;
|
||||
failedInstall: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a remote package, which represents an update package available for download.
|
||||
*/
|
||||
export interface IRemotePackage extends IPackage {
|
||||
/**
|
||||
* The URL at which the package is available for download.
|
||||
*/
|
||||
downloadUrl: string;
|
||||
|
||||
/**
|
||||
* Downloads the package update from the CodePush service.
|
||||
*
|
||||
* @param downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully.
|
||||
* @param downloadError Optional callback invoked in case of an error.
|
||||
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
|
||||
*/
|
||||
download(downloadSuccess: SuccessCallback<ILocalPackage>, downloadError?: ErrorCallback, downloadProgress?: SuccessCallback<DownloadProgress>): void;
|
||||
|
||||
/**
|
||||
* Aborts the current download session, previously started with download().
|
||||
*
|
||||
* @param abortSuccess Optional callback invoked if the abort operation succeeded.
|
||||
* @param abortError Optional callback invoked in case of an error.
|
||||
*/
|
||||
abortDownload(abortSuccess?: SuccessCallback<void>, abortError?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a local package.
|
||||
*
|
||||
* !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
|
||||
*/
|
||||
export interface ILocalPackage extends IPackage {
|
||||
/**
|
||||
* The local storage path where this package is located.
|
||||
*/
|
||||
localPath: string;
|
||||
|
||||
/**
|
||||
* Indicates if the current application run is the first one after the package was applied.
|
||||
*/
|
||||
isFirstRun: boolean;
|
||||
|
||||
/**
|
||||
* Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded.
|
||||
* On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success.
|
||||
* Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run.
|
||||
*
|
||||
* @param installSuccess Callback invoked if the install operation succeeded.
|
||||
* @param installError Optional callback inovoked in case of an error.
|
||||
* @param installOptions Optional parameter used for customizing the installation behavior.
|
||||
*/
|
||||
install(installSuccess: SuccessCallback<InstallMode>, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decomposed static side of RemotePackage.
|
||||
* For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
|
||||
*/
|
||||
/* tslint:disable */
|
||||
interface RemotePackage_Static {
|
||||
new (): IRemotePackage;
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
||||
/**
|
||||
* Decomposed static side of LocalPackage.
|
||||
* For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
|
||||
*/
|
||||
/* tslint:disable */
|
||||
interface LocalPackage_Static {
|
||||
new (): ILocalPackage;
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
||||
declare var RemotePackage: RemotePackage_Static;
|
||||
declare var LocalPackage: LocalPackage_Static;
|
||||
|
||||
/**
|
||||
* Defines the JSON format of the current package information file.
|
||||
* This file is stored in the local storage of the device and persists between store updates and code-push updates.
|
||||
*
|
||||
* !! THIS FILE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
|
||||
*/
|
||||
interface IPackageInfoMetadata extends ILocalPackage {
|
||||
nativeBuildTime: string;
|
||||
}
|
||||
|
||||
interface NativeUpdateNotification {
|
||||
updateAppVersion: boolean; // Always true
|
||||
appVersion: string;
|
||||
}
|
||||
|
||||
export interface Callback<T> { (error: Error, parameter: T): void; }
|
||||
export interface SuccessCallback<T> { (result?: T): void; }
|
||||
export interface ErrorCallback { (error?: Error): void; }
|
||||
|
||||
interface Configuration {
|
||||
appVersion: string;
|
||||
clientUniqueId: string;
|
||||
deploymentKey: string;
|
||||
serverUrl: string;
|
||||
ignoreAppVersion?: boolean;
|
||||
}
|
||||
|
||||
declare class AcquisitionStatus {
|
||||
static DeploymentSucceeded: string;
|
||||
static DeploymentFailed: string;
|
||||
}
|
||||
|
||||
declare class AcquisitionManager {
|
||||
constructor(httpRequester: Http.Requester, configuration: Configuration);
|
||||
public queryUpdateWithCurrentPackage(currentPackage: IPackage, callback?: Callback<IRemotePackage | NativeUpdateNotification>): void;
|
||||
public reportStatusDeploy(pkg?: IPackage, status?: string, previousLabelOrAppVersion?: string, previousDeploymentKey?: string, callback?: Callback<void>): void;
|
||||
public reportStatusDownload(pkg: IPackage, callback?: Callback<void>): void;
|
||||
}
|
||||
|
||||
interface CodePushCordovaPlugin {
|
||||
|
||||
/**
|
||||
* Get the current package information.
|
||||
*
|
||||
* @param packageSuccess Callback invoked with the currently deployed package information.
|
||||
* @param packageError Optional callback invoked in case of an error.
|
||||
*/
|
||||
getCurrentPackage(packageSuccess: SuccessCallback<ILocalPackage>, packageError?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
|
||||
* This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
|
||||
*/
|
||||
getPendingPackage(packageSuccess: SuccessCallback<ILocalPackage>, packageError?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Checks with the CodePush server if an update package is available for download.
|
||||
*
|
||||
* @param querySuccess Callback invoked in case of a successful response from the server.
|
||||
* The callback takes one RemotePackage parameter. A non-null package is a valid update.
|
||||
* A null package means the application is up to date for the current native application version.
|
||||
* @param queryError Optional callback invoked in case of an error.
|
||||
* @param deploymentKey Optional deployment key that overrides the config.xml setting.
|
||||
*/
|
||||
checkForUpdate(querySuccess: SuccessCallback<IRemotePackage>, queryError?: ErrorCallback, deploymentKey?: string): void;
|
||||
|
||||
/**
|
||||
* Notifies the plugin that the update operation succeeded and that the application is ready.
|
||||
* Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
|
||||
* If using sync API, calling this function is not required since sync calls it internally.
|
||||
*
|
||||
* @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
|
||||
* @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
|
||||
*/
|
||||
notifyApplicationReady(notifySucceeded?: SuccessCallback<void>, notifyFailed?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
|
||||
* will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
|
||||
*/
|
||||
restartApplication(installSuccess: SuccessCallback<void>, errorCallback?: ErrorCallback): void;
|
||||
|
||||
/**
|
||||
* Convenience method for installing updates in one method call.
|
||||
* This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
|
||||
*
|
||||
* The algorithm of this method is the following:
|
||||
* - Checks for an update on the CodePush server.
|
||||
* - If an update is available
|
||||
* - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
|
||||
* The update package will then be downloaded and applied.
|
||||
* - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
|
||||
* If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
|
||||
* - Otherwise, the update package will be downloaded and applied with no user interaction.
|
||||
* - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
|
||||
* - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
|
||||
*
|
||||
* @param syncCallback Optional callback to be called with the status of the sync operation.
|
||||
* The callback will be called only once, and the possible statuses are defined by the SyncStatus enum.
|
||||
* @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
|
||||
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
|
||||
*
|
||||
*/
|
||||
sync(syncCallback?: SuccessCallback<SyncStatus>, syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the possible result statuses of the window.codePush.sync operation.
|
||||
*/
|
||||
export enum SyncStatus {
|
||||
/**
|
||||
* The application is up to date.
|
||||
*/
|
||||
UP_TO_DATE,
|
||||
|
||||
/**
|
||||
* An update is available, it has been downloaded, unzipped and copied to the deployment folder.
|
||||
* After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources.
|
||||
*/
|
||||
UPDATE_INSTALLED,
|
||||
|
||||
/**
|
||||
* An optional update is available, but the user declined to install it. The update was not downloaded.
|
||||
*/
|
||||
UPDATE_IGNORED,
|
||||
|
||||
/**
|
||||
* An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update.
|
||||
* The console logs should contain more information about what happened. No update has been applied in this case.
|
||||
*/
|
||||
ERROR,
|
||||
|
||||
/**
|
||||
* There is an ongoing sync in progress, so this attempt to sync has been aborted.
|
||||
*/
|
||||
IN_PROGRESS,
|
||||
|
||||
/**
|
||||
* Intermediate status - the plugin is about to check for updates.
|
||||
*/
|
||||
CHECKING_FOR_UPDATE,
|
||||
|
||||
/**
|
||||
* Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled.
|
||||
*/
|
||||
AWAITING_USER_ACTION,
|
||||
|
||||
/**
|
||||
* Intermediate status - the update package is about to be downloaded.
|
||||
*/
|
||||
DOWNLOADING_PACKAGE,
|
||||
|
||||
/**
|
||||
* Intermediate status - the update package is about to be installed.
|
||||
*/
|
||||
INSTALLING_UPDATE
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the available install modes for updates.
|
||||
*/
|
||||
export enum InstallMode {
|
||||
/**
|
||||
* The update will be applied to the running application immediately. The application will be reloaded with the new content immediately.
|
||||
*/
|
||||
IMMEDIATE,
|
||||
|
||||
/**
|
||||
* The update is downloaded but not installed immediately. The new content will be available the next time the application is started.
|
||||
*/
|
||||
ON_NEXT_RESTART,
|
||||
|
||||
/**
|
||||
* The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first.
|
||||
*/
|
||||
ON_NEXT_RESUME
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the install operation options.
|
||||
*/
|
||||
export interface InstallOptions {
|
||||
/**
|
||||
* Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART.
|
||||
*/
|
||||
installMode?: InstallMode;
|
||||
|
||||
/**
|
||||
* If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed.
|
||||
*/
|
||||
minimumBackgroundDuration?: number;
|
||||
|
||||
/**
|
||||
* Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE.
|
||||
*/
|
||||
mandatoryInstallMode?: InstallMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the sync operation options.
|
||||
*/
|
||||
export interface SyncOptions extends InstallOptions {
|
||||
/**
|
||||
* Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true.
|
||||
*/
|
||||
ignoreFailedUpdates?: boolean;
|
||||
|
||||
/**
|
||||
* Used to enable, disable or customize the user interaction during sync.
|
||||
* If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory.
|
||||
* To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance.
|
||||
*/
|
||||
updateDialog?: boolean | UpdateDialogOptions;
|
||||
|
||||
/**
|
||||
* Overrides the config.xml deployment key when checking for updates.
|
||||
*/
|
||||
deploymentKey?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the configuration options for the alert or confirmation dialog
|
||||
*/
|
||||
export interface UpdateDialogOptions {
|
||||
/**
|
||||
* If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update.
|
||||
* The user will not be able to cancel the operation, since the update is mandatory.
|
||||
*/
|
||||
mandatoryUpdateMessage?: string;
|
||||
|
||||
/**
|
||||
* If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog.
|
||||
* If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded.
|
||||
*/
|
||||
optionalUpdateMessage?: string;
|
||||
|
||||
/**
|
||||
* The title of the dialog box used for interacting with the user in case of a mandatory or optional update.
|
||||
* This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set.
|
||||
*/
|
||||
updateTitle?: string;
|
||||
|
||||
/**
|
||||
* The label of the confirmation button in case of an optional update.
|
||||
*/
|
||||
optionalInstallButtonLabel?: string;
|
||||
|
||||
/**
|
||||
* The label of the cancel button in case of an optional update.
|
||||
*/
|
||||
optionalIgnoreButtonLabel?: string;
|
||||
|
||||
/**
|
||||
* The label of the continue button in case of a mandatory update.
|
||||
*/
|
||||
mandatoryContinueButtonLabel?: string;
|
||||
|
||||
/**
|
||||
* Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message.
|
||||
*/
|
||||
appendReleaseDescription?: boolean;
|
||||
|
||||
/**
|
||||
* Optional prefix to add to the release description.
|
||||
*/
|
||||
descriptionPrefix?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the JSON format of the package diff manifest file.
|
||||
*/
|
||||
interface IDiffManifest {
|
||||
deletedFiles: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the format of the DownloadProgress object, used to send periodical update notifications on the progress of the update download.
|
||||
*/
|
||||
export interface DownloadProgress {
|
||||
totalBytes: number;
|
||||
receivedBytes: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name CodePush
|
||||
* @description
|
||||
* CodePush plugin for Cordova by Microsoft that supports iOS and Android.
|
||||
*
|
||||
* For more info, please see https://github.com/ksachdeva/ionic2-code-push-example
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { CodePush } from 'ionic-native';
|
||||
*
|
||||
* // note - mostly error & completed methods of observable will not fire
|
||||
* // as syncStatus will contain the current state of the update
|
||||
* CodePush.sync().subscribe((syncStatus) => console.log(syncStatus));
|
||||
*
|
||||
* const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); }
|
||||
* CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CodePush',
|
||||
plugin: 'cordova-plugin-code-push',
|
||||
pluginRef: 'codePush',
|
||||
repo: 'https://github.com/Microsoft/cordova-plugin-code-push',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class CodePush {
|
||||
|
||||
/**
|
||||
* Get the current package information.
|
||||
*
|
||||
* @param packageSuccess Callback invoked with the currently deployed package information.
|
||||
* @param packageError Optional callback invoked in case of an error.
|
||||
* @returns {Promise<ILocalPackage>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentPackage(): Promise<ILocalPackage> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
|
||||
* This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
|
||||
* @returns {Promise<ILocalPackage>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getPendingPackage(): Promise<ILocalPackage> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks with the CodePush server if an update package is available for download.
|
||||
*
|
||||
* @param querySuccess Callback invoked in case of a successful response from the server.
|
||||
* The callback takes one RemotePackage parameter. A non-null package is a valid update.
|
||||
* A null package means the application is up to date for the current native application version.
|
||||
* @param queryError Optional callback invoked in case of an error.
|
||||
* @param deploymentKey Optional deployment key that overrides the config.xml setting.
|
||||
* @returns {Promise<IRemotePackage>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static checkForUpdate(deploymentKey?: string): Promise<IRemotePackage> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the plugin that the update operation succeeded and that the application is ready.
|
||||
* Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
|
||||
* If using sync API, calling this function is not required since sync calls it internally.
|
||||
*
|
||||
* @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
|
||||
* @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static notifyApplicationReady(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
|
||||
* will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static restartApplication(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for installing updates in one method call.
|
||||
* This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
|
||||
*
|
||||
* The algorithm of this method is the following:
|
||||
* - Checks for an update on the CodePush server.
|
||||
* - If an update is available
|
||||
* - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
|
||||
* The update package will then be downloaded and applied.
|
||||
* - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
|
||||
* If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
|
||||
* - Otherwise, the update package will be downloaded and applied with no user interaction.
|
||||
* - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
|
||||
* - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
|
||||
*
|
||||
* @param syncCallback Optional callback to be called with the status of the sync operation.
|
||||
* @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
|
||||
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
|
||||
* @returns {Observable<SyncStatus>}
|
||||
*
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
successIndex: 0,
|
||||
errorIndex: 3 // we don't need this, so we set it to a value higher than # of args
|
||||
})
|
||||
static sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): Observable<SyncStatus> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
|
||||
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from './plugin';
|
||||
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
|
||||
export type ContactFieldType = 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface IContactProperties {
|
||||
/** A globally unique identifier. */
|
||||
id?: string;
|
||||
@@ -40,20 +44,20 @@ export interface IContactProperties {
|
||||
*/
|
||||
export class Contact implements IContactProperties {
|
||||
private _objectInstance: any;
|
||||
@InstanceProperty get id(): string { return; }
|
||||
@InstanceProperty get displayName(): string { return; }
|
||||
@InstanceProperty get name(): IContactName {return; }
|
||||
@InstanceProperty get nickname(): string { return; }
|
||||
@InstanceProperty get phoneNumbers(): IContactField[] { return; }
|
||||
@InstanceProperty get emails(): IContactField[] { return; }
|
||||
@InstanceProperty get addresses(): IContactAddress[] { return; }
|
||||
@InstanceProperty get ims(): IContactField[] { return; }
|
||||
@InstanceProperty get organizations(): IContactOrganization[] { return; }
|
||||
@InstanceProperty get birthday(): Date { return; }
|
||||
@InstanceProperty get note(): string { return; }
|
||||
@InstanceProperty get photos(): IContactField[] { return; }
|
||||
@InstanceProperty get categories(): IContactField[] { return; }
|
||||
@InstanceProperty get urls(): IContactField[] { return; }
|
||||
@InstanceProperty id: string;
|
||||
@InstanceProperty displayName: string;
|
||||
@InstanceProperty name: IContactName;
|
||||
@InstanceProperty nickname: string;
|
||||
@InstanceProperty phoneNumbers: IContactField[];
|
||||
@InstanceProperty emails: IContactField[];
|
||||
@InstanceProperty addresses: IContactAddress[];
|
||||
@InstanceProperty ims: IContactField[];
|
||||
@InstanceProperty organizations: IContactOrganization[];
|
||||
@InstanceProperty birthday: Date;
|
||||
@InstanceProperty note: string;
|
||||
@InstanceProperty photos: IContactField[];
|
||||
@InstanceProperty categories: IContactField[];
|
||||
@InstanceProperty urls: IContactField[];
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
@@ -71,18 +75,30 @@ export class Contact implements IContactProperties {
|
||||
@CordovaInstance()
|
||||
remove(): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
save(): Promise<any> { return; }
|
||||
save(): Promise<any> {
|
||||
return getPromise((resolve, reject) => {
|
||||
this._objectInstance.save((contact) => {
|
||||
this._objectInstance = contact;
|
||||
resolve(this);
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface IContactError {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface IContactError {
|
||||
/** Error code */
|
||||
code: number;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
declare var ContactError: {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare var ContactError: {
|
||||
new (code: number): IContactError;
|
||||
UNKNOWN_ERROR: number;
|
||||
INVALID_ARGUMENT_ERROR: number;
|
||||
@@ -112,49 +128,37 @@ export interface IContactName {
|
||||
* @private
|
||||
*/
|
||||
export class ContactName implements IContactName {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) {
|
||||
this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix);
|
||||
}
|
||||
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
@InstanceProperty get familyName(): string { return; }
|
||||
@InstanceProperty get givenName(): string { return; }
|
||||
@InstanceProperty get middleName(): string { return; }
|
||||
@InstanceProperty get honorificPrefix(): string { return; }
|
||||
@InstanceProperty get honorificSuffix(): string { return; }
|
||||
constructor(public formatted?: string,
|
||||
public familyName?: string,
|
||||
public givenName?: string,
|
||||
public middleName?: string,
|
||||
public honorificPrefix?: string,
|
||||
public honorificSuffix?: string) {}
|
||||
}
|
||||
|
||||
export interface IContactField {
|
||||
/** A string that indicates what type of field this is, home for example. */
|
||||
type: string;
|
||||
type?: string;
|
||||
/** The value of the field, such as a phone number or email address. */
|
||||
value: string;
|
||||
value?: string;
|
||||
/** Set to true if this ContactField contains the user's preferred value. */
|
||||
pref: boolean;
|
||||
pref?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class ContactField implements IContactField {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(type?: string, value?: string, pref?: boolean) {
|
||||
this._objectInstance = new window.ContactField(type, value, pref);
|
||||
}
|
||||
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty get value(): string { return; }
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
constructor(public type?: string,
|
||||
public value?: string,
|
||||
public pref?: boolean) {}
|
||||
}
|
||||
|
||||
export interface IContactAddress {
|
||||
/** Set to true if this ContactAddress contains the user's preferred value. */
|
||||
pref?: boolean;
|
||||
/** A string indicating what type of field this is, home for example. */
|
||||
type?: string;
|
||||
type?: string;
|
||||
/** The full address formatted for display. */
|
||||
formatted?: string;
|
||||
/** The full street address. */
|
||||
@@ -173,34 +177,21 @@ export interface IContactAddress {
|
||||
* @private
|
||||
*/
|
||||
export class ContactAddress implements IContactAddress {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(pref?: boolean,
|
||||
type?: string,
|
||||
formatted?: string,
|
||||
streetAddress?: string,
|
||||
locality?: string,
|
||||
region?: string,
|
||||
postalCode?: string,
|
||||
country?: string) {
|
||||
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
|
||||
}
|
||||
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
@InstanceProperty get streetAddress(): string { return; }
|
||||
@InstanceProperty get locality(): string { return; }
|
||||
@InstanceProperty get region(): string { return; }
|
||||
@InstanceProperty get postalCode(): string { return; }
|
||||
@InstanceProperty get country(): string { return; }
|
||||
constructor(public pref?: boolean,
|
||||
public type?: string,
|
||||
public formatted?: string,
|
||||
public streetAddress?: string,
|
||||
public locality?: string,
|
||||
public region?: string,
|
||||
public postalCode?: string,
|
||||
public country?: string) {}
|
||||
}
|
||||
|
||||
export interface IContactOrganization {
|
||||
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
||||
pref?: boolean;
|
||||
/** A string that indicates what type of field this is, home for example. */
|
||||
type?: string;
|
||||
type?: string;
|
||||
/** The name of the organization. */
|
||||
name?: string;
|
||||
/** The department the contract works for. */
|
||||
@@ -213,15 +204,13 @@ export interface IContactOrganization {
|
||||
* @private
|
||||
*/
|
||||
export class ContactOrganization implements IContactOrganization {
|
||||
private _objectInstance: any;
|
||||
constructor() {
|
||||
this._objectInstance = new window.ContactOrganization();
|
||||
}
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty get name(): string { return; }
|
||||
@InstanceProperty get department(): string { return; }
|
||||
@InstanceProperty get title(): string { return; }
|
||||
constructor(
|
||||
public type?: string,
|
||||
public name?: string,
|
||||
public department?: string,
|
||||
public title?: string,
|
||||
public pref?: boolean
|
||||
) {}
|
||||
}
|
||||
|
||||
/** Search options to filter navigator.contacts. */
|
||||
@@ -232,22 +221,20 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class ContactFindOptions implements IContactFindOptions {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = new window.ContactFindOptions();
|
||||
}
|
||||
|
||||
@InstanceProperty get filter(): string { return; }
|
||||
@InstanceProperty get multiple(): boolean { return; }
|
||||
@InstanceProperty get desiredFields(): any { return; }
|
||||
@InstanceProperty get hasPhoneNumber(): boolean { return; }
|
||||
constructor(public filter?: string,
|
||||
public multiple?: boolean,
|
||||
public desiredFields?: string[],
|
||||
public hasPhoneNumber?: boolean) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,50 +249,81 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
*
|
||||
*
|
||||
* let contact = new Contact();
|
||||
* contact.displayName = 'Mr. Ionitron';
|
||||
*
|
||||
* contact.name = new ContactName(null, 'Smith', 'John');
|
||||
* contact.phoneNumbers = [new ContactField('mobile', '6471234567')];
|
||||
* contact.save().then(
|
||||
* () => console.log('Contact saved!', contact),
|
||||
* (error: any) => console.error('Error saving contact.', error)
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @interfaces
|
||||
* IContactProperties
|
||||
* IContactError
|
||||
* IContactName
|
||||
* IContactField
|
||||
* IContactAddress
|
||||
* IContactOrganization
|
||||
* IContactFindOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Contacts',
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||||
})
|
||||
export class Contacts {
|
||||
/**
|
||||
* Create a single contact.
|
||||
* @returns {Contact} Returns a Contact object
|
||||
*/
|
||||
static create(): Contact {
|
||||
return new Contact();
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for contacts in the Contacts list.
|
||||
* @param fields {string[]} Contact fields to be used as a search qualifier.
|
||||
* @param fields {ContactFieldType[]} Contact fields to be used as a search qualifier.
|
||||
* A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR.
|
||||
* A contactFields value of "*" searches all contact fields.
|
||||
*
|
||||
* @param options {Object} the options to query with:
|
||||
* @param options {IContactFindOptions} the options to query with:
|
||||
* filter: The search string used to find navigator.contacts. (string) (Default: "")
|
||||
* multiple: Determines if the find operation returns multiple navigator.contacts. (Boolean) (Default: false)
|
||||
* desiredFields: Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. (DOMString[]) [Optional]
|
||||
* hasPhoneNumber(Android only): Filters the search to only return contacts with a phone number informed. (Boolean) (Default: false)
|
||||
*
|
||||
* @return Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static find(fields: string[], options?: any): Promise<any> { return; }
|
||||
static find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.find(fields, (contacts) => {
|
||||
resolve(contacts.map(processContact));
|
||||
}, reject, options);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a single Contact.
|
||||
* @return Returns a Promise that resolves with the selected Contact
|
||||
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
|
||||
*/
|
||||
@Cordova()
|
||||
static pickContact(): Promise<any> { return; }
|
||||
static pickContact(): Promise<Contact> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function processContact(contact) {
|
||||
let newContact = new Contact();
|
||||
for (let prop in contact) {
|
||||
if (typeof contact[prop] === 'function') continue;
|
||||
newContact[prop] = contact[prop];
|
||||
}
|
||||
return newContact;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
/**
|
||||
* @name Crop
|
||||
* @description Crops images
|
||||
@@ -16,6 +16,7 @@ import {Cordova, Plugin} from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Crop',
|
||||
plugin: 'cordova-plugin-crop',
|
||||
pluginRef: 'plugins',
|
||||
repo: 'https://github.com/jeduan/cordova-plugin-crop'
|
||||
@@ -25,10 +26,10 @@ export class Crop {
|
||||
* Crops an image
|
||||
* @param pathToImage
|
||||
* @param options
|
||||
* @return {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
|
||||
* @returns {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static crop(pathToImage: string, options?: {quality: number}): Promise<string> {return; }
|
||||
static crop(pathToImage: string, options?: {quality: number}): Promise<string> { return; }
|
||||
}
|
||||
|
||||
@@ -1,66 +1,104 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
|
||||
|
||||
export interface DatePickerOptions {
|
||||
/**
|
||||
* Platforms: iOS, Android, Windows
|
||||
* The mode of the date picker
|
||||
* Values: date | time | datetime
|
||||
*/
|
||||
mode: string;
|
||||
|
||||
/**
|
||||
* Platforms: iOS, Android, Windows
|
||||
* Selected date
|
||||
*/
|
||||
date: Date | string | number;
|
||||
|
||||
/**
|
||||
* Platforms: iOS, Android, Windows
|
||||
* Minimum date
|
||||
* Type: Date | empty String
|
||||
* Default: empty String
|
||||
*/
|
||||
minDate?: Date | string | number;
|
||||
|
||||
/**
|
||||
* Platforms?: iOS, Android, Windows
|
||||
* Maximum date
|
||||
* Type?: Date | empty String
|
||||
* Default?: empty String
|
||||
*/
|
||||
maxDate?: Date | string | number;
|
||||
|
||||
/**
|
||||
* Platforms?: Android
|
||||
* Label for the dialog title. If empty, uses android default (Set date/Set time).
|
||||
* Type?: String
|
||||
* Default?: empty String
|
||||
*/
|
||||
titleText?: string;
|
||||
|
||||
/**
|
||||
* Platforms?: Android
|
||||
* Label of BUTTON_POSITIVE (done button) on Android
|
||||
*/
|
||||
okText?: string;
|
||||
|
||||
// TODO complete documentation here, and copy params & docs to main plugin docs
|
||||
/**
|
||||
* Label of BUTTON_NEGATIVE (cancel button). If empty, uses android.R.string.cancel.
|
||||
*/
|
||||
cancelText?: string;
|
||||
/**
|
||||
* Label of today button. If empty, doesn't show the option to select current date.
|
||||
*/
|
||||
todayText?: string;
|
||||
/**
|
||||
* Label of now button. If empty, doesn't show the option to select current time.
|
||||
*/
|
||||
nowText?: string;
|
||||
/**
|
||||
* Shows time dialog in 24 hours format.
|
||||
*/
|
||||
is24Hour?: boolean;
|
||||
/**
|
||||
* Choose the Android theme for the picker. You can use the DatePicker.ANDROID_THEMES property.
|
||||
* Values: 1: THEME_TRADITIONAL | 2: THEME_HOLO_DARK | 3: THEME_HOLO_LIGHT | 4: THEME_DEVICE_DEFAULT_DARK | 5: THEME_DEVICE_DEFAULT_LIGHT
|
||||
*/
|
||||
androidTheme?: number;
|
||||
allowOldDate?: boolean;
|
||||
/**
|
||||
* Shows or hide dates earlier then selected date.
|
||||
*/
|
||||
allowOldDates?: boolean;
|
||||
/**
|
||||
* Shows or hide dates after selected date.
|
||||
*/
|
||||
allowFutureDates?: boolean;
|
||||
/**
|
||||
* Label of done button.
|
||||
*/
|
||||
doneButtonLabel?: string;
|
||||
/**
|
||||
* Hex color of done button.
|
||||
*/
|
||||
doneButtonColor?: string;
|
||||
/**
|
||||
* Label of cancel button.
|
||||
*/
|
||||
cancelButtonLabel?: string;
|
||||
/**
|
||||
* Hex color of cancel button.
|
||||
*/
|
||||
cancelButtonColor?: string;
|
||||
/**
|
||||
* X position of date picker. The position is absolute to the root view of the application.
|
||||
*/
|
||||
x?: number;
|
||||
/**
|
||||
* Y position of date picker. The position is absolute to the root view of the application.
|
||||
*/
|
||||
y?: number;
|
||||
/**
|
||||
* Interval between options in the minute section of the date picker.
|
||||
*/
|
||||
minuteInterval?: number;
|
||||
/**
|
||||
* Force the UIPopoverArrowDirection enum. The value any will revert to default UIPopoverArrowDirectionAny and let the app choose the proper direction itself.
|
||||
*/
|
||||
popoverArrowDirection?: string;
|
||||
/**
|
||||
* Force locale for datePicker.
|
||||
*/
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
@@ -69,10 +107,6 @@ export interface DatePickerOptions {
|
||||
* @description
|
||||
* The DatePicker plugin allows the user to fetch date or time using native dialogs.
|
||||
*
|
||||
* Platforms supported: iOS, Android, Windows
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DatePicker } from 'ionic-native';
|
||||
@@ -86,21 +120,37 @@ export interface DatePickerOptions {
|
||||
* err => console.log('Error occurred while getting date: ', err)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* DatePickerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DatePicker',
|
||||
plugin: 'cordova-plugin-datepicker',
|
||||
pluginRef: 'datePicker',
|
||||
repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker'
|
||||
repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker',
|
||||
platforms: ['Android', 'iOS', 'Windows']
|
||||
})
|
||||
export class DatePicker {
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static ANDROID_THEMES = {
|
||||
THEME_TRADITIONAL: 1,
|
||||
THEME_HOLO_DARK: 2,
|
||||
THEME_HOLO_LIGHT: 3,
|
||||
THEME_DEVICE_DEFAULT_DARK: 4,
|
||||
THEME_DEVICE_DEFAULT_LIGHT: 5
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows the date and/or time picker dialog(s)
|
||||
* @param {DatePickerOptions} options Options for the date picker.
|
||||
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options: DatePickerOptions): Promise<Date> { return; }
|
||||
static show(options: DatePickerOptions): Promise<Date> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DBMeter',
|
||||
plugin: 'cordova-plugin-dbmeter',
|
||||
pluginRef: 'DBMeter',
|
||||
repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
|
||||
@@ -40,7 +41,7 @@ export class DBMeter {
|
||||
|
||||
/**
|
||||
* Starts listening
|
||||
* @return {Observable<string>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
|
||||
* @returns {Observable<any>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
@@ -57,14 +58,14 @@ export class DBMeter {
|
||||
|
||||
/**
|
||||
* Check if the DB Meter is listening
|
||||
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
|
||||
*/
|
||||
@Cordova()
|
||||
static isListening(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Delete the DB Meter instance
|
||||
* @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
|
||||
* @returns {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
|
||||
*/
|
||||
@Cordova()
|
||||
static delete(): Promise<any> { return; }
|
||||
|
||||
@@ -28,15 +28,43 @@ export interface DeeplinkMatch {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { IonicDeeplinks } from 'ionic-native';
|
||||
* import { Deeplinks } from 'ionic-native';
|
||||
*
|
||||
* Deeplinks.route({
|
||||
'/about-us': AboutPage,
|
||||
'/universal-links-test': AboutPage,
|
||||
'/products/:productId': ProductPage
|
||||
}).subscribe((match) => {
|
||||
// match.$route - the route we matched, which is the matched entry from the arguments to route()
|
||||
// match.$args - the args passed in the link
|
||||
// match.$link - the full link data
|
||||
console.log('Successfully matched route', match);
|
||||
}, (nomatch) => {
|
||||
// nomatch.$link - the full link data
|
||||
console.error('Got a deeplink that didn\'t match', nomatch);
|
||||
});
|
||||
* ```
|
||||
*
|
||||
* Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
|
||||
* the actual navigation for you:
|
||||
*
|
||||
* ```typescript
|
||||
* Deeplinks.routeWithNavController(this.navController, {
|
||||
'/about-us': AboutPage,
|
||||
'/products/:productId': ProductPage
|
||||
});
|
||||
* ```
|
||||
*
|
||||
* See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
|
||||
* retrieve the `NavController` reference at runtime.
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Deeplinks',
|
||||
plugin: 'ionic-plugin-deeplinks',
|
||||
pluginRef: 'IonicDeeplink',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
||||
platforms: ['iOS', 'Android']
|
||||
platforms: ['iOS', 'Android'],
|
||||
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
|
||||
})
|
||||
export class Deeplinks {
|
||||
|
||||
@@ -47,8 +75,8 @@ export class Deeplinks {
|
||||
* paths takes an object of the form { 'path': data }. If a deeplink
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
* @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
|
||||
* is rejected if a deeplink comes through that does not match a given path.
|
||||
* @returns {Observable<DeeplinkMatch>} Returns an Observable that is called each time a deeplink comes through, and
|
||||
* errors if a deeplink comes through that does not match a given path.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
@@ -70,8 +98,8 @@ export class Deeplinks {
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
|
||||
* is rejected if a deeplink comes through that does not match a given path.
|
||||
* @returns {Observable<DeeplinkMatch>} Returns an Observable that resolves each time a deeplink comes through, and
|
||||
* errors if a deeplink comes through that does not match a given path.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
|
||||
56
src/plugins/device-feedback.ts
Normal file
56
src/plugins/device-feedback.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name DeviceFeedback
|
||||
* @description
|
||||
*
|
||||
* Plugin that lets you provide haptic or acoustic feedback on Android devices.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { DeviceFeedback } from 'ionic-native';
|
||||
*
|
||||
* DeviceFeedback.acoustic();
|
||||
*
|
||||
* DeviceFeedback.haptic(0);
|
||||
*
|
||||
* DeviceFeedback.isFeedbackEnabled()
|
||||
* .then((feedback) => {
|
||||
* console.log(feedback);
|
||||
* // {
|
||||
* // acoustic: true,
|
||||
* // haptic: true
|
||||
* // }
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceFeedback',
|
||||
plugin: 'cordova-plugin-velda-devicefeedback',
|
||||
pluginRef: 'plugins.deviceFeedback',
|
||||
repo: 'https://github.com/VVelda/device-feedback',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class DeviceFeedback {
|
||||
|
||||
/**
|
||||
* Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static acoustic(): void { }
|
||||
|
||||
/**
|
||||
* Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
|
||||
* @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static haptic(type: number): void { }
|
||||
|
||||
/**
|
||||
* Check if haptic and acoustic feedback is enabled by user settings.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
|
||||
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
import { CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window: {
|
||||
device: Device
|
||||
};
|
||||
declare var window: any;
|
||||
|
||||
export interface Device {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface IDevice {
|
||||
/** Get the version of Cordova running on the device. */
|
||||
cordova: string;
|
||||
/**
|
||||
@@ -41,6 +42,7 @@ export interface Device {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Device',
|
||||
plugin: 'cordova-plugin-device',
|
||||
pluginRef: 'device',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device'
|
||||
@@ -50,9 +52,9 @@ export class Device {
|
||||
/**
|
||||
* Returns the whole device object.
|
||||
*
|
||||
* @returns {Object} The device object.
|
||||
* @returns {Device} The device object.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get device() { return window.device; }
|
||||
static device: IDevice;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
@Plugin({
|
||||
pluginName: 'DeviceAccounts',
|
||||
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
||||
pluginRef: 'plugins.DeviceAccounts',
|
||||
repo: 'https://github.com/loicknuchel/cordova-device-accounts',
|
||||
@@ -11,24 +12,28 @@ export class DeviceAccounts {
|
||||
|
||||
/**
|
||||
* Gets all accounts registered on the Android Device
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static get(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get all accounts registered on Android device for requested type
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getByType(type: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get all emails registered on Android device (accounts with 'com.google' type)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getEmails(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the first email registered on Android device
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getEmail(): Promise<any> { return; }
|
||||
|
||||
@@ -62,6 +62,7 @@ export interface AccelerometerOptions {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceMotion',
|
||||
plugin: 'cordova-plugin-device-motion',
|
||||
pluginRef: 'navigator.accelerometer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-motion'
|
||||
@@ -70,7 +71,7 @@ export class DeviceMotion {
|
||||
|
||||
/**
|
||||
* Get the current acceleration along the x, y, and z axes.
|
||||
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
|
||||
* @returns {Promise<AccelerationData>} Returns object with x, y, z, and timestamp properties
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentAcceleration(): Promise<AccelerationData> { return; }
|
||||
|
||||
@@ -67,6 +67,7 @@ export interface CompassOptions {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceOrientation',
|
||||
plugin: 'cordova-plugin-device-orientation',
|
||||
pluginRef: 'navigator.compass',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
|
||||
|
||||
@@ -8,16 +8,109 @@ import { Cordova, Plugin } from './plugin';
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Diagnostic } from 'ionic-native';
|
||||
*
|
||||
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
|
||||
* let errorCallback = (e) => console.error(e);
|
||||
*
|
||||
* Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
|
||||
*
|
||||
* Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
|
||||
*
|
||||
*
|
||||
* Diagnostic.getBluetoothState()
|
||||
* .then((state) => {
|
||||
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
|
||||
* // do something
|
||||
* } else {
|
||||
* // do something else
|
||||
* }
|
||||
* }).catch(e => console.error(e));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Diagnostic',
|
||||
plugin: 'cordova.plugins.diagnostic',
|
||||
pluginRef: 'cordova.plugins.diagnostic',
|
||||
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
|
||||
})
|
||||
export class Diagnostic {
|
||||
|
||||
static permission = {
|
||||
READ_CALENDAR: 'READ_CALENDAR',
|
||||
WRITE_CALENDAR: 'WRITE_CALENDAR',
|
||||
CAMERA: 'CAMERA',
|
||||
READ_CONTACTS: 'READ_CONTACTS',
|
||||
WRITE_CONTACTS: 'WRITE_CONTACTS',
|
||||
GET_ACCOUNTS: 'GET_ACCOUNTS',
|
||||
ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION',
|
||||
ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION',
|
||||
RECORD_AUDIO: 'RECORD_AUDIO',
|
||||
READ_PHONE_STATE: 'READ_PHONE_STATE',
|
||||
CALL_PHONE: 'CALL_PHONE',
|
||||
ADD_VOICEMAIL: 'ADD_VOICEMAIL',
|
||||
USE_SIP: 'USE_SIP',
|
||||
PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS',
|
||||
READ_CALL_LOG: 'READ_CALL_LOG',
|
||||
WRITE_CALL_LOG: 'WRITE_CALL_LOG',
|
||||
SEND_SMS: 'SEND_SMS',
|
||||
RECEIVE_SMS: 'RECEIVE_SMS',
|
||||
READ_SMS: 'READ_SMS',
|
||||
RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH',
|
||||
RECEIVE_MMS: 'RECEIVE_MMS',
|
||||
WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE',
|
||||
READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE',
|
||||
BODY_SENSORS: 'BODY_SENSORS'
|
||||
};
|
||||
|
||||
static permissionStatus = {
|
||||
GRANTED: 'GRANTED',
|
||||
GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS
|
||||
RESTRICTED: 'RESTRICTED', // iOS
|
||||
DENIED: 'DENIED',
|
||||
DENIED_ALWAYS: 'DENIED_ALWAYS', // android
|
||||
NOT_REQUESTED: 'NOT_REQUESTED'
|
||||
};
|
||||
|
||||
static locationAuthorizationMode = {
|
||||
ALWAYS: 'ALWAYS',
|
||||
WHEN_IN_USE: 'WHEN_IN_USE'
|
||||
};
|
||||
|
||||
static permissionGroups = {
|
||||
CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
|
||||
CAMERA: ['CAMERA'],
|
||||
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
|
||||
LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
|
||||
MICROPHONE: ['RECORD_AUDIO'],
|
||||
PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
|
||||
SENSORS: ['BODY_SENSORS'],
|
||||
SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
|
||||
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
|
||||
};
|
||||
|
||||
static locationMode = {
|
||||
HIGH_ACCURACY: 'high_accuracy',
|
||||
DEVICE_ONLY: 'device_only',
|
||||
BATTERY_SAVING: 'battery_saving',
|
||||
LOCATION_OFF: 'location_off'
|
||||
};
|
||||
|
||||
static bluetoothState = {
|
||||
UNKNOWN: 'unknown',
|
||||
RESETTING: 'resetting', // iOS
|
||||
UNSUPPORTED: 'unsupported', // iOS
|
||||
UNAUTHORIZED: 'unauthorized', // iOS
|
||||
POWERED_OFF: 'powered_off',
|
||||
POWERED_ON: 'powered_on',
|
||||
POWERING_OFF: 'powering_off',
|
||||
POWERING_ON: 'powering_on'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationAvailable(): Promise<any> { return; }
|
||||
@@ -25,6 +118,7 @@ export class Diagnostic {
|
||||
/**
|
||||
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
|
||||
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiAvailable(): Promise<any> { return; }
|
||||
@@ -32,6 +126,7 @@ export class Diagnostic {
|
||||
/**
|
||||
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
|
||||
* application is authorized to use it.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraAvailable(): Promise<any> { return; }
|
||||
@@ -39,70 +134,441 @@ export class Diagnostic {
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isBluetoothAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Displays the device location settings to allow user to enable location services/change location mode.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToLocationSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays mobile settings to allow user to enable mobile data.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToMobileDataSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays Bluetooth settings to allow user to enable Bluetooth.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToBluetoothSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays WiFi settings to allow user to enable WiFi.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
static switchToWifiSettings(): void { }
|
||||
|
||||
/**
|
||||
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'Windows 10'] })
|
||||
static isWifiEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Enables/disables WiFi on the device.
|
||||
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
|
||||
* @param state {boolean}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
|
||||
static setWifiState(state: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enables/disables Bluetooth on the device.
|
||||
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
|
||||
* @param state {boolean}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getLocationAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*
|
||||
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if camera hardware is present on device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isCameraPresent(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the camera.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isCameraAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the camera authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getCameraAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests camera authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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'] })
|
||||
static isMicrophoneAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the microphone authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests microphone authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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'] })
|
||||
static isContactsAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the contacts authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getContactsAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests contacts authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static requestContactsAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the calendar.
|
||||
*
|
||||
* Notes for Android:
|
||||
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
||||
*
|
||||
* Notes for iOS:
|
||||
* - This relates to Calendar Events (not Calendar Reminders)
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static isCalendarAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the calendar authorization status for the application.
|
||||
*
|
||||
* Notes for Android:
|
||||
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
|
||||
*
|
||||
* Notes for iOS:
|
||||
* - This relates to Calendar Events (not Calendar Reminders)
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static getCalendarAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests calendar authorization for the application.
|
||||
*
|
||||
* Notes for iOS:
|
||||
* - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
|
||||
* - This relates to Calendar Events (not Calendar Reminders)
|
||||
*
|
||||
* Notes for Android:
|
||||
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
||||
* - This requests permission for `READ_CALENDAR` run-time permission
|
||||
* - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'] })
|
||||
static requestCalendarAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Opens settings page for this app.
|
||||
* On Android, this opens the "App Info" page in the Settings app.
|
||||
* On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Bluetooth state occurs.
|
||||
* @param handler
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
static registerBluetoothStateChangeHandler(handler: Function): void { }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Location state occurs.
|
||||
* @param handler
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
static registerLocationStateChangeHandler(handler: Function): void { }
|
||||
|
||||
/**
|
||||
* Checks if high-accuracy locations are available to the app from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isGpsLocationAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either:
|
||||
* - Device only = GPS hardware only (high accuracy)
|
||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isGpsLocationEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
|
||||
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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.
|
||||
* Returns true if Location mode is enabled and is set to either:
|
||||
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
|
||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNetworkLocationEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
|
||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
|
||||
* Returns the current location mode setting for the device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isRemoteNotificationsEnabled(): Promise<any> { return; }
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static getLocationMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for a given permission.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permission
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for multiple permissions.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permissions
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for a runtime permission.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
||||
* @param permission
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static requestRuntimePermission(permission: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for multiple runtime permissions.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permissions
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
static requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Indicates if the plugin is currently requesting a runtime permission via the native API.
|
||||
* Note that only one request can be made concurrently because the native API cannot handle concurrent requests,
|
||||
* so the plugin will invoke the error callback if attempting to make more than one simultaneous request.
|
||||
* Multiple permission requests should be grouped into a single call since the native API is setup to handle batch requests of multiple permission groups.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static isRequestingPermission(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a runtime permission request has completed.
|
||||
* Pass in a falsey value to de-register the currently registered function.
|
||||
* @param handler {Function}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static registerPermissionRequestCompleteHandler(handler: Function): void { 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; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* 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; }
|
||||
|
||||
/**
|
||||
* Requests camera roll authorization for the application.
|
||||
* Should only be called if authorization status is NOT_REQUESTED.
|
||||
* Calling it when in any other state will have no effect.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
|
||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isRegisteredForRemoteNotifications(): Promise<any> { 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; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use reminders.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* Requests reminders authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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; }
|
||||
|
||||
/**
|
||||
* Returns the background refresh authorization status for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static getBackgroundRefreshStatus(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface PromptCallback {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Dialogs',
|
||||
plugin: 'cordova-plugin-dialogs',
|
||||
pluginRef: 'navigator.notification',
|
||||
repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
|
||||
|
||||
@@ -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,11 @@ declare var cordova: any;
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-email-composer',
|
||||
pluginName: 'EmailComposer',
|
||||
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 {
|
||||
|
||||
@@ -55,7 +56,7 @@ export class EmailComposer {
|
||||
* Verifies if sending emails is supported on the device.
|
||||
*
|
||||
* @param app {string?} An optional app id or uri scheme.
|
||||
* @returns {Promise<boolean>} Resolves if available, rejects if not available
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
static isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
|
||||
490
src/plugins/estimote-beacons.ts
Normal file
490
src/plugins/estimote-beacons.ts
Normal file
@@ -0,0 +1,490 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name EstimoteBeacons
|
||||
*
|
||||
* @description
|
||||
* This plugin enables communication between a phone and Estimote Beacons peripherals.
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'EstimoteBeacons',
|
||||
plugin: 'cordova-plugin-estimote',
|
||||
pluginRef: 'estimote.beacons',
|
||||
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
export class EstimoteBeacons {
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityUnknown = 0;
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityImmediate = 1;
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityNear = 2;
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityFar = 3;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorUnknown = 0;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorMintCocktail = 1;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorIcyMarshmallow = 2;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorBlueberryPie = 3;
|
||||
/**
|
||||
* Beacon colour.
|
||||
*/
|
||||
static BeaconColorSweetBeetroot = 4;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorCandyFloss = 5;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorLemonTart = 6;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorVanillaJello = 7;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorLiquoriceSwirl = 8;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorWhite = 9;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorTransparent = 10;
|
||||
|
||||
/** Region state */
|
||||
static RegionStateUnknown = 'unknown';
|
||||
|
||||
/** Region state */
|
||||
static RegionStateOutside = 'outside';
|
||||
|
||||
/** Region state */
|
||||
static RegionStateInside = 'inside';
|
||||
|
||||
/**
|
||||
* Ask the user for permission to use location services
|
||||
* while the app is in the foreground.
|
||||
* You need to call this function or requestAlwaysAuthorization
|
||||
* on iOS 8+.
|
||||
* Does nothing on other platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.requestWhenInUseAuthorization().then(
|
||||
* () => { console.log('on success'); },
|
||||
* () => { console.log('on error'); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestWhenInUseAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Ask the user for permission to use location services
|
||||
* whenever the app is running.
|
||||
* You need to call this function or requestWhenInUseAuthorization
|
||||
* on iOS 8+.
|
||||
* Does nothing on other platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.requestAlwaysAuthorization().then(
|
||||
* () => { console.log('on success'); },
|
||||
* () => { console.log('on error'); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestAlwaysAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the current location authorization status.
|
||||
* Implemented on iOS 8+.
|
||||
* Does nothing on other platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.authorizationStatus().then(
|
||||
* (result) => { console.log('Location authorization status: ' + result); },
|
||||
* (errorMessage) => { console.log('Error: ' + errorMessage); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static authorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start advertising as a beacon.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
|
||||
* .then(() => { console.log('Beacon started'); });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param uuid {string} UUID string the beacon should advertise (mandatory).
|
||||
* @param major {number} Major value to advertise (mandatory).
|
||||
* @param minor {number} Minor value to advertise (mandatory).
|
||||
* @param regionId {string} Identifier of the region used to advertise (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
clearFunction: 'stopAdvertisingAsBeacon'
|
||||
})
|
||||
static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop advertising as a beacon.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
|
||||
* .then(() => { console.log('Beacon started'); });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopAdvertisingAsBeacon(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable analytics.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); });
|
||||
* ```
|
||||
* @param enable {number} Boolean value to turn analytics on or off (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enableAnalytics(enable: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Test if analytics is enabled.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); });
|
||||
* ```
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAnalyticsEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Test if App ID and App Token is set.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); });
|
||||
* ```
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set App ID and App Token.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.setupAppIDAndAppToken('MyAppID', 'MyAppToken').then(() => { console.log('AppID and AppToken configured!'); });
|
||||
* ```
|
||||
* @param appID {string} The App ID (mandatory).
|
||||
* @param appToken {string} The App Token (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
|
||||
* Available on iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
|
||||
* console.log(JSON.stringify(beacons));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each beacon discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopEstimoteBeaconDiscovery'
|
||||
})
|
||||
static startEstimoteBeaconDiscovery(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop CoreBluetooth scan. Available on iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
|
||||
* console.log(JSON.stringify(beacons));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopEstimoteBeaconDiscovery(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||
* console.log(JSON.stringify(info));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each beacon discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopRangingBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||
* console.log(JSON.stringify(info));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* {@link EstimoteBeacons.startRangingBeaconsInRegion}.
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopRangingSecureBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
|
||||
* console.log('Region state: ' + JSON.stringify(state));
|
||||
* });
|
||||
* ```
|
||||
* @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}
|
||||
* for further details (optional, defaults to false, iOS only).
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each region state discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopMonitoringForRegion',
|
||||
clearWithArgs: true,
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* EstimoteBeacons.startMonitoringForRegion.
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
* @see {@link EstimoteBeacons.startMonitoringForRegion}
|
||||
* @param region {EstimoteBeaconRegion} Region
|
||||
* @param notifyEntryStateOnDisplay {boolean}
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopSecureMonitoringForRegion',
|
||||
clearWithArgs: true,
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
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
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Connect to Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.connectToBeacon(FF:0F:F0:00:F0:00);
|
||||
* ```
|
||||
* ```
|
||||
* EstimoteBeacons.connectToBeacon({
|
||||
* proximityUUID: '000000FF-F00F-0FF0-F000-000FF0F00000',
|
||||
* major: 1,
|
||||
* minor: 1
|
||||
* });
|
||||
* ```
|
||||
* @param beacon {Beacon} Beacon to connect to.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static connectToBeacon(beacon: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Disconnect from connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.disconnectConnectedBeacon();
|
||||
* ```
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnectConnectedBeacon(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write proximity UUID to connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* // Example that writes constant ESTIMOTE_PROXIMITY_UUID
|
||||
* EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID);
|
||||
*
|
||||
* @param uuid {string} String to write as new UUID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write major to connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* // Example that writes 1
|
||||
* EstimoteBeacons.writeConnectedMajor(1);
|
||||
*
|
||||
* @param major {number} number to write as new major
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedMajor(major: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write minor to connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* // Example that writes 1
|
||||
* EstimoteBeacons.writeConnectedMinor(1);
|
||||
*
|
||||
* @param minor {number} number to write as new minor
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedMinor(minor: number): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface EstimoteBeaconRegion {
|
||||
state?: string;
|
||||
major: number;
|
||||
minor: number;
|
||||
identifier?: string;
|
||||
uuid: string;
|
||||
}
|
||||
@@ -78,10 +78,11 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Facebook',
|
||||
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 {
|
||||
|
||||
@@ -89,6 +90,7 @@ export class Facebook {
|
||||
* Browser wrapper
|
||||
* @param {number} appId Your Facebook AppID from their dashboard
|
||||
* @param {string} version The version of API you may want to use. Optional
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static browserInit(appId: number, version?: string): Promise<any> {
|
||||
@@ -113,7 +115,7 @@ export class Facebook {
|
||||
* ```
|
||||
*
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
||||
* @return {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
* @returns {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
|
||||
@@ -122,7 +124,7 @@ export class Facebook {
|
||||
* Logout of Facebook.
|
||||
*
|
||||
* For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
|
||||
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves on a successful logout, and rejects if logout fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static logout(): Promise<any> { return; }
|
||||
@@ -151,7 +153,7 @@ export class Facebook {
|
||||
*
|
||||
* For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
|
||||
*
|
||||
* @return Returns a Promise that resolves with a status, or rejects with an error
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with a status, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static getLoginStatus(): Promise<any> { return; }
|
||||
@@ -159,7 +161,7 @@ export class Facebook {
|
||||
/**
|
||||
* Get a Facebook access token for using Facebook services.
|
||||
*
|
||||
* @return Returns a Promise that resolves with an access token, or rejects with an error
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with an access token, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static getAccessToken(): Promise<string> { return; }
|
||||
@@ -178,8 +180,8 @@ export class Facebook {
|
||||
* ```
|
||||
*
|
||||
* For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
|
||||
* @options {Object} options The dialog options
|
||||
* @return Returns a Promise that resolves with success data, or rejects with an error
|
||||
* @param {Object} options The dialog options
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with success data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static showDialog(options: any): Promise<any> { return; }
|
||||
@@ -195,7 +197,7 @@ export class Facebook {
|
||||
*
|
||||
* @param {string} requestPath Graph API endpoint you want to call
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
|
||||
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the result of the request, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static api(requestPath: string, permissions: string[]): Promise<any> { return; }
|
||||
@@ -206,7 +208,7 @@ export class Facebook {
|
||||
* @param {string} name Name of the event
|
||||
* @param {Object} [params] An object containing extra data to log with the event
|
||||
* @param {number} [valueToSum] any value to be added to added to a sum on each event
|
||||
* @return
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logEvent(
|
||||
@@ -220,7 +222,7 @@ export class Facebook {
|
||||
*
|
||||
* @param {number} value Value of the purchase.
|
||||
* @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
|
||||
* @return Returns a Promise
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logPurchase(value: number, currency: string): Promise<any> { return; }
|
||||
@@ -238,7 +240,7 @@ export class Facebook {
|
||||
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
|
||||
* picture: image to be displayed in the App Invite dialog
|
||||
*
|
||||
* @return Returns a Promise that resolves with the result data, or rejects with an error
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the result data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static appInvite(options: {
|
||||
|
||||
32
src/plugins/file-chooser.ts
Normal file
32
src/plugins/file-chooser.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name FileChooser
|
||||
* @description
|
||||
*
|
||||
* Opens the file picker on Android for the user to select a file, returns a file URI.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileChooser} from 'ionic-native';
|
||||
*
|
||||
* FileChooser.open()
|
||||
* .then(uri => console.log(uri);
|
||||
* .catch(e => console.log(e);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileChooser',
|
||||
plugin: 'http://github.com/don/cordova-filechooser.git',
|
||||
pluginRef: 'fileChooser',
|
||||
repo: 'https://github.com/don/cordova-filechooser',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class FileChooser {
|
||||
/**
|
||||
* Open a file
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static open(): Promise<string> { return; }
|
||||
}
|
||||
58
src/plugins/file-opener.ts
Normal file
58
src/plugins/file-opener.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name FileOpener
|
||||
* @description
|
||||
* This plugin will open a file on your device file system with its default application.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileOpener} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileOpener',
|
||||
plugin: 'cordova-plugin-file-opener2',
|
||||
pluginRef: 'cordova.plugins.fileOpener2',
|
||||
repo: 'https://github.com/pwlin/cordova-plugin-file-opener2'
|
||||
})
|
||||
export class FileOpener {
|
||||
/**
|
||||
* Open an file
|
||||
* @param filePath {string} File Path
|
||||
* @param fileMIMEType {string} File MIME Type
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static open(filePath: string, fileMIMEType: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Uninstalls a package
|
||||
* @param packageId {string} Package ID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static uninstall(packageId: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Check if an app is already installed
|
||||
* @param packageId {string} Package ID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static appIsInstalled(packageId: string): Promise<any> {return; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, pluginWarn } from './plugin';
|
||||
|
||||
declare var window: any;
|
||||
declare var cordova: any;
|
||||
|
||||
@@ -24,7 +25,7 @@ export interface Entry {
|
||||
/** The full absolute path from the root to the entry. */
|
||||
fullPath: string;
|
||||
/** The file system on which the entry resides. */
|
||||
fileSystem: FileSystem;
|
||||
filesystem: FileSystem;
|
||||
nativeURL: string;
|
||||
/**
|
||||
* Look up metadata about this entry.
|
||||
@@ -170,6 +171,7 @@ export interface Flags {
|
||||
}
|
||||
|
||||
export interface WriteOptions {
|
||||
create?: boolean;
|
||||
replace?: boolean;
|
||||
append?: boolean;
|
||||
truncate?: number; // if present, number of bytes to truncate file to before writing
|
||||
@@ -300,10 +302,10 @@ export interface FileReader {
|
||||
onabort: (evt: ProgressEvent) => void;
|
||||
|
||||
abort(): void;
|
||||
readAsText(fe: FileEntry, encoding?: string): void;
|
||||
readAsDataURL(fe: FileEntry): void;
|
||||
readAsBinaryString(fe: FileEntry): void;
|
||||
readAsArrayBuffer(fe: FileEntry): void;
|
||||
readAsText(fe: File | Blob, encoding?: string): void;
|
||||
readAsDataURL(fe: File | Blob): void;
|
||||
readAsBinaryString(fe: File | Blob): void;
|
||||
readAsArrayBuffer(fe: File | Blob): void;
|
||||
}
|
||||
|
||||
declare var FileReader: {
|
||||
@@ -336,6 +338,7 @@ declare var FileError: {
|
||||
PATH_EXISTS_ERR: number;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @name File
|
||||
* @description
|
||||
@@ -358,6 +361,7 @@ declare var FileError: {
|
||||
* It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'File',
|
||||
plugin: 'cordova-plugin-file',
|
||||
pluginRef: 'cordova.file',
|
||||
repo: 'https://github.com/apache/cordova-plugin-file'
|
||||
@@ -380,9 +384,22 @@ export class File {
|
||||
14: 'DIR_READ_ERR',
|
||||
};
|
||||
|
||||
@Cordova()
|
||||
/**
|
||||
* Get free disk space
|
||||
* @returns {Promise<number>} Returns a promise that resolves with the remaining free disk space
|
||||
*/
|
||||
static getFreeDiskSpace(): Promise<number> {
|
||||
return;
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
if (!cordova || !cordova.exec) {
|
||||
pluginWarn({
|
||||
pluginName: 'File',
|
||||
plugin: 'cordova-plugin-file'
|
||||
});
|
||||
reject({ error: 'plugin_not_installed' });
|
||||
} else {
|
||||
cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,9 +407,8 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dir Name of directory to check
|
||||
* @return {Promise<boolean|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
* @returns {Promise<boolean|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
*/
|
||||
|
||||
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
|
||||
if ((/^\//.test(dir))) {
|
||||
let err = new FileError(5);
|
||||
@@ -415,9 +431,8 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dirName Name of directory to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @return {Promise<DirectoryEntry|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
*/
|
||||
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
@@ -429,7 +444,7 @@ export class File {
|
||||
create: true
|
||||
};
|
||||
|
||||
if (replace) {
|
||||
if (!replace) {
|
||||
options.exclusive = true;
|
||||
}
|
||||
|
||||
@@ -444,9 +459,8 @@ export class File {
|
||||
*
|
||||
* @param {string} path The path to the directory
|
||||
* @param {string} dirName The directory name
|
||||
* @return {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult|FileError> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
@@ -470,9 +484,8 @@ export class File {
|
||||
* @param {string} dirName The source directory name
|
||||
* @param {string} newPath The destionation path to the directory
|
||||
* @param {string} newDirName The destination directory name
|
||||
* @return {Promise<DirectoryEntry|Entry|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry|Entry|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
*/
|
||||
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry|FileError> {
|
||||
newDirName = newDirName || dirName;
|
||||
|
||||
@@ -501,7 +514,7 @@ export class File {
|
||||
* @param {string} dirName Name of directory to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
|
||||
* @return {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
*/
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry|FileError> {
|
||||
if ((/^\//.test(newDirName))) {
|
||||
@@ -527,9 +540,8 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dirName Name of directory
|
||||
* @return {Promise<Entry[]>} Returns a Promise that resolves to an array of Entry objects or rejects with an error.
|
||||
* @returns {Promise<Entry[]>} Returns a Promise that resolves to an array of Entry objects or rejects with an error.
|
||||
*/
|
||||
|
||||
static listDir(path: string, dirName: string): Promise<Entry[]> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
@@ -552,9 +564,8 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dirName Name of directory
|
||||
* @return {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
|
||||
*/
|
||||
|
||||
static removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
@@ -576,9 +587,8 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file to check
|
||||
* @return {Promise<boolean|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
* @returns {Promise<boolean|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
*/
|
||||
|
||||
static checkFile(path: string, file: string): Promise<boolean|FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
@@ -606,7 +616,7 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @return {Promise<FileEntry|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
* @returns {Promise<FileEntry|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
*/
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry|FileError> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
@@ -634,9 +644,8 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to remove
|
||||
* @return {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
@@ -657,69 +666,66 @@ 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 {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.
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
static writeFile(path: string, fileName: string,
|
||||
text: string, replaceOrOptions: boolean | WriteOptions): Promise<void> {
|
||||
text: string | Blob, options: WriteOptions = {}): Promise<any> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
const err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
let opts: WriteOptions = {};
|
||||
if (replaceOrOptions) {
|
||||
if (typeof(replaceOrOptions) === 'boolean') {
|
||||
opts.replace = <boolean>replaceOrOptions;
|
||||
}
|
||||
}
|
||||
const getFileOpts: Flags = {
|
||||
create: !options.append,
|
||||
exclusive: !options.replace
|
||||
};
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, fileName, opts);
|
||||
return File.getFile(fse, fileName, getFileOpts);
|
||||
})
|
||||
.then((fe) => {
|
||||
return File.createWriter(fe);
|
||||
})
|
||||
return File.writeFileEntry(fe, text, options);
|
||||
});
|
||||
}
|
||||
|
||||
/** Write content to FileEntry.
|
||||
*
|
||||
* @private
|
||||
* @param {FileEntry} fe file entry object
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
private static writeFileEntry(fe: FileEntry, text: string | Blob, options: WriteOptions) {
|
||||
return File.createWriter(fe)
|
||||
.then((writer) => {
|
||||
if (opts.append) {
|
||||
if (options.append) {
|
||||
writer.seek(writer.length);
|
||||
}
|
||||
|
||||
if (opts.hasOwnProperty('truncate')) {
|
||||
writer.truncate(opts.truncate);
|
||||
if (options.truncate) {
|
||||
writer.truncate(options.truncate);
|
||||
}
|
||||
|
||||
return File.write(writer, text);
|
||||
});
|
||||
})
|
||||
.then(() => fe);
|
||||
}
|
||||
|
||||
|
||||
/** Write to an existing 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> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
.then((fse) => {
|
||||
return File.getFile(fse, fileName, {create: false});
|
||||
})
|
||||
.then((fe) => {
|
||||
return File.createWriter(fe);
|
||||
})
|
||||
.then((writer) => {
|
||||
return File.write(writer, text);
|
||||
});
|
||||
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
|
||||
return File.writeFile(path, fileName, text, { create: false });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -727,7 +733,7 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
*/
|
||||
static readAsText(path: string, file: string): Promise<string|FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
@@ -742,7 +748,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);
|
||||
@@ -752,8 +758,12 @@ export class File {
|
||||
reject({code: null, message: 'READER_ONLOADEND_ERR'});
|
||||
}
|
||||
};
|
||||
fe.file(file => {
|
||||
reader.readAsText(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
reader.readAsText(fe);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -764,7 +774,7 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
*/
|
||||
static readAsDataURL(path: string, file: string): Promise<string|FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
@@ -779,7 +789,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);
|
||||
@@ -790,7 +800,13 @@ export class File {
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsDataURL(fe);
|
||||
|
||||
|
||||
fe.file(file => {
|
||||
reader.readAsDataURL(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -800,7 +816,7 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
*/
|
||||
static readAsBinaryString(path: string, file: string): Promise<string|FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
@@ -815,7 +831,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);
|
||||
@@ -826,7 +842,12 @@ export class File {
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsBinaryString(fe);
|
||||
fe.file(file => {
|
||||
reader.readAsBinaryString(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -836,7 +857,7 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @return {Promise<ArrayBuffer|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
* @returns {Promise<ArrayBuffer|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
*/
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer|FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
@@ -851,7 +872,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);
|
||||
@@ -862,7 +883,12 @@ export class File {
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsArrayBuffer(fe);
|
||||
fe.file(file => {
|
||||
reader.readAsArrayBuffer(file);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -874,7 +900,7 @@ export class File {
|
||||
* @param {string} fileName Name of file to move
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
|
||||
* @return {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
*/
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
|
||||
newFileName = newFileName || fileName;
|
||||
@@ -904,7 +930,7 @@ export class File {
|
||||
* @param {string} fileName Name of file to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
|
||||
* @return {Promise<Entry|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
*/
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
|
||||
newFileName = newFileName || fileName;
|
||||
@@ -930,15 +956,22 @@ 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 static resolveLocalFilesystemUrl(furl: string): Promise<Entry> {
|
||||
return new Promise((resolve, reject) => {
|
||||
/**
|
||||
* Resolves a local file system URL
|
||||
* @param fileUrl {string} file system url
|
||||
* @returns {Promise<Entry>}
|
||||
*/
|
||||
static resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
try {
|
||||
window.resolveLocalFileSystemURL(furl, (entry) => {
|
||||
window.resolveLocalFileSystemURL(fileUrl, (entry) => {
|
||||
resolve(entry);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
@@ -951,8 +984,13 @@ export class File {
|
||||
});
|
||||
}
|
||||
|
||||
private static resolveDirectoryUrl(durl: string): Promise<DirectoryEntry> {
|
||||
return File.resolveLocalFilesystemUrl(durl)
|
||||
/**
|
||||
* Resolves a local directory url
|
||||
* @param directoryUrl {string} directory system url
|
||||
* @returns {Promise<DirectoryEntry>}
|
||||
*/
|
||||
static resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
|
||||
return File.resolveLocalFilesystemUrl(directoryUrl)
|
||||
.then((de) => {
|
||||
if (de.isDirectory) {
|
||||
return <DirectoryEntry>de;
|
||||
@@ -964,10 +1002,17 @@ export class File {
|
||||
});
|
||||
}
|
||||
|
||||
private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise<DirectoryEntry> {
|
||||
return new Promise((resolve, reject) => {
|
||||
/**
|
||||
* Get a directory
|
||||
* @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method
|
||||
* @param directoryName {string} Directory name
|
||||
* @param flags {Flags} Options
|
||||
* @returns {Promise<DirectoryEntry>}
|
||||
*/
|
||||
static getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
|
||||
return new Promise<DirectoryEntry>((resolve, reject) => {
|
||||
try {
|
||||
fse.getDirectory(dn, flags, (de) => {
|
||||
directoryEntry.getDirectory(directoryName, flags, (de) => {
|
||||
resolve(de);
|
||||
}, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
@@ -980,12 +1025,17 @@ export class File {
|
||||
});
|
||||
}
|
||||
|
||||
private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise<FileEntry> {
|
||||
return new Promise((resolve, reject) => {
|
||||
/**
|
||||
* Get a file
|
||||
* @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method
|
||||
* @param fileName {string} File name
|
||||
* @param flags {Flags} Options
|
||||
* @returns {Promise<FileEntry>}
|
||||
*/
|
||||
static getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
|
||||
return new Promise<FileEntry>((resolve, reject) => {
|
||||
try {
|
||||
fse.getFile(fn, flags, (fe) => {
|
||||
resolve(fe);
|
||||
}, (err) => {
|
||||
directoryEntry.getFile(fileName, flags, resolve, (err) => {
|
||||
File.fillErrorMessage(err);
|
||||
reject(err);
|
||||
});
|
||||
@@ -996,8 +1046,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) => {
|
||||
@@ -1007,8 +1060,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) => {
|
||||
@@ -1018,8 +1074,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) => {
|
||||
@@ -1029,8 +1088,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) => {
|
||||
@@ -1040,8 +1102,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) => {
|
||||
@@ -1051,8 +1116,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) => {
|
||||
@@ -1062,16 +1130,51 @@ export class File {
|
||||
});
|
||||
}
|
||||
|
||||
private static write(writer: FileWriter, gu: string | Blob): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static write(writer: FileWriter, gu: string | Blob): Promise<any> {
|
||||
if (gu instanceof Blob) {
|
||||
return this.writeFileInChunks(writer, gu);
|
||||
}
|
||||
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
writer.onwriteend = (evt) => {
|
||||
if (writer.error) {
|
||||
reject(writer.error);
|
||||
} else {
|
||||
resolve();
|
||||
resolve(evt);
|
||||
}
|
||||
};
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
36
src/plugins/filepath.ts
Normal file
36
src/plugins/filepath.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
/**
|
||||
* @name FilePath
|
||||
* @description
|
||||
*
|
||||
* This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FilePath} from 'ionic-native';
|
||||
*
|
||||
* FilePath.resolveNativePath(path)
|
||||
* .then(filePath => console.log(filePath);
|
||||
* .catch(err => console.log(err);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FilePath',
|
||||
plugin: 'cordova-plugin-filepath',
|
||||
pluginRef: 'window.FilePath',
|
||||
repo: 'https://github.com/hiddentao/cordova-plugin-filepath',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class FilePath {
|
||||
/**
|
||||
* Resolve native path for given content URL/path.
|
||||
* @param {String} path Content URL/path.
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static resolveNativePath(path: string): Promise<string> {return; }
|
||||
}
|
||||
@@ -138,7 +138,7 @@ export interface FileTransferError {
|
||||
* fileKey: 'file',
|
||||
* fileName: 'name.jpg',
|
||||
* headers: {}
|
||||
* .....
|
||||
* .....
|
||||
* }
|
||||
* fileTransfer.upload("<file path>", "<api endpoint>", options)
|
||||
* .then((data) => {
|
||||
@@ -148,10 +148,32 @@ export interface FileTransferError {
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* // Cordova
|
||||
* declare var cordova: any;
|
||||
*
|
||||
* download() {
|
||||
* const fileTransfer = new Transfer();
|
||||
* let url = 'http://www.example.com/file.pdf';
|
||||
* fileTransfer.download(url, cordova.file.dataDirectory + 'file.pdf').then((entry) => {
|
||||
* console.log('download complete: ' + entry.toURL());
|
||||
* }, (error) => {
|
||||
* // handle error
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* Note: You will not see your documents using a file explorer on your device. Use adb:
|
||||
*
|
||||
* ```
|
||||
* adb shell
|
||||
* run-as com.your.app
|
||||
* cd files
|
||||
* ls
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileTransfer',
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginRef: 'FileTransfer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-file-transfer'
|
||||
@@ -189,7 +211,7 @@ export class Transfer {
|
||||
* @param {string} url URL of the server to receive the file, as encoded by encodeURI().
|
||||
* @param {FileUploadOptions} options Optional parameters.
|
||||
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
|
||||
* @returns {Promise<FileUploadResult>} Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
successIndex: 2,
|
||||
@@ -206,7 +228,7 @@ export class Transfer {
|
||||
* @param {stirng} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
|
||||
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
|
||||
* @return Returns a Promise that resolves to a FileEntry object.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to a FileEntry object.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
successIndex: 2,
|
||||
|
||||
@@ -16,6 +16,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Flashlight',
|
||||
plugin: 'cordova-plugin-flashlight',
|
||||
pluginRef: 'window.plugins.flashlight',
|
||||
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
|
||||
|
||||
163
src/plugins/geofence.ts
Normal file
163
src/plugins/geofence.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
/**
|
||||
* @name Geofence
|
||||
* @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence.
|
||||
* Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
|
||||
* @usage
|
||||
* ```
|
||||
* import { Geofence } from 'ionic-native';
|
||||
* import { Platform } from 'ionic-angular'
|
||||
* ...
|
||||
*
|
||||
* constructor(private platform: Platform) {
|
||||
* this.platform.ready().then(() => {
|
||||
// initialize the plugin
|
||||
* Geofence.initialize().then(
|
||||
* // resolved promise does not return a value
|
||||
* () => console.log('Geofence Plugin Ready'),
|
||||
* (err) => console.log(err)
|
||||
* )
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* private addGeofence() {
|
||||
* //options describing geofence
|
||||
* let fence = {
|
||||
* id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb", //any unique ID
|
||||
* latitude: 37.285951, //center of geofence radius
|
||||
* longitude: -121.936650,
|
||||
* radius: 100, //radius to edge of geofence
|
||||
* transitionType: 3, //see 'Transition Types' below
|
||||
* notification: { //notification settings
|
||||
* id: 1, //any unique ID
|
||||
* title: "You crossed a fence", //notification title
|
||||
* text: "You just arrived to Gliwice city center.", //notification body
|
||||
* openAppOnClick: true //open app when notification is tapped
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Geofence.addOrUpdate(fence).then(
|
||||
* () => console.log('Geofence added'),
|
||||
* (err) => console.log('Geofence failed to add')
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
* ### Transition Types ###
|
||||
* Transition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence.
|
||||
*
|
||||
* #### Supported values ####
|
||||
* - 1: Enter
|
||||
* - 2: Leave
|
||||
* - 3: Both
|
||||
*
|
||||
* ### Defining a Geofence ###
|
||||
* Geofences are defined by an object that is passed to `addOrUpdate()`. Object properties are:
|
||||
* - id: Any unique ID for the geofence. This ID is used to remove and update a geofence
|
||||
* - latitude: Latitude coordinate of the center of the geofence radius
|
||||
* - longitude: Latitude coordinate of the center of the geofence radius
|
||||
* - radius: Radius from the center to the edge of the geofence
|
||||
* - transitionType: Type of geofence transition to monitor for. See 'Transition Types' above
|
||||
* - notification: Object. Options for defining the notification sent when a geofence is crossed
|
||||
* - id: Any unique ID
|
||||
* - title: Notification title
|
||||
* - text: Notification body
|
||||
* - openAppOnClick: Boolean. Whether to open the app when the notification is tapped by the user
|
||||
*
|
||||
* ### Troubleshooting ###
|
||||
* #### I get compile errors when I run `ionic build ios` or `ionic run ios`. ####
|
||||
* This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly.
|
||||
* Try running `ionic platform rm <platform>` then run `ionic platform add <platform>` to recreate the
|
||||
* platform directories.
|
||||
*/
|
||||
declare var window: any;
|
||||
|
||||
@Plugin({
|
||||
pluginName: 'Geofence',
|
||||
plugin: 'cordova-plugin-geofence',
|
||||
pluginRef: 'geofence',
|
||||
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
|
||||
})
|
||||
|
||||
export class Geofence {
|
||||
|
||||
public static TransitionType = {
|
||||
ENTER: 1,
|
||||
EXIT: 2,
|
||||
BOTH: 3
|
||||
};
|
||||
|
||||
public static onTrasitionReceived: Function;
|
||||
|
||||
/**
|
||||
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static initialize(): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Adds a new geofence or array of geofences. For geofence object, see above.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
|
||||
* geofence was created.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static remove(geofenceId: string | Array<string>): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Removes all geofences.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static removeAll(): Promise<void> { return; };
|
||||
|
||||
/**
|
||||
* Returns an array of geofences currently being monitored.
|
||||
*
|
||||
* @returns {Promise<Array<string>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getWatched(): Promise<string> { return; };
|
||||
|
||||
/**
|
||||
* Called when a geofence is crossed in the direction specified by `TransitType`.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
static onTransitionReceived(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||
return () => window.geofence.onTransitionReceived = () => {};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user clicks a geofence notification. iOS and Android only.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
static onNotificationClicked(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||
return () => window.geofence.onNotificationClicked = () => {};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,16 +121,25 @@ 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({
|
||||
pluginName: 'Geolocation',
|
||||
plugin: 'cordova-plugin-geolocation',
|
||||
pluginRef: 'navigator.geolocation',
|
||||
repo: 'https://github.com/apache/cordova-plugin-geolocation'
|
||||
@@ -128,7 +149,7 @@ export class Geolocation {
|
||||
* Get the device's current position.
|
||||
*
|
||||
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
|
||||
* @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
|
||||
* @returns {Promise<Geoposition>} Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -140,7 +161,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);
|
||||
* });
|
||||
*
|
||||
@@ -149,12 +172,12 @@ 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.
|
||||
* @returns {Observable<Geoposition>} 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> {
|
||||
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);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Globalization',
|
||||
plugin: 'cordova-plugin-globalization',
|
||||
pluginRef: 'navigator.globalization',
|
||||
repo: 'https://github.com/apache/cordova-plugin-globalization'
|
||||
@@ -19,14 +20,14 @@ export class Globalization {
|
||||
|
||||
/**
|
||||
* Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
|
||||
* @return {Promise<{value: string}>}
|
||||
* @returns {Promise<{value: string}>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getPreferredLanguage(): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
|
||||
* @return {Promise<{value: string}>}
|
||||
* @returns {Promise<{value: string}>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getLocaleName(): Promise<{ value: string }> { return; }
|
||||
@@ -35,7 +36,7 @@ export class Globalization {
|
||||
* Converts date to string
|
||||
* @param {Date} date Date you wish to convert
|
||||
* @param options Options for the converted date. Length, selector.
|
||||
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
|
||||
* @returns {Promise<{value: string}>} Returns a promise when the date has been converted.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
@@ -47,7 +48,7 @@ export class Globalization {
|
||||
* Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
|
||||
* @param {string} dateString Date as a string to be converted
|
||||
* @param options Options for the converted date. Length, selector.
|
||||
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
|
||||
* @returns {Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }>} Returns a promise when the date has been converted.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
@@ -58,7 +59,7 @@ export class Globalization {
|
||||
/**
|
||||
* Returns a pattern string to format and parse dates according to the client's user preferences.
|
||||
* @param options Object with the format length and selector
|
||||
* @return {Promise<{value: string}>} Returns a promise.
|
||||
* @returns {Promise<{pattern: string}>} Returns a promise.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -68,7 +69,7 @@ export class Globalization {
|
||||
/**
|
||||
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
||||
* @param options Object with type (narrow or wide) and item (month or days).
|
||||
* @return {Promise<{value: string}>} Returns a promise.
|
||||
* @returns {Promise<{value: Array<string>}>} Returns a promise.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -78,33 +79,34 @@ export class Globalization {
|
||||
/**
|
||||
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
|
||||
* @param {data} date Date to process
|
||||
* @returns {Promise<dst>} reutrns a promise with the value
|
||||
* @returns {Promise<{dst: string}>} reutrns a promise with the value
|
||||
*/
|
||||
@Cordova()
|
||||
static isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns the first day of the week according to the client's user preferences and calendar.
|
||||
* @returns {Promise<value>} reutrns a promise with the value
|
||||
* @returns {Promise<{value: string}>} returns a promise with the value
|
||||
*/
|
||||
@Cordova()
|
||||
static getFirstDayOfWeek(): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
* Returns a number formatted as a string according to the client's user preferences.
|
||||
* @param options
|
||||
* @param numberToConvert {Number} The number to convert
|
||||
* @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static numberToString(options: { type: string }): Promise<{ value: string }> { return; }
|
||||
static numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} stringToConvert String you want to conver to a number
|
||||
* @param options The type of number you want to return. Can be decimal, percent, or currency.
|
||||
* @returns {Promise} Returns a promise with the value.
|
||||
* @returns {Promise<{ value: number | string }>} Returns a promise with the value.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
@@ -115,7 +117,7 @@ export class Globalization {
|
||||
/**
|
||||
* Returns a pattern string to format and parse numbers according to the client's user preferences.
|
||||
* @param options Can be decimal, percent, or currency.
|
||||
* @returns {Promise} returns a promise with the value.
|
||||
* @returns {Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -125,7 +127,7 @@ export class Globalization {
|
||||
/**
|
||||
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
|
||||
* @param {string} currencyCode Currency Code.A
|
||||
* @returns {Promise} returns a promise with the value
|
||||
* @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
|
||||
|
||||
@@ -12,17 +12,19 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-googleplus',
|
||||
pluginRef: 'window.plugins.googleplus',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus',
|
||||
platforms: ['Web', 'Android', 'iOS'],
|
||||
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid'
|
||||
pluginName: 'GooglePlus',
|
||||
plugin: 'cordova-plugin-googleplus',
|
||||
pluginRef: 'window.plugins.googleplus',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus',
|
||||
platforms: ['Web', 'Android', 'iOS'],
|
||||
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid'
|
||||
})
|
||||
export class GooglePlus {
|
||||
|
||||
/**
|
||||
* The login function walks the user through the Google Auth process.
|
||||
* @param options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static login(options?: any): Promise<any> { return; }
|
||||
@@ -30,18 +32,21 @@ export class GooglePlus {
|
||||
/**
|
||||
* You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are.
|
||||
* @param options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trySilentLogin(options?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This will clear the OAuth2 token.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static logout(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnect(): Promise<any> { return; }
|
||||
|
||||
@@ -13,55 +13,140 @@ declare var window;
|
||||
* - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GoogleAnalytics',
|
||||
plugin: 'cordova-plugin-google-analytics',
|
||||
pluginRef: 'analytics',
|
||||
pluginRef: 'ga',
|
||||
repo: 'https://github.com/danwilson/google-analytics-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS', 'Browser']
|
||||
})
|
||||
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
|
||||
* @param {number} interval Optional dispatch period in seconds. Defaults to 30.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static startTrackerWithId(id: string): Promise<any> { return; }
|
||||
static startTrackerWithId(id: string, interval?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
||||
* @param allow {boolean}
|
||||
* @returns {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
|
||||
* @returns {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
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the app version
|
||||
* @param appVersion {string} App version
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setAppVersion(appVersion: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set OptOut
|
||||
* @param optout {boolean}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setOptOut(optout: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable verbose logging
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static debugMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track custom metric
|
||||
* @param key {string}
|
||||
* @param value {any}
|
||||
* @returns {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
|
||||
* @returns {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}
|
||||
* @returns {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
|
||||
* @returns {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}
|
||||
* @returns {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}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
|
||||
@@ -69,12 +154,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}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
|
||||
@@ -89,57 +175,15 @@ export class GoogleAnalytics {
|
||||
* @param {number} price
|
||||
* @param {number} quantity
|
||||
* @param {string} currencyCode
|
||||
* @returns {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}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Hotspot',
|
||||
plugin: 'cordova-plugin-hotspot',
|
||||
pluginRef: 'cordova.plugins.hotspot',
|
||||
repo: 'https://github.com/hypery2k/cordova-hotspot-plugin',
|
||||
@@ -22,9 +23,15 @@ import { Cordova, Plugin } from './plugin';
|
||||
})
|
||||
export class Hotspot {
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static toggleWifi(): Promise<boolean> { return; }
|
||||
|
||||
@@ -35,7 +42,7 @@ export class Hotspot {
|
||||
* @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
|
||||
* @param {string} password - password for your new Access Point
|
||||
*
|
||||
* @return {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
|
||||
* @returns {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
|
||||
*/
|
||||
@Cordova()
|
||||
static createHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
@@ -43,7 +50,7 @@ export class Hotspot {
|
||||
/**
|
||||
* Turns on Access Point
|
||||
*
|
||||
* @return {Promise<boolean>} - true if AP is started
|
||||
* @returns {Promise<boolean>} - true if AP is started
|
||||
*/
|
||||
@Cordova()
|
||||
static startHotspot(): Promise<boolean> { return; }
|
||||
@@ -55,7 +62,7 @@ export class Hotspot {
|
||||
* @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
|
||||
* @param {string} password - password for your new Access Point
|
||||
*
|
||||
* @return {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
|
||||
* @returns {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
|
||||
*/
|
||||
@Cordova()
|
||||
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
|
||||
@@ -63,7 +70,7 @@ export class Hotspot {
|
||||
/**
|
||||
* Turns off Access Point
|
||||
*
|
||||
* @return {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
|
||||
* @returns {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static stopHotspot(): Promise<boolean> { return; }
|
||||
@@ -71,11 +78,14 @@ export class Hotspot {
|
||||
/**
|
||||
* Checks if hotspot is enabled
|
||||
*
|
||||
* @return {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
|
||||
* @returns {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static isHotspotEnabled(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<HotspotDevice>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> { return; }
|
||||
|
||||
@@ -87,7 +97,7 @@ export class Hotspot {
|
||||
* @param {string} password
|
||||
* password to use
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @returns {Promise<void>}
|
||||
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -105,7 +115,7 @@ export class Hotspot {
|
||||
* @param {string[]} encryption
|
||||
* Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @returns {Promise<void>}
|
||||
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -121,7 +131,7 @@ export class Hotspot {
|
||||
* @param {string} password
|
||||
* Password for network
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @returns {Promise<void>}
|
||||
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -133,45 +143,81 @@ export class Hotspot {
|
||||
* @param {string} ssid
|
||||
* SSID of network
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @returns {Promise<void>}
|
||||
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
|
||||
*/
|
||||
@Cordova()
|
||||
static removeWifiNetwork(ssid: string): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isConnectedToInternet(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isConnectedToInternetViaWifi(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiOn(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiSupported(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiDirectSupported(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<HotspotNetwork>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static scanWifi(): Promise<Array<Network>> { return; }
|
||||
static scanWifi(): Promise<Array<HotspotNetwork>> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<HotspotNetwork>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static scanWifiByLevel(): Promise<Array<Network>> { return; }
|
||||
static scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopWifiPeriodicallyScan(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<HotspotNetworkConfig>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getNetConfig(): Promise<NetworkConfig> { return; }
|
||||
static getNetConfig(): Promise<HotspotNetworkConfig> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<ConnectionInfo>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getConnectionInfo(): Promise<ConnectionInfo> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
static pingHost(ip: string): Promise<string> { return; }
|
||||
|
||||
@@ -180,7 +226,7 @@ export class Hotspot {
|
||||
*
|
||||
* @param {string} ip - IP Address that you want the MAC Address of
|
||||
*
|
||||
* @return {Promise<string>} - A Promise for the MAC Address
|
||||
* @returns {Promise<string>} - A Promise for the MAC Address
|
||||
*/
|
||||
@Cordova()
|
||||
static getMacAddressOfHost(ip: string): Promise<string> { return; }
|
||||
@@ -190,7 +236,7 @@ export class Hotspot {
|
||||
*
|
||||
* @param {string} ip - IP Address you want to test
|
||||
*
|
||||
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||
* @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||
*/
|
||||
@Cordova()
|
||||
static isDnsLive(ip: string): Promise<boolean> { return; }
|
||||
@@ -200,7 +246,7 @@ export class Hotspot {
|
||||
*
|
||||
* @param {string} ip - IP Address you want to test
|
||||
*
|
||||
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||
* @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
|
||||
*/
|
||||
@Cordova()
|
||||
static isPortLive(ip: string): Promise<boolean> { return; }
|
||||
@@ -208,7 +254,7 @@ export class Hotspot {
|
||||
/**
|
||||
* Checks if device is rooted
|
||||
*
|
||||
* @return {Promise<boolean>} - A Promise for whether the device is rooted
|
||||
* @returns {Promise<boolean>} - A Promise for whether the device is rooted
|
||||
*/
|
||||
@Cordova()
|
||||
static isRooted(): Promise<boolean> { return; }
|
||||
@@ -217,90 +263,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({
|
||||
pluginName: 'HTTP',
|
||||
plugin: 'cordova-plugin-http',
|
||||
pluginRef: 'cordovaHTTP',
|
||||
repo: 'https://github.com/wymsee/cordova-HTTP',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class HTTP {
|
||||
|
||||
/**
|
||||
* This returns an object representing a basic HTTP Authorization header of the form.
|
||||
* @param username {string} Username
|
||||
* @param password {string} Password
|
||||
* @returns {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
|
||||
* @returns {Promise<void>} 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
|
||||
* @returns {Promise<void>} 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
|
||||
* @returns {Promise<void>} 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
|
||||
* @returns {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
|
||||
* @returns {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 name {string} The name of the parameter to pass the file along as
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
static uploadFile(url: string, body: any, headers: any, filePath: string, name: 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.
|
||||
* @returns {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;
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Httpd',
|
||||
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
|
||||
pluginRef: 'cordova.plugins.CorHttpd',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-httpd',
|
||||
@@ -32,8 +33,8 @@ export class Httpd {
|
||||
|
||||
/**
|
||||
* Starts a web server.
|
||||
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
||||
* @param options {HttpdOptions}
|
||||
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
|
||||
@@ -140,7 +140,7 @@ export interface Delegate {
|
||||
/**
|
||||
* An observable that publishes information about the location permission authorization status.
|
||||
*
|
||||
* @return Returns a string.
|
||||
* @returns {Observable<string>} Returns a string.
|
||||
*/
|
||||
didChangeAuthorizationStatus(): Observable<string>;
|
||||
|
||||
@@ -151,7 +151,7 @@ export interface Delegate {
|
||||
* This event is called when the phone begins starts monitoring,
|
||||
* when requestStateForRegion is called, etc.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
didDetermineStateForRegion(): Observable<PluginResult>;
|
||||
|
||||
@@ -163,7 +163,7 @@ export interface Delegate {
|
||||
* will be called even when the app is not running on iOS.
|
||||
* The app will run silently in the background for a small amount of time.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
didEnterRegion(): Observable<PluginResult>;
|
||||
|
||||
@@ -175,7 +175,7 @@ export interface Delegate {
|
||||
* will be called even when the app is not running on iOS.
|
||||
* The app will run silently in the background for a small amount of time.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
didExitRegion(): Observable<PluginResult>;
|
||||
|
||||
@@ -184,7 +184,7 @@ export interface Delegate {
|
||||
* each time that the device ranges beacons. Modern Android and iOS devices range
|
||||
* aproximately once per second.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
didRangeBeaconsInRegion(): Observable<PluginResult>;
|
||||
|
||||
@@ -192,7 +192,7 @@ export interface Delegate {
|
||||
* An Observable that publishes event data to it's subscribers
|
||||
* when the device begins monitoring a region.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
didStartMonitoringForRegion(): Observable<PluginResult>;
|
||||
|
||||
@@ -200,7 +200,7 @@ export interface Delegate {
|
||||
* An Observable that publishes event data to it's subscribers
|
||||
* when the device fails to monitor a region.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
monitoringDidFailForRegionWithError(): Observable<PluginResult>;
|
||||
|
||||
@@ -208,7 +208,7 @@ export interface Delegate {
|
||||
* An Observable that publishes event data to it's subscribers
|
||||
* when the device begins advertising as an iBeacon.
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
peripheralManagerDidStartAdvertising(): Observable<PluginResult>;
|
||||
|
||||
@@ -217,7 +217,7 @@ export interface Delegate {
|
||||
* when the state of the peripheral manager's state updates.
|
||||
*
|
||||
*
|
||||
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
* @returns {Observable<PluginResult>} Returns a PluginResult object with information about the event, region, and beacon(s).
|
||||
*/
|
||||
peripheralManagerDidUpdateState(): Observable<PluginResult>;
|
||||
}
|
||||
@@ -268,6 +268,7 @@ export interface Delegate {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'IBeacon',
|
||||
plugin: 'cordova-plugin-ibeacon',
|
||||
pluginRef: 'cordova.plugins.locationManager',
|
||||
repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
|
||||
@@ -379,14 +380,14 @@ export class IBeacon {
|
||||
* @param {Number} minor The minor value that you use to identify a specific beacon.
|
||||
* @param {BOOL} notifyEntryStateOnDisplay
|
||||
*
|
||||
* @return Returns the BeaconRegion that was created
|
||||
* @returns {BeaconRegion} Returns the BeaconRegion that was created
|
||||
*/
|
||||
static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the Delegate
|
||||
* @returns {Delegate} Returns the Delegate
|
||||
*/
|
||||
@Cordova()
|
||||
static getDelegate(): Delegate { return; }
|
||||
@@ -394,7 +395,7 @@ export class IBeacon {
|
||||
/**
|
||||
* @param {Delegate} delegate An instance of a delegate to register with the native layer.
|
||||
*
|
||||
* @return Returns the Delegate
|
||||
* @returns {Delegate} Returns the Delegate
|
||||
*/
|
||||
@Cordova()
|
||||
static setDelegate(delegate: Delegate): Delegate { return; }
|
||||
@@ -416,7 +417,7 @@ export class IBeacon {
|
||||
* message get emitted in the native runtime and the DOM as well after a certain
|
||||
* period of time.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the request and started to send events.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -424,7 +425,7 @@ export class IBeacon {
|
||||
|
||||
/**
|
||||
* Determines if bluetooth is switched on, according to the native layer.
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* @returns {Promise<boolean>} Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether bluetooth is active.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -433,7 +434,7 @@ export class IBeacon {
|
||||
/**
|
||||
* Enables Bluetooth using the native Layer. (ANDROID ONLY)
|
||||
*
|
||||
* @returns Returns a promise which is resolved when Bluetooth
|
||||
* @returns {Promise<void>} Returns a promise which is resolved when Bluetooth
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -442,7 +443,7 @@ export class IBeacon {
|
||||
/**
|
||||
* Disables Bluetooth using the native Layer. (ANDROID ONLY)
|
||||
*
|
||||
* @returns Returns a promise which is resolved when Bluetooth
|
||||
* @returns {Promise<void>} Returns a promise which is resolved when Bluetooth
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -462,7 +463,7 @@ export class IBeacon {
|
||||
* @param {Region} region An instance of {Region} which will be monitored
|
||||
* by the operating system.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<string>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -479,7 +480,7 @@ export class IBeacon {
|
||||
* @param {Region} region An instance of {Region} which will be monitored
|
||||
* by the operating system.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -495,7 +496,7 @@ export class IBeacon {
|
||||
* @param {Region} region An instance of {Region} which will be monitored
|
||||
* by the operating system.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -513,7 +514,7 @@ export class IBeacon {
|
||||
* @param {Region} region An instance of {BeaconRegion} which will be monitored
|
||||
* by the operating system.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -530,7 +531,7 @@ export class IBeacon {
|
||||
* @param {Region} region An instance of {BeaconRegion} which will be monitored
|
||||
* by the operating system.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -539,7 +540,7 @@ export class IBeacon {
|
||||
/**
|
||||
* Queries the native layer to determine the current authorization in effect.
|
||||
*
|
||||
* @returns Returns a promise which is resolved with the
|
||||
* @returns {Promise<any>} Returns a promise which is resolved with the
|
||||
* requested authorization status.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -552,7 +553,7 @@ export class IBeacon {
|
||||
* <a href="https://developer.apple.com/library/prerelease/iOS/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestAlwaysAuthorization">requestAlwaysAuthorization</a>
|
||||
*
|
||||
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
|
||||
* @returns Returns a promise that is resolved when the request dialog is shown.
|
||||
* @returns {Promise<void>} Returns a promise that is resolved when the request dialog is shown.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||
@@ -561,7 +562,7 @@ export class IBeacon {
|
||||
/**
|
||||
* See the docuemntation of {@code requestWhenInUseAuthorization} for further details.
|
||||
*
|
||||
* @returns Returns a promise which is resolved when the native layer
|
||||
* @returns {Promise<void>} Returns a promise which is resolved when the native layer
|
||||
* shows the request dialog.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -569,7 +570,7 @@ export class IBeacon {
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns Returns a promise which is resolved with an {Array}
|
||||
* @returns {Promise<Region[]>} Returns a promise which is resolved with an {Array}
|
||||
* of {Region} instances that are being monitored by the native layer.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -577,7 +578,7 @@ export class IBeacon {
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns Returns a promise which is resolved with an {Array}
|
||||
* @returns {Promise<Region[]>} Returns a promise which is resolved with an {Array}
|
||||
* of {Region} instances that are being ranged by the native layer.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -585,7 +586,7 @@ export class IBeacon {
|
||||
|
||||
/**
|
||||
* Determines if ranging is available or not, according to the native layer.
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* @returns {Promise<boolean>} Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether ranging is available or not.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -597,7 +598,7 @@ export class IBeacon {
|
||||
* @param {Region} region An instance of {Region} which will be checked
|
||||
* by the operating system.
|
||||
*
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* @returns {Promise<boolean>} Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether the region type is supported or not.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -617,7 +618,7 @@ export class IBeacon {
|
||||
* @param {Integer} measuredPower: Optional parameter, if left empty, the device will
|
||||
* use it's own default value.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the advertising request.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -628,7 +629,7 @@ export class IBeacon {
|
||||
*
|
||||
* This is done asynchronously and may not be immediately reflected in isAdvertising.
|
||||
*
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop advertising.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -636,7 +637,7 @@ export class IBeacon {
|
||||
|
||||
/**
|
||||
* Determines if advertising is available or not, according to the native layer.
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* @returns {Promise<void>} Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether advertising is available or not.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -644,7 +645,7 @@ export class IBeacon {
|
||||
|
||||
/**
|
||||
* Determines if advertising is currently active, according to the native layer.
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* @returns {Promise<void>} Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether advertising is active.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -654,7 +655,7 @@ export class IBeacon {
|
||||
* Disables debug logging in the native layer. Use this method if you want
|
||||
* to prevent this plugin from writing to the device logs.
|
||||
*
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -665,7 +666,7 @@ export class IBeacon {
|
||||
* to allow the plugin the posting local notifications.
|
||||
* This can be very helpful when debugging how to apps behave when launched into the background.
|
||||
*
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer has set the flag to enabled.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -675,7 +676,7 @@ export class IBeacon {
|
||||
* Disables the posting of debug notifications in the native layer. Use this method if you want
|
||||
* to prevent the plugin from posting local notifications.
|
||||
*
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer has set the flag to disabled.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -685,7 +686,7 @@ export class IBeacon {
|
||||
* Enables debug logging in the native layer. Use this method if you want
|
||||
* a debug the inner workings of this plugin.
|
||||
*
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* @returns {Promise<void>} Returns a promise which is resolved as soon as the
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
@@ -697,7 +698,7 @@ export class IBeacon {
|
||||
*
|
||||
* @param {String} message The message to append to the device logs.
|
||||
*
|
||||
* @returns Returns a promise which is resolved with the log
|
||||
* @returns {Promise<void>} Returns a promise which is resolved with the log
|
||||
* message received by the native layer for appending. The returned message
|
||||
* is expected to be equivalent to the one provided in the original call.
|
||||
*/
|
||||
|
||||
@@ -2,19 +2,23 @@ import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface ImagePickerOptions {
|
||||
// max images to be selected, defaults to 15. If this is set to 1, upon
|
||||
// selection of a single image, the plugin will return it.
|
||||
/**
|
||||
* max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it.
|
||||
*/
|
||||
maximumImagesCount?: number;
|
||||
|
||||
// max width and height to allow the images to be. Will keep aspect
|
||||
// ratio no matter what. So if both are 800, the returned image
|
||||
// will be at most 800 pixels wide and 800 pixels tall. If the width is
|
||||
// 800 and height 0 the image will be 800 pixels wide if the source
|
||||
// is at least that wide.
|
||||
/**
|
||||
* Max width to allow images to be
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* Max height to allow images to be
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
// quality of resized image, defaults to 100
|
||||
/**
|
||||
* Quality of images, defaults to 100
|
||||
*/
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
@@ -38,17 +42,20 @@ export interface ImagePickerOptions {
|
||||
* }
|
||||
* }, (err) => { });
|
||||
* ```
|
||||
* @interfaces
|
||||
* ImagePickerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-image-picker',
|
||||
pluginName: 'ImagePicker',
|
||||
plugin: 'https://github.com/Telerik-Verified-Plugins/ImagePicker',
|
||||
pluginRef: 'window.imagePicker',
|
||||
repo: 'https://github.com/wymsee/cordova-imagePicker'
|
||||
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker'
|
||||
})
|
||||
export class ImagePicker {
|
||||
/**
|
||||
* Pick pictures from the library.
|
||||
* @param {ImagePickerOptions} options
|
||||
* @return Returns a Promise that resolves the image file URI
|
||||
* @returns {Promise<any>} Returns a Promise that resolves the image file URI
|
||||
* otherwise rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -56,4 +63,22 @@ export class ImagePicker {
|
||||
})
|
||||
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if we have permission to read images
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates whether we have permission
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static hasReadPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Request permission to read images
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static requestReadPermission(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -67,11 +67,15 @@ export interface ImageResizerOptions {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ImageResizer',
|
||||
plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
|
||||
pluginRef: 'ImageResizer',
|
||||
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
|
||||
})
|
||||
export class ImageResizer {
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static resize(options: ImageResizerOptions): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Plugin, CordovaInstance } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
@@ -30,14 +31,18 @@ export interface InAppBrowserEvent extends Event {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppBrowser',
|
||||
plugin: 'cordova-plugin-inappbrowser',
|
||||
pluginRef: 'cordova.InAppBrowser',
|
||||
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
|
||||
})
|
||||
export class InAppBrowser {
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static open(url: string, target?: string, options?: string): void {
|
||||
console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
|
||||
console.warn('Native: Your current usage of the InAppBrowser plugin is deprecated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
|
||||
}
|
||||
|
||||
private _objectInstance: any;
|
||||
@@ -75,13 +80,15 @@ export class InAppBrowser {
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
* @param {Object} Details of the script to run, specifying either a file or code key.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||
@@ -91,8 +98,8 @@ export class InAppBrowser {
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event Event name
|
||||
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
* @param {string} name of the event
|
||||
* @returns {Observable<InAppBrowserEvent>} 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) => {
|
||||
|
||||
123
src/plugins/inapppurchase.ts
Normal file
123
src/plugins/inapppurchase.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name InAppPurchase
|
||||
* @description
|
||||
* A lightweight Cordova plugin for in app purchases on iOS/Android.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {InAppPurchase} from 'ionic-native';
|
||||
*
|
||||
* InAppPurchase
|
||||
* .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
|
||||
* .then((products) => {
|
||||
* console.log(products);
|
||||
* // [{ productId: 'com.yourapp.prod1', 'title': '...', description: '...', price: '...' }, ...]
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
*
|
||||
* InAppPurchase
|
||||
* .buy('com.yourapp.prod1')
|
||||
* .then((data)=> {
|
||||
* console.log(data);
|
||||
* // {
|
||||
* // transactionId: ...
|
||||
* // receipt: ...
|
||||
* // signature: ...
|
||||
* // }
|
||||
* })
|
||||
* .catch((err)=> {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
*
|
||||
* ```ts
|
||||
* // fist buy the product...
|
||||
* InAppPurchase
|
||||
* .buy('com.yourapp.consumable_prod1')
|
||||
* .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature))
|
||||
* .then(() => console.log('product was successfully consumed!'))
|
||||
* .catch( err=> console.log(err))
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppPurchase',
|
||||
plugin: 'cordova-plugin-inapppurchase',
|
||||
pluginRef: 'inAppPurchase',
|
||||
platforms: ['Android', 'iOS'],
|
||||
repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase'
|
||||
})
|
||||
export class InAppPurchase {
|
||||
|
||||
/**
|
||||
* Retrieves a list of full product data from Apple/Google. This method must be called before making purchases.
|
||||
* @param {array<string>} productId an array of product ids.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with an array of objects.
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static getProducts(productId: string[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Buy a product that matches the productId.
|
||||
* @param {string} productId A string that matches the product you want to buy.
|
||||
* @returns {Promise<{transactionId: string, receipt: string, signature: string, productType: string}>} Returns a Promise that resolves with the transaction details.
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
|
||||
|
||||
/**
|
||||
* Same as buy, but for subscription based products.
|
||||
* @param {string} productId A string that matches the product you want to subscribe to.
|
||||
* @returns {Promise<{transactionId: string, receipt: string, signature: string, productType: string}>} Returns a Promise that resolves with the transaction details.
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
|
||||
|
||||
/**
|
||||
* Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message:
|
||||
* @param {string} productType
|
||||
* @param {string} receipt
|
||||
* @param {string} signature
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static consume(productType: string, receipt: string, signature: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Restore all purchases from the store
|
||||
* @returns {Promise<any>} Returns a promise with an array of purchases.
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
static restorePurchases(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the receipt.
|
||||
* @returns {Promise<string>} Returns a promise that contains the string for the receipt
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static getReceipt(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Insomnia',
|
||||
plugin: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git',
|
||||
pluginRef: 'plugins.insomnia',
|
||||
repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin',
|
||||
@@ -35,14 +36,14 @@ export class Insomnia {
|
||||
|
||||
/**
|
||||
* Keeps awake the application
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static keepAwake(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Allows the application to sleep again
|
||||
* @returns {Promise}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static allowSleepAgain(): Promise<any> { return; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Instagram
|
||||
@@ -15,6 +15,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Instagram',
|
||||
plugin: 'cordova-instagram-plugin',
|
||||
pluginRef: 'Instagram',
|
||||
repo: 'https://github.com/vstirbu/InstagramPlugin'
|
||||
@@ -24,7 +25,7 @@ export class Instagram {
|
||||
/**
|
||||
* Detect if the Instagram application is installed on the device.
|
||||
*
|
||||
* @return {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
|
||||
* @returns {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
@@ -37,7 +38,7 @@ export class Instagram {
|
||||
*
|
||||
* @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share
|
||||
* @param caption The caption of the image
|
||||
* @return {Promise<any>} Returns a promise that resolves if the image was shared
|
||||
* @returns {Promise<any>} Returns a promise that resolves if the image was shared
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
@@ -47,7 +48,7 @@ export class Instagram {
|
||||
/**
|
||||
* Share a library asset or video
|
||||
* @param assetLocalIdentifier A local fileURI
|
||||
* @return {Promise<any>} Returns a promise that resolves if the image was shared
|
||||
* @returns {Promise<any>} Returns a promise that resolves if the image was shared
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
|
||||
36
src/plugins/is-debug.ts
Normal file
36
src/plugins/is-debug.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name IsDebug
|
||||
* @description
|
||||
* Detect if the app is running in debug mode or not.
|
||||
* Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {IsDebug} from 'ionic-native';
|
||||
*
|
||||
* IsDebug.getIsDebug()
|
||||
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'IsDebug',
|
||||
plugin: 'cordova-plugin-is-debug',
|
||||
pluginRef: 'cordova.plugins.IsDebug',
|
||||
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
|
||||
})
|
||||
export class IsDebug {
|
||||
|
||||
/**
|
||||
* Determine if an app was installed via xcode / eclipse / the ionic CLI etc
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
|
||||
*/
|
||||
@Cordova()
|
||||
static getIsDebug(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Keyboard',
|
||||
plugin: 'ionic-plugin-keyboard',
|
||||
pluginRef: 'cordova.plugins.Keyboard',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
|
||||
@@ -57,6 +58,7 @@ export class Keyboard {
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
@@ -67,6 +69,7 @@ export class Keyboard {
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
|
||||
@@ -82,6 +82,7 @@ export interface LaunchNavigatorOptions {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'LaunchNavigator',
|
||||
plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
|
||||
pluginRef: 'launchnavigator',
|
||||
repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
|
||||
@@ -106,12 +107,14 @@ export class LaunchNavigator {
|
||||
/**
|
||||
* Determines if the given app is installed and available on the current device.
|
||||
* @param app {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAppAvailable(app: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns a list indicating which apps are installed and available on the current device.
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
static availableApps(): Promise<string[]> { return; }
|
||||
@@ -119,6 +122,7 @@ export class LaunchNavigator {
|
||||
/**
|
||||
* Returns the display name of the specified app.
|
||||
* @param app {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getAppDisplayName(app: string): string { return; }
|
||||
@@ -126,6 +130,7 @@ export class LaunchNavigator {
|
||||
/**
|
||||
* Returns list of supported apps on a given platform.
|
||||
* @param platform {string}
|
||||
* @returns {string[]}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getAppsForPlatform(platform: string): string[] { return; }
|
||||
@@ -134,6 +139,7 @@ export class LaunchNavigator {
|
||||
* Indicates if an app on a given platform supports specification of transport mode.
|
||||
* @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS`
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsTransportMode(app: string, platform: string): boolean { return; }
|
||||
@@ -142,6 +148,7 @@ export class LaunchNavigator {
|
||||
* Returns the list of transport modes supported by an app on a given platform.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {string[]}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getTransportModes(app: string, platform: string): string[] { return; }
|
||||
@@ -151,6 +158,7 @@ export class LaunchNavigator {
|
||||
* Note that currently only Google Maps on Android does.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||
@@ -159,16 +167,31 @@ export class LaunchNavigator {
|
||||
* Indicates if an app on a given platform supports specification of start location.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsStart(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsStartName(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsDestName(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param destination {string | number[]}
|
||||
* @param options {LaunchNavigatorOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'LocalNotifications',
|
||||
plugin: 'de.appplant.cordova.plugin.local-notification',
|
||||
pluginRef: 'cordova.plugins.notification.local',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-local-notifications'
|
||||
@@ -53,7 +54,7 @@ export class LocalNotifications {
|
||||
|
||||
/**
|
||||
* Schedules a single or multiple notifications
|
||||
* @param options
|
||||
* @param options {Notification | Array<Notification>} optional
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
@@ -62,7 +63,7 @@ export class LocalNotifications {
|
||||
|
||||
/**
|
||||
* Updates a previously scheduled notification. Must include the id in the options parameter.
|
||||
* @param options
|
||||
* @param options {Notification} optional
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
@@ -71,13 +72,15 @@ export class LocalNotifications {
|
||||
|
||||
/**
|
||||
* Clears single or multiple notifications
|
||||
* @param notificationId A single notification id, or an array of notification ids.
|
||||
* @param notificationId {any} A single notification id, or an array of notification ids.
|
||||
* @returns {Promise<any>} Returns a promise when the notification had been cleared
|
||||
*/
|
||||
@Cordova()
|
||||
static clear(notificationId: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Clears all notifications
|
||||
* @returns {Promise<any>} Returns a promise when all notifications have cleared
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 0,
|
||||
@@ -87,13 +90,15 @@ export class LocalNotifications {
|
||||
|
||||
/**
|
||||
* Cancels single or multiple notifications
|
||||
* @param notificationId A single notification id, or an array of notification ids.
|
||||
* @param notificationId {any} A single notification id, or an array of notification ids.
|
||||
* @returns {Promise<any>} Returns a promise when the notification is canceled
|
||||
*/
|
||||
@Cordova()
|
||||
static cancel(notificationId: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Cancels all notifications
|
||||
* @returns {Promise<any>} Returns a promise when all notifications are canceled
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 0,
|
||||
@@ -103,53 +108,61 @@ export class LocalNotifications {
|
||||
|
||||
/**
|
||||
* Checks presence of a notification
|
||||
* @param notificationId
|
||||
* @param notificationId {number}
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isPresent(notificationId: number): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks is a notification is scheduled
|
||||
* @param notificationId
|
||||
* @param notificationId {number}
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isScheduled(notificationId: number): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if a notification is triggered
|
||||
* @param notificationId
|
||||
* @param notificationId {number}
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isTriggered(notificationId: number): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Get all the notification ids
|
||||
* @returns {Promise<Array<number>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllIds(): Promise<Array<number>> { return; }
|
||||
|
||||
/**
|
||||
* Get the ids of triggered notifications
|
||||
* @returns {Promise<Array<number>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getTriggeredIds(): Promise<Array<number>> { return; }
|
||||
|
||||
/**
|
||||
* Get the ids of scheduled notifications
|
||||
* @returns {Promise<Array<number>>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
static getScheduledIds(): Promise<Array<number>> { return; }
|
||||
|
||||
/**
|
||||
* Get a notification object
|
||||
* @param notificationId The id of the notification to get
|
||||
* @param notificationId {any} The id of the notification to get
|
||||
* @returns {Promise<Notification>}
|
||||
*/
|
||||
@Cordova()
|
||||
static get(notificationId: any): Promise<Notification> { return; }
|
||||
|
||||
/**
|
||||
* Get a scheduled notification object
|
||||
* @param notificationId The id of the notification to get
|
||||
* @param notificationId {any} The id of the notification to get
|
||||
* @returns {Promise<Notification>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getScheduled(notificationId: any): Promise<Notification> { return; }
|
||||
@@ -157,28 +170,46 @@ export class LocalNotifications {
|
||||
/**
|
||||
* Get a triggered notification object
|
||||
* @param notificationId The id of the notification to get
|
||||
* @returns {Promise<Notification>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getTriggered(notificationId: any): Promise<Notification> { return; }
|
||||
|
||||
/**
|
||||
* Get all notification objects
|
||||
* @returns {Promise<Array<Notification>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAll(): Promise<Array<Notification>> { return; }
|
||||
|
||||
/**
|
||||
* Get all scheduled notification objects
|
||||
* @returns {Promise<Array<Notification>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllScheduled(): Promise<Array<Notification>> { return; }
|
||||
|
||||
/**
|
||||
* Get all triggered notification objects
|
||||
* @returns {Promise<Array<Notification>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getAllTriggered(): Promise<Array<Notification>> { return; }
|
||||
|
||||
/**
|
||||
* Register permission to show notifications if not already granted.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static registerPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Informs if the app has the permission to show notifications.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static hasPermission(): Promise<boolean> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Sets a callback for a specific event
|
||||
|
||||
68
src/plugins/location-accuracy.ts
Normal file
68
src/plugins/location-accuracy.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
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({
|
||||
pluginName: 'LocationAccuracy',
|
||||
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
|
||||
* @param accuracy {number} Accuracy, from 0 to 4. You can use the static properties of this class that start with REQUEST_PRIORITY_
|
||||
* @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
static request(accuracy: number): 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;
|
||||
|
||||
}
|
||||
30
src/plugins/market.ts
Normal file
30
src/plugins/market.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name Market
|
||||
* @description
|
||||
* Opens an app's page in the market place (Google Play, App Store)
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Market} from 'ionic-native';
|
||||
*
|
||||
* Market.open('your.package.name');
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Market',
|
||||
plugin: 'cordova-plugin-market',
|
||||
pluginRef: 'cordova.plugins.market',
|
||||
repo: 'https://github.com/xmartlabs/cordova-plugin-market'
|
||||
})
|
||||
export class Market {
|
||||
/**
|
||||
* Opens an app in Google Play / App Store
|
||||
* @param appId {string} Package name
|
||||
* @param callbacks {Object} Optional callbacks in the format {success?: Function, failure?: Function}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static open(appId: string, callbacks?: {success?: Function, failure?: Function}): void { }
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
@@ -22,41 +22,37 @@ declare var navigator: any;
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MediaCapture',
|
||||
plugin: 'cordova-plugin-media-capture',
|
||||
pluginRef: 'navigator.device.capture',
|
||||
repo: 'https://github.com/apache/cordova-plugin-media-capture'
|
||||
})
|
||||
export class MediaCapture {
|
||||
/**
|
||||
* The audio recording formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedImageModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedImageModes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The recording image sizes and formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedAudioModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedAudioModes;
|
||||
}
|
||||
static supportedImageModes: ConfigurationData[];
|
||||
|
||||
/**
|
||||
* The audio recording formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static supportedAudioModes: ConfigurationData[];
|
||||
|
||||
/**
|
||||
* The recording video resolutions and formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedVideoModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedVideoModes;
|
||||
}
|
||||
static supportedVideoModes: ConfigurationData[];
|
||||
|
||||
/**
|
||||
* Start the audio recorder application and return information about captured audio clip files.
|
||||
* @param options
|
||||
* @returns {Promise<MediaFile[]>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -66,6 +62,7 @@ export class MediaCapture {
|
||||
/**
|
||||
* Start the camera application and return information about captured image files.
|
||||
* @param options
|
||||
* @returns {Promise<MediaFile[]>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -75,6 +72,7 @@ export class MediaCapture {
|
||||
/**
|
||||
* Start the video recorder application and return information about captured video clip files.
|
||||
* @param options
|
||||
* @returns {Promise<MediaFile[]>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -83,6 +81,7 @@ export class MediaCapture {
|
||||
|
||||
/**
|
||||
* is fired if the capture call is successful
|
||||
* @returns {Observable<MediaFile[]>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
@@ -92,6 +91,7 @@ export class MediaCapture {
|
||||
|
||||
/**
|
||||
* is fired if the capture call is unsuccessful
|
||||
* @returns {Observable<CaptureError>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -70,6 +68,7 @@ export interface MediaError {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MediaPlugin',
|
||||
repo: 'https://github.com/apache/cordova-plugin-media',
|
||||
plugin: 'cordova-plugin-media',
|
||||
pluginRef: 'Media'
|
||||
@@ -77,51 +76,85 @@ export interface MediaError {
|
||||
export class MediaPlugin {
|
||||
|
||||
// Constants
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_NONE: number = 0;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_STARTING: number = 1;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_RUNNING: number = 2;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_PAUSED: number = 3;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_STOPPED: number = 4;
|
||||
|
||||
// error codes
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_ERR_ABORTED: number = 1;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_ERR_NETWORK: number = 2;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_ERR_DECODE: number = 3;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static MEDIA_ERR_NONE_SUPPORTED: number = 4;
|
||||
|
||||
// Properties
|
||||
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({
|
||||
pluginName: 'MediaPlugin',
|
||||
plugin: 'cordova-plugin-media'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current amplitude of the current recording.
|
||||
* Get the current amplitude of the current recording.
|
||||
* @returns {Promise<any>} 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<any>} 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 {number} Returns a promise with the duration of the current recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
@@ -157,7 +190,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
|
||||
@@ -166,7 +199,7 @@ export class MediaPlugin {
|
||||
|
||||
/**
|
||||
* Set the volume for an audio file.
|
||||
* @param volume The volume to set for playback. The value must be within the range of 0.0 to 1.0.
|
||||
* @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
|
||||
159
src/plugins/mixpanel.ts
Normal file
159
src/plugins/mixpanel.ts
Normal file
@@ -0,0 +1,159 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
declare var mixpanel: any;
|
||||
|
||||
/**
|
||||
* @name Mixpanel
|
||||
* @description
|
||||
* Cordova Plugin that wraps Mixpanel SDK for Android and iOS
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Mixpanel} from 'ionic-native';
|
||||
*
|
||||
* Mixpanel.init(token)
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
*
|
||||
* ```
|
||||
* @classes
|
||||
* MixpanelPeople
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Mixpanel',
|
||||
plugin: 'cordova-plugin-mixpanel',
|
||||
pluginRef: 'mixpanel',
|
||||
repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin'
|
||||
})
|
||||
export class Mixpanel {
|
||||
/**
|
||||
*
|
||||
* @param aliasId {string}
|
||||
* @param originalId {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static alias(aliasId: string, originalId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static distinctId(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static flush(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param distinctId {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static identify(distinctId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param token {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static init(token: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param superProperties {any}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static registerSuperProperties(superProperties: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static reset(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param eventName {string}
|
||||
* @param eventProperties {any} optional
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static track(eventName: string, eventProperties?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static showSurvey(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {MixpanelPeople}
|
||||
*/
|
||||
static get people(): typeof MixpanelPeople {
|
||||
return MixpanelPeople;
|
||||
};
|
||||
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class MixpanelPeople {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static plugin: string = 'cordova-plugin-mixpanel';
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static pluginRef: string = 'mixpanel.people';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param distinctId {string}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static identify(distinctId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param peopleProperties {string}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static increment(peopleProperties: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pushId
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setPushId(pushId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param peopleProperties
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static set(peopleProperties: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param peopleProperties
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setOnce(peopleProperties: any): Promise<any> { return; }
|
||||
}
|
||||
129
src/plugins/music-controls.ts
Normal file
129
src/plugins/music-controls.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
/**
|
||||
* @name MusicControls
|
||||
* @description
|
||||
* Music controls for Cordova applications.
|
||||
* Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play.
|
||||
* Handle also headset event (plug, unplug, headset button).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {MusicControls} from 'ionic-native';
|
||||
*
|
||||
* MusicControls.create({
|
||||
* track : 'Time is Running Out', // optional, default : ''
|
||||
* artist : 'Muse', // optional, default : ''
|
||||
* cover : 'albums/absolution.jpg', // optional, default : nothing
|
||||
* // cover can be a local path (use fullpath 'file:///storage/emulated/...', or only 'my_image.jpg' if my_image.jpg is in the www folder of your app)
|
||||
* // or a remote url ('http://...', 'https://...', 'ftp://...')
|
||||
* isPlaying : true, // optional, default : true
|
||||
* dismissable : true, // optional, default : false
|
||||
*
|
||||
* // hide previous/next/close buttons:
|
||||
* hasPrev : false, // show previous button, optional, default: true
|
||||
* hasNext : false, // show next button, optional, default: true
|
||||
* hasClose : true, // show close button, optional, default: false
|
||||
*
|
||||
* // Android only, optional
|
||||
* // text displayed in the status bar when the notification (and the ticker) are updated
|
||||
* ticker : 'Now playing "Time is Running Out"'
|
||||
* });
|
||||
*
|
||||
* MusicControls.subscribe().subscribe(action => {
|
||||
*
|
||||
* switch(action) {
|
||||
* case 'music-controls-next':
|
||||
* // Do something
|
||||
* break;
|
||||
* case 'music-controls-previous':
|
||||
* // Do something
|
||||
* break;
|
||||
* case 'music-controls-pause':
|
||||
* // Do something
|
||||
* break;
|
||||
* case 'music-controls-play':
|
||||
* // Do something
|
||||
* break;
|
||||
* case 'music-controls-destroy':
|
||||
* // Do something
|
||||
* break;
|
||||
*
|
||||
* // Headset events (Android only)
|
||||
* case 'music-controls-media-button' :
|
||||
* // Do something
|
||||
* break;
|
||||
* case 'music-controls-headset-unplugged':
|
||||
* // Do something
|
||||
* break;
|
||||
* case 'music-controls-headset-plugged':
|
||||
* // Do something
|
||||
* break;
|
||||
* default:
|
||||
* break;
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
* MusicControls.listen(); // activates the observable above
|
||||
*
|
||||
* MusicControls.updateIsPlaying(true);
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MusicControls',
|
||||
plugin: 'cordova-plugin-music-controls',
|
||||
pluginRef: 'MusicControls',
|
||||
repo: 'https://github.com/homerours/cordova-music-controls-plugin'
|
||||
})
|
||||
export class MusicControls {
|
||||
/**
|
||||
* Create the media controls
|
||||
* @param options {MusicControlsOptions}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static create(options: MusicControlsOptions): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Destroy the media controller
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static destroy(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Subscribe to the events of the media controller
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static subscribe(): Observable<any> {return; }
|
||||
|
||||
/**
|
||||
* Start listening for events, this enables the Observable from the subscribe method
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static listen(): void {}
|
||||
|
||||
/**
|
||||
* Toggle play/pause:
|
||||
* @param isPlaying {boolean}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static updateIsPlaying(isPlaying: boolean): void {}
|
||||
}
|
||||
export interface MusicControlsOptions {
|
||||
track: string;
|
||||
artist: string;
|
||||
cover: string;
|
||||
isPlaying: boolean;
|
||||
dismissable: boolean;
|
||||
hasPrev: boolean;
|
||||
hasNext: boolean;
|
||||
hasClose: boolean;
|
||||
ticker: string;
|
||||
}
|
||||
@@ -10,6 +10,10 @@ import { Plugin, Cordova } from './plugin';
|
||||
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
|
||||
*
|
||||
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
|
||||
*
|
||||
* // can optionally pass a callback to be called when the file is done playing
|
||||
* NativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing'));
|
||||
*
|
||||
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
|
||||
*
|
||||
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
|
||||
@@ -21,6 +25,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NativeAudio',
|
||||
plugin: 'cordova-plugin-nativeaudio',
|
||||
pluginRef: 'plugins.NativeAudio',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
|
||||
@@ -50,17 +55,19 @@ export class NativeAudio {
|
||||
/**
|
||||
* Plays an audio asset
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @param completeCallback {Function} callback to be invoked when audio is done playing
|
||||
* @param completeCallback {Function} optional. Callback to be invoked when audio is done playing
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static play(id: string, completeCallback: Function): Promise<any> {return; }
|
||||
static play(id: string, completeCallback?: Function): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Stops playing an audio
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(id: string): Promise<any> {return; }
|
||||
@@ -76,6 +83,7 @@ export class NativeAudio {
|
||||
/**
|
||||
* Unloads an audio file from memory
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static unload(id: string): Promise<any> {return; }
|
||||
@@ -84,6 +92,7 @@ export class NativeAudio {
|
||||
* Changes the volume for preloaded complex assets.
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @param volume {number} the volume of the audio asset (0.1 to 1.0)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
|
||||
|
||||
95
src/plugins/native-page-transitions.ts
Normal file
95
src/plugins/native-page-transitions.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name NativePageTransitions
|
||||
* @description
|
||||
* The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {NativePageTransitions, TransitionOptions} from 'ionic-native';
|
||||
*
|
||||
* let options: TransitionOptions = {
|
||||
* direction: 'up',
|
||||
* duration: 500,
|
||||
* slowdownfactor: 3,
|
||||
* slidePixels: 20,
|
||||
* iosdelay: 100,
|
||||
* androiddelay: 150,
|
||||
* winphonedelay: 250,
|
||||
* fixedPixelsTop: 0,
|
||||
* fixedPixelsBottom: 60
|
||||
* };
|
||||
*
|
||||
* NativePageTransitions.slide(options)
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NativePageTransitions',
|
||||
plugin: 'com.telerik.plugins.nativepagetransitions',
|
||||
pluginRef: 'plugins.nativepagetransitions',
|
||||
repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions',
|
||||
platforms: ['iOS', 'Android', 'Windows Phone']
|
||||
})
|
||||
export class NativePageTransitions {
|
||||
/**
|
||||
* Perform a slide animation
|
||||
* @param options {TransitionOptions} Options for the transition
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static slide(options: TransitionOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Perform a flip animation
|
||||
* @param options {TransitionOptions} Options for the transition
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static flip(options: TransitionOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Perform a fade animation
|
||||
* @param options {TransitionOptions} Options for the transition
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({platforms: ['iOS', 'Android']})
|
||||
static fade(options: TransitionOptions): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Perform a slide animation
|
||||
* @param options {TransitionOptions} Options for the transition
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({platforms: ['iOS', 'Android']})
|
||||
static drawer(options: TransitionOptions): Promise<any> { return; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Perform a slide animation
|
||||
* @param options {TransitionOptions} Options for the transition
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static curl(options: TransitionOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface TransitionOptions {
|
||||
direction?: string;
|
||||
duration?: number;
|
||||
slowdownfactor?: number;
|
||||
slidePixels?: number;
|
||||
iosdelay?: number;
|
||||
androiddelay?: number;
|
||||
winphonedelay?: number;
|
||||
fixedPixelsTop?: number;
|
||||
fixedPixelsBottom?: number;
|
||||
action?: string;
|
||||
origin?: string;
|
||||
href?: string;
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NativeStorage',
|
||||
plugin: 'cordova-plugin-nativestorage',
|
||||
pluginRef: 'NativeStorage',
|
||||
repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage'
|
||||
@@ -32,6 +33,7 @@ export class NativeStorage {
|
||||
* Stores a value
|
||||
* @param reference {string}
|
||||
* @param value
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setItem(reference: string, value: any): Promise<any> {return; }
|
||||
@@ -39,6 +41,7 @@ export class NativeStorage {
|
||||
/**
|
||||
* Gets a stored item
|
||||
* @param reference {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getItem(reference: string): Promise<any> {return; }
|
||||
@@ -46,12 +49,14 @@ export class NativeStorage {
|
||||
/**
|
||||
* Removes a single stored item
|
||||
* @param reference {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static remove(reference: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Removes all stored values.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static clear(): Promise<any> {return; }
|
||||
|
||||
@@ -43,6 +43,7 @@ declare var navigator: any;
|
||||
* The `connection` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none`
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Network',
|
||||
plugin: 'cordova-plugin-network-information',
|
||||
repo: 'https://github.com/apache/cordova-plugin-network-information',
|
||||
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'],
|
||||
@@ -54,7 +55,7 @@ export class Network {
|
||||
* Return the network connection type
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get connection(): string { return navigator.connection.type; }
|
||||
static connection: string;
|
||||
|
||||
/**
|
||||
* Get notified when the device goes offline
|
||||
|
||||
185
src/plugins/nfc.ts
Normal file
185
src/plugins/nfc.ts
Normal file
@@ -0,0 +1,185 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
declare let window: any;
|
||||
/**
|
||||
* @name NFC
|
||||
* @description
|
||||
* The NFC plugin allows you to read and write NFC tags. You can also beam to, and receive from, other NFC enabled devices.
|
||||
*
|
||||
* Use to
|
||||
* - read data from NFC tags
|
||||
* - write data to NFC tags
|
||||
* - send data to other NFC enabled devices
|
||||
* - receive data from NFC devices
|
||||
*
|
||||
* This plugin uses NDEF (NFC Data Exchange Format) for maximum compatibilty between NFC devices, tag types, and operating systems.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {NFC, Ndef} from 'ionic-native';
|
||||
*
|
||||
* let message = Ndef.textRecord('Hello world');
|
||||
* NFC.share([message]).then(onSuccess).catch(onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NFC',
|
||||
plugin: 'phonegap-nfc',
|
||||
pluginRef: 'nfc',
|
||||
repo: 'https://github.com/chariotsolutions/phonegap-nfc'
|
||||
})
|
||||
export class NFC {
|
||||
/**
|
||||
* Registers an event listener for any NDEF tag.
|
||||
* @param onSuccess
|
||||
* @param onFailure
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
successIndex: 0,
|
||||
errorIndex: 3,
|
||||
clearFunction: 'removeNdefListener',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static addNdefListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
|
||||
|
||||
/**
|
||||
* Registers an event listener for tags matching any tag type.
|
||||
* @param mimeType
|
||||
* @param onSuccess
|
||||
* @param onFailure
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
successIndex: 1,
|
||||
errorIndex: 4,
|
||||
clearFunction: 'removeTagDiscoveredListener',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static addTagDiscoveredListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
|
||||
|
||||
/**
|
||||
* Registers an event listener for NDEF tags matching a specified MIME type.
|
||||
* @param onSuccess
|
||||
* @param onFailure
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
successIndex: 0,
|
||||
errorIndex: 3,
|
||||
clearFunction: 'removeMimeTypeListener',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static addMimeTypeListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
|
||||
|
||||
/**
|
||||
* Registers an event listener for formatable NDEF tags.
|
||||
* @param onSuccess
|
||||
* @param onFailure
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
successIndex: 0,
|
||||
errorIndex: 3
|
||||
})
|
||||
static addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
|
||||
|
||||
/**
|
||||
* Qrites an NdefMessage to a NFC tag.
|
||||
* @param message {any[]}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static write(message: any[]): Promise<any> {return; }
|
||||
/**
|
||||
* Makes a NFC tag read only. **Warning** this is permanent.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static makeReadyOnly(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Shares an NDEF Message via peer-to-peer.
|
||||
* @param message An array of NDEF Records.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static share(message: any[]): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Stop sharing NDEF data via peer-to-peer.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static unshare(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Erase a NDEF tag
|
||||
*/
|
||||
@Cordova()
|
||||
static erase(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Send a file to another device via NFC handover.
|
||||
* @param uris A URI as a String, or an array of URIs.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static handover(uris: string[]): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Stop sharing NDEF data via NFC handover.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopHandover(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Show the NFC settings on the device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static showSettings(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Check if NFC is available and enabled on this device.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static enabled(): Promise<any> {return; }
|
||||
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class Ndef {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static pluginName = 'NFC';
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static plugin = 'phonegap-nfc';
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static pluginRef = 'ndef';
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static uriRecord(uri: string): any { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static textRecord(text: string): any { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static mimeMediaRecord(mimeType: string, payload: string): any { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static androidApplicationRecord(packageName: string): any { return; }
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* @name OneSignal
|
||||
* @description
|
||||
@@ -14,17 +13,24 @@ 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.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
|
||||
*
|
||||
* OneSignal.handleNotificationReceived().subscribe(() => {
|
||||
* // do something when notification is received
|
||||
* });
|
||||
*
|
||||
* OneSignal.handleNotificationOpened().subscribe(() => {
|
||||
* // do something when a notification is opened
|
||||
* });
|
||||
*
|
||||
* OneSignal.endInit();
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'OneSignal',
|
||||
plugin: 'onesignal-cordova-plugin',
|
||||
pluginRef: 'plugins.OneSignal',
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
|
||||
@@ -32,19 +38,112 @@ 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.
|
||||
* constants to use in inFocusDisplaying()
|
||||
*/
|
||||
@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.
|
||||
* @returns {any}
|
||||
*/
|
||||
@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
|
||||
* @returns {any}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static iOSSettings(settings: {
|
||||
kOSSettingsKeyInAppLaunchURL: boolean;
|
||||
kOSSettingsKeyAutoPrompt: boolean;
|
||||
}): any { return; }
|
||||
|
||||
/**
|
||||
* @returns {any}
|
||||
*/
|
||||
@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<any>} 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<any>} 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 +152,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 +159,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,38 +171,25 @@ 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 { }
|
||||
|
||||
/**
|
||||
* Warning:
|
||||
* Only applies to Android and Amazon devices.
|
||||
*
|
||||
* 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.
|
||||
* Setting to control how OneSignal notifications will be shown when one is received while your app is in focus. By default this is set to inAppAlert, which can be helpful during development.
|
||||
*
|
||||
* @param {enable} enable
|
||||
* @param {number} displayOption Options are 0 = None, 1 = InAppAlert, and 2 = Notification.
|
||||
*/
|
||||
@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 { }
|
||||
static inFocusDisplaying(displayOption: number): 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 { }
|
||||
@@ -165,71 +197,10 @@ export class OneSignal {
|
||||
/**
|
||||
*
|
||||
* @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification)
|
||||
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
|
||||
* @returns {Promise<any>} 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 +208,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 +230,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;
|
||||
}
|
||||
|
||||
470
src/plugins/pay-pal.ts
Normal file
470
src/plugins/pay-pal.ts
Normal file
@@ -0,0 +1,470 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name PayPal
|
||||
* @description
|
||||
* PayPal plugin for Cordova/Ionic Applications
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {PayPal, PayPalPayment, PayPalConfiguration} from "ionic-native";
|
||||
*
|
||||
* PayPal.init({
|
||||
* "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({
|
||||
pluginName: 'PayPal',
|
||||
plugin: 'com.paypal.cordova.mobilesdk',
|
||||
pluginRef: 'PayPalMobile',
|
||||
repo: 'https://github.com/paypal/PayPal-Cordova-Plugin'
|
||||
})
|
||||
export class PayPal {
|
||||
/**
|
||||
* Retrieve the version of the PayPal iOS SDK library. Useful when contacting support.
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@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 {PayPalEnvironment} clientIdsForEnvironments: set of client ids for environments
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static init(clientIdsForEnvironments: PayPalEnvironment): Promise<any> {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: PayPalConfiguration object, for Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
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
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static renderSinglePaymentUI(payment: PayPalPayment): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Once a user has consented to future payments, when the user subsequently initiates a PayPal payment
|
||||
* from their device to be completed by your server, PayPal uses a Correlation ID to verify that the
|
||||
* payment is originating from a valid, user-consented device+application.
|
||||
* This helps reduce fraud and decrease declines.
|
||||
* This method MUST be called prior to initiating a pre-consented payment (a "future payment") from a mobile device.
|
||||
* Pass the result to your server, to include in the payment request sent to PayPal.
|
||||
* Do not otherwise cache or store this value.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static clientMetadataID(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Please Read Docs on Future Payments at https://github.com/paypal/PayPal-iOS-SDK#future-payments
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static renderFuturePaymentUI(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* 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
|
||||
* See https://developer.paypal.com/docs/integration/direct/identity/attributes/ for more details
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static renderProfileSharingUI(scopes: string[]): Promise<any> {return; }
|
||||
}
|
||||
|
||||
export interface PayPalEnvironment {
|
||||
PayPalEnvironmentProduction: string;
|
||||
PayPalEnvironmentSandbox: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of the payment.
|
||||
*/
|
||||
amount: string;
|
||||
/**
|
||||
* The ISO 4217 currency for the payment.
|
||||
*/
|
||||
currency: string;
|
||||
/**
|
||||
* A short description of the payment.
|
||||
*/
|
||||
shortDescription: string;
|
||||
/**
|
||||
* "Sale" for an immediate payment.
|
||||
*/
|
||||
intent: string;
|
||||
/**
|
||||
* Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com,
|
||||
* for your tracking purposes.
|
||||
*/
|
||||
bnCode: string = 'PhoneGap_SP';
|
||||
/**
|
||||
* Optional invoice number, for your tracking purposes. (up to 256 characters)
|
||||
*/
|
||||
invoiceNumber: string;
|
||||
|
||||
/**
|
||||
* Optional text, for your tracking purposes. (up to 256 characters)
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Password to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPassword?: string;
|
||||
/**
|
||||
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPin?: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class PayPalConfiguration implements PayPalConfigurationOptions {
|
||||
/**
|
||||
* You use a PayPalConfiguration object to configure many aspects of how the SDK behaves.
|
||||
* see defaults for options available
|
||||
*/
|
||||
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 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} 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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PhotoViewer',
|
||||
plugin: 'com-sarriaroman-photoviewer',
|
||||
pluginRef: 'PhotoViewer',
|
||||
repo: 'https://github.com/sarriaroman/photoviewer'
|
||||
@@ -24,5 +25,5 @@ export class PhotoViewer {
|
||||
* @param options {any}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static show(url: string, title?: string, options?: {share?: boolean; }): void { }
|
||||
static show(url: string, title?: string, options?: {share?: boolean}): void { }
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PinDialog',
|
||||
plugin: 'cordova-plugin-pin-dialog',
|
||||
pluginRef: 'plugins.pinDialog',
|
||||
repo: 'https://github.com/Paldom/PinDialog'
|
||||
@@ -30,6 +31,7 @@ export class PinDialog {
|
||||
* @param {string} message Message to show the user
|
||||
* @param {string} title Title of the dialog
|
||||
* @param {string[]} buttons Buttons to show
|
||||
* @returns {Promise<{ buttonIndex: number, input1: string }>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1
|
||||
|
||||
@@ -3,8 +3,6 @@ import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
declare var $q;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -20,8 +18,8 @@ export const getPlugin = function(pluginRef: string): any {
|
||||
* @param pluginObj
|
||||
* @param method
|
||||
*/
|
||||
export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
|
||||
export const pluginWarn = function(pluginObj: any, method?: string) {
|
||||
let pluginName = pluginObj.pluginName, plugin = pluginObj.plugin;
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
} else {
|
||||
@@ -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]
|
||||
@@ -56,16 +59,39 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
} else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
|
||||
let obj: any = {};
|
||||
obj[opts.successName] = resolve;
|
||||
obj[opts.errorName] = reject;
|
||||
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);
|
||||
const setSuccessIndex = () => {
|
||||
// If we've specified a success/error index
|
||||
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) {
|
||||
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
|
||||
const setErrorIndex = () => {
|
||||
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
|
||||
if (opts.errorIndex > args.length) {
|
||||
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
|
||||
} else {
|
||||
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
|
||||
}
|
||||
};
|
||||
|
||||
if (opts.successIndex > opts.errorIndex) {
|
||||
setErrorIndex();
|
||||
setSuccessIndex();
|
||||
} else {
|
||||
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
|
||||
setSuccessIndex();
|
||||
setErrorIndex();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
// which is 90% of cases
|
||||
@@ -85,7 +111,7 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
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);
|
||||
cordovaWarn(pluginObj.pluginName, methodName);
|
||||
return {
|
||||
error: 'cordova_not_available'
|
||||
};
|
||||
@@ -101,18 +127,34 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
|
||||
}
|
||||
|
||||
function getPromise(cb) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +199,7 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
|
||||
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName);
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
@@ -184,7 +226,7 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
}
|
||||
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName);
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
@@ -214,6 +256,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.pluginName, 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
|
||||
@@ -246,7 +329,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
* @usage
|
||||
* ```typescript
|
||||
* @Plugin({
|
||||
* name: 'MyPlugin',
|
||||
* pluginName: 'MyPlugin',
|
||||
* plugin: 'cordova-plugin-myplugin',
|
||||
* pluginRef: 'window.myplugin'
|
||||
* })
|
||||
@@ -265,10 +348,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;
|
||||
};
|
||||
}
|
||||
@@ -310,41 +407,65 @@ export function CordovaInstance(opts: any = {}) {
|
||||
*
|
||||
* Before calling the original method, ensure Cordova and the plugin are installed.
|
||||
*/
|
||||
export function CordovaProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>) {
|
||||
let originalMethod = descriptor.get;
|
||||
|
||||
descriptor.get = function(...args: any[]) {
|
||||
export function CordovaProperty(target: Function, key: string) {
|
||||
let exists: Function = function(): boolean {
|
||||
if (!window.cordova) {
|
||||
cordovaWarn(this.name, null);
|
||||
return {};
|
||||
return false;
|
||||
}
|
||||
let pluginObj: any = this;
|
||||
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
||||
let pluginInstance = getPlugin(this.pluginRef);
|
||||
if (!pluginInstance) {
|
||||
pluginWarn(this, key);
|
||||
return {};
|
||||
return false;
|
||||
}
|
||||
return originalMethod.apply(this, args);
|
||||
return true;
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
Object.defineProperty(target, key, {
|
||||
get: function() {
|
||||
if (exists) {
|
||||
return this.pluginRef[key];
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
if (exists) {
|
||||
this.pluginRef[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param target
|
||||
* @param key
|
||||
* @param descriptor
|
||||
* @constructor
|
||||
*/
|
||||
export function InstanceProperty(target: any, key: string, descriptor: TypedPropertyDescriptor<any>) {
|
||||
descriptor.get = function() {
|
||||
return this._objectInstance[key];
|
||||
};
|
||||
|
||||
descriptor.set = function(...args: any[]) {
|
||||
this._objectInstance[key] = args[0];
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
export function InstanceProperty(target: any, key: string) {
|
||||
Object.defineProperty(target, key, {
|
||||
get: function(){
|
||||
return this._objectInstance[key];
|
||||
},
|
||||
set: function(value){
|
||||
this._objectInstance[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
54
src/plugins/power-management.ts
Normal file
54
src/plugins/power-management.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name PowerManagement
|
||||
* @description
|
||||
* The PowerManagement plugin offers access to the devices power-management functionality.
|
||||
* It should be used for applications which keep running for a long time without any user interaction.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {PowerManagement} from 'ionic-native';
|
||||
*
|
||||
* PowerManagement.acquire()
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PowerManagement',
|
||||
plugin: 'cordova-plugin-powermanagement-orig',
|
||||
pluginRef: 'powerManagement',
|
||||
repo: 'https://github.com/Viras-/cordova-plugin-powermanagement'
|
||||
})
|
||||
export class PowerManagement {
|
||||
/**
|
||||
* Acquire a wakelock by calling this.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static acquire(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* This acquires a partial wakelock, allowing the screen to be dimmed.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static dim(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static release(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* By default, the plugin will automatically release a wakelock when your app is paused (e.g. when the screen is turned off, or the user switches to another app).
|
||||
* It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function.
|
||||
* @param set {boolean}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setReleaseOnPause(set: boolean): Promise<any> {return; }
|
||||
}
|
||||
@@ -61,6 +61,7 @@ export interface PrintOptions {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Printer',
|
||||
plugin: 'de.appplant.cordova.plugin.printer',
|
||||
pluginRef: 'cordova.plugins.printer',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
|
||||
@@ -70,14 +71,16 @@ export class Printer {
|
||||
|
||||
/**
|
||||
* Checks whether to device is capable of printing.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Sends content to the printer.
|
||||
* @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
|
||||
* @param {options} The options to pass to the printer
|
||||
* @param content {string | HTMLElement} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
|
||||
* @param options {PrintOptions} optional. The options to pass to the printer
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
||||
|
||||
@@ -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 {
|
||||
@@ -284,9 +286,11 @@ declare var PushNotification: {
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Push',
|
||||
plugin: 'phonegap-plugin-push',
|
||||
pluginRef: 'PushNotification',
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-push'
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-push',
|
||||
install: 'ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX'
|
||||
})
|
||||
export class Push {
|
||||
|
||||
@@ -308,7 +312,7 @@ export class Push {
|
||||
* ```
|
||||
*
|
||||
* @param {PushOptions} options The Push [options](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#parameters).
|
||||
* @return {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object.
|
||||
* @returns {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
@@ -317,7 +321,7 @@ export class Push {
|
||||
|
||||
/**
|
||||
* Check whether the push notification permission has been granted.
|
||||
* @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
|
||||
* @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
|
||||
*/
|
||||
@Cordova()
|
||||
static hasPermission(): Promise<{ isEnabled: boolean }> { return; }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user