Compare commits

...

241 Commits

Author SHA1 Message Date
Ibby
debe6834ef chore(): update changelog 2016-10-14 06:06:49 -04:00
Ibby
292c8801ea Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-14 06:06:31 -04:00
william
b031ceed99 docs(camera-preview): fix repo link (#695)
Breaking link to Repo.
2016-10-14 03:06:11 -07:00
Ibby
82d4ec2738 2.2.3 2016-10-14 06:03:59 -04:00
Ibby
9c55358620 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-13 19:15:46 -04:00
Ibby
51bc5ef542 docs(ble): update docs for isEnabled
closes #665
2016-10-13 19:15:38 -04:00
Colin Frick
74a252b324 fix(googlemaps): Expose 'type' property in GoogleMapsLatLngBounds #693 (#694) 2016-10-13 16:00:15 -07:00
Ramon Henrique Ornelas
43c8592b40 style(file): fix angular style (#685) 2016-10-12 19:52:27 -07:00
Ramon Henrique Ornelas
babfb0dca3 fix(onesignal): update to match latest API version (#691) 2016-10-12 19:51:57 -07:00
Ibby
ceb4217415 chore(): update changelog 2016-10-11 21:03:52 -04:00
Ibby
798625698d 2.2.2 2016-10-11 21:03:23 -04:00
Ibby
5cfb3b033b refractor(): remove unused import 2016-10-11 21:02:53 -04:00
Ibrahim Hadeed
95d666c348 Merge pull request #682 from driftyco/fix/file
fix(file): fix writeFile method
2016-10-11 18:01:55 -07:00
Ibby
276d61bf3a fix(file): read methods can accept Blobs too 2016-10-11 20:48:53 -04:00
Ibby
397a209ad2 docs(file): improve docs 2016-10-11 20:46:05 -04:00
Ibby
d2f42ef33a fix(file): getFreeDiskSpace now works 2016-10-11 20:44:27 -04:00
Ibby
fe46907aaa docs(file): document getFreeDiskspace 2016-10-11 20:39:26 -04:00
Ibby
5c92455ee9 feat(file): getFile and getDirectory are now public
closes #657
2016-10-11 20:30:14 -04:00
Ibby
046cbe7fca chore(): update changelog 2016-10-11 20:18:33 -04:00
Ibby
32f09275aa 2.2.1 2016-10-11 20:18:17 -04:00
Ibby
542ff4cf95 feat(file): resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods
closes #657
2016-10-11 20:16:39 -04:00
Ibby
5710eb78a8 fix(file): last parameter for writeFile now only accepts options 2016-10-11 20:13:21 -04:00
Ibby
842a80d493 fix(file): fix writeFile method
addresses #464 #552 #666
2016-10-11 20:10:47 -04:00
Ibby
c2d4f1c0da fix(location-accuracy): accuracy param is number
closes #676
2016-10-11 19:35:54 -04:00
Xueron Nee
e28e5b0f5f fix(themeablebrowser): add missed options (#680) 2016-10-11 16:33:35 -07:00
Job
bff4862979 fix(diagnostic): misspelled getContactsAuthorizationStatus method (#678) 2016-10-11 16:32:24 -07:00
Ibby
6bcef44d42 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-11 09:14:22 -04:00
Ibby
69c9b6f555 docs(): set ANDROID_THEMES to private 2016-10-11 09:14:17 -04:00
Ibby
7f38cb5a16 docs(datepicker): improve docs 2016-10-11 09:13:56 -04:00
Ramon Henrique Ornelas
cf7abe110d fix(http): export via window.IonicNative (#675)
* fix(http): fix export system module

* style(http): fix angular style

* style(http): delete multiline

* chore(http): add attribute platforms to decorator Plugin

* fix(http): typo param uploadFile()

* fix(http): typo commit ba6a7e9930
2016-10-11 03:25:15 -07:00
Ibby
5b060345d2 chore(): update changelog 2016-10-11 04:30:55 -04:00
Ibby
1784036ef7 chore(): update changelog 2016-10-11 04:22:46 -04:00
Ibby
7a8577007c 2.2.0 2016-10-11 04:19:02 -04:00
Ibrahim Hadeed
7c6e6d8b6b fix(onesignal): update to match latest api (#671)
closes #667
2016-10-11 01:12:43 -07:00
Ramon Henrique Ornelas
c5fd83ddb6 style(onesignal): add semicolon fix lint (#672) 2016-10-11 01:12:32 -07:00
Ramon Henrique Ornelas
7b2fe69c7c docs(camera-preview): change repo no longer maintaned fix #360
* docs(camera-preview): change repo no longer maintaned  fix #360

* refactor(camera-preview): delete dead code
2016-10-11 01:11:05 -07:00
Ibrahim Hadeed
f0961c7b23 feat(http): add cordovaHTTP wrapper (#674) 2016-10-11 01:06:41 -07:00
Ibby
35c8bbd49e fix(native-transitions): add missing interface properties 2016-10-10 20:50:10 -04:00
Ibby
1a343c1ea5 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-10 20:10:43 -04:00
Ibby
4fef8ff326 refractor(onesignal): add OneSignalNotification interface 2016-10-10 20:10:14 -04:00
Xueron Nee
13681756ae fix(thmeable-browser): fix the name of the plugin (#663) 2016-10-09 04:33:54 -04:00
Ibby
4a798281e4 chore(): update changelog 2016-10-08 20:57:54 -04:00
Ibby
79670b7878 2.1.9 2016-10-08 20:57:47 -04:00
Ibby
720084578d fix(paypal): add optional details param to paypalpayment 2016-10-08 20:44:32 -04:00
Patrick Bußmann
3dd6a92ccf fix(paypal): problems with selection of PayPal environment (#662)
* Fixed bugs with selection of environment and added missing prepareToRender function

* Updated PayPal usage example
2016-10-08 20:34:27 -04:00
Ramon Henrique Ornelas
7d1686ef93 refactor(googlemaps): throw warnings plugin_not_installed (#655)
* refactor(googlemaps): adjust imports to warnings console and delete @author comments

* refactor(googlemaps): throw warnings plugin_not_installed

* refactor(googlemaps): delete warnings of the methods added Promise.reject case plugin_not_instalet
2016-10-08 20:29:53 -04:00
Ibby
b40b0fff98 chore(): update changelog 2016-10-08 18:50:49 -04:00
Ibby
4dba0580ac 2.1.8 2016-10-08 18:50:36 -04:00
Ibby
11653ce752 fix(googlemaps): fixes GoogleMapsLatLng class
closes 658
2016-10-08 18:48:28 -04:00
Ramon Henrique Ornelas
d3e6f3ba41 refactor(plugin): improvement pull #654 (#661) 2016-10-08 15:07:01 -04:00
Thiery Laverdure
2c6cc37a5f docs(calendar): fix typo (#660) 2016-10-08 14:54:02 -04:00
Ibby
4c7defb2ec chore(): update changelog 2016-10-06 20:38:32 -04:00
Ibby
2da02e6d46 2.1.7 2016-10-06 20:38:21 -04:00
Ibby
7a91c87a72 test(): sync methods no longer get resolve/reject 2016-10-06 20:37:41 -04:00
Patrick Bußmann
598f8a9e7c fix(paypal): fixed currency code not found issue (#653) 2016-10-06 20:34:45 -04:00
ziggyJ
6f0f02bb66 fix google maps setPadding not working issue #573 (#654) 2016-10-06 20:33:42 -04:00
Ramon Henrique Ornelas
e4bde77bd4 chore(): deleted ionic-gulp-tslint change for gulp-tslint directly (#611) 2016-10-06 00:37:34 -04:00
Ibby
c24b331866 chore(): update changelog 2016-10-06 00:27:24 -04:00
Ibby
4ac348bd0f 2.1.6 2016-10-06 00:27:04 -04:00
Ibby
f0026572e7 fix(paypal): fix helper classes 2016-10-06 00:26:59 -04:00
Ibby
e30ccabf7b 2.1.5 2016-10-05 23:19:55 -04:00
Ibby
6b286db51a chore(): add successIndex at the correct position if we have optional params 2016-10-05 23:19:45 -04:00
Ibby
d79d62bfa0 docs(hotspot): remove unecessary doc tags 2016-10-05 22:46:22 -04:00
Ibby
2bdd3a3868 chore(): update changelog 2016-10-05 22:43:59 -04:00
Ibby
09d481e1d6 2.1.4 2016-10-05 22:43:31 -04:00
Ibby
6f23bef5d1 fix(google-analytics): specify successIndex and errorIndex for methods with optional params 2016-10-05 22:43:20 -04:00
Ibby
84f54d64aa chore(): update changelog 2016-10-05 22:42:35 -04:00
Ibby
c9ddec3bb5 2.1.3 2016-10-05 22:36:10 -04:00
Ibby
f62e1081e1 fix(google-analytics): add newSession param 2016-10-05 22:35:52 -04:00
Ibby
7dba41cbe1 docs(google-analytics): add missing docs 2016-10-05 22:30:40 -04:00
Ibby
77b0277290 fix(google-analytics): add missing methods, fix return types 2016-10-05 22:27:28 -04:00
Ibby
40325cad9f fix(google-analytics): fix depreciated plugin reference 2016-10-05 22:20:55 -04:00
Ibby
ab5bbae2f6 chore(): update changelog 2016-10-05 21:04:04 -04:00
Ibby
5da746d2fc 2.1.2 2016-10-05 21:03:06 -04:00
Ibby
72a694a5e1 fix(googlemaps): add missing properties
should fix #642
2016-10-05 20:43:57 -04:00
Andrew Cole
1ab0d2f915 Changed confusing sentence structure. (#644)
Reading the document on which destination type, without commas leads to confusing behaviour.
2016-10-05 20:33:31 -04:00
Ramon Henrique Ornelas
083118aff4 docs(background-geolocation): exports interfaces to template dgeni (#640) 2016-10-05 20:33:13 -04:00
Ramon Henrique Ornelas
ad373c93ae docs(paypal): delete ':' of the params (#639) 2016-10-05 20:32:47 -04:00
Ramon Henrique Ornelas
ac301c284f docs(one-signal): fix types params (#638) 2016-10-05 20:32:29 -04:00
Ramon Henrique Ornelas
1e0509da98 docs(paypal): fix typo name interface (#637) 2016-10-05 20:32:12 -04:00
Ibrahim Hadeed
ad3bef2e5a chore(): fix module export conflicts (#633)
* chore(): fix module export conflicts

* remove export{}

* resolve conflicting export names
2016-10-05 20:29:40 -04:00
AndreasGassmann
bbbbb3e8d0 feat(zBar): add zBar barcode scanner plugin (#634) 2016-10-04 15:12:39 -04:00
Ibby
0bc73e525d docs(contacts): improve docs 2016-10-04 13:59:32 -04:00
Ibby
7ababc4d67 docs(googlemaps): remove related interface untill they're well documented 2016-10-04 13:47:28 -04:00
Ibrahim Hadeed
6ff8f03ef0 docs(): docs now display interfaces and related classes
document interfaces + other classes
2016-10-04 13:46:55 -04:00
Ibby
010a6ea304 docs(geolocation): add error handling and related interfaces 2016-10-04 13:45:54 -04:00
perry
973c80b264 docs(pay-pal): interfaces dont’ need to be marked private if their corresponding var is 2016-10-03 17:06:40 -05:00
Ibby
b5f9ba588a 2.1.1 2016-10-03 17:38:47 -04:00
Ibby
c5724fdc4e chore(): fix main and typings paths 2016-10-03 17:38:42 -04:00
Ibby
ebda055444 chore(): update changelog 2016-10-03 17:05:21 -04:00
Ibby
7cf9bd8e5e 2.1.0 2016-10-03 17:04:49 -04:00
Ibrahim Hadeed
ce710117f7 fix(paypal): fix typings, add PayPalItem and PayPalPaymentDetails
fix(paypal): fix typings, add PayPalItem and PayPalPaymentDetails
2016-10-03 16:57:33 -04:00
Ibby
fcda04acf1 add missing docs 2016-10-03 16:56:15 -04:00
Ibby
83ac4c7bbe more docs 2016-10-03 16:51:57 -04:00
Ibrahim Hadeed
2be7872cd6 docs(LocationAccuracy): fixes typo
docs(LocationAccuracy): fixes typo
2016-10-03 14:16:15 -04:00
Ibrahim Hadeed
97a7f1a4e7 docs(googlemaps): change observable to promise in main docs (#624)
GoogleMaps.one() returns Promise not Observable
2016-10-03 14:15:56 -04:00
Nakul Gulati
e9e37f33f9 Changed observable to promise in docs
GoogleMaps.one() returns Promise not Observable
2016-10-03 18:50:40 +05:30
Manu Mtz.-Almeida
344ce11a3e docs(LocationAccuracy): fixes typo 2016-10-03 14:26:13 +02:00
Ibby
7fcd1f85a3 docs(paypal): add related interfaces 2016-10-03 03:18:54 -04:00
Ibby
5d13ba03d8 fix(paypal): fix typings, add PayPalItem and PayPalPaymentDetails 2016-10-03 03:14:51 -04:00
Tomas Beran
a99b753d2d feat(stepcounter): add stepcounter plugin (#607)
* feat(stepcounter): add stepcounter plugin

* docs(stepcounter): add missing returns
2016-10-02 18:20:01 -04:00
Ramon Henrique Ornelas
8f26f4b3ef chore(): move templates of the root folder to scripts/templates similar to Ionic (#612) 2016-10-02 18:19:24 -04:00
Ramon Henrique Ornelas
624bc1d9b5 style(media): fix angular style (#614) 2016-10-01 16:15:58 -04:00
Ramon Henrique Ornelas
0a07bef2d2 chore(): move CONTRIBUTING to .github/CONTRIBUTING (#613) 2016-10-01 16:15:32 -04:00
Ibby
96bb4d38dc chore(media): remove unused import, ensure plugin is installed 2016-10-01 15:19:16 -04:00
Ibby
58a99a14d5 fix(media): add status as a parmeter instead of property of instance 2016-10-01 15:05:08 -04:00
Tom Zöhner
66e9e46458 feat(googlemaps): support bounds in Geocoder (#599) 2016-09-29 11:52:14 -04:00
Gianfranco Palumbo
d6060a95d7 fix(power-management): fix repo and pluginref (#603)
Fixes the link that is generated in the docs here
http://ionicframework.com/docs/v2/native/powermanagement/
2016-09-28 17:56:27 -04:00
Chris Maissan
80ff2f3bfa fix(calendar): fixed modifyEventWithOptions and related interface
* Fixed Calendar modifyEventWithOptions method

* Updated comments
2016-09-28 13:54:19 -04:00
Steve Sanders
16f05c3b0d fix(push): Add support for passing notification id into finish (#600) 2016-09-28 13:51:03 -04:00
Hoisel
2ed84b1b71 fix(social-sharing): shareWithOptions method signature (#598)
Fix shareWithOptions method signature, replacing 'options.file' property with 'options.files' to match social sharing plugin [method interface](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209)
2016-09-27 14:00:01 -04:00
Daniel Leal
8d21f5f225 fix(googlemaps): CameraPosition target can now be GoogleMapsLatLng[] (#587) 2016-09-27 10:51:43 -04:00
SylvainGuittard
be2c198259 fix(googlemaps): typo in GoogleMapsTileOverlayOptions (#589) 2016-09-27 10:51:04 -04:00
Ibrahim Hadeed
dde011c8f6 document interfaces + other classes 2016-09-27 10:46:41 -04:00
Max Lynch
47112c7c24 feat(plugin): checkInstall w/ warning msg 2016-09-25 18:17:09 -05:00
Ramon Henrique Ornelas
1b87af86bf docs(emailcompposer): change repo #568 (#584) 2016-09-25 19:01:39 -04:00
Max Lynch
d45a2b5407 feat(plugin): add getPlugin to plugin interface. Fixes #582 2016-09-25 17:59:56 -05:00
Ibrahim Hadeed
49bf9b7cc5 docs(ble): add return docs for startScanWithOptions 2016-09-25 18:44:29 -04:00
Ibrahim Hadeed
79f0a3fc7b feat(ble): add startScanWithOptions
closes #539
2016-09-25 18:36:00 -04:00
Ibrahim Hadeed
60b7c7469a feat(location-accuracy): add location accuracy plugin (#583)
closes #484
2016-09-25 18:28:22 -04:00
Ibrahim Hadeed
c377489aba chore(): add license 2016-09-25 17:59:21 -04:00
Ibrahim Hadeed
8bb22fb576 fix badges 2016-09-25 17:58:32 -04:00
Ibrahim Hadeed
310e0942fd fix badges 2016-09-25 17:58:13 -04:00
Ibrahim Hadeed
df06a24746 fix badges 2016-09-25 17:57:38 -04:00
Ibrahim Hadeed
b9151bc062 feat(themable-browser): add ThemableBrowser plugin
closes #549
2016-09-25 17:55:13 -04:00
Ibrahim Hadeed
972d63b2d2 feat(themable-browser): add ThemableBrowser plugin
closes #549
2016-09-25 17:53:17 -04:00
Ibrahim Hadeed
440786a4f7 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-09-25 17:00:11 -04:00
Ibrahim Hadeed
3a6ec05bef style(googlemaps): remove unecessary new lines 2016-09-25 16:55:17 -04:00
Ramon Henrique Ornelas
c5733326a9 fix(isdebug): export IsDebug class (#578) 2016-09-25 15:42:31 -04:00
Ibrahim Hadeed
f36b1c03cb refractor(googlemaps): fix typo in GoogleMapsTileOverlayOptions 2016-09-25 15:29:03 -04:00
Max Lynch
3266d21ba4 chore(changelog): update changelog 2016-09-24 17:33:37 -05:00
Max Lynch
62f1504514 vBump 2016-09-24 17:30:07 -05:00
Max Lynch
f60d08b7a4 feat(plugin): cordova function override. fixes #437 2016-09-24 17:26:23 -05:00
Max Lynch
a092a31a1e feat(emailcomposer): use new supported plugin. #568 2016-09-24 16:00:44 -05:00
Max Lynch
6407518892 Add back erroneous exports 2016-09-24 15:44:28 -05:00
Max Lynch
e7e45f608c feat(npm): typescript 2.0.2 2016-09-24 15:41:07 -05:00
Max Lynch
c175badab6 Merge pull request #561 from krizroring/master
Extension of the BackgroundGeolocation plugin
2016-09-24 15:40:59 -05:00
Max Lynch
05783be9ac Merge pull request #574 from ramonornela/fix_style
style(inapppurchase): fix angular style
2016-09-24 15:36:48 -05:00
Ramon Ornelas
6948eabc96 style(inapppurchase): fix angular style 2016-09-24 09:39:31 -03:00
Max Lynch
48196da281 feat(push): add coldstart property. Fixes #559 2016-09-22 20:43:51 -05:00
Max Lynch
a0b6b1084b fix(webintent): add type param. Fixes #564 2016-09-22 20:37:36 -05:00
Max Lynch
4292959c87 fix(plugins): export VideoPlayer. Fixes #563 2016-09-22 20:35:19 -05:00
Max Lynch
e50b961bf9 fix(npm): duplicate typings 2016-09-22 15:10:44 -05:00
Max Lynch
0ba3957e8a chore(npm): proper 2.0.0 typescript 2016-09-22 13:59:20 -05:00
Max Lynch
c33842f8f0 chore(npm): proper 2.0.0 typescript 2016-09-22 13:58:57 -05:00
Max Lynch
f87237852f chore(npm): bump to 1.3.27 2016-09-22 13:39:51 -05:00
Max Lynch
bfb63a77a2 chore(npm): bump to 1.3.26 2016-09-22 13:37:01 -05:00
Max Lynch
b1ca6af2c3 add typings for old release 2016-09-22 13:36:38 -05:00
Max Lynch
2f20deacf2 Revert "Bump to 2.0.0 typescript"
This reverts commit de1086b894.
2016-09-22 13:36:27 -05:00
Max Lynch
de1086b894 Bump to 2.0.0 typescript 2016-09-22 13:25:16 -05:00
Max Lynch
6a19c8cf48 fix(ts): use old ts version for 1.3.x #567 2016-09-22 13:11:56 -05:00
Max Lynch
b6b0359fcf fixing package.json publish 2016-09-21 15:12:27 -05:00
Max Lynch
bb0d81a4e9 vBump 2016-09-21 15:10:44 -05:00
Max Lynch
4014972feb feat(build): Support ES2015 modules 2016-09-21 15:04:46 -05:00
Max Lynch
3903fee2bf feat(scripts): publish script with npm and bower. Fixes #448 2016-09-21 11:02:32 -05:00
Christian Roring
31706867c7 feat(BackgroundGeolocation): code cleanup 2016-09-20 14:00:57 +02:00
Christian Roring
808a75e41c feat(BackgroundGeolocation): Update to the latest version 2016-09-20 13:07:01 +02:00
Christian Roring
919e8dae30 feat(BackgroundGeolocation): Update to the latest version 2016-09-20 12:36:56 +02:00
Ibrahim Hadeed
763ad1bdb0 fix(call-number): number should be a string
closes #545
2016-09-19 18:20:51 -04:00
Ibrahim Hadeed
281575b961 feat(background-geolocation): add showAppSettings function
closes #548
2016-09-19 18:18:53 -04:00
Ibrahim Hadeed
42d1bbc7a8 docs(camera): add return type to cleanup
closes #550
2016-09-19 18:14:51 -04:00
Jay Cambron
a28667e751 docs(background-geolocation): add notice (#534) 2016-09-19 18:00:58 -04:00
Attila Oláh
505ff189d9 chore(market): add missing plugin name (#557) 2016-09-19 17:58:37 -04:00
Daniel Imhoff
35c37c2d9e chore(build): rename to more explicit tsconfig-es5.json 2016-09-14 14:13:14 -05:00
Daniel Imhoff
efbd11676f put tsc output into dist/es5, not just dist/ 2016-09-14 13:35:45 -05:00
Daniel Imhoff
abf3335415 'npm run' runs with node_modules/.bin in path 2016-09-14 13:25:50 -05:00
Andrew Mitchell
c83b0437fa feat(localNotifications): added register and has permission functions (#536) 2016-09-13 08:10:14 -04:00
Ibrahim Hadeed
23fc908eb6 fix(googlemaps): CameraPosition target can now be LatLngBounds
closes #547
2016-09-13 06:17:07 -04:00
Daniel Imhoff
9d35567cb5 Fix import to use @reactivex/rxjs 2016-09-09 14:45:24 -05:00
Max Lynch
7f77b8f069 Package 2016-09-09 09:50:13 -05:00
mhartington
410b3d261f docs(localNotification): update docs 2016-09-07 12:44:35 -04:00
Max Lynch
d8baf3a814 Merge pull request #524 from mattlewis92/ng1-promise-tweak
fix(ng1): fail gracefully when angular 1 promises can't be retrieved
2016-09-07 10:07:53 -05:00
Ibrahim Hadeed
c36b0a6b3f chore(): update changelog 2016-09-06 23:38:15 -04:00
Ibrahim Hadeed
3385a46648 1.3.21 2016-09-06 23:37:58 -04:00
Ibrahim Hadeed
550b8289c9 reafractor(file): add types to promises 2016-09-06 23:33:51 -04:00
Ibrahim Hadeed
2aa998f66f docs(googlemaps): improve usage 2016-09-06 23:23:51 -04:00
Ibrahim Hadeed
dff034a5b6 feat(googlemaps): can pass HTMLElement to constructor 2016-09-06 23:23:06 -04:00
Ibrahim Hadeed
c407b6d4f0 docs(googlemaps): improve usage 2016-09-06 23:21:29 -04:00
Ibrahim Hadeed
58c9439a32 docs(camera-preview): add usage
closes #363
2016-09-06 23:12:35 -04:00
Ibrahim Hadeed
c75f89894a fix(): remove CanvasCamera plugin 2016-09-06 23:04:53 -04:00
Ibrahim Hadeed
a566240266 fix(media): nest the constructor logic 2016-09-06 23:02:46 -04:00
Ibrahim Hadeed
d03d70ff0b fix(googlemaps): moveCamera and animateCamera now return a Promise
closes #511
2016-09-06 22:28:56 -04:00
Ibrahim Hadeed
7910493a6c fix(file): set exclusive to true when replace is false
closes #516
2016-09-06 22:24:34 -04:00
Ibrahim Hadeed
c76de34b97 fix(social-sharing): shareViaEmail now resolves/rejects when not providing optional args 2016-09-06 22:22:38 -04:00
Ibrahim Hadeed
ddae67913d chore(): lint 2016-09-06 21:59:58 -04:00
Ramon Henrique Ornelas
4f9716415b fix(social-sharing): various fixes (#520)
* feat(socialsharing): add method shareVia()

* docs(socialsharing): fix docs params Types

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

* docs(socialsharing): shareVia()

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

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

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

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

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

* style(crop): fix angular style

* style(file-chooser): fix angular style

* style(file-opener): fix angular style

* style(file): fix angular style

* style(inappbrowser): fix angular style

* style(instagram): fix angular style

* style(is-debug): fix angular style

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

* style(market): fix angular style

* style(music-controls): fix angular style

* style(nfc): fix angular style

* style(pay-pal): fix angular style

* style(power-management): fix angular style

* style(securestorage): fix angular style

* style(streaming-media): fix angular style

* style(video-editor): fix angular style

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

* style(mixpanel): Match editorconfig
2016-08-29 10:58:00 -04:00
Guille
cb176aae90 fix(diagnostic): Fix diagnostic objects 2016-08-29 16:50:28 +02:00
Guille
9d573a92ce fix(diagnostic): Add DENIED_ALWAYS to permissionStatus, also some code formatting 2016-08-29 14:59:43 +02:00
Guillermo
877ac27868 fix(install-instructions): This fixes install instructions for deeplinks, facebook and googlemaps (#499) 2016-08-27 15:20:51 -04:00
Ibrahim Hadeed
9c8321d3b4 chore(): update changelog 2016-08-27 15:09:38 -04:00
Ibrahim Hadeed
e8bfb77b3d 1.3.20 2016-08-27 15:09:19 -04:00
Ibrahim Hadeed
87ab8980b2 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-08-27 14:56:45 -04:00
Ibrahim Hadeed
13de69080a refractor(): use es6 features
tor-es6'
2016-08-27 14:56:34 -04:00
Ibrahim Hadeed
8d439ff0cf fix merge conflicts 2016-08-27 14:55:37 -04:00
Guillermo
f6d5ac4621 fix(GoogleMaps): Fixes #452 (#498) 2016-08-27 14:50:49 -04:00
Ibrahim Hadeed
f37a40e138 remove duplicate identifier 2016-08-27 14:46:05 -04:00
Ibrahim Hadeed
21d8122257 feat(file-opener): add file opener support (#497)
closes #295
2016-08-27 14:43:57 -04:00
Ibrahim Hadeed
0cf7d6aca1 feat(youtube): add Youtube video player plugin support (#496) 2016-08-27 14:35:18 -04:00
Ibrahim Hadeed
94a7dae863 feat(file-chooser): add file chooser plugin support (#495) 2016-08-27 14:35:12 -04:00
Ibrahim Hadeed
4e9bc95fff feat(music-controls): add music controls plugin support (#494) 2016-08-27 14:35:06 -04:00
Ibrahim Hadeed
ad57733daf feat(canvas-camera): add CanvasCamera support 2016-08-27 14:15:15 -04:00
Ibrahim Hadeed
f4acc35cba chore(): fix plugin:create 2016-08-27 14:02:29 -04:00
Ibrahim Hadeed
f2cf1d4e03 chore(): add minimal template 2016-08-27 13:03:39 -04:00
Ibrahim Hadeed
b91740a91a docs(): add private to extra classes 2016-08-27 12:33:02 -04:00
Ibrahim Hadeed
a006cdb77b chore(): update changelog 2016-08-27 02:12:47 -04:00
Ibrahim Hadeed
c93d95132d 1.3.19 2016-08-27 02:11:09 -04:00
Ibrahim Hadeed
dd0c9baffd fix(mixpanel): implement CordovaProperty correctly 2016-08-27 02:10:50 -04:00
Ibrahim Hadeed
661276467c refractor(streaming-media): refractor to resolve duplicate 2016-08-27 02:08:16 -04:00
Ibrahim Hadeed
cf8e3420c0 feat(mixpanel): add mixpanel support (#492) 2016-08-27 02:05:35 -04:00
Ibrahim Hadeed
9fe5c196aa feat(paypal): add PayPal support (#491) 2016-08-27 02:04:11 -04:00
Ibrahim Hadeed
76aa8a6494 feat(nfc): add nfc support (#493)
* feat(nfc): add nfc plugin

addresses #412

* feat(nfc): add nfc support
2016-08-27 02:03:06 -04:00
Ibrahim Hadeed
9bcc4ed80f feat(market): add Market plugin support (#490) 2016-08-27 02:02:30 -04:00
Ibrahim Hadeed
cd82a5393e feat(power-management): add power management support (#489) 2016-08-27 02:02:23 -04:00
Ibrahim Hadeed
00d87dba98 feat(native-page-transitions): add support for Native Page Transitions plugin (#488) 2016-08-27 02:02:13 -04:00
Ibrahim Hadeed
759f8ef910 feat(call-number): add support for CallNumber plugin (#487) 2016-08-27 02:02:07 -04:00
Ibrahim Hadeed
841b242fb9 feat(streaming-media): add streaming media support (#486) 2016-08-27 02:01:59 -04:00
Ibrahim Hadeed
ae03d7237e Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-08-26 13:48:06 -04:00
Ibrahim Hadeed
ff64c6e363 docs(diagnostic): add return types to docs 2016-08-26 13:14:13 -04:00
Alex Muramoto
820e4d78bf docs(geofence): remove code comments (#483) 2016-08-26 13:09:12 -04:00
Ibrahim Hadeed
c7a5f7d023 docs(): add description tag 2016-08-26 13:08:13 -04:00
Matt Lewis
f2bf2b5626 refactor: use es6 features in index file 2016-08-19 08:34:12 +01:00
78 changed files with 4984 additions and 1260 deletions

View File

@@ -1,3 +1,288 @@
<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)
* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175))
### Features
* **http:** add cordovaHTTP wrapper ([#674](https://github.com/driftyco/ionic-native/issues/674)) ([f0961c7](https://github.com/driftyco/ionic-native/commit/f0961c7))
<a name="2.1.9"></a>
## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.8...v2.1.9) (2016-10-09)
### Bug Fixes
* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845))
* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92))
<a name="2.1.8"></a>
## [2.1.8](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.8) (2016-10-08)
### Bug Fixes
* **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce))
<a name="2.1.7"></a>
## [2.1.7](https://github.com/driftyco/ionic-native/compare/v2.1.6...v2.1.7) (2016-10-07)
### Bug Fixes
* **paypal:** fixed currency code not found issue ([#653](https://github.com/driftyco/ionic-native/issues/653)) ([598f8a9](https://github.com/driftyco/ionic-native/commit/598f8a9))
<a name="2.1.6"></a>
## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.5...v2.1.6) (2016-10-06)
### Bug Fixes
* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657))
<a name="2.1.5"></a>
## [2.1.5](https://github.com/driftyco/ionic-native/compare/v2.1.4...v2.1.5) (2016-10-06)
<a name="2.1.4"></a>
## [2.1.4](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.4) (2016-10-06)
### Bug Fixes
* **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef))
<a name="2.1.3"></a>
## [2.1.3](https://github.com/driftyco/ionic-native/compare/v2.1.2...v2.1.3) (2016-10-06)
### Bug Fixes
* **google-analytics:** add missing methods, fix return types ([77b0277](https://github.com/driftyco/ionic-native/commit/77b0277))
* **google-analytics:** add newSession param ([f62e108](https://github.com/driftyco/ionic-native/commit/f62e108))
* **google-analytics:** fix depreciated plugin reference ([40325ca](https://github.com/driftyco/ionic-native/commit/40325ca))
<a name="2.1.2"></a>
## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.1...v2.1.2) (2016-10-06)
### Bug Fixes
* **googlemaps:** add missing properties ([72a694a](https://github.com/driftyco/ionic-native/commit/72a694a)), closes [#642](https://github.com/driftyco/ionic-native/issues/642)
### Features
* **zBar:** add zBar barcode scanner plugin ([#634](https://github.com/driftyco/ionic-native/issues/634)) ([bbbbb3e](https://github.com/driftyco/ionic-native/commit/bbbbb3e))
<a name="2.1.1"></a>
## [2.1.1](https://github.com/driftyco/ionic-native/compare/v2.1.0...v2.1.1) (2016-10-03)
<a name="2.1.0"></a>
# [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03)
### Bug Fixes
* **calendar:** fixed modifyEventWithOptions and related interface ([80ff2f3](https://github.com/driftyco/ionic-native/commit/80ff2f3))
* **googlemaps:** CameraPosition target can now be GoogleMapsLatLng[] ([#587](https://github.com/driftyco/ionic-native/issues/587)) ([8d21f5f](https://github.com/driftyco/ionic-native/commit/8d21f5f))
* **googlemaps:** typo in GoogleMapsTileOverlayOptions ([#589](https://github.com/driftyco/ionic-native/issues/589)) ([be2c198](https://github.com/driftyco/ionic-native/commit/be2c198))
* **isdebug:** export IsDebug class ([#578](https://github.com/driftyco/ionic-native/issues/578)) ([c573332](https://github.com/driftyco/ionic-native/commit/c573332))
* **media:** add status as a parmeter instead of property of instance ([58a99a1](https://github.com/driftyco/ionic-native/commit/58a99a1))
* **paypal:** fix typings, add PayPalItem and PayPalPaymentDetails ([5d13ba0](https://github.com/driftyco/ionic-native/commit/5d13ba0))
* **power-management:** fix repo and pluginref ([#603](https://github.com/driftyco/ionic-native/issues/603)) ([d6060a9](https://github.com/driftyco/ionic-native/commit/d6060a9))
* **push:** Add support for passing notification id into finish ([#600](https://github.com/driftyco/ionic-native/issues/600)) ([16f05c3](https://github.com/driftyco/ionic-native/commit/16f05c3))
* **social-sharing:** shareWithOptions method signature ([#598](https://github.com/driftyco/ionic-native/issues/598)) ([2ed84b1](https://github.com/driftyco/ionic-native/commit/2ed84b1)), closes [/github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209](https://github.com//github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java/issues/L209)
### Features
* **ble:** add startScanWithOptions ([79f0a3f](https://github.com/driftyco/ionic-native/commit/79f0a3f)), closes [#539](https://github.com/driftyco/ionic-native/issues/539)
* **googlemaps:** support bounds in Geocoder ([#599](https://github.com/driftyco/ionic-native/issues/599)) ([66e9e46](https://github.com/driftyco/ionic-native/commit/66e9e46))
* **location-accuracy:** add location accuracy plugin ([#583](https://github.com/driftyco/ionic-native/issues/583)) ([60b7c74](https://github.com/driftyco/ionic-native/commit/60b7c74)), closes [#484](https://github.com/driftyco/ionic-native/issues/484)
* **plugin:** add getPlugin to plugin interface. Fixes [#582](https://github.com/driftyco/ionic-native/issues/582) ([d45a2b5](https://github.com/driftyco/ionic-native/commit/d45a2b5))
* **plugin:** checkInstall w/ warning msg ([47112c7](https://github.com/driftyco/ionic-native/commit/47112c7))
* **stepcounter:** add stepcounter plugin ([#607](https://github.com/driftyco/ionic-native/issues/607)) ([a99b753](https://github.com/driftyco/ionic-native/commit/a99b753))
* **themable-browser:** add ThemableBrowser plugin ([b9151bc](https://github.com/driftyco/ionic-native/commit/b9151bc)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
* **themable-browser:** add ThemableBrowser plugin ([972d63b](https://github.com/driftyco/ionic-native/commit/972d63b)), closes [#549](https://github.com/driftyco/ionic-native/issues/549)
<a name="2.0.3"></a>
## [2.0.3](https://github.com/driftyco/ionic-native/compare/v1.3.21...v2.0.3) (2016-09-24)
### Bug Fixes
* **call-number:** number should be a string ([763ad1b](https://github.com/driftyco/ionic-native/commit/763ad1b)), closes [#545](https://github.com/driftyco/ionic-native/issues/545)
* **googlemaps:** CameraPosition target can now be LatLngBounds ([23fc908](https://github.com/driftyco/ionic-native/commit/23fc908)), closes [#547](https://github.com/driftyco/ionic-native/issues/547)
* **npm:** duplicate typings ([e50b961](https://github.com/driftyco/ionic-native/commit/e50b961))
* **plugins:** export VideoPlayer. Fixes [#563](https://github.com/driftyco/ionic-native/issues/563) ([4292959](https://github.com/driftyco/ionic-native/commit/4292959))
* **ts:** use old ts version for 1.3.x [#567](https://github.com/driftyco/ionic-native/issues/567) ([6a19c8c](https://github.com/driftyco/ionic-native/commit/6a19c8c))
* **webintent:** add type param. Fixes [#564](https://github.com/driftyco/ionic-native/issues/564) ([a0b6b10](https://github.com/driftyco/ionic-native/commit/a0b6b10))
### Features
* **background-geolocation:** add showAppSettings function ([281575b](https://github.com/driftyco/ionic-native/commit/281575b)), closes [#548](https://github.com/driftyco/ionic-native/issues/548)
* **BackgroundGeolocation:** code cleanup ([3170686](https://github.com/driftyco/ionic-native/commit/3170686))
* **BackgroundGeolocation:** Update to the latest version ([808a75e](https://github.com/driftyco/ionic-native/commit/808a75e))
* **BackgroundGeolocation:** Update to the latest version ([919e8da](https://github.com/driftyco/ionic-native/commit/919e8da))
* **build:** Support ES2015 modules ([4014972](https://github.com/driftyco/ionic-native/commit/4014972))
* **emailcomposer:** use new supported plugin. [#568](https://github.com/driftyco/ionic-native/issues/568) ([a092a31](https://github.com/driftyco/ionic-native/commit/a092a31))
* **localNotifications:** added register and has permission functions ([#536](https://github.com/driftyco/ionic-native/issues/536)) ([c83b043](https://github.com/driftyco/ionic-native/commit/c83b043))
* **npm:** typescript 2.0.2 ([e7e45f6](https://github.com/driftyco/ionic-native/commit/e7e45f6))
* **plugin:** cordova function override. fixes [#437](https://github.com/driftyco/ionic-native/issues/437) ([f60d08b](https://github.com/driftyco/ionic-native/commit/f60d08b))
* **push:** add coldstart property. Fixes [#559](https://github.com/driftyco/ionic-native/issues/559) ([48196da](https://github.com/driftyco/ionic-native/commit/48196da))
* **scripts:** publish script with npm and bower. Fixes [#448](https://github.com/driftyco/ionic-native/issues/448) ([3903fee](https://github.com/driftyco/ionic-native/commit/3903fee))
<a name="1.3.21"></a>
## [1.3.21](https://github.com/driftyco/ionic-native/compare/v1.3.20...v1.3.21) (2016-09-07)
### Bug Fixes
* **base64togallery:** fixes callbacks ([#513](https://github.com/driftyco/ionic-native/issues/513)) ([1db1374](https://github.com/driftyco/ionic-native/commit/1db1374))
* **diagnostic:** Add DENIED_ALWAYS to permissionStatus, also some code formatting ([9d573a9](https://github.com/driftyco/ionic-native/commit/9d573a9))
* **diagnostic:** Fix diagnostic objects ([cb176aa](https://github.com/driftyco/ionic-native/commit/cb176aa))
* **diagnostic:** Fix permissionStatus object ([8f3d36f](https://github.com/driftyco/ionic-native/commit/8f3d36f))
* **diagnostic:** Fix typo ([f93f958](https://github.com/driftyco/ionic-native/commit/f93f958))
* **file:** set exclusive to true when replace is false ([7910493](https://github.com/driftyco/ionic-native/commit/7910493)), closes [#516](https://github.com/driftyco/ionic-native/issues/516)
* **geolocation:** retain Observable even during an error condition ([#532](https://github.com/driftyco/ionic-native/issues/532)) ([26dead9](https://github.com/driftyco/ionic-native/commit/26dead9))
* **googlemaps:** moveCamera and animateCamera now return a Promise ([d03d70f](https://github.com/driftyco/ionic-native/commit/d03d70f)), closes [#511](https://github.com/driftyco/ionic-native/issues/511)
* **install-instructions:** This fixes install instructions for deeplinks, facebook and googlemaps ([#499](https://github.com/driftyco/ionic-native/issues/499)) ([877ac27](https://github.com/driftyco/ionic-native/commit/877ac27))
* **media:** nest the constructor logic ([a566240](https://github.com/driftyco/ionic-native/commit/a566240))
* **mixpanel:** Make eventProperties optional ([#501](https://github.com/driftyco/ionic-native/issues/501)) ([51364f8](https://github.com/driftyco/ionic-native/commit/51364f8))
* **ng1:** fail gracefully when angular 1 promises can't be retrieved ([d135dc2](https://github.com/driftyco/ionic-native/commit/d135dc2))
* **ng1:** grab injector from app. [#451](https://github.com/driftyco/ionic-native/issues/451) ([2dc68a4](https://github.com/driftyco/ionic-native/commit/2dc68a4))
* remove CanvasCamera plugin ([c75f898](https://github.com/driftyco/ionic-native/commit/c75f898))
* **social-sharing:** shareViaEmail now resolves/rejects when not providing optional args ([c76de34](https://github.com/driftyco/ionic-native/commit/c76de34))
* **social-sharing:** various fixes ([#520](https://github.com/driftyco/ionic-native/issues/520)) ([4f97164](https://github.com/driftyco/ionic-native/commit/4f97164))
### Features
* **file:** adds chunked blob writing ([#529](https://github.com/driftyco/ionic-native/issues/529)) ([bbbd0d5](https://github.com/driftyco/ionic-native/commit/bbbd0d5))
* **file:** allows writeFile and writeExistingFile to accept Blob ([#527](https://github.com/driftyco/ionic-native/issues/527)) ([393e9d0](https://github.com/driftyco/ionic-native/commit/393e9d0))
* **googlemaps:** can pass HTMLElement to constructor ([dff034a](https://github.com/driftyco/ionic-native/commit/dff034a))
<a name="1.3.20"></a>
## [1.3.20](https://github.com/driftyco/ionic-native/compare/v1.3.19...v1.3.20) (2016-08-27)
### 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)
@@ -5,13 +290,16 @@
### 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))
@@ -24,7 +312,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))
@@ -58,12 +346,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
@@ -74,27 +363,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
@@ -125,7 +413,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))
@@ -152,7 +440,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
@@ -265,12 +553,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))
@@ -279,7 +583,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
@@ -287,13 +590,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
View 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.

View File

@@ -1,8 +1,8 @@
[![Circle CI](https://circleci.com/gh/driftyco/ionic-native.svg?style=shield)](https://circleci.com/gh/driftyco/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native-playground)
[![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native)
[![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/)
[![NPM](https://nodei.co/npm-dl/ionic-native.png?months=6&height=2)](https://nodei.co/npm/ionic-native/)
# Ionic Native

View File

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

View File

@@ -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/'));

60
karma.conf.ts Normal file
View File

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

View File

@@ -1,8 +1,10 @@
{
"name": "ionic-native",
"version": "1.3.18",
"version": "2.2.3",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"main": "dist/es5/index.js",
"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"

View File

@@ -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);
// // }
// // })
// }
// })
// }

View File

@@ -1,5 +1,7 @@
module.exports = [
{'name': 'advanced'},
{'name': 'demo'},
{'name': 'usage'}
{'name': 'usage'},
{'name': 'classes'}, // related classes
{'name': 'interfaces'} // related interfaces
];

View File

@@ -11,6 +11,39 @@ doc: "<$ doc.name $>"
docType: "<$ doc.docType $>"
---
<@ macro interfaceTable(interface) @>
<@ for export in doc.moduleDoc.exports -@>
<@ if export.name == interface @>
<table class="table param-table" style="margin:0;">
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<@ for param in export.members @>
<tr>
<td>
<$ param.name $>
<@ if param.optional @><div><em>(optional)</em></div><@ endif @>
</td>
<td>
<$ param.returnType | escape $>
</td>
<td>
<$ param.description | marked $>
</td>
</tr>
<@ endfor @>
</tbody>
</table>
<@ endif @>
<@- endfor @>
<@ endmacro @>
<@ macro paramList(paramData) -@>
<@- if paramData -@><span class="params">(
<@- for param in paramData -@>
@@ -73,15 +106,81 @@ docType: "<$ doc.docType $>"
<$ typeList(fn.typeList) $> <$ fn.description $>
<@- endmacro -@>
<@ macro documentClass(doc) @>
<@- if doc.statics.length -@>
<h2>Static Members</h2>
<@ for method in doc.statics -@>
<@ if not method.internal @>
<div id="<$ method.name $>"></div>
<h3><$ functionSyntax(method) $></h3>
<@- if method.decorators @>
<@ for prop in method.decorators[0].argumentInfo @>
<@ if prop.platforms @>
<p>
<b>Platforms:</b>
<@- for platform in prop.platforms @>
<code><$ platform $></code>&nbsp;
<@ 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>&nbsp;
<@ endfor -@>
</p>
<@ endif @>
<@ endfor @>
<@ endif -@>
<$ method.description $>
<@ if method.params @>
<$ paramTable(method.params) $>
<@ endif @>
<@ if method.this @>
<h4> Method's `this`
<$ method.this $>
</h4>
<@ endif @>
<@ if method.returns @>
<div class="return-value" markdown="1">
<i class="icon ion-arrow-return-left"></i>
<b>Returns:</b> <$ typeInfo(method.returns) $>
</div>
<@ endif @>
<@ endif @>
<@ endfor -@>
<@ endif @>
<!-- methods on the class -->
<@- if doc.members and doc.members.length @>
<h2>Instance Members</h2>
<@- for method in doc.members @>
<div id="<$ method.name $>"></div>
<h3>
<$ functionSyntax(method) $>
</h3>
<$ method.description $>
<@ if method.params @>
<$ paramTable(method.params) $>
<@ endif @>
<@ if method.this @>
<h4> Method's `this`
<$ method.this $>
</h4>
<@ endif @>
<@ if method.returns @>
<div class="return-value" markdown="1">
<i class="icon ion-arrow-return-left"></i>
<b>Returns:</b> <$ typeInfo(method.returns) $>
</div>
<@ endif @>
<@ endfor -@>
<@- endif -@>
<$ documentClass(doc) $>
<@ block advanced @>
<@- if doc.advanced -@>
@@ -285,6 +305,40 @@ docType: "<$ doc.docType $>"
<@- endif -@>
<@ endblock @>
<!-- other classes -->
<@ for tag in doc.tags.tags -@>
<@ if tag.tagName == 'classes' -@>
<h2><a class="anchor" name="related-classes" href="#related-classes"></a>Related Classes</h2>
<@ set classes = tag.description.split('\n') @>
<@ for item in classes -@>
<@ if item.length > 1 @>
<@ for export in doc.moduleDoc.exports -@>
<@ if export.name == item @>
<h3><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h3>
<$ documentClass(export) $>
<@ endif @>
<@- endfor @>
<@ endif @>
<@- endfor @>
<@- endif @>
<@- endfor @>
<!-- end other classes -->
<!-- interfaces -->
<@ for tag in doc.tags.tags -@>
<@ if tag.tagName == 'interfaces' @>
<h2><a class="anchor" name="interfaces" href="#interfaces"></a>Interfaces</h2>
<@ set interfaces = tag.description.split('\n') @>
<@ for item in interfaces -@>
<@ if item.length > 1 @>
<h3><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h3>
<$ interfaceTable(item) $>
<@ endif @>
<@- endfor @>
<@ endif @>
<@- endfor @>
<!-- end interfaces -->
<!-- related link -->
<@- if doc.see @>

View File

@@ -0,0 +1,19 @@
import { Plugin } from './plugin';
/**
* @name PluginName
* @description
*
* @usage
* ```
* import { PluginName } from 'ionic-native';
*
*
* ```
*/
@Plugin({
plugin: '',
pluginRef: '',
repo: ''
})
export class PluginName {
}

View File

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

View File

@@ -20,6 +20,7 @@ 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';
@@ -40,6 +41,8 @@ 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 { Transfer } from './plugins/filetransfer';
import { Flashlight } from './plugins/flashlight';
import { Geofence } from './plugins/geofence';
@@ -49,6 +52,7 @@ import { GooglePlus } from './plugins/google-plus';
import { GoogleMap } from './plugins/googlemaps';
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';
@@ -61,15 +65,23 @@ 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';
@@ -83,203 +95,237 @@ import { SpinnerDialog } from './plugins/spinnerdialog';
import { Splashscreen } from './plugins/splashscreen';
import { SQLite } from './plugins/sqlite';
import { StatusBar } from './plugins/statusbar';
import { Stepcounter } from './plugins/stepcounter';
import { StreamingMedia } from './plugins/streaming-media';
import { ThreeDeeTouch } from './plugins/3dtouch';
import { Toast } from './plugins/toast';
import { TouchID } from './plugins/touchid';
import { TextToSpeech } from './plugins/text-to-speech';
import { ThemeableBrowser } from './plugins/themeable-browser';
import { TwitterConnect } from './plugins/twitter-connect';
import { Vibration } from './plugins/vibration';
import { VideoEditor } from './plugins/video-editor';
import { VideoPlayer } from './plugins/video-player';
import { WebIntent } from './plugins/webintent';
import { YoutubeVideoPlayer } from './plugins/youtube-video-player';
import { ZBar } from './plugins/z-bar';
import { Zip } from './plugins/zip';
export * from './plugins/3dtouch';
export * from './plugins/actionsheet';
export * from './plugins/admob';
export * from './plugins/android-fingerprint-auth';
export * from './plugins/appavailability';
export * from './plugins/apprate';
export * from './plugins/appversion';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
export * from './plugins/badge';
export * from './plugins/barcodescanner';
export * from './plugins/base64togallery';
export * from './plugins/batterystatus';
export * from './plugins/ble';
export * from './plugins/bluetoothserial';
export * from './plugins/brightness';
export * from './plugins/calendar';
export * from './plugins/call-number';
export * from './plugins/camera';
export * from './plugins/camera-preview';
export * from './plugins/card-io';
export * from './plugins/clipboard';
export * from './plugins/code-push';
export * from './plugins/contacts';
export * from './plugins/crop';
export * from './plugins/datepicker';
export * from './plugins/dbmeter';
export * from './plugins/deeplinks';
export * from './plugins/device';
export * from './plugins/deviceaccounts';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
export * from './plugins/diagnostic';
export * from './plugins/dialogs';
export * from './plugins/emailcomposer';
export * from './plugins/estimote-beacons';
export * from './plugins/facebook';
export * from './plugins/file';
export * from './plugins/file-chooser';
export * from './plugins/file-opener';
export * from './plugins/filetransfer';
export * from './plugins/flashlight';
export * from './plugins/geofence';
export * from './plugins/geolocation';
export * from './plugins/globalization';
export * from './plugins/google-plus';
export * from './plugins/googleanalytics';
export * from './plugins/googlemaps';
export * from './plugins/hotspot';
export * from './plugins/http';
export * from './plugins/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
export * from './plugins/imageresizer';
export * from './plugins/inappbrowser';
export * from './plugins/inapppurchase';
export * from './plugins/insomnia';
export * from './plugins/instagram';
export * from './plugins/is-debug';
export * from './plugins/keyboard';
export * from './plugins/launchnavigator';
export * from './plugins/localnotifications';
export * from './plugins/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 {
ActionSheet,
AdMob,
AndroidFingerprintAuth,
AppAvailability,
AppRate,
AppVersion,
Badge,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
CameraPreview,
Clipboard,
CodePush,
Crop,
DBMeter,
Deeplinks,
DeviceAccounts,
Dialogs,
Diagnostic,
EmailComposer,
EstimoteBeacons,
File,
Flashlight,
Geofence,
Globalization,
GooglePlus,
GoogleAnalytics,
Hotspot,
InAppPurchase,
Insomnia,
Instagram,
Keyboard,
NativeAudio,
NativeStorage,
Network,
OneSignal,
PhotoViewer,
ScreenOrientation,
PinDialog,
Screenshot,
SecureStorage,
Shake,
SocialSharing,
Sim,
Splashscreen,
SQLite,
StatusBar,
TouchID,
Transfer,
TextToSpeech,
Vibration,
WebIntent,
Zip
}
export * from './plugins/plugin';
export * from './plugins/webintent';
export * from './plugins/youtube-video-player';
export * from './plugins/z-bar';
export * from './plugins/zip';
// Window export to use outside of a module loading system
window['IonicNative'] = {
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,
CodePush: CodePush,
Contacts: Contacts,
Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
Device: Device,
DeviceAccounts: DeviceAccounts,
DeviceMotion: DeviceMotion,
DeviceOrientation: DeviceOrientation,
Dialogs: Dialogs,
Diagnostic: Diagnostic,
EmailComposer: EmailComposer,
EstimoteBeacons: EstimoteBeacons,
Facebook: Facebook,
File: File,
Flashlight: Flashlight,
Geofence: Geofence,
Geolocation: Geolocation,
Globalization: Globalization,
GooglePlus: GooglePlus,
GoogleMap: GoogleMap,
GoogleAnalytics: GoogleAnalytics,
Hotspot: Hotspot,
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser,
InAppPurchase: InAppPurchase,
Instagram: Instagram,
IsDebug: IsDebug,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications,
MediaCapture: MediaCapture,
MediaPlugin: MediaPlugin,
NativeAudio: NativeAudio,
NativeStorage: NativeStorage,
Network: Network,
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
PhotoViewer: PhotoViewer,
ScreenOrientation: ScreenOrientation,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SecureStorage: SecureStorage,
Shake: Shake,
Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
SpinnerDialog: SpinnerDialog,
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
ActionSheet,
AdMob,
AndroidFingerprintAuth,
AppAvailability,
AppRate,
AppVersion,
Badge,
BackgroundGeolocation,
BackgroundMode,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
Calendar,
CallNumber,
Camera,
CameraPreview,
CardIO,
Clipboard,
CodePush,
Contacts,
Crop,
DatePicker,
DBMeter,
Deeplinks,
Device,
DeviceAccounts,
DeviceMotion,
DeviceOrientation,
Dialogs,
Diagnostic,
EmailComposer,
EstimoteBeacons,
Facebook,
File,
FileChooser,
FileOpener,
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,
Sim,
SMS,
SocialSharing,
SpinnerDialog,
Splashscreen,
SQLite,
StatusBar,
Stepcounter,
StreamingMedia,
ThreeDeeTouch,
Toast,
TouchID,
Transfer,
TextToSpeech,
ThemeableBrowser,
TwitterConnect,
VideoEditor,
VideoPlayer,
Vibration,
WebIntent,
YoutubeVideoPlayer,
ZBar,
Zip
};
initAngular1(window['IonicNative']);
@@ -288,16 +334,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);

View File

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

View File

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

View File

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

View File

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

View File

@@ -207,6 +207,19 @@ export class BLE {
})
static startScan(services: string[]): Observable<any> { return; }
/**
* Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
* @param options {any}
* @return Returns an Observable that notifies of each peripheral discovered.
*/
@Cordova({
observable: true,
clearFunction: 'stopScan',
clearWithArgs: true
})
static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
/**
* Stop a scan started by `startScan`.
*
@@ -387,17 +400,10 @@ export class BLE {
/**
* Report if bluetooth is enabled.
*
* @usage
* ```
* BLE.isEnabled().then(
* () => { console.log('enabled'); },
* () => { console.log('not enabled'); }
* );
* ```
* @return Returns a Promise.
* @return {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).

View File

@@ -5,6 +5,7 @@ import { Cordova, Plugin } from './plugin';
* @private
*/
export interface CalendarOptions {
id?: string;
firstReminderMinutes?: number;
secondReminderMinutes?: number;
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly'
@@ -52,7 +53,7 @@ export class Calendar {
* - You're using Android < 6, or
* - You've already granted permission
*
* If this returns false, you should call `requestReadWritePermissions` function
* If this returns false, you should call the `requestReadWritePermission` function
* @returns {Promise<boolean>}
*/
@Cordova()
@@ -336,7 +337,8 @@ export class Calendar {
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions`
* @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
* @return Returns a Promise
*/
@Cordova()
@@ -351,8 +353,9 @@ export class Calendar {
newNotes?: string,
newStartDate?: Date,
newEndDate?: Date,
options?: CalendarOptions
) { return; }
filterOptions?: CalendarOptions,
newOptions?: CalendarOptions
): Promise<any> { return; }
/**
* Delete an event.

View File

@@ -0,0 +1,36 @@
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({
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
*/
@Cordova({
callbackOrder: 'reverse'
})
static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
return;
}
}

View File

@@ -19,13 +19,59 @@ export interface CameraPreviewSize {
* @description
* Showing camera preview in HTML
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview).
*
* @usage
* ```
* import { CameraPreview } from 'ionic-native';
*
* // camera options (Size and location)
* let cameraRect: CameraPreviewRect = {
* x: 100,
* y: 100,
* width: 200,
* height: 200
* };
*
*
* // start camera
* CameraPreview.startCamera(
* cameraRect, // position and size of preview
* 'front', // default camera
* true, // tape to take picture
* false, // disable drag
* true // send the preview to the back of the screen so we can add overlaying elements
* );
*
* // Set the handler to run every time we take a picture
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
* console.log(result);
* // do something with the result
* });
*
*
* // take a picture
* CameraPreview.takePicture({
* maxWidth: 640,
* maxHeight: 640
* });
*
* // Switch camera
* CameraPreview.switchCamera();
*
* // set color effect to negative
* CameraPreview.setColorEffect('negative');
*
* // Stop the camera preview
* CameraPreview.stopCamera();
*
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-camera-preview',
pluginRef: 'cordova.plugins.camerapreview',
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
repo: 'https://github.com/westonganger/cordova-plugin-camera-preview',
platforms: ['Android', 'iOS']
})
export class CameraPreview {
@@ -42,9 +88,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void {
};
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { };
/**
* Stops the camera preview instance.
@@ -95,14 +139,6 @@ export class CameraPreview {
})
static hide(): void { };
/**
* Set the default mode for the Flash.
*/
// @Cordova({
// sync: true
// })
// static setFlashMode(mode: number): void { };
/**
* Set camera color effect.
*/
@@ -110,15 +146,4 @@ export class CameraPreview {
sync: true
})
static setColorEffect(effect: string): void { };
/**
* @private
* @enum {number}
*/
static FlashMode = {
OFF: 0,
ON: 1,
AUTO: 2
};
}

View File

@@ -7,8 +7,8 @@ export interface CameraOptions {
/**
* Choose the format of the return value.
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
* DATA_URL : 0, Return image as base64-encoded string
* FILE_URI : 1, Return image file URI
* DATA_URL : 0, Return image as base64-encoded string,
* FILE_URI : 1, Return image file URI,
* NATIVE_URI : 2 Return image native URI
* (e.g., assets-library:// on iOS or content:// on Android)
*/
@@ -105,6 +105,9 @@ export interface CameraPopoverOptions {
* // Handle error
* });
* ```
* @interfaces
* CameraOptions
* CameraPopoverOptions
*/
@Plugin({
plugin: 'cordova-plugin-camera',
@@ -204,6 +207,6 @@ export class Camera {
@Cordova({
platforms: ['iOS']
})
static cleanup() { };
static cleanup(): Promise<any> { return; };
}

View File

@@ -401,6 +401,7 @@ export interface DownloadProgress {
/**
* @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

View File

@@ -1,9 +1,11 @@
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
declare var window: any,
navigator: any;
/**
* @private
*/
export interface IContactProperties {
/** A globally unique identifier. */
id?: string;
@@ -75,6 +77,9 @@ export class Contact implements IContactProperties {
save(): Promise<any> { return; }
}
/**
* @private
*/
interface IContactError {
/** Error code */
code: number;
@@ -82,6 +87,9 @@ interface IContactError {
message: string;
}
/**
* @private
*/
declare var ContactError: {
new (code: number): IContactError;
UNKNOWN_ERROR: number;
@@ -186,13 +194,21 @@ export class ContactAddress implements IContactAddress {
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
}
/** Set to true if this ContactAddress contains the user's preferred value. */
@InstanceProperty get pref(): boolean { return; }
/** A string indicating what type of field this is, home for example. */
@InstanceProperty get type(): string { return; }
/** The full address formatted for display. */
@InstanceProperty get formatted(): string { return; }
/** The full street address. */
@InstanceProperty get streetAddress(): string { return; }
/** The city or locality. */
@InstanceProperty get locality(): string { return; }
/** The state or region. */
@InstanceProperty get region(): string { return; }
/** The zip code or postal code. */
@InstanceProperty get postalCode(): string { return; }
/** The country name. */
@InstanceProperty get country(): string { return; }
}
@@ -217,10 +233,15 @@ export class ContactOrganization implements IContactOrganization {
constructor() {
this._objectInstance = new window.ContactOrganization();
}
/** Set to true if this ContactOrganization contains the user's preferred value. */
@InstanceProperty get pref(): boolean { return; }
/** A string that indicates what type of field this is, home for example. */
@InstanceProperty get type(): string { return; }
/** The name of the organization. */
@InstanceProperty get name(): string { return; }
/** The department the contract works for. */
@InstanceProperty get department(): string { return; }
/** The contact's title at the organization. */
@InstanceProperty get title(): string { return; }
}
@@ -232,6 +253,10 @@ export interface IContactFindOptions {
multiple?: boolean;
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
desiredFields?: string[];
/**
* (Android only): Filters the search to only return contacts with a phone number informed.
*/
hasPhoneNumber?: boolean;
}
/**
@@ -244,9 +269,24 @@ export class ContactFindOptions implements IContactFindOptions {
this._objectInstance = new window.ContactFindOptions();
}
/**
* The search string used to find navigator.contacts. (Default: "")
*/
@InstanceProperty get filter(): string { return; }
/**
* Determines if the find operation returns multiple navigator.contacts. (Default: false)
*/
@InstanceProperty get multiple(): boolean { return; }
/**
* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields.
*/
@InstanceProperty get desiredFields(): any { return; }
/**
* (Android only): Filters the search to only return contacts with a phone number informed.
*/
@InstanceProperty get hasPhoneNumber(): boolean { return; }
}
@@ -268,8 +308,12 @@ export class ContactFindOptions implements IContactFindOptions {
* (error: any) => console.error('Error saving contact.', error)
* );
* ```
*
*
* @interfaces
* IContactProperties
* @classes
* ContactFindOptions
* ContactOrganization
* ContactAddress
*/
@Plugin({
plugin: 'cordova-plugin-contacts',
@@ -277,6 +321,10 @@ export class ContactFindOptions implements IContactFindOptions {
repo: 'https://github.com/apache/cordova-plugin-contacts'
})
export class Contacts {
/**
* Create a single contact.
* @return Returns a object Contact
*/
static create(): Contact {
return new Contact();
}

View File

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

View File

@@ -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;
/**
* Shows or hide dates earlier then selected date.
*/
allowOldDate?: 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;
}
@@ -86,7 +124,8 @@ export interface DatePickerOptions {
* err => console.log('Error occurred while getting date: ', err)
* );
* ```
*
* @interfaces
* DatePickerOptions
*/
@Plugin({
plugin: 'cordova-plugin-datepicker',
@@ -95,12 +134,25 @@ export interface DatePickerOptions {
})
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;
}
}

View File

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

View File

@@ -1,4 +1,4 @@
import {Cordova, Plugin} from './plugin';
import { Cordova, Plugin } from './plugin';
/**
* @name Diagnostic
@@ -19,7 +19,7 @@ import {Cordova, Plugin} from './plugin';
*
* Diagnostic.getBluetoothState()
* .then((state) => {
* if(state == Diagnostic.bluetoothStates.POWERED_ON){
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
* // do something
* } else {
* // do something else
@@ -36,73 +36,80 @@ import {Cordova, Plugin} from './plugin';
export class Diagnostic {
static permission = {
'READ_CALENDAR': 'READ_CALENDAR',
'WRITE_CALENDAR': 'WRITE_CALENDAR',
'CAMERA': 'CAMERA',
'READ_CONTACTS': 'READ_CONTACTS',
'WRITE_CONTACTS': 'WRITE_CONTACTS',
'GET_ACCOUNTS': 'GET_ACCOUNTS',
'ACCESS_FINE_LOCATION': 'ACCESS_FINE_LOCATION',
'ACCESS_COARSE_LOCATION': 'ACCESS_COARSE_LOCATION',
'RECORD_AUDIO': 'RECORD_AUDIO',
'READ_PHONE_STATE': 'READ_PHONE_STATE',
'CALL_PHONE': 'CALL_PHONE',
'ADD_VOICEMAIL': 'ADD_VOICEMAIL',
'USE_SIP': 'USE_SIP',
'PROCESS_OUTGOING_CALLS': 'PROCESS_OUTGOING_CALLS',
'READ_CALL_LOG': 'READ_CALL_LOG',
'WRITE_CALL_LOG': 'WRITE_CALL_LOG',
'SEND_SMS': 'SEND_SMS',
'RECEIVE_SMS': 'RECEIVE_SMS',
'READ_SMS': 'READ_SMS',
'RECEIVE_WAP_PUSH': 'RECEIVE_WAP_PUSH',
'RECEIVE_MMS': 'RECEIVE_MMS',
'WRITE_EXTERNAL_STORAGE': 'WRITE_EXTERNAL_STORAGE',
'READ_EXTERNAL_STORAGE': 'READ_EXTERNAL_STORAGE',
'BODY_SENSORS': 'BODY_SENSORS'
READ_CALENDAR: 'READ_CALENDAR',
WRITE_CALENDAR: 'WRITE_CALENDAR',
CAMERA: 'CAMERA',
READ_CONTACTS: 'READ_CONTACTS',
WRITE_CONTACTS: 'WRITE_CONTACTS',
GET_ACCOUNTS: 'GET_ACCOUNTS',
ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION',
ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION',
RECORD_AUDIO: 'RECORD_AUDIO',
READ_PHONE_STATE: 'READ_PHONE_STATE',
CALL_PHONE: 'CALL_PHONE',
ADD_VOICEMAIL: 'ADD_VOICEMAIL',
USE_SIP: 'USE_SIP',
PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS',
READ_CALL_LOG: 'READ_CALL_LOG',
WRITE_CALL_LOG: 'WRITE_CALL_LOG',
SEND_SMS: 'SEND_SMS',
RECEIVE_SMS: 'RECEIVE_SMS',
READ_SMS: 'READ_SMS',
RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH',
RECEIVE_MMS: 'RECEIVE_MMS',
WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE',
READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE',
BODY_SENSORS: 'BODY_SENSORS'
};
static permissionStatus = {
'NOT_REQUESTED': 'not_determined',
'DENIED': 'denied',
'RESTRICTED': 'restricted',
'GRANTED': 'authorized',
'GRANTED_WHEN_IN_USE': 'authorized_when_in_use'
GRANTED: 'GRANTED',
GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS
RESTRICTED: 'RESTRICTED', // iOS
DENIED: 'DENIED',
DENIED_ALWAYS: 'DENIED_ALWAYS', // android
NOT_REQUESTED: 'NOT_REQUESTED'
};
static locationAuthorizationMode = {
'ALWAYS': 'always',
'WHEN_IN_USE': 'when_in_use'
ALWAYS: 'ALWAYS',
WHEN_IN_USE: 'WHEN_IN_USE'
};
static permissionGroups = {
'GRANTED': 'GRANTED',
'DENIED': 'DENIED',
'NOT_REQUESTED': 'NOT_REQUESTED',
'DENIED_ALWAYS': 'DENIED_ALWAYS'
CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
CAMERA: ['CAMERA'],
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
MICROPHONE: ['RECORD_AUDIO'],
PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
SENSORS: ['BODY_SENSORS'],
SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
};
static locationMode = {
'HIGH_ACCURACY': 'high_accuracy',
'DEVICE_ONLY': 'device_only',
'BATTERY_SAVING': 'battery_saving',
'LOCATION_OFF': 'location_off'
HIGH_ACCURACY: 'high_accuracy',
DEVICE_ONLY: 'device_only',
BATTERY_SAVING: 'battery_saving',
LOCATION_OFF: 'location_off'
};
static bluetoothState = {
'UNKNOWN': 'unknown',
'RESETTING': 'resetting', // iOS
'UNSUPPORTED': 'unsupported', // iOS
'UNAUTHORIZED': 'unauthorized', // iOS
'POWERED_OFF': 'powered_off',
'POWERED_ON': 'powered_on',
'POWERING_OFF': 'powering_off',
'POWERING_ON': 'powering_on'
UNKNOWN: 'unknown',
RESETTING: 'resetting', // iOS
UNSUPPORTED: 'unsupported', // iOS
UNAUTHORIZED: 'unauthorized', // iOS
POWERED_OFF: 'powered_off',
POWERED_ON: 'powered_on',
POWERING_OFF: 'powering_off',
POWERING_ON: 'powering_on'
};
/**
* Checks if app is able to access device location.
* @returns {Promise<any>}
*/
@Cordova()
static isLocationAvailable(): Promise<any> { return; }
@@ -110,6 +117,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; }
@@ -117,6 +125,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; }
@@ -124,6 +133,7 @@ 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; }
@@ -131,31 +141,32 @@ export class Diagnostic {
/**
* Displays the device location settings to allow user to enable location services/change location mode.
*/
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToLocationSettings(): void { }
/**
* Displays mobile settings to allow user to enable mobile data.
*/
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToMobileDataSettings(): void { }
/**
* Displays Bluetooth settings to allow user to enable Bluetooth.
*/
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToBluetoothSettings(): void { }
/**
* Displays WiFi settings to allow user to enable WiFi.
*/
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToWifiSettings(): void { }
/**
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'Windows 10']})
@Cordova({ platforms: ['Android', 'Windows 10'] })
static isWifiEnabled(): Promise<boolean> { return; }
/**
@@ -163,7 +174,7 @@ export class Diagnostic {
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
* @param state {boolean}
*/
@Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']})
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setWifiState(state: boolean): Promise<any> { return; }
/**
@@ -171,96 +182,110 @@ export class Diagnostic {
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
* @param state {boolean}
*/
@Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']})
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setBluetoothState(state: boolean): Promise<any> { return; }
/**
* Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static isLocationEnabled(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android', 'iOS'] })
static isLocationEnabled(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use location.
* 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; }
@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({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
/**
* Checks if camera hardware is present on device.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraPresent(): Promise<any> { return; }
/**
* 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({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraAuthorized(): Promise<any> { return; }
/**
* Returns the camera authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getCameraAuthorizationStatus(): Promise<any> { return; }
/**
* Requests camera authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCameraAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the microphone.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isMicrophoneAuthorized(): Promise<boolean> { return; }
/**
* Returns the microphone authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
/**
* Requests microphone authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestMicrophoneAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use contacts (address book).
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isContactsAuthorized(): Promise<boolean> { return; }
/**
* Returns the contacts authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static getContactsAuthroizationStatus(): Promise<any> { return; }
@Cordova({ platforms: ['Android', 'iOS'] })
static getContactsAuthorizationStatus(): Promise<any> { return; }
/**
* Requests contacts authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static requestContactsAuthorization(): Promise<any> { return; }
/**
@@ -271,8 +296,9 @@ export class Diagnostic {
*
* Notes for iOS:
* - This relates to Calendar Events (not Calendar Reminders)
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static isCalendarAuthorized(): Promise<boolean> { return; }
/**
@@ -284,8 +310,9 @@ export class Diagnostic {
* Notes for iOS:
* - This relates to Calendar Events (not Calendar Reminders)
*
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
@Cordova({ platforms: ['Android', 'iOS'] })
static getCalendarAuthorizationStatus(): Promise<any> { return; }
/**
@@ -300,43 +327,48 @@ export class Diagnostic {
* - 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']})
@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; }
@Cordova({ platforms: ['Android', 'iOS'] })
static switchToSettings(): Promise<any> { return; }
/**
* Returns the state of Bluetooth on the device.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android', 'iOS']})
static getBluetoothState(): Promise<any> {return; }
@Cordova({ platforms: ['Android', 'iOS'] })
static getBluetoothState(): Promise<any> { return; }
/**
* Registers a function to be called when a change in Bluetooth state occurs.
* @param handler
*/
@Cordova({platforms: ['Android', 'iOS'], sync: true})
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerBluetoothStateChangeHandler(handler: Function): void { }
/**
* Registers a function to be called when a change in Location state occurs.
* @param handler
*/
@Cordova({platforms: ['Android', 'iOS'], sync: true})
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerLocationStateChangeHandler(handler: Function): void { }
/**
* 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.
* 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<any>}
*/
@Cordova({platforms: ['Android']})
static isGpsLocationAvailable(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static isGpsLocationAvailable(): Promise<boolean> { return; }
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
@@ -344,152 +376,177 @@ export class Diagnostic {
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova({platforms: ['Android']})
@Cordova({ platforms: ['Android'] })
static isGpsLocationEnabled(): Promise<any> { return; }
/**
* 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.
* 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; }
@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({platforms: ['Android']})
@Cordova({ platforms: ['Android'] })
static isNetworkLocationEnabled(): Promise<any> { return; }
/**
* Returns the current location mode setting for the device.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['Android']})
static getLocationMode(): Promise<any> {return; }
@Cordova({ platforms: ['Android'] })
static getLocationMode(): Promise<any> { return; }
/**
* Returns the current authorisation status for a given permission.
* 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; }
@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; }
@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; }
@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; }
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
/**
* Checks if the device setting for Bluetooth is switched on.
* This requires `BLUETOOTH` permission on Android
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static isBluetoothEnabled(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static isBluetoothEnabled(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static hasBluetoothSupport(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static hasBluetoothSupport(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static hasBluetoothLESupport(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static hasBluetoothLESupport(): Promise<boolean> { return; }
/**
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['Android']})
static hasBluetoothLEPeripheralSupport(): Promise<boolean> {return; }
@Cordova({ platforms: ['Android'] })
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isCameraRollAuthorized(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isCameraRollAuthorized(): Promise<boolean> { return; }
/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static getCameraRollAuthorizationStatus(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
/**
* Requests camera roll authorization for the application. Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
* 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; }
@Cordova({ platforms: ['iOS'] })
static requestCameraRollAuthorization(): Promise<any> { return; }
/**
* Checks if remote (push) notifications are enabled.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isRemoteNotificationsEnabled(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isRemoteNotificationsEnabled(): Promise<boolean> { return; }
/**
* Indicates if the app is registered for remote (push) notifications on the device.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isRegisteredForRemoteNotifications(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isRegisteredForRemoteNotifications(): Promise<boolean> { return; }
/**
* Indicates the current setting of notification types for the app in the Settings app.
* Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static getRemoteNotificationTypes(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static getRemoteNotificationTypes(): Promise<any> { return; }
/**
* Checks if the application is authorized to use reminders.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isRemindersAuthorized(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isRemindersAuthorized(): Promise<boolean> { return; }
/**
* Returns the reminders authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static getRemindersAuthorizationStatus(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static getRemindersAuthorizationStatus(): Promise<any> { return; }
/**
* Requests reminders authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static requestRemindersAuthorization(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static requestRemindersAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized for background refresh.
* @returns {Promise<boolean>}
*/
@Cordova({platforms: ['iOS']})
static isBackgroundRefreshAuthorized(): Promise<boolean> {return; }
@Cordova({ platforms: ['iOS'] })
static isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
/**
* Returns the background refresh authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static getBackgroundRefreshStatus(): Promise<any> {return; }
@Cordova({ platforms: ['iOS'] })
static getBackgroundRefreshStatus(): Promise<any> { return; }
}

View File

@@ -7,7 +7,7 @@ declare var cordova: any;
* @name Email Composer
* @description
*
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/hypery2k/cordova-email-plugin).
*
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
* A good alternative to this plugin is the social sharing plugin.
@@ -44,10 +44,10 @@ declare var cordova: any;
* ```
*/
@Plugin({
plugin: 'cordova-plugin-email-composer',
plugin: 'cordova-plugin-email',
pluginRef: 'cordova.plugins.email',
repo: 'https://github.com/katzer/cordova-plugin-email-composer.git',
platforms: ['Android', 'iOS', 'Windows Phone 8']
repo: 'https://github.com/hypery2k/cordova-email-plugin',
platforms: ['Android', 'iOS']
})
export class EmailComposer {

View File

@@ -272,7 +272,7 @@ export class EstimoteBeacons {
*
* @usage
* ```
* let region: BeaconRegion = {} // Empty region matches all beacons.
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
* console.log(JSON.stringify(info));
* });
@@ -280,7 +280,7 @@ export class EstimoteBeacons {
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @return Returns an Observable that notifies of each beacon discovered.
*/
@Cordova({
@@ -288,14 +288,14 @@ export class EstimoteBeacons {
clearFunction: 'stopRangingBeaconsInRegion',
clearWithArgs: true
})
static startRangingBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
/**
* Stop ranging beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: BeaconRegion = {} // Empty region matches all beacons.
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
* console.log(JSON.stringify(info));
* });
@@ -303,11 +303,11 @@ export class EstimoteBeacons {
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @return returns a Promise.
*/
@Cordova()
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start ranging secure beacons. Available on iOS.
@@ -321,7 +321,7 @@ export class EstimoteBeacons {
clearFunction: 'stopRangingSecureBeaconsInRegion',
clearWithArgs: true
})
static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
/**
* Stop ranging secure beacons. Available on iOS.
@@ -329,19 +329,19 @@ export class EstimoteBeacons {
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
*/
@Cordova()
static stopRangingSecureBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start monitoring beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: BeaconRegion = {} // Empty region matches all beacons.
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
* console.log('Region state: ' + JSON.stringify(state));
* });
* ```
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
* are inside a region when the user turns display on, see
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
@@ -355,21 +355,21 @@ export class EstimoteBeacons {
successIndex: 1,
errorIndex: 2
})
static startMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
/**
* Stop monitoring beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: BeaconRegion = {} // Empty region matches all beacons.
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
* ```
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @return returns a Promise.
*/
@Cordova()
static stopMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start monitoring secure beacons. Available on iOS.
@@ -378,6 +378,8 @@ export class EstimoteBeacons {
* To use secure beacons set the App ID and App Token using
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
* @see {@link EstimoteBeacons.startMonitoringForRegion}
* @param region {EstimoteBeaconRegion} Region
* @param notifyEntryStateOnDisplay {boolean}
*/
@Cordova({
observable: true,
@@ -386,16 +388,17 @@ export class EstimoteBeacons {
successIndex: 1,
errorIndex: 2
})
static startSecureMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
static startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
/**
* Stop monitoring secure beacons. Available on iOS.
* This function has the same parameters/behaviour as
* {@link EstimoteBeacons.stopMonitoringForRegion}.
* @param region {EstimoteBeaconRegion} Region
*/
@Cordova()
static stopSecureMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Connect to Estimote Beacon. Available on Android.
@@ -473,7 +476,7 @@ export class EstimoteBeacons {
}
export interface BeaconRegion {
export interface EstimoteBeaconRegion {
state?: string;
major: number;
minor: number;

View File

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

View File

@@ -0,0 +1,30 @@
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({
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
*/
@Cordova()
static open(): Promise<string> { return; }
}

View File

@@ -0,0 +1,54 @@
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({
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
*/
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'error'
})
static open(filePath: string, fileMIMEType: string): Promise<any> {return; }
/**
* Uninstalls a package
* @param packageId {string} Package ID
*/
@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
*/
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'error'
})
static appIsInstalled(packageId: string): Promise<any> {return; }
}

View File

@@ -1,4 +1,5 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, pluginWarn } from './plugin';
declare var window: any;
declare var cordova: any;
@@ -300,10 +301,10 @@ export interface FileReader {
onabort: (evt: ProgressEvent) => void;
abort(): void;
readAsText(fe: File, encoding?: string): void;
readAsDataURL(fe: File): void;
readAsBinaryString(fe: File): void;
readAsArrayBuffer(fe: File): 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 +337,12 @@ declare var FileError: {
PATH_EXISTS_ERR: number;
};
let pluginMeta = {
plugin: 'cordova-plugin-file',
pluginRef: 'cordova.file',
repo: 'https://github.com/apache/cordova-plugin-file'
};
/**
* @name File
* @description
@@ -357,11 +364,7 @@ declare var FileError: {
* Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/
* It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html
*/
@Plugin({
plugin: 'cordova-plugin-file',
pluginRef: 'cordova.file',
repo: 'https://github.com/apache/cordova-plugin-file'
})
@Plugin(pluginMeta)
export class File {
static cordovaFileError: {} = {
1: 'NOT_FOUND_ERR',
@@ -380,9 +383,19 @@ 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(pluginMeta);
reject({ error: 'plugin_not_installed' });
} else {
cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []);
}
});
}
/**
@@ -392,7 +405,6 @@ export class File {
* @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.
*/
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
if ((/^\//.test(dir))) {
let err = new FileError(5);
@@ -417,7 +429,6 @@ export class File {
* @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.
*/
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
@@ -429,7 +440,7 @@ export class File {
create: true
};
if (replace) {
if (!replace) {
options.exclusive = true;
}
@@ -446,7 +457,6 @@ export class File {
* @param {string} dirName The directory name
* @return {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);
@@ -472,7 +482,6 @@ export class File {
* @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.
*/
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry|FileError> {
newDirName = newDirName || dirName;
@@ -529,7 +538,6 @@ export class File {
* @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.
*/
static listDir(path: string, dirName: string): Promise<Entry[]> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
@@ -554,7 +562,6 @@ export class File {
* @param {string} dirName Name of directory
* @return {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);
@@ -578,7 +585,6 @@ export class File {
* @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.
*/
static checkFile(path: string, file: string): Promise<boolean|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
@@ -636,7 +642,6 @@ export class File {
* @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.
*/
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
@@ -657,39 +662,38 @@ 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.
* @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<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeFile(path: string, fileName: string,
text: string, replaceOrOptions: boolean | WriteOptions): Promise<void> {
text: string | Blob, options: WriteOptions): Promise<void> {
if ((/^\//.test(fileName))) {
let 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;
}
}
let getFileOpts: Flags = {
create: true,
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);
})
.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);
@@ -700,10 +704,10 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string} text content to write
* @param {string | Blob} text content or blob to write
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeExistingFile(path: string, fileName: string, text: string): Promise<void> {
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -742,7 +746,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -783,7 +787,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -825,7 +829,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -866,7 +870,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -950,15 +954,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);
@@ -971,8 +982,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;
@@ -984,10 +1000,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);
@@ -1000,12 +1023,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);
});
@@ -1016,8 +1044,11 @@ export class File {
});
}
/**
* @private
*/
private static remove(fe: Entry): Promise<RemoveResult> {
return new Promise((resolve, reject) => {
return new Promise<RemoveResult>((resolve, reject) => {
fe.remove(() => {
resolve({success: true, fileRemoved: fe});
}, (err) => {
@@ -1027,8 +1058,11 @@ export class File {
});
}
/**
* @private
*/
private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
srce.moveTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
@@ -1038,8 +1072,11 @@ export class File {
});
}
/**
* @private
*/
private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
srce.copyTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
@@ -1049,8 +1086,11 @@ export class File {
});
}
/**
* @private
*/
private static readEntries(dr: DirectoryReader): Promise<Entry[]> {
return new Promise((resolve, reject) => {
return new Promise<Entry[]>((resolve, reject) => {
dr.readEntries((entries) => {
resolve(entries);
}, (err) => {
@@ -1060,8 +1100,11 @@ export class File {
});
}
/**
* @private
*/
private static rimraf(de: DirectoryEntry): Promise<RemoveResult> {
return new Promise((resolve, reject) => {
return new Promise<RemoveResult>((resolve, reject) => {
de.removeRecursively(() => {
resolve({success: true, fileRemoved: de});
}, (err) => {
@@ -1071,8 +1114,11 @@ export class File {
});
}
/**
* @private
*/
private static createWriter(fe: FileEntry): Promise<FileWriter> {
return new Promise((resolve, reject) => {
return new Promise<FileWriter>((resolve, reject) => {
fe.createWriter((writer) => {
resolve(writer);
}, (err) => {
@@ -1082,16 +1128,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();
});
}
}

View File

@@ -133,7 +133,6 @@ export class Geofence {
/**
* Called when a geofence is crossed in the direction specified by `TransitType`.
* Commenting out. Not yet implemented in plugin.
*
* @return {Promise<any>}
*/
@@ -147,8 +146,7 @@ export class Geofence {
}
/**
* Called when the user clicks a geofence notification. iOS and Android only.
* Commenting out. Not yet implemented in plugin.
* Called when the user clicks a geofence notification. iOS and Android only.
*
* @return {Promise<Object>}
*/

View File

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

View File

@@ -14,7 +14,7 @@ declare var window;
*/
@Plugin({
plugin: 'cordova-plugin-google-analytics',
pluginRef: 'analytics',
pluginRef: 'ga',
repo: 'https://github.com/danwilson/google-analytics-plugin',
platforms: ['Android', 'iOS']
})
@@ -23,45 +23,128 @@ export class GoogleAnalytics {
* In your 'deviceready' handler, set up your Analytics tracker.
* https://developers.google.com/analytics/devguides/collection/analyticsjs/
* @param {string} id Your Google Analytics Mobile App property
* @return {Promise<any>}
*/
@Cordova()
static startTrackerWithId(id: string): Promise<any> { return; }
/**
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
* @param allow {boolean}
* @return {Promise<any>}
*/
@Cordova()
static setAllowIDFACollection(allow: boolean): Promise<any> { return; }
/**
* Set a UserId
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
* @param {string} id User ID
* @return {Promise<any>}
*/
@Cordova()
static setUserId(id: string): Promise<any> { return; }
/**
* Set a anonymize Ip address
* @param anonymize {boolean} Set to true to anonymize the IP Address
* @return {Promise<any>}
*/
@Cordova()
static setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
/**
* Sets the app version
* @param appVersion {string} App version
* @return {Promise<any>}
*/
@Cordova()
static setAppVersion(appVersion: string): Promise<any> { return; }
/**
* Set OptOut
* @param optout {boolean}
* @return {Promise<any>}
*/
@Cordova()
static setOptOut(optout: boolean): Promise<any> { return; }
/**
* Enable verbose logging
* @return {Promise<any>}
*/
@Cordova()
static debugMode(): Promise<any> { return; }
/**
* Track custom metric
* @param key {string}
* @param value {any}
* @return {Promise<any>}
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
static trackMetric(key: string, value?: any): Promise<any> { return; }
/**
* Track a screen
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
*
* @param {string} title Screen title
* @param {string} campaignUrl Campaign url for measuring referrals
* @param title {string} Screen title
* @param campaignUrl {string} Campaign url for measuring referrals
* @param newSession {boolean} Set to true to create a new session
* @return {Promise<any>}
*/
@Cordova({
successIndex: 3,
errorIndex: 4
})
static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
/**
* Add a Custom Dimension
* https://developers.google.com/analytics/devguides/platform/customdimsmets
* @param key {string}
* @param value {string}
* @return {Promise<any>}
*/
@Cordova()
static trackView(title: string, campaignUrl?: string): Promise<any> { return; }
static addCustomDimension(key: number, value: string): Promise<any> { return; }
/**
* Track an event
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
* @param {string} category
* @param {string} action
* @param {string} label
* @param {number} value
* @param category {string}
* @param action {string}
* @param label {string}
* @param value {number}
* @param newSession {boolean} Set to true to create a new session
* @return {Promise<any>}
*/
@Cordova()
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return; }
@Cordova({
successIndex: 5,
errorIndex: 6
})
static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
/**
* Track an exception
* @param {string} description
* @param {boolean} fatal
* @param description {string}
* @param fatal {boolean}
* @return {Promise<any>}
*/
@Cordova()
static trackException(description: string, fatal: boolean): Promise<any> { return; }
/**
* Track User Timing (App Speed)
* @param {string} category
* @param {number} intervalInMilliseconds
* @param {string} variable
* @param {string} label
* @param category {string}
* @param intervalInMilliseconds {number}
* @param variable {string}
* @param label {string}
* @return {Promise<any>}
*/
@Cordova()
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
@@ -69,12 +152,13 @@ export class GoogleAnalytics {
/**
* Add a Transaction (Ecommerce)
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
* @param {string} id
* @param {string} affiliation
* @param {number} revenue
* @param {number} tax
* @param {number} shipping
* @param {string} currencyCode
* @param id {string}
* @param affiliation {string}
* @param revenue {number}
* @param tax {number}
* @param shipping {number}
* @param currencyCode {string}
* @return {Promise<any>}
*/
@Cordova()
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
@@ -89,57 +173,15 @@ export class GoogleAnalytics {
* @param {number} price
* @param {number} quantity
* @param {string} currencyCode
* @return {Promise<any>}
*/
@Cordova()
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
/**
* Add a Custom Dimension
* https://developers.google.com/analytics/devguides/platform/customdimsmets
* @param {string} key
* @param {string} value
*/
@Cordova()
static addCustomDimension(key: number, value: string): Promise<any> { return; }
/**
* Set a UserId
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
* @param {string} id
*/
@Cordova({sync: true})
static setUserId(id: string): void { }
/**
* Sets the app version
* @param appVersion
*/
@Cordova({sync: true})
static setAppVersion(appVersion: string): void { }
/**
* Set a anonymize Ip address
* @param anonymize
*/
@Cordova({sync: true})
static setAnonymizeIp(anonymize: boolean): void { }
/**
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
* @param allow
*/
@Cordova({sync: true})
static setAllowIDFACollection(allow: boolean): void { }
/**
* Enable verbose logging
*/
@Cordova({sync: true})
static debugMode(): Promise<any> { return; }
/**
* Enable/disable automatic reporting of uncaught exceptions
* @param {boolean} shouldEnable
* @param shouldEnable {boolean}
* @return {Promise<any>}
*/
@Cordova()
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }

File diff suppressed because it is too large Load Diff

View File

@@ -155,10 +155,10 @@ export class Hotspot {
static isWifiDirectSupported(): Promise<boolean> { return; }
@Cordova()
static scanWifi(): Promise<Array<Network>> { return; }
static scanWifi(): Promise<Array<HotspotNetwork>> { return; }
@Cordova()
static scanWifiByLevel(): Promise<Array<Network>> { return; }
static scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
@Cordova()
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
@@ -167,7 +167,7 @@ export class Hotspot {
static stopWifiPeriodicallyScan(): Promise<any> { return; }
@Cordova()
static getNetConfig(): Promise<NetworkConfig> { return; }
static getNetConfig(): Promise<HotspotNetworkConfig> { return; }
@Cordova()
static getConnectionInfo(): Promise<ConnectionInfo> { return; }
@@ -217,90 +217,90 @@ export class Hotspot {
export interface ConnectionInfo {
/**
* @property {string} SSID
* SSID
* The service set identifier (SSID) of the current 802.11 network.
*/
SSID: string;
/**
* @property {string} BSSID
* BSSID
* The basic service set identifier (BSSID) of the current access point.
*/
BSSID: string;
/**
* @property {string} linkSpeed
* linkSpeed
* The current link speed in Mbps
*/
linkSpeed: string;
/**
* @property {string} IPAddress
* IPAddress
* The IP Address
*/
IPAddress: string;
/**
* @property {string} networkID
* networkID
* Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.
*/
networkID: string;
}
export interface Network {
export interface HotspotNetwork {
/**
* @property {string} SSID
* SSID
* Human readable network name
*/
SSID: string;
/**
* @property {string} BSSID
* BSSID
* MAC Address of the access point
*/
BSSID: string;
/**
* @property {number (int)} frequency
* frequency
* The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.
*/
frequency: number;
/**
* @property {number} level
* level
* The detected signal level in dBm, also known as the RSSI.
*/
level: number;
/**
* @property {number} timestamp
* timestamp
* Timestamp in microseconds (since boot) when this result was last seen.
*/
timestamp: number;
/**
* @property {string} capabilities
* capabilities
* Describes the authentication, key management, and encryption schemes supported by the access point.
*/
capabilities: string;
}
export interface NetworkConfig {
export interface HotspotNetworkConfig {
/**
* @property {string} deviceIPAddress - Device IP Address
* deviceIPAddress - Device IP Address
*/
deviceIPAddress: string;
/**
* @property {string} deviceMacAddress - Device MAC Address
* deviceMacAddress - Device MAC Address
*/
deviceMacAddress: string;
/**
* @property {string} gatewayIPAddress - Gateway IP Address
* gatewayIPAddress - Gateway IP Address
*/
gatewayIPAddress: string;
/**
* @property {string} gatewayMacAddress - Gateway MAC Address
* gatewayMacAddress - Gateway MAC Address
*/
gatewayMacAddress: string;
}
export interface HotspotDevice {
/**
* @property {string} ip
* ip
* Hotspot IP Address
*/
ip: string;
/**
* @property {string} mac
* mac
* Hotspot MAC Address
*/
mac: string;

157
src/plugins/http.ts Normal file
View File

@@ -0,0 +1,157 @@
import { Plugin, Cordova } from './plugin';
/**
* @name HTTP
* @description
* Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
*
* Advantages over Javascript requests:
* - Background threading - all requests are done in a background thread
* - SSL Pinning
*
* @usage
* ```
* import { HTTP } from 'ionic-native';
*
* HTTP.get('http://ionic.io', {}, {})
* .then(data => {
*
* console.log(data.status);
* console.log(data.data); // data received by server
* console.log(data.headers);
*
* })
* .catch(error => {
*
* console.log(error.status);
* console.log(error.error); // error message as string
* console.log(error.headers);
*
* });
*
* ```
* @interfaces
* HTTPResponse
*/
@Plugin({
plugin: 'cordova-plugin-http',
pluginRef: 'cordovaHTTP',
repo: 'https://github.com/wymsee/cordova-HTTP',
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
* @return {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'}
*/
@Cordova({ sync: true })
static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
/**
* This sets up all future requests to use Basic HTTP authentication with the given username and password.
* @param username {string} Username
* @param password {string} Password
*/
@Cordova({ sync: true })
static useBasicAuth(username: string, password: string): void { }
/**
* Set a header for all future requests. Takes a header and a value.
* @param header {string} The name of the header
* @param value {string} The value of the header
*/
@Cordova({ sync: true })
static setHeader(header: string, value: string): void { }
/**
* Enable or disable SSL Pinning. This defaults to false.
*
* To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this stackoverflow answer. You want to convert it to a DER encoded certificate with a .cer extension.
*
* As an alternative, you can store your .cer files in the www/certificates folder.
* @param enable {boolean} Set to true to enable
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static enableSSLPinning(enable: boolean): Promise<void> { return; }
/**
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
* @param accept {boolean} Set to true to accept
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static acceptAllCerts(accept: boolean): Promise<void> { return; }
/**
* Whether or not to validate the domain name in the certificate. This defaults to true.
* @param validate {boolean} Set to true to validate
* @return {Promise<any>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static validateDomainName(validate: boolean): Promise<void> { return; }
/**
* Make a POST request
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
* @param url {string} The url to send the request to
* @param parameters {Object} Parameters to send with the request
* @param headers {Object} The headers to set for this request
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
* @param url {string} The url to send the request to
* @param body {Object} The body of the request
* @param headers {Object} The headers to set for this request
* @param filePath {string} The local path of the file to upload
* @param name {string} The name of the parameter to pass the file along as
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static uploadFile(url: string, body: any, headers: any, filePath: string, 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.
* @return {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
}
export interface HTTPResponse {
/**
* The status number of the response
*/
status: number;
/**
* The data that is in the response. This property usually exists when a promise returned by a request method resolves.
*/
data?: any;
/**
* The headers of the response
*/
headers: any;
/**
* Error response from the server. This property usually exists when a promise returned by a request method rejects.
*/
error?: string;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,67 @@
import {Plugin, Cordova} from './plugin';
/**
* @name LocationAccuracy
* @description
* This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually.
*
* @usage
* ```
* import { LocationAccuracy } from 'ionic-native';
*
* LocationAccuracy.canRequest().then((canRequest: boolean) => {
*
* if(canRequest) {
* // the accuracy option will be ignored by iOS
* LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
* () => console.log('Request successful'),
* error => console.log('Error requesting location permissions', error)
* );
* }
*
* });
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-request-location-accuracy',
pluginRef: 'cordova.plugins.locationAccuracy',
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy'
})
export class LocationAccuracy {
/**
* Indicates if you can request accurate location
* @returns {Promise<boolean>} Returns a promise that resovles with a boolean that indicates if you can request accurate location
*/
@Cordova()
static canRequest(): Promise<boolean> { return; }
/**
* Indicates if a request is currently in progress
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates if a request is currently in progress
*/
@Cordova()
static isRequesting(): Promise<boolean> { return; }
/**
* Requests accurate location
* @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;
}

29
src/plugins/market.ts Normal file
View File

@@ -0,0 +1,29 @@
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({
plugin: 'cordova-plugin-market',
pluginRef: '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
*/
@Cordova({sync: true})
static open(appId: string, callbacks?: {success?: Function, failure?: Function}): void { }
}

View File

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

View File

@@ -1,6 +1,4 @@
import { CordovaInstance, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
import { CordovaInstance, Plugin, getPlugin, pluginWarn } from './plugin';
declare var Media: any;
@@ -69,59 +67,91 @@ export interface MediaError {
*
* ```
*/
@Plugin({
let pluginMeta = {
repo: 'https://github.com/apache/cordova-plugin-media',
plugin: 'cordova-plugin-media',
pluginRef: 'Media'
})
};
@Plugin(pluginMeta)
export class MediaPlugin {
// Constants
/**
* @private
*/
static MEDIA_NONE: number = 0;
/**
* @private
*/
static MEDIA_STARTING: number = 1;
/**
* @private
*/
static MEDIA_RUNNING: number = 2;
/**
* @private
*/
static MEDIA_PAUSED: number = 3;
/**
* @private
*/
static MEDIA_STOPPED: number = 4;
// error codes
/**
* @private
*/
static MEDIA_ERR_ABORTED: number = 1;
/**
* @private
*/
static MEDIA_ERR_NETWORK: number = 2;
/**
* @private
*/
static MEDIA_ERR_DECODE: number = 3;
/**
* @private
*/
static MEDIA_ERR_NONE_SUPPORTED: number = 4;
// Properties
private _objectInstance: any;
status: Observable<any>;
init: Promise<any>;
// Methods
/**
* Open a media file
* @param src {string} A URI containing the audio content.
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
*/
constructor(src: string) {
let res, rej, next;
this.init = new Promise<any>((resolve, reject) => { res = resolve; rej = reject; });
this.status = new Observable((observer) => {
next = data => observer.next(data);
});
this._objectInstance = new Media(src, res, rej, next);
constructor(src: string, onStatusUpdate?: Function) {
if (!!getPlugin('Media')) {
this.init = new Promise<any>((resolve, reject) => {
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
});
} else {
pluginWarn(pluginMeta);
}
}
/**
* Returns the current amplitude of the current recording.
* Get the current amplitude of the current recording.
* @returns {Promise} Returns a promise with the amplitude of the current recording
*/
@CordovaInstance()
getCurrentAmplitude(): Promise<any> { return; }
/**
* Returns the current position within an audio file. Also updates the Media object's position parameter.
* Get the current position within an audio file. Also updates the Media object's position parameter.
* @returns {Promise} Returns a promise with the position of the current recording
*/
@CordovaInstance()
getCurrentPosition(): Promise<any> { return; }
/**
* Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
* Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
* @returns {Promise} Returns a promise with the duration of the current recording
*/
@CordovaInstance({
sync: true
@@ -157,7 +187,7 @@ export class MediaPlugin {
/**
* Sets the current position within an audio file.
* @param milliseconds
* @param {number} milliseconds The time position you want to set for the current audio file
*/
@CordovaInstance({
sync: true

112
src/plugins/mixpanel.ts Normal file
View File

@@ -0,0 +1,112 @@
import { Cordova, CordovaProperty, 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);
*
* ```
*/
@Plugin({
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; }
/**
*
*/
@Cordova()
static flush(): Promise<any> { return; }
/**
*
* @param distinctId {string}
* @returns {Promise<any>}
*/
@Cordova()
static identify(distinctId): Promise<any> { return; }
/**
*
* @param token {string}
* @returns {Promise<any>}
*/
@Cordova()
static init(token: string): Promise<any> { return; }
/**
*
* @param superProperties
* @returns {Promise<any>}
*/
@Cordova()
static registerSuperProperties(superProperties: any): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static reset(): Promise<any> { return; }
/**
*
* @param eventName
* @param eventProperties
*/
@Cordova()
static track(eventName: string, eventProperties?: any): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static showSurvey(): Promise<any> { return; }
/**
*
* @returns {MixpanelPeople}
*/
@CordovaProperty
static get people(): MixpanelPeople { return mixpanel.people; };
}
/**
* @private
*/
export declare class MixpanelPeople {
static identify(distinctId: string, onSuccess?: Function, onFail?: Function): void;
static increment(peopleProperties: any, onSuccess?: Function, onFail?: Function): void;
static setPushId(pushId: string, onSuccess?: Function, onFail?: Function): void;
static set(peopleProperties: any, onSuccess?: Function, onFail?: Function): void;
static setOnce(peopleProperties: any, onSuccess?: Function, onFail?: Function): void;
}

View File

@@ -0,0 +1,128 @@
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({
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;
}

View File

@@ -0,0 +1,89 @@
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({
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
*/
@Cordova()
static slide(options: TransitionOptions): Promise<any> { return; }
/**
* Perform a flip animation
* @param options {TransitionOptions} Options for the transition
*/
@Cordova()
static flip(options: TransitionOptions): Promise<any> { return; }
/**
* Perform a fade animation
* @param options {TransitionOptions} Options for the transition
*/
@Cordova({platforms: ['iOS', 'Android']})
static fade(options: TransitionOptions): Promise<any> { return; }
/**
* Perform a slide animation
* @param options {TransitionOptions} Options for the transition
*/
@Cordova({platforms: ['iOS', 'Android']})
static drawer(options: TransitionOptions): Promise<any> { return; }
/**
* Perform a slide animation
* @param options {TransitionOptions} Options for the transition
*/
@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;
}

163
src/plugins/nfc.ts Normal file
View File

@@ -0,0 +1,163 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @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({
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
* @return {Promise<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
* @return {Promise<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
* @return {Promise<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
* @return {Promise<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[]}
* @return {Promise<any>}
*/
@Cordova()
static write(message: any[]): Promise<any> {return; }
/**
* Makes a NFC tag read only. **Warning** this is permanent.
* @return {Promise<any>}
*/
@Cordova()
static makeReadyOnly(): Promise<any> {return; }
/**
* Shares an NDEF Message via peer-to-peer.
* @param message An array of NDEF Records.
* @return {Promise<any>}
*/
@Cordova()
static share(message: any[]): Promise<any> {return; }
/**
* Stop sharing NDEF data via peer-to-peer.
* @return {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.
* @return {Promise<any>}
*/
@Cordova()
static handover(uris: string[]): Promise<any> {return; }
/**
* Stop sharing NDEF data via NFC handover.
* @return {Promise<any>}
*/
@Cordova()
static stopHandover(): Promise<any> {return; }
/**
* Show the NFC settings on the device.
* @return {Promise<any>}
*/
@Cordova()
static showSettings(): Promise<any> {return; }
/**
* Check if NFC is available and enabled on this device.
* @return {Promise<any>}
*/
@Cordova()
static enabled(): Promise<any> {return; }
}
/**
* @private
*/
export declare class Ndef {
static uriRecord(uri: string): any;
static textRecord(text: string): any;
static mimeMediaRecord(mimeType: string, payload: string): any;
static androidApplicationRecord(packageName: string): any;
}

View File

@@ -1,7 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name OneSignal
* @description
@@ -14,13 +13,19 @@ import { Observable } from 'rxjs/Observable';
* ```typescript
* import { OneSignal } from 'ionic-native';
*
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
* {googleProjectNumber: '703322744261'})
* .subscribe(jsonData => {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* });
* OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
*
* OneSignal.enableInAppAlertNotification(true);
* OneSignal.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();
* ```
*
*/
@@ -32,19 +37,107 @@ import { Observable } from 'rxjs/Observable';
export class OneSignal {
/**
* Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
*
* @param {appId} Your AppId from your OneSignal app
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
* @returns {Observable} when a notification is received. Handle your notification action here.
* 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.
*/
@Cordova({ sync: true })
static startInit(appId: string, googleProjectNumber: string): any { return; }
/**
* Callback to run when a notification is received
* @return {Observable<any>}
*/
@Cordova({
observable: true
})
static handleNotificationReceived(): Observable<any> { return; }
/**
* Callback to run when a notification is opened
* @return {Observable<any>}
*/
@Cordova({
observable: true
})
static handleNotificationOpened(): Observable<any> { return; }
/**
*
* @param settings
*/
@Cordova({ sync: true })
static iOSSettings(settings: {
kOSSettingsKeyInAppLaunchURL: boolean;
kOSSettingsKeyAutoPrompt: boolean;
}): any { return; }
@Cordova({ sync: true })
static endInit(): any { return; }
/**
* Retrieve a list of tags that have been set on the user from the OneSignal server.
*
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
*/
@Cordova()
static getTags(): Promise<any> { return; }
/**
* Lets you retrieve the OneSignal user id and device token.
* Your handler is called after the device is successfully registered with OneSignal.
*
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
* It returns a JSON with `userId`and `pushToken`.
*/
@Cordova()
static getIds(): Promise<any> { return; }
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
*
* @param {string} Key of your choosing to create or update.
* @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
*/
@Cordova({ sync: true })
static sendTag(key: string, value: string): void { }
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
*
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
@Cordova({ sync: true })
static sendTags(json: any): void { }
/**
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
*
* @param {string} Key to remove.
*/
@Cordova({ sync: true })
static deleteTag(key: string): void { }
/**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
*
* @param {Array<string>} Keys to remove.
*/
@Cordova({ sync: true })
static deleteTags(keys: string[]): void { }
/**
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
@@ -53,60 +146,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 +153,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 +165,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 { }
@@ -168,68 +194,7 @@ export class OneSignal {
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
*/
@Cordova()
static postNotification(notificationObj: {
app_id: string,
contents: any,
headings?: any,
isIos?: boolean,
isAndroid?: boolean,
isWP?: boolean,
isWP_WNS?: boolean,
isAdm?: boolean,
isChrome?: boolean,
isChromeWeb?: boolean,
isSafari?: boolean,
isAnyWeb?: boolean,
included_segments?: string[],
excluded_segments?: string[],
include_player_ids?: string[],
include_ios_tokens?: string[],
include_android_reg_ids?: string[],
include_wp_uris?: string[],
include_wp_wns_uris?: string[],
include_amazon_reg_ids?: string[],
include_chrome_reg_ids?: string[],
include_chrome_web_reg_ids?: string[],
app_ids?: string[];
tags?: any[],
ios_badgeType?: string,
ios_badgeCount?: number,
ios_sound?: string,
android_sound?: string,
adm_sound?: string,
wp_sound?: string,
wp_wns_sound?: string,
data?: any,
buttons?: any,
small_icon?: string,
large_icon?: string,
big_picture?: string,
adm_small_icon?: string,
adm_large_icon?: string,
adm_big_picture?: string,
chrome_icon?: string,
chrome_big_picture?: string,
chrome_web_icon?: string,
firefox_icon?: string,
url?: string,
send_after?: string,
delayed_option?: string,
delivery_time_of_day?: string,
android_led_color?: string,
android_accent_color?: string,
android_visibility?: number,
content_available?: boolean,
amazon_background_data?: boolean,
template_id?: string,
android_group?: string,
android_group_message?: any,
adm_group?: string,
adm_group_message?: any,
ttl?: number,
priority?: number,
ios_category?: string
}): Promise<any> { return; }
static postNotification(notificationObj: OneSignalNotification): Promise<any> { return; }
/**
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
@@ -237,6 +202,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 +224,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;
}

462
src/plugins/pay-pal.ts Normal file
View File

@@ -0,0 +1,462 @@
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({
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.
*/
@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
*/
@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
**/
@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
*/
@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.
*/
@Cordova()
static clientMetadataID(): Promise<any> {return; }
/**
* Please Read Docs on Future Payments at https://github.com/paypal/PayPal-iOS-SDK#future-payments
*/
@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
**/
@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;
}

View File

@@ -3,8 +3,6 @@ import { Observable } from 'rxjs/Observable';
declare var window;
declare var Promise;
declare var $q;
/**
* @private
@@ -20,7 +18,7 @@ export const getPlugin = function(pluginRef: string): any {
* @param pluginObj
* @param method
*/
export const pluginWarn = function(pluginObj: any, method: string) {
export const pluginWarn = function(pluginObj: any, method?: string) {
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
@@ -43,6 +41,11 @@ export const cordovaWarn = function(pluginName: string, method: string) {
}
};
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
// ignore resolve and reject in case sync
if (opts.sync) {
return args;
}
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder === 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
@@ -56,9 +59,19 @@ 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);
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) {
@@ -102,17 +115,30 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
}
function getPromise(cb) {
const tryNativePromise = () => {
if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
}
};
if (window.angular) {
let $q = window.angular.injector(['ng']).get('$q');
return $q((resolve, reject) => {
cb(resolve, reject);
});
} else if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
let injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector();
if (injector) {
let $q = injector.get('$q');
return $q((resolve, reject) => {
cb(resolve, reject);
});
} else {
console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.');
return tryNativePromise();
}
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
return tryNativePromise();
}
}
@@ -214,6 +240,47 @@ function wrapEventObservable(event: string): Observable<any> {
});
}
/**
* Certain plugins expect the user to override methods in the plugin. For example,
* window.cordova.plugins.backgroundMode.onactivate = function() { ... }.
*
* Unfortunately, this is brittle and would be better wrapped as an Observable. overrideFunction
* does just this.
*/
function overrideFunction(pluginObj: any, methodName: string, args: any[], opts: any = {}): Observable<any> {
return new Observable(observer => {
let pluginInstance = getPlugin(pluginObj.pluginRef);
if (!pluginInstance) {
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
if (!window.cordova) {
cordovaWarn(pluginObj.name, methodName);
observer.error({
error: 'cordova_not_available'
});
}
pluginWarn(pluginObj, methodName);
observer.error({
error: 'plugin_not_installed'
});
return;
}
let method = pluginInstance[methodName];
if (!method) {
observer.error({
error: 'no_such_method'
});
observer.complete();
return;
}
pluginInstance[methodName] = observer.next.bind(observer);
});
}
/**
* @private
* @param pluginObj
@@ -265,10 +332,24 @@ export function Plugin(config) {
cls[k] = config[k];
}
cls['installed'] = function() {
cls['installed'] = function(printWarning?: boolean) {
return !!getPlugin(config.pluginRef);
};
cls['getPlugin'] = function() {
return getPlugin(config.pluginRef);
};
cls['checkInstall'] = function() {
let pluginInstance = getPlugin(config.pluginRef);
if (!pluginInstance) {
pluginWarn(cls);
return false;
}
return true;
};
return cls;
};
}
@@ -348,3 +429,19 @@ export function InstanceProperty(target: any, key: string, descriptor: TypedProp
return descriptor;
}
/**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export function CordovaFunctionOverride(opts: any = {}) {
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
return {
value: function(...args: any[]) {
return overrideFunction(this, methodName, opts);
}
};
};
}

View File

@@ -0,0 +1,49 @@
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({
plugin: 'cordova-plugin-powermanagement-orig',
pluginRef: 'powerManagement',
repo: 'https://github.com/Viras-/cordova-plugin-powermanagement'
})
export class PowerManagement {
/**
* Acquire a wakelock by calling this.
*/
@Cordova()
static acquire(): Promise<any> {return; }
/**
* This acquires a partial wakelock, allowing the screen to be dimmed.
*/
@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.
*/
@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}
*/
@Cordova()
static setReleaseOnPause(set: boolean): Promise<any> {return; }
}

View File

@@ -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 {

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,73 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Stepcounter
* @description
* Cordova plugin for using device's stepcounter on Android (API > 19)
*
* Use to
* - start and stop stepcounter service
* - read device's stepcounter data
*
* @usage
* ```
* import { Stepcounter } from 'ionic-native';
*
* let startingOffset = 0;
* Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure));
*
* Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure));
*
* ```
*/
@Plugin({
plugin: 'https://github.com/texh/cordova-plugin-stepcounter',
pluginRef: 'stepcounter',
repo: 'https://github.com/texh/cordova-plugin-stepcounter',
platforms: ['Android']
})
export class Stepcounter {
/**
* Start the step counter
*
* @param startingOffset {number} will be added to the total steps counted in this session
* @return {Promise} Returns a Promise that resolves on success or rejects on failure
*/
@Cordova()
static start(startingOffset: number): Promise<number | any> { return; }
/**
* Stop the step counter
* @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
*/
@Cordova()
static stop(): Promise<number | any> { return; }
/**
* Get the amount of steps for today (or -1 if it no data given)
* @return {Promise} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure
*/
@Cordova()
static getTodayStepCount(): Promise<number | any> { return; }
/**
* Get the amount of steps since the start command has been called
* @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
*/
@Cordova()
static getStepCount(): Promise<number | any> { return; }
/**
* Returns true/false if Android device is running >API level 19 && has the step counter API available
* @return {Promise} Returns a Promise that resolves on success, or rejects on failure
*/
@Cordova()
static deviceCanCountSteps(): Promise<boolean | any> { return; }
/**
* Get the step history (JavaScript object)
* @return {Promise} Returns a Promise that resolves on success, or rejects on failure
*/
@Cordova()
static getHistory(): Promise<any> { return; }
}

View File

@@ -0,0 +1,77 @@
import { Plugin, Cordova } from './plugin';
/**
* @name StreamingMedia
* @description
* This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android.
*
* @usage
* ```
* import {StreamingMedia, StreamingVideoOptions} from 'ionic-native';
*
* let options: StreamingVideoOptions = {
* successCallback: () => { console.log('Video played') },
* errorCallback: (e) => { console.log('Error streaming') },
* orientation: 'landscape'
* };
*
* StreamingMedia.('https://path/to/video/stream', options);
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-streaming-media',
pluginRef: 'plugins.streamingMedia',
repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media',
platforms: ['Android', 'iOS']
})
export class StreamingMedia {
/**
* Streams a video
* @param videoUrl {string} The URL of the video
* @param options {StreamingVideoOptions} Options
*/
@Cordova({sync: true})
static playVideo(videoUrl: string, options?: StreamingVideoOptions): void { }
/**
* Streams an audio
* @param audioUrl {string} The URL of the audio stream
* @param options {StreamingAudioOptions} Options
*/
@Cordova({sync: true})
static playAudio(audioUrl: string, options?: StreamingAudioOptions): void { }
/**
* Stops streaming audio
*/
@Cordova({sync: true})
static stopAudio(): void { }
/**
* Pauses streaming audio
*/
@Cordova({sync: true, platforms: ['iOS']})
static pauseAudio(): void { }
/**
* Resumes streaming audio
*/
@Cordova({sync: true, platforms: ['iOS']})
static resumeAudio(): void { }
}
export interface StreamingVideoOptions {
successCallback?: Function;
errorCallback?: Function;
orientation?: string;
}
export interface StreamingAudioOptions {
bgColor?: string;
bgImage?: string;
bgImageScale?: string;
initFullscreen?: boolean;
successCallback?: Function;
errorCallback?: Function;
}

View File

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

View File

@@ -0,0 +1,210 @@
import { Plugin, CordovaInstance } from './plugin';
import { Observable } from 'rxjs/Observable';
import { InAppBrowserEvent } from './inappbrowser';
declare var cordova: any;
export interface ThemeableBrowserButton {
wwwImage?: string;
image?: string;
wwwImagePressed?: string;
imagePressed?: string;
wwwImageDensity?: number;
align?: string;
event?: string;
}
export interface ThemeableBrowserOptions {
statusbar?: {
color: string;
};
toolbar?: {
height?: number;
color?: string;
image?: string;
};
title?: {
color?: string;
staticText?: string;
showPageTitle?: boolean;
};
backButton?: ThemeableBrowserButton;
forwardButton?: ThemeableBrowserButton;
closeButton?: ThemeableBrowserButton;
customButtons?: ThemeableBrowserButton[];
menu?: {
image?: string;
imagePressed?: string;
title?: string;
cancel?: string;
align?: string;
items?: {
event: string;
label: string;
}[];
};
backButtonCanClose?: boolean;
disableAnimation?: boolean;
// inAppBrowser options
location?: string;
hidden?: string;
clearcache?: string;
clearsessioncache?: string;
zoom?: string;
hardwareback?: string;
mediaPlaybackRequiresUserAction?: string;
shouldPauseOnSuspsend?: string;
closebuttoncaption?: string;
disallowoverscroll?: string;
enableViewportScale?: string;
allowInlineMediaPlayback?: string;
keyboardDisplayRequiresUserAction?: string;
suppressesIncrementalRendering?: string;
presentationstyle?: string;
transitionstyle?: string;
toolbarposition?: string;
fullscreen?: string;
}
/**
* @name ThemeableBrowser
* @description
* In-app browser that allows styling.
*
* @usage
* ```
* import { ThemeableBrowser } from 'ionic-native';
*
* // can add options from the original InAppBrowser in a JavaScript object form (not string)
* // This options object also takes additional parameters introduced by the ThemeableBrowser plugin
* // This example only shows the additional parameters for ThemeableBrowser
* // Note that that `image` and `imagePressed` values refer to resources that are stored in your app
* let options = {
* statusbar: {
* color: '#ffffffff'
* },
* toolbar: {
* height: 44,
* color: '#f0f0f0ff'
* },
* title: {
* color: '#003264ff',
* showPageTitle: true
* },
* backButton: {
* image: 'back',
* imagePressed: 'back_pressed',
* align: 'left',
* event: 'backPressed'
* },
* forwardButton: {
* image: 'forward',
* imagePressed: 'forward_pressed',
* align: 'left',
* event: 'forwardPressed'
* },
* closeButton: {
* image: 'close',
* imagePressed: 'close_pressed',
* align: 'left',
* event: 'closePressed'
* },
* customButtons: [
* {
* image: 'share',
* imagePressed: 'share_pressed',
* align: 'right',
* event: 'sharePressed'
* }
* ],
* menu: {
* image: 'menu',
* imagePressed: 'menu_pressed',
* title: 'Test',
* cancel: 'Cancel',
* align: 'right',
* items: [
* {
* event: 'helloPressed',
* label: 'Hello World!'
* },
* {
* event: 'testPressed',
* label: 'Test!'
* }
* ]
* },
* backButtonCanClose: true
* };
*
* let browser = new ThemeableBrowser('https://ionic.io', '_blank', options);
*
* ```
* We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here.
*/
@Plugin({
plugin: 'cordova-plugin-themeablebrowser',
pluginRef: 'cordova.ThemeableBrowser',
repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser'
})
export class ThemeableBrowser {
private _objectInstance: any;
constructor(url: string, target: string, styleOptions: ThemeableBrowserOptions) {
try {
this._objectInstance = cordova.ThemeableBrowser.open(url, target, styleOptions);
} catch (e) {
window.open(url);
console.warn('Native: ThemeableBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
}
}
/**
* Displays an browser window that was opened hidden. Calling this has no effect
* if the browser was already visible.
*/
@CordovaInstance({sync: true})
show(): void { }
/**
* Closes the browser window.
*/
@CordovaInstance({sync: true})
close(): void { }
/**
* Reloads the current page
*/
@CordovaInstance({ sync: true })
reload(): void { }
/**
* Injects JavaScript code into the browser window.
* @param script Details of the script to run, specifying either a file or code key.
*/
@CordovaInstance()
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
/**
* Injects CSS into the browser window.
* @param css Details of the script to run, specifying either a file or code key.
*/
@CordovaInstance()
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
/**
* A method that allows you to listen to events happening in the browser.
* Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined`
* @param event Event name
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
on(event: string): Observable<InAppBrowserEvent> {
return new Observable<InAppBrowserEvent>((observer) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
});
}
}

View File

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

View File

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

View File

@@ -0,0 +1,28 @@
import { Plugin, Cordova } from './plugin';
/**
* @name YoutubeVideoPlayer
* @description
* Plays YouTube videos in Native YouTube App
*
* @usage
* ```
* import {YoutubeVideoPlayer} from 'ionic-native';
*
* YouTubeVideoPlayer.openVideo('myvideoid');
*
* ```
*/
@Plugin({
plugin: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git',
pluginRef: 'YoutubeVideoPlayer',
repo: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer',
platforms: ['Android', 'iOS']
})
export class YoutubeVideoPlayer {
/**
* Plays a YouTube video
* @param videoId {string} Video ID
*/
@Cordova({sync: true})
static openVideo(videoId: string): void { }
}

91
src/plugins/z-bar.ts Normal file
View File

@@ -0,0 +1,91 @@
import { Plugin, Cordova } from './plugin';
/**
* @name ZBar
* @description
* The ZBar Scanner Plugin allows you to scan 2d barcodes.
*
* Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar).
*
* @usage
* ```
* import { ZBar } from 'ionic-native';
*
* let zBarOptions = {
* flash: "off",
* drawSight: false
* };
*
* ZBar.scan(zBarOptions)
* .then(result => {
* console.log(result); // Scanned code
* })
* .catch(error => {
* console.log(error); // Error message
* });
*
* ```
*
* @advanced
* zBar options
*
* | Option | Type | Values | Defaults |
* |--------------------|-----------|-----------------------------------------------------------------------------------------|
* | text_title |`string?` | | `"Scan QR Code"` (Android only) |
* | text_instructions |`string?` | | `"Please point your camera at the QR code."` (Android only) |
* | camera |`string?` | `"front"`, `"back"`, | `"back"` |
* | flash |`string?` | `"on"`, `"off"`, `"auto"` | `"auto"` |
* | drawSight |`boolean?` | `true`, `false` | `true` (Draws red line in center of scanner) |
*
*/
@Plugin({
plugin: 'cordova-plugin-cszbar',
pluginRef: 'cloudSky.zBar',
repo: 'https://github.com/tjwoon/csZBar',
platforms: ['Android', 'iOS']
})
export class ZBar {
/**
* Open the scanner
* @param options { ZBarOptions } Scan options
* @return Returns a Promise that resolves with the scanned string, or rejects with an error.
*/
@Cordova()
static scan(options: ZBarOptions): Promise<any> { return; }
}
export interface ZBarOptions {
/**
* A string representing the title text (Android only).
* Default: "Scan QR Code"
*/
text_title?: string;
/**
* A string representing the instruction text (Android only).
* Default: "Please point your camera at the QR code."
*/
text_instructions?: string;
/**
* A string defining the active camera when opening the scanner.
* Possible values: "front", "back"
* Default: "back"
*/
camera?: string;
/**
* A string defining the state of the flash.
* Possible values: "on", "off", "auto"
* Default: "auto"
*/
flash?: string;
/**
* A boolean to show or hide a line in the center of the scanner.
* Default: true
*/
drawSight?: boolean;
}

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

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

15
tsconfig-es5.json Normal file
View File

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

15
tsconfig-esm.json Normal file
View File

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

View File

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

5
typings.json Normal file
View File

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

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

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

View File

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

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

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