Compare commits

...

268 Commits

Author SHA1 Message Date
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
Ibrahim Hadeed
a4798b81a8 refracto(): tslint 2016-08-26 12:33:28 -04:00
Ibrahim Hadeed
48334aa4cd chore(): 2016-08-26 12:29:15 -04:00
Ibrahim Hadeed
8b2d47587a 1.3.18 2016-08-26 12:25:11 -04:00
Ibrahim Hadeed
c04379af19 refractor(geofence): fix tslint issues 2016-08-26 12:21:38 -04:00
Ibrahim Hadeed
d26bc886cf chore(): update contribution guide 2016-08-26 12:20:22 -04:00
Kapil Sachdeva
905f988d43 feat(code-push): add wrapper for cordova-plugin-code-push (#420)
* feat - introduce the plugin wrapper for code-push and type definitions

* feat(code-push) - change the signature of the methods to return Promise & decorate them with Cordova decorator

* fix(code push) - in sync method call the native method

* fix(code-push) : use decorator on syc to mark it as an observable / add sample usage

* docs(code-push) : add the link to the sample repository

* fix - merge errors

* fix(code-push) : add description field on CodePush class / remove not needed IWindow interface declaration
2016-08-26 12:06:26 -04:00
David Störcher
eff7841ec2 fix(File): fixed readFileAs (#479)
* Fix(File): Fixing readFileAs

https://developer.mozilla.org/de/docs/Web/API/FileReader --> FileReader expects File and not FileEntry.

* Fix(File): Fixing readFileAs

refactoring to arrow Functions
2016-08-26 09:22:59 -04:00
Ibrahim Hadeed
8526e89e12 feat(inAppPurchase): add inAppPurhcase plugin (#423)
* feat(inAppPurchase): add inAppPurchase

* add otherPromise option to decorator
2016-08-26 08:18:43 -04:00
Ibrahim Hadeed
bde47eb37b merge 2016-08-26 08:17:47 -04:00
Justin Schuldt
61716467df docs(background-geolocation): config method, example fix (#478) 2016-08-26 08:14:54 -04:00
Ibrahim Hadeed
efa222fb55 fix(geofence): fix event listeners 2016-08-26 08:12:28 -04:00
Ibrahim Hadeed
abfa8a5f0f remove DS_STORE files 2016-08-26 08:07:20 -04:00
Alex Muramoto
a438967336 feat(geofence): Adds geofence plugin (#442)
* Fixes syntax error in usage example, and improves usage formatting

* Moves error codes into usage section

* Adds basics of geofence plugin

* Updates exports to include Geofence

* Adds geofence docs and tested functions

* Corrects promise types and comments out unimplemented functions

* Minor updates to geofence

* Reverts camera-preview changes for this branch to master
2016-08-26 08:06:36 -04:00
Ibrahim Hadeed
47a9b34ea2 feat(diagnostic): add full plugin functionality (#424)
* feat(diagnostic): add full plugin functionality

closes #224

* docs(): calendar methods (#476)

* feat(diag): add constants
2016-08-26 08:06:04 -04:00
Ibrahim Hadeed
c4110eedf4 fix(facebook): export interfaces 2016-08-26 07:54:52 -04:00
Ibrahim Hadeed
27218cda86 Merge branch 'Lekooa-estimote' 2016-08-26 07:53:30 -04:00
Ibrahim Hadeed
8c059fc1d0 fix conflict 2016-08-26 07:53:18 -04:00
Matt Lewis
dd39ba8c48 feat(IsDebug): add the IsDebug plugin (#475) 2016-08-26 05:16:20 -04:00
Daniel Salvagni
aa76fac3af docs(screenshot): fixes Screenshot spelling on the example code (#480)
Screenshot was spelling wrong: `Screneshot`.
2016-08-26 05:14:57 -04:00
Daniel Salvagni
e4f198ae42 docs(screen-orientation): fixes the advanced table info (#481) 2016-08-26 05:14:32 -04:00
Mike Hartington
dfdaa157a4 docs(screenOrientation): update docs 2016-08-23 14:13:57 -04:00
Mike Hartington
ea58a78f62 docs(backgroundMode): update docs 2016-08-23 12:47:11 -04:00
Ibrahim Hadeed
34f34521d9 chore(): update changelog 2016-08-22 21:48:45 -04:00
Ibrahim Hadeed
ffcbb6a355 1.3.17 2016-08-22 21:48:13 -04:00
Ibrahim Hadeed
2510c5fd4a fix(nativeaudio): fix plugin reference 2016-08-22 21:45:37 -04:00
Ramon Henrique Ornelas
ed8c67ce7e chore(): tslint (#466)
* fix src tslint gulp ionic

* - fix errors tslint
2016-08-22 18:19:43 -04:00
Robert Coie
16628a49f7 fix(file): initialize writeFile options (#468) 2016-08-22 18:18:53 -04:00
Aaron Czichon
38ff6f2a32 docs(onesignal): updated the OneSignal docs (#467) 2016-08-22 18:18:23 -04:00
Fabien Duthu
af39282191 Removed 'public' before the property names and cleaned c/p extra docs 2016-08-22 15:37:51 +02:00
Alex Muramoto
eab0bf44b2 refractor(media): change MediaError to interface, and error codes to static members (#463) 2016-08-21 10:42:11 -04:00
Guillermo
a94912912e chore(deps): bump tslint-ionic-rules (#460)
* Bump tslint-ionic-rules

* Bump tslint-ionic-rules
2016-08-19 11:01:24 -04:00
Alex Muramoto
55ba65ac68 fix(camera-preview): changes implementation to match Cordova plugin (#441)
* Removes preview settings from options obj and creates proper rect interface

* Changes startCamera() signature to match plugin

* Adds alpha to function signature

* Removes CameraPreviewOptions and CameraPreviewSize interfaces that don't match plugin

* Adds back CameraPreviewSize interface - oops

* Updates docs for startCamera()

* Changes CameraPreviewSize interface to Size to match plugin

* Adds docs for takePicture

* Reverts change to signature of setOnPictureTakenHandler

* Adds CameraPreview prefix to interfaces
2016-08-19 09:10:05 -04:00
Matt Lewis
f3e698f1be feat(instagram): add instagram sharing plugin (#453)
Closes #307
2016-08-19 09:08:05 -04:00
David Störcher
14e41a31ef fix(file): fixes exclusive option (#459)
Exclusive means that the file will not be Overridden so it has to be set if replace is False.
2016-08-19 09:07:32 -04:00
Alex Muramoto
62bcd313e3 docs(file): adds Entry to types returned in File.moveDir promise (#456) 2016-08-19 07:06:17 -04:00
Matt Lewis
7a53013819 feat(VideoEditor): add video editor plugin. (#457)
Closes #316
2016-08-19 07:05:11 -04:00
Alex Muramoto
4a0f082158 Feat(twitter): adds showUser() (#454) 2016-08-19 07:00:05 -04:00
Matt Lewis
f2bf2b5626 refactor: use es6 features in index file 2016-08-19 08:34:12 +01:00
Kevin Boosten
4e87ac72ea fix(): add the reject function at the expected errorIndex position in the args array (#436)
We don't want that the reject cb takes the position of an optional
argument that has not been defined
For example the Dialogs.alert method takes an optional 'buttonLabel'
string. In case we do not set this value, and thus want to use the
default value, the 'reject'
callback get spliced into this position due the fact that the splice
start index is bigger than the array length.
Dialogs.alert("title", "message", "My button text") --> args =
["title",  resolve, "message", "My button text", reject]
Dialogs.alert("title", "message") -->  args = ["title", resolve,
"message", reject] --> reject is on the position of the buttontitle!

The cordova-plugin-dialogs alert function receives the wrong arguments
—> alert: function(message, completeCallback, title, buttonLabel)
The buttonLabel will receive the "reject" callback instead of a
undefined value.
2016-08-17 07:34:11 -04:00
Ibrahim Hadeed
95e256293f docs(barcodescanner): update docs
addresses #260
2016-08-17 07:28:21 -04:00
Alex Muramoto
22ab575dd0 docs(DEVELOPER.MD): Adds steps for adding new plugins to index.ts (#444)
* Adds steps for updating index.ts

* Adds .DS_Store to gitignore

* Adds step for exporting
2016-08-17 03:11:52 -04:00
Jochen Bedersdorfer
abd706f435 refractor(file): additions to documentation and type definitions for File plugin (#446)
* Additions to documentations and type definitions

Added return types to documentation as well as modified return type definition to match actual types returned.
Used union types for promises where applicable.

Builds and gulp docs ok.

* Update file.ts
2016-08-17 03:11:10 -04:00
Ramon Henrique Ornelas
4c00e14cd4 refractor(): fix angular style (#445)
* - fix angular style

* - Fix angular style
2016-08-17 03:09:34 -04:00
Alex Muramoto
e45d7c4ab1 docs(): Adds commit message guidelines (#447) 2016-08-17 03:09:06 -04:00
Joel Jeske
c37fdf47a4 docs(): Fix typo "$cordov" -> "$cordova" (#443) 2016-08-17 01:59:02 -04:00
Ramon Henrique Ornelas
9a2ea25308 style(): fix angular style (#434) 2016-08-16 00:53:15 -04:00
Ibrahim Hadeed
560e5ce7bb chore(): update changelog 2016-08-15 13:39:43 -04:00
Ibrahim Hadeed
dc0039b820 1.3.16 2016-08-15 13:37:56 -04:00
Ibrahim Hadeed
8bc499f221 fix(photo-viewer): method is static 2016-08-15 13:37:24 -04:00
Ibrahim Hadeed
93ce443467 chore(): update changelog 2016-08-15 11:50:16 -04:00
Ibrahim Hadeed
f3c5ebd28b 1.3.15 2016-08-15 11:49:32 -04:00
Ibrahim Hadeed
bcd46eea9d Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-08-15 11:49:08 -04:00
Ibrahim Hadeed
689bfd9568 feat(google-analytics): add missing functions 2016-08-15 11:48:40 -04:00
Christopher Manouvrier
dcf3ab2787 feat(TTS): add tts plugin (#431)
* Initial Pass at TTS

* Rename and fix index

* Remove unnecessary window in reference

closes #311
2016-08-15 09:29:51 -04:00
Ibrahim Hadeed
b4158f4f85 chore(): update changelog 2016-08-15 05:14:06 -04:00
Ibrahim Hadeed
0a54929169 1.3.14 2016-08-15 05:13:31 -04:00
Ibrahim Hadeed
e34f94e0c1 feat(zip): add zip plugin (#430)
closes #421
2016-08-15 05:10:43 -04:00
Ibrahim Hadeed
d4c6ea46e6 chore(): add plugin template and generator (#429)
* chore(): add plugin template and generator

* docs(): add instructions to use plugin generator
2016-08-15 04:46:54 -04:00
Ibrahim Hadeed
203d4c7669 feat(shake): add Shake plugin (#426)
closes #313
2016-08-15 03:58:34 -04:00
Ibrahim Hadeed
8cd6686803 feat(native-audio): Add native audio plugin (#427)
closes #315
2016-08-15 03:58:20 -04:00
Ibrahim Hadeed
aaddd9eea2 fix(datepicker): date now accepts Date, string, or number (#428)
closes #354
2016-08-15 03:58:06 -04:00
Ibby Hadeed
1e300ae35f add otherPromise option to decorator 2016-08-15 01:15:20 -04:00
Ibby Hadeed
c9b76c4a9a chore(): update changelog 2016-08-13 11:33:48 -04:00
Ibby Hadeed
0e5bdc2f1e 1.3.13 2016-08-13 11:30:59 -04:00
Ibby Hadeed
4b08d854bd fix(inappbrowser): fix event listener 2016-08-13 11:30:52 -04:00
Fabien Duthu
080c5a19e6 Added missing clearWithArgs option to the @Cordova decorator 2016-07-31 21:14:45 +02:00
Fabien Duthu
1da35968de Estimate beacons plugin class 2016-07-27 10:07:33 +02:00
mhartington
f1988f67f5 feat(inAppPurchase): add inAppPurchase 2016-07-15 17:33:55 -04:00
89 changed files with 7050 additions and 1037 deletions

View File

@@ -10,7 +10,7 @@ Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/bl
#### There are no rules, but here are a few things to consider:
###### Before you submit an issue:
* Do a quick search to see if there are similar issues
* Check that you are using the latest version of `ionic-native`
* **Check that you are using the latest version of** `ionic-native`
###### Still having problems? submit an issue with the following details:
* Short description of the issue

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.DS_Store
node_modules/
.idea
dist/

View File

@@ -1,14 +1,324 @@
<a name="1.3.12"></a>
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13)
<a name="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)
### Bug Fixes
* **facebook:** export interfaces ([c4110ee](https://github.com/driftyco/ionic-native/commit/c4110ee))
* **File:** fixed readFileAs ([#479](https://github.com/driftyco/ionic-native/issues/479)) ([eff7841](https://github.com/driftyco/ionic-native/commit/eff7841))
* **geofence:** fix event listeners ([efa222f](https://github.com/driftyco/ionic-native/commit/efa222f))
### Features
* **code-push:** add wrapper for cordova-plugin-code-push ([#420](https://github.com/driftyco/ionic-native/issues/420)) ([905f988](https://github.com/driftyco/ionic-native/commit/905f988))
* **diagnostic:** add full plugin functionality ([#424](https://github.com/driftyco/ionic-native/issues/424)) ([47a9b34](https://github.com/driftyco/ionic-native/commit/47a9b34)), closes [#224](https://github.com/driftyco/ionic-native/issues/224)
* **geofence:** Adds geofence plugin ([#442](https://github.com/driftyco/ionic-native/issues/442)) ([a438967](https://github.com/driftyco/ionic-native/commit/a438967))
* **inAppPurchase:** add inAppPurhcase plugin ([#423](https://github.com/driftyco/ionic-native/issues/423)) ([8526e89](https://github.com/driftyco/ionic-native/commit/8526e89))
* **IsDebug:** add the IsDebug plugin ([#475](https://github.com/driftyco/ionic-native/issues/475)) ([dd39ba8](https://github.com/driftyco/ionic-native/commit/dd39ba8))
<a name="1.3.17"></a>
## [1.3.17](https://github.com/driftyco/ionic-native/compare/v1.3.16...v1.3.17) (2016-08-23)
### Bug Fixes
* add the reject function at the expected errorIndex position in the args array ([#436](https://github.com/driftyco/ionic-native/issues/436)) ([4e87ac7](https://github.com/driftyco/ionic-native/commit/4e87ac7))
* **camera-preview:** changes implementation to match Cordova plugin ([#441](https://github.com/driftyco/ionic-native/issues/441)) ([55ba65a](https://github.com/driftyco/ionic-native/commit/55ba65a))
* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3))
* **file:** initialize writeFile options ([#468](https://github.com/driftyco/ionic-native/issues/468)) ([16628a4](https://github.com/driftyco/ionic-native/commit/16628a4))
* **nativeaudio:** fix plugin reference ([2510c5f](https://github.com/driftyco/ionic-native/commit/2510c5f))
### Features
* **instagram:** add instagram sharing plugin ([#453](https://github.com/driftyco/ionic-native/issues/453)) ([f3e698f](https://github.com/driftyco/ionic-native/commit/f3e698f)), closes [#307](https://github.com/driftyco/ionic-native/issues/307)
* **VideoEditor:** add video editor plugin. ([#457](https://github.com/driftyco/ionic-native/issues/457)) ([7a53013](https://github.com/driftyco/ionic-native/commit/7a53013)), closes [#316](https://github.com/driftyco/ionic-native/issues/316)
<a name="1.3.16"></a>
## [1.3.16](https://github.com/driftyco/ionic-native/compare/v1.3.15...v1.3.16) (2016-08-15)
### Bug Fixes
* **photo-viewer:** method is static ([8bc499f](https://github.com/driftyco/ionic-native/commit/8bc499f))
<a name="1.3.15"></a>
## [1.3.15](https://github.com/driftyco/ionic-native/compare/v1.3.14...v1.3.15) (2016-08-15)
### Features
* **google-analytics:** add missing functions ([689bfd9](https://github.com/driftyco/ionic-native/commit/689bfd9))
* **TTS:** add tts plugin ([#431](https://github.com/driftyco/ionic-native/issues/431)) ([dcf3ab2](https://github.com/driftyco/ionic-native/commit/dcf3ab2)), closes [#311](https://github.com/driftyco/ionic-native/issues/311)
<a name="1.3.14"></a>
## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.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
* **native-audio:** Add native audio plugin ([#427](https://github.com/driftyco/ionic-native/issues/427)) ([8cd6686](https://github.com/driftyco/ionic-native/commit/8cd6686)), closes [#315](https://github.com/driftyco/ionic-native/issues/315)
* **shake:** add Shake plugin ([#426](https://github.com/driftyco/ionic-native/issues/426)) ([203d4c7](https://github.com/driftyco/ionic-native/commit/203d4c7)), closes [#313](https://github.com/driftyco/ionic-native/issues/313)
* **zip:** add zip plugin ([#430](https://github.com/driftyco/ionic-native/issues/430)) ([e34f94e](https://github.com/driftyco/ionic-native/commit/e34f94e)), closes [#421](https://github.com/driftyco/ionic-native/issues/421)
<a name="1.3.12"></a>
## [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
@@ -39,7 +349,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))
@@ -66,7 +376,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
@@ -124,6 +434,7 @@
### Features
* **googlemaps:** add Geocoder class ([#292](https://github.com/driftyco/ionic-native/issues/292)) ([2996da6](https://github.com/driftyco/ionic-native/commit/2996da6)), closes [#280](https://github.com/driftyco/ionic-native/issues/280)
* **inAppPurchase:** add inAppPurchase ([f1988f6](https://github.com/driftyco/ionic-native/commit/f1988f6))
* **media-capture:** add media capture plugin ([#293](https://github.com/driftyco/ionic-native/issues/293)) ([daa6d4c](https://github.com/driftyco/ionic-native/commit/daa6d4c)), closes [#272](https://github.com/driftyco/ionic-native/issues/272)
* **nativestorage:** add NativeStorage plugin wrapper ([af5d4ad](https://github.com/driftyco/ionic-native/commit/af5d4ad))
* **pin-dialog:** add pin dialog plugin ([#291](https://github.com/driftyco/ionic-native/issues/291)) ([2fe37c4](https://github.com/driftyco/ionic-native/commit/2fe37c4))
@@ -178,12 +489,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))
@@ -192,7 +519,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
@@ -200,13 +526,6 @@
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
* **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115)
* **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed))
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
<a name="1.2.4"></a>
## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01)

View File

@@ -5,6 +5,16 @@ This is a short guide on creating new plugin wrappers for Ionic Native.
## Creating Plugin Wrappers
First, let's start by creating a new plugin wrapper from template.
```
// Call this command, and replace PluginName with the name of the plugin you wish to add
// Make sure to capitalize the first letter, or use CamelCase if necessary.
gulp plugin:create -n PluginName
```
Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity):
```
@@ -92,6 +102,58 @@ The `@Cordova` decorator has a few more options now.
`clearFunction` is used in conjunction with the `observable` option and indicates the function to be called when the Observable is disposed.
### Updating index.ts
For new plugins, you will need to update `/src/index.ts` to properly export your plugin and make it available for use.
1. Import the plugin class into `index.ts`:
`import {PluginClassName} from ./plugins/filenameForPlugin`
No need to put the `.ts` extension on the filename.
2. Add the plugin class name to the list in the `export` object:
```
export {
ActionSheet,
AdMob,
AndroidFingerprintAuth,
YourPluginClassName,
...
}
```
3. Add the plugin class name to the `window['IonicNative']` object:
```
window['IonicNative'] = {
ActionSheet: ActionSheet,
AdMob: AdMob,
AndroidFingerprintAuth: AndroidFingerprintAuth,
YourPluginClassName: YourPluginClassName,
...
```
4. If your plugin exports any other objects outside of the plugin class, add an export statement for the file:
`export * from './plugins/filenameForPlugin';`
No need to put the `.ts` extension on the filename.
For example, `googlemaps.ts` exports a const outside of the plugin's main `GoogleMap` class:
```
export const GoogleMapsAnimation = {
BOUNCE: 'BOUNCE',
DROP: 'DROP'
};
```
To properly export `GoogleMapsAnimation`, `index.ts` is updated with:
`export * from './plugins/googlemaps';`
### Testing your changes
You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
@@ -103,3 +165,32 @@ You need to run `npm run lint` to analyze the code and ensure it's consistency w
### 'Wrapping' Up
That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.
## Commit Message Format
We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the our change log. (Ok you got us, it's basically Angular's commit message format).
`type(scope): subject`
#### Type
Must be one of the following:
* **fix**: A bug fix
* **feat**: A new feature
* **docs**: Documentation only changes
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **perf**: A code change that improves performance
* **test**: Adding missing tests
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
#### Scope
The scope could be anything specifying place of the commit change. For example, the name of the plugin being changed
#### Subject
The subject contains succinct description of the change:
* use the imperative, present tense: "change" not "changed" nor "changes"
* do not capitalize first letter
* do not place a period (.) at the end
* entire length of the commit message must not go over 50 characters

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,9 @@ 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');
var flagConfig = {
string: ['port', 'version', 'ngVersion', 'animations'],
@@ -25,4 +27,23 @@ gulp.task("minify:dist", function(){
.pipe(gulp.dest('./dist'));
});
gulp.task('lint', tslint);
gulp.task('lint', function() {
gulp.src('src/**/*.ts')
.pipe(tslint({
formatter: "verbose",
configuration: 'tslint.json'
}))
.pipe(tslint.report())
});
gulp.task('plugin:create', function(){
if(flags.n && flags.n !== ''){
var src = flags.m?'./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/'));
} else {
console.log("Usage is: gulp plugin:create -n PluginName");
}
});

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.12",
"version": "2.1.9",
"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"
],
@@ -16,33 +18,47 @@
"conventional-github-releaser": "^1.1.3",
"cpr": "^1.0.0",
"cz-conventional-changelog": "^1.1.6",
"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-tslint": "^5.0.0",
"gulp-replace": "^0.5.4",
"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",
"tslint-ionic-rules": "0.0.3",
"typescript": "^1.8.10"
"tsify": "~1.0.4",
"tslint": "^3.15.1",
"tslint-ionic-rules": "0.0.5",
"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": {
"type": "git",
@@ -53,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

@@ -0,0 +1,50 @@
/**
* This is a template for new plugin wrappers
*
* TODO:
* - Add/Change information below
* - Document usage (importing, executing main functionality)
* - Remove any imports that you are not using
* - Add this file to /src/index.ts (follow style of other plugins)
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
* - Remove this note
*
*/
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name PluginName
* @description
* This plugin does something
*
* @usage
* ```
* import { PluginName } from 'ionic-native';
*
* PluginName.functionName('Hello', 123)
* .then((something: any) => doSomething(something))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
plugin: '', // npm package name, example: cordova-plugin-camera
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
repo: '', // the github repository URL for the plugin
install: '' // OPTIONAL install command, in case the plugin requires variables
})
export class PluginName {
/**
* This function does something
* @param arg1 {string} Some param to configure something
* @param arg2 {number} Another param to configure something
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
static functionName(arg1: string, arg2: number): Promise<any> {
return; // We add return; here to avoid any IDE / Compiler errors
}
}

View File

@@ -1,121 +1,223 @@
import {initAngular1} from './ng1';
import { initAngular1 } from './ng1';
const DEVICE_READY_TIMEOUT = 2000;
declare var window;
import {ActionSheet} from './plugins/actionsheet';
import {AdMob} from './plugins/admob';
import { ActionSheet } from './plugins/actionsheet';
import { AdMob } from './plugins/admob';
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
import {AppAvailability} from './plugins/appavailability';
import {AppRate} from './plugins/apprate';
import {AppVersion} from './plugins/appversion';
import {Badge} from './plugins/badge';
import {BackgroundGeolocation} from './plugins/background-geolocation';
import {BackgroundMode} from './plugins/backgroundmode';
import {BarcodeScanner} from './plugins/barcodescanner';
import {Base64ToGallery} from './plugins/base64togallery';
import {BatteryStatus} from './plugins/batterystatus';
import {Brightness} from './plugins/brightness';
import {BLE} from './plugins/ble';
import {BluetoothSerial} from './plugins/bluetoothserial';
import {Calendar} from './plugins/calendar';
import {Camera} from './plugins/camera';
import {CameraPreview} from './plugins/camera-preview';
import {CardIO} from './plugins/card-io';
import {Clipboard} from './plugins/clipboard';
import {Contacts} from './plugins/contacts';
import {Crop} from './plugins/crop';
import {DatePicker} from './plugins/datepicker';
import {DBMeter} from './plugins/dbmeter';
import {Deeplinks} from './plugins/deeplinks';
import {Device} from './plugins/device';
import {DeviceAccounts} from './plugins/deviceaccounts';
import {DeviceMotion} from './plugins/devicemotion';
import {DeviceOrientation} from './plugins/deviceorientation';
import {Diagnostic} from './plugins/diagnostic';
import {Dialogs} from './plugins/dialogs';
import {EmailComposer} from './plugins/emailcomposer';
import {Facebook} from './plugins/facebook';
import {File} from './plugins/file';
import {Transfer} from './plugins/filetransfer';
import {Flashlight} from './plugins/flashlight';
import {Geolocation} from './plugins/geolocation';
import {Globalization} from './plugins/globalization';
import {GooglePlus} from './plugins/google-plus';
import {GoogleMap} from './plugins/googlemaps';
import {GoogleAnalytics} from './plugins/googleanalytics';
import {Hotspot} from './plugins/hotspot';
import {Httpd} from './plugins/httpd';
import {IBeacon} from './plugins/ibeacon';
import {ImagePicker} from './plugins/imagepicker';
import {ImageResizer} from './plugins/imageresizer';
import {InAppBrowser} from './plugins/inappbrowser';
import {Insomnia} from './plugins/insomnia';
import {Keyboard} from './plugins/keyboard';
import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
import {MediaCapture} from './plugins/media-capture';
import {NativeStorage} from './plugins/nativestorage';
import {MediaPlugin} from './plugins/media';
import {Network} from './plugins/network';
import {OneSignal} from './plugins/onesignal';
import { AppAvailability } from './plugins/appavailability';
import { AppRate } from './plugins/apprate';
import { AppVersion } from './plugins/appversion';
import { Badge } from './plugins/badge';
import { BackgroundGeolocation } from './plugins/background-geolocation';
import { BackgroundMode } from './plugins/backgroundmode';
import { BarcodeScanner } from './plugins/barcodescanner';
import { Base64ToGallery } from './plugins/base64togallery';
import { BatteryStatus } from './plugins/batterystatus';
import { Brightness } from './plugins/brightness';
import { BLE } from './plugins/ble';
import { BluetoothSerial } from './plugins/bluetoothserial';
import { Calendar } from './plugins/calendar';
import { CallNumber } from './plugins/call-number';
import { Camera } from './plugins/camera';
import { CameraPreview } from './plugins/camera-preview';
import { CardIO } from './plugins/card-io';
import { Clipboard } from './plugins/clipboard';
import { CodePush } from './plugins/code-push';
import { Contacts } from './plugins/contacts';
import { Crop } from './plugins/crop';
import { DatePicker } from './plugins/datepicker';
import { DBMeter } from './plugins/dbmeter';
import { Deeplinks } from './plugins/deeplinks';
import { Device } from './plugins/device';
import { DeviceAccounts } from './plugins/deviceaccounts';
import { DeviceMotion } from './plugins/devicemotion';
import { DeviceOrientation } from './plugins/deviceorientation';
import { Diagnostic } from './plugins/diagnostic';
import { Dialogs } from './plugins/dialogs';
import { EmailComposer } from './plugins/emailcomposer';
import { EstimoteBeacons } from './plugins/estimote-beacons';
import { Facebook } from './plugins/facebook';
import { File } from './plugins/file';
import { FileChooser } from './plugins/file-chooser';
import { FileOpener } from './plugins/file-opener';
import { Transfer } from './plugins/filetransfer';
import { Flashlight } from './plugins/flashlight';
import { Geofence } from './plugins/geofence';
import { Geolocation } from './plugins/geolocation';
import { Globalization } from './plugins/globalization';
import { GooglePlus } from './plugins/google-plus';
import { GoogleMap } from './plugins/googlemaps';
import { GoogleAnalytics } from './plugins/googleanalytics';
import { Hotspot } from './plugins/hotspot';
import { Httpd } from './plugins/httpd';
import { IBeacon } from './plugins/ibeacon';
import { ImagePicker } from './plugins/imagepicker';
import { ImageResizer } from './plugins/imageresizer';
import { InAppBrowser } from './plugins/inappbrowser';
import { InAppPurchase } from './plugins/inapppurchase';
import { Insomnia } from './plugins/insomnia';
import { Instagram } from './plugins/instagram';
import { IsDebug } from './plugins/is-debug';
import { Keyboard } from './plugins/keyboard';
import { LaunchNavigator } from './plugins/launchnavigator';
import { LocalNotifications } from './plugins/localnotifications';
import { LocationAccuracy } from './plugins/location-accuracy';
import { MediaCapture } from './plugins/media-capture';
import { NativeAudio } from './plugins/native-audio';
import { NativePageTransitions } from './plugins/native-page-transitions';
import { NativeStorage } from './plugins/nativestorage';
import { Market } from './plugins/market';
import { MediaPlugin } from './plugins/media';
import { Mixpanel } from './plugins/mixpanel';
import { MusicControls } from './plugins/music-controls';
import { Network } from './plugins/network';
import { NFC } from './plugins/nfc';
import { OneSignal } from './plugins/onesignal';
import { PhotoViewer } from './plugins/photo-viewer';
import {ScreenOrientation} from './plugins/screen-orientation';
import {PinDialog} from './plugins/pin-dialog';
import {Printer} from './plugins/printer';
import {Push} from './plugins/push';
import {SafariViewController} from './plugins/safari-view-controller';
import {Screenshot} from './plugins/screenshot';
import {SecureStorage} from './plugins/securestorage';
import {Sim} from './plugins/sim';
import {SMS} from './plugins/sms';
import {SocialSharing} from './plugins/socialsharing';
import {SpinnerDialog} from './plugins/spinnerdialog';
import {Splashscreen} from './plugins/splashscreen';
import {SQLite} from './plugins/sqlite';
import {StatusBar} from './plugins/statusbar';
import {ThreeDeeTouch} from './plugins/3dtouch';
import {Toast} from './plugins/toast';
import {TouchID} from './plugins/touchid';
import {TwitterConnect} from './plugins/twitter-connect';
import {Vibration} from './plugins/vibration';
import {VideoPlayer} from './plugins/video-player';
import {WebIntent} from './plugins/webintent';
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';
import { Screenshot } from './plugins/screenshot';
import { SecureStorage } from './plugins/securestorage';
import { Shake } from './plugins/shake';
import { Sim } from './plugins/sim';
import { SMS } from './plugins/sms';
import { SocialSharing } from './plugins/socialsharing';
import { SpinnerDialog } from './plugins/spinnerdialog';
import { Splashscreen } from './plugins/splashscreen';
import { SQLite } from './plugins/sqlite';
import { StatusBar } from './plugins/statusbar';
import { 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/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
export * from './plugins/imageresizer';
export * from './plugins/inappbrowser';
export * from './plugins/inapppurchase';
export * from './plugins/insomnia';
export * from './plugins/instagram';
export * from './plugins/is-debug';
export * from './plugins/keyboard';
export * from './plugins/launchnavigator';
export * from './plugins/localnotifications';
export * from './plugins/location-accuracy';
export * from './plugins/market';
export * from './plugins/media';
export * from './plugins/media-capture';
export * from './plugins/mixpanel';
export * from './plugins/music-controls';
export * from './plugins/native-audio';
export * from './plugins/native-page-transitions';
export * from './plugins/nativestorage';
export * from './plugins/network';
export * from './plugins/nfc';
export * from './plugins/onesignal';
export * from './plugins/pay-pal';
export * from './plugins/photo-viewer';
export * from './plugins/pin-dialog';
export * from './plugins/plugin';
export * from './plugins/power-management';
export * from './plugins/printer';
export * from './plugins/push';
export * from './plugins/safari-view-controller';
export * from './plugins/screen-orientation';
export * from './plugins/screenshot';
export * from './plugins/securestorage';
export * from './plugins/shake';
export * from './plugins/sim';
export * from './plugins/sms';
export * from './plugins/socialsharing';
export * from './plugins/spinnerdialog';
export * from './plugins/splashscreen';
export * from './plugins/sqlite';
export * from './plugins/statusbar';
export * from './plugins/stepcounter';
export * from './plugins/streaming-media';
export * from './plugins/text-to-speech';
export * from './plugins/themeable-browser';
export * from './plugins/toast';
export * from './plugins/touchid';
export * from './plugins/twitter-connect';
export * from './plugins/vibration';
export * from './plugins/video-editor';
export * from './plugins/video-player';
export {
export * from './plugins/webintent';
export * from './plugins/youtube-video-player';
export * from './plugins/z-bar';
export * from './plugins/zip';
// Window export to use outside of a module loading system
window['IonicNative'] = {
ActionSheet,
AdMob,
AndroidFingerprintAuth,
@@ -123,129 +225,104 @@ export {
AppRate,
AppVersion,
Badge,
BackgroundGeolocation,
BackgroundMode,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
Calendar,
CallNumber,
Camera,
CameraPreview,
CardIO,
Clipboard,
CodePush,
Contacts,
Crop,
DatePicker,
DBMeter,
Deeplinks,
Device,
DeviceAccounts,
DeviceMotion,
DeviceOrientation,
Dialogs,
Diagnostic,
EmailComposer,
EstimoteBeacons,
Facebook,
File,
FileChooser,
FileOpener,
Flashlight,
Geofence,
Geolocation,
Globalization,
GooglePlus,
GoogleMap,
GoogleAnalytics,
Hotspot,
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,
SocialSharing,
Shake,
Sim,
SMS,
SocialSharing,
SpinnerDialog,
Splashscreen,
SQLite,
StatusBar,
Stepcounter,
StreamingMedia,
ThreeDeeTouch,
Toast,
TouchID,
Transfer,
TextToSpeech,
ThemeableBrowser,
TwitterConnect,
VideoEditor,
VideoPlayer,
Vibration,
WebIntent
}
export * from './plugins/plugin';
// Window export to use outside of a module loading system
window['IonicNative'] = {
ActionSheet: ActionSheet,
AdMob: AdMob,
AndroidFingerprintAuth: AndroidFingerprintAuth,
AppAvailability: AppAvailability,
AppRate: AppRate,
AppVersion: AppVersion,
Badge: Badge,
BackgroundGeolocation: BackgroundGeolocation,
BackgroundMode: BackgroundMode,
BarcodeScanner: BarcodeScanner,
Base64ToGallery: Base64ToGallery,
BatteryStatus: BatteryStatus,
Brightness: Brightness,
BLE: BLE,
BluetoothSerial: BluetoothSerial,
Calendar: Calendar,
Camera: Camera,
CameraPreview: CameraPreview,
CardIO: CardIO,
Clipboard: Clipboard,
Contacts: Contacts,
Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
Device: Device,
DeviceAccounts: DeviceAccounts,
DeviceMotion: DeviceMotion,
DeviceOrientation: DeviceOrientation,
Dialogs: Dialogs,
Diagnostic: Diagnostic,
EmailComposer: EmailComposer,
Facebook: Facebook,
File: File,
Flashlight: Flashlight,
Geolocation: Geolocation,
Globalization: Globalization,
GooglePlus: GooglePlus,
GoogleMap : GoogleMap,
GoogleAnalytics: GoogleAnalytics,
Hotspot: Hotspot,
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications,
MediaCapture: MediaCapture,
MediaPlugin: MediaPlugin,
NativeStorage: NativeStorage,
Network: Network,
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
PhotoViewer: PhotoViewer,
ScreenOrientation: ScreenOrientation,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SecureStorage: SecureStorage,
Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
SpinnerDialog: SpinnerDialog,
Splashscreen: Splashscreen,
SQLite: SQLite,
StatusBar: StatusBar,
ThreeDeeTouch: ThreeDeeTouch,
Toast: Toast,
TouchID: TouchID,
Transfer: Transfer,
TwitterConnect: TwitterConnect,
VideoPlayer: VideoPlayer,
Vibration: Vibration,
WebIntent: WebIntent
WebIntent,
YoutubeVideoPlayer,
ZBar,
Zip
};
initAngular1(window['IonicNative']);
@@ -254,16 +331,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

@@ -3,18 +3,19 @@ declare var window;
/**
* Initialize the ionic.native Angular module if we're running in ng1.
* This iterates through the list of registered plugins and dynamically
* creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovStatusBar.
* creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
*/
export function initAngular1(plugins) {
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

@@ -106,8 +106,9 @@ export class ThreeDeeTouch {
*/
static onHomeIconPressed(): Observable<any> {
return new Observable(observer => {
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
else {
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) {
window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
} else {
observer.error('3dTouch plugin is not available.');
observer.complete();
}

View File

@@ -1,10 +1,7 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
import {Cordova, Plugin} from './plugin';
declare var window;
export interface Location {
/**
@@ -106,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.
@@ -133,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
@@ -154,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;
}
/**
@@ -170,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,
@@ -190,18 +257,19 @@ export interface Config {
* }, (error) => {
* console.log('BackgroundGeolocation error');
* }, {
* //options
* });
* }, config);
*
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
* BackgroundGeolocation.start();
* }
* })
*
* // If you wish to turn OFF background-tracking, call the #stop method.
* BackgroundGeolocation.stop();
*
* ```
* @interfaces
* Location
* Config
*/
@Plugin({
plugin: 'cordova-plugin-mauron85-background-geolocation',
@@ -211,22 +279,70 @@ export interface Config {
})
export class BackgroundGeolocation {
/**
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
*
* Possible values:
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
* ANDROID_ACTIVITY_PROVIDER: 1
*
* @enum {number}
*/
static LocationProvider: any = {
ANDROID_DISTANCE_FILTER_PROVIDER: 0,
ANDROID_ACTIVITY_PROVIDER: 1
};
/**
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
* 1000 results in lowest power drain and least accurate readings.
*
* Possible values:
* HIGH: 0
* MEDIUM: 10
* LOW: 100
* PASSIVE: 1000
*
* enum {number}
*/
static Accuracy: any = {
HIGH: 0,
MEDIUM: 10,
LOW: 100,
PASSIVE: 1000
};
/**
* Used in the switchMode function
*
* Possible values:
* BACKGROUND: 0
* FOREGROUND: 1
*
* @enum {number}
*/
static Mode: any = {
BACKGROUND: 0,
FOREGROUND: 1
};
/**
* Configure the plugin.
* Success callback will be called with one argument - Location object, which tries to mimic w3c Coordinates interface.
*
* @param {Function} 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.
*
* Fail callback to be executed every time a geolocation error occurs.
*
* Options a json object of type Config
*/
@Cordova({
sync: true
})
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
/**
* Turn ON the background-geolocation system.
* The user will be tracked whenever they suspend the app.
@@ -234,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
@@ -249,7 +363,6 @@ export class BackgroundGeolocation {
@Cordova()
static finish() { }
/**
* Force the plugin to enter "moving" or "stationary" state
* NOTE: IOS, WP only
@@ -257,7 +370,6 @@ export class BackgroundGeolocation {
@Cordova()
static changePace(isMoving: boolean) { }
/**
* Setup configuration
*/
@@ -289,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.
@@ -323,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
@@ -337,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 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

@@ -38,6 +38,7 @@ export class BarcodeScanner {
};
/**
* Open the barcode scanner.
* @param options {Object} Optional options to pass to the scanner
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
@Cordova({
@@ -48,8 +49,8 @@ export class BarcodeScanner {
/**
* Encodes data into a barcode.
* NOTE: not well supported on Android
* @param type
* @param data
* @param type {string} Type of encoding
* @param data {any} Data to encode
*/
@Cordova()
static encode(type: string, data: any): Promise<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`.
*

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

@@ -2,25 +2,11 @@ import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
export interface CameraPreviewOptions {
export interface CameraPreviewRect {
x: number;
y: number;
width: number;
height: number;
/**
* Choose the camera to use (front- or back-facing).
* 'front' for front camera
* 'rear' for rear camera
*/
camera: string;
/** Take photo on tap */
tapPhoto: boolean;
/** */
previewDrag: boolean;
/** */
toBack: boolean;
/** Alpha use when toBack is set to true */
alpha: number;
}
export interface CameraPreviewSize {
@@ -35,6 +21,52 @@ export interface CameraPreviewSize {
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
* @usage
* ```
* import { CameraPreview } from 'ionic-native';
*
* // camera options (Size and location)
* let cameraRect: CameraPreviewRect = {
* x: 100,
* y: 100,
* width: 200,
* height: 200
* };
*
*
* // start camera
* CameraPreview.startCamera(
* cameraRect, // position and size of preview
* 'front', // default camera
* true, // tape to take picture
* false, // disable drag
* true // send the preview to the back of the screen so we can add overlaying elements
* );
*
* // Set the handler to run every time we take a picture
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
* console.log(result);
* // do something with the result
* });
*
*
* // take a picture
* CameraPreview.takePicture({
* maxWidth: 640,
* maxHeight: 640
* });
*
* // Switch camera
* CameraPreview.switchCamera();
*
* // set color effect to negative
* CameraPreview.setColorEffect('negative');
*
* // Stop the camera preview
* CameraPreview.stopCamera();
*
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-camera-preview',
@@ -46,12 +78,17 @@ export class CameraPreview {
/**
* Starts the camera preview instance.
* @param {CameraPreviewOptions} options for the preview
* @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number}
* @param {string} which camera to use - 'front' | 'back'
* @param {boolean} enable tap to take picture
* @param {boolean} enable preview box drag across the screen
* @param {boolean} send preview box to the back of the webview
* @param {number} alpha of the preview box
*/
@Cordova({
sync: true
})
static startCamera(options: CameraPreviewOptions): void { };
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { };
/**
* Stops the camera preview instance.
@@ -63,6 +100,7 @@ export class CameraPreview {
/**
* Take the picture, the parameter size is optional
* @param {CameraPreviewSize} optional - size of the picture to take
*/
@Cordova({
sync: true

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; };
}

517
src/plugins/code-push.ts Normal file
View File

@@ -0,0 +1,517 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
// below are taken from
// https://raw.githubusercontent.com/Microsoft/cordova-plugin-code-push/master/typings/codePush.d.ts
// and adjusted to remove warnings and access control
namespace Http {
export const enum Verb {
GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
}
export interface Response {
statusCode: number;
body?: string;
}
export interface Requester {
request(verb: Verb, url: string, callback: Callback<Response>): void;
request(verb: Verb, url: string, requestBody: string, callback: Callback<Response>): void;
}
}
/**
* Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app,
* in which case only the appVersion is compulsory.
*
* !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
*/
export interface IPackage {
deploymentKey: string;
description: string;
label: string;
appVersion: string;
isMandatory: boolean;
packageHash: string;
packageSize: number;
failedInstall: boolean;
}
/**
* Defines a remote package, which represents an update package available for download.
*/
export interface IRemotePackage extends IPackage {
/**
* The URL at which the package is available for download.
*/
downloadUrl: string;
/**
* Downloads the package update from the CodePush service.
*
* @param downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully.
* @param downloadError Optional callback invoked in case of an error.
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
*/
download(downloadSuccess: SuccessCallback<ILocalPackage>, downloadError?: ErrorCallback, downloadProgress?: SuccessCallback<DownloadProgress>): void;
/**
* Aborts the current download session, previously started with download().
*
* @param abortSuccess Optional callback invoked if the abort operation succeeded.
* @param abortError Optional callback invoked in case of an error.
*/
abortDownload(abortSuccess?: SuccessCallback<void>, abortError?: ErrorCallback): void;
}
/**
* Defines a local package.
*
* !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
*/
export interface ILocalPackage extends IPackage {
/**
* The local storage path where this package is located.
*/
localPath: string;
/**
* Indicates if the current application run is the first one after the package was applied.
*/
isFirstRun: boolean;
/**
* Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded.
* On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success.
* Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run.
*
* @param installSuccess Callback invoked if the install operation succeeded.
* @param installError Optional callback inovoked in case of an error.
* @param installOptions Optional parameter used for customizing the installation behavior.
*/
install(installSuccess: SuccessCallback<InstallMode>, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void;
}
/**
* Decomposed static side of RemotePackage.
* For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
*/
/* tslint:disable */
interface RemotePackage_Static {
new (): IRemotePackage;
}
/* tslint:enable */
/**
* Decomposed static side of LocalPackage.
* For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
*/
/* tslint:disable */
interface LocalPackage_Static {
new (): ILocalPackage;
}
/* tslint:enable */
declare var RemotePackage: RemotePackage_Static;
declare var LocalPackage: LocalPackage_Static;
/**
* Defines the JSON format of the current package information file.
* This file is stored in the local storage of the device and persists between store updates and code-push updates.
*
* !! THIS FILE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
*/
interface IPackageInfoMetadata extends ILocalPackage {
nativeBuildTime: string;
}
interface NativeUpdateNotification {
updateAppVersion: boolean; // Always true
appVersion: string;
}
export interface Callback<T> { (error: Error, parameter: T): void; }
export interface SuccessCallback<T> { (result?: T): void; }
export interface ErrorCallback { (error?: Error): void; }
interface Configuration {
appVersion: string;
clientUniqueId: string;
deploymentKey: string;
serverUrl: string;
ignoreAppVersion?: boolean;
}
declare class AcquisitionStatus {
static DeploymentSucceeded: string;
static DeploymentFailed: string;
}
declare class AcquisitionManager {
constructor(httpRequester: Http.Requester, configuration: Configuration);
public queryUpdateWithCurrentPackage(currentPackage: IPackage, callback?: Callback<IRemotePackage | NativeUpdateNotification>): void;
public reportStatusDeploy(pkg?: IPackage, status?: string, previousLabelOrAppVersion?: string, previousDeploymentKey?: string, callback?: Callback<void>): void;
public reportStatusDownload(pkg: IPackage, callback?: Callback<void>): void;
}
interface CodePushCordovaPlugin {
/**
* Get the current package information.
*
* @param packageSuccess Callback invoked with the currently deployed package information.
* @param packageError Optional callback invoked in case of an error.
*/
getCurrentPackage(packageSuccess: SuccessCallback<ILocalPackage>, packageError?: ErrorCallback): void;
/**
* Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
* This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
*/
getPendingPackage(packageSuccess: SuccessCallback<ILocalPackage>, packageError?: ErrorCallback): void;
/**
* Checks with the CodePush server if an update package is available for download.
*
* @param querySuccess Callback invoked in case of a successful response from the server.
* The callback takes one RemotePackage parameter. A non-null package is a valid update.
* A null package means the application is up to date for the current native application version.
* @param queryError Optional callback invoked in case of an error.
* @param deploymentKey Optional deployment key that overrides the config.xml setting.
*/
checkForUpdate(querySuccess: SuccessCallback<IRemotePackage>, queryError?: ErrorCallback, deploymentKey?: string): void;
/**
* Notifies the plugin that the update operation succeeded and that the application is ready.
* Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
* If using sync API, calling this function is not required since sync calls it internally.
*
* @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
* @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
*/
notifyApplicationReady(notifySucceeded?: SuccessCallback<void>, notifyFailed?: ErrorCallback): void;
/**
* Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
* will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
*/
restartApplication(installSuccess: SuccessCallback<void>, errorCallback?: ErrorCallback): void;
/**
* Convenience method for installing updates in one method call.
* This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
*
* The algorithm of this method is the following:
* - Checks for an update on the CodePush server.
* - If an update is available
* - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
* The update package will then be downloaded and applied.
* - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
* If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
* - Otherwise, the update package will be downloaded and applied with no user interaction.
* - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
* - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
*
* @param syncCallback Optional callback to be called with the status of the sync operation.
* The callback will be called only once, and the possible statuses are defined by the SyncStatus enum.
* @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
*
*/
sync(syncCallback?: SuccessCallback<SyncStatus>, syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): void;
}
/**
* Defines the possible result statuses of the window.codePush.sync operation.
*/
export enum SyncStatus {
/**
* The application is up to date.
*/
UP_TO_DATE,
/**
* An update is available, it has been downloaded, unzipped and copied to the deployment folder.
* After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources.
*/
UPDATE_INSTALLED,
/**
* An optional update is available, but the user declined to install it. The update was not downloaded.
*/
UPDATE_IGNORED,
/**
* An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update.
* The console logs should contain more information about what happened. No update has been applied in this case.
*/
ERROR,
/**
* There is an ongoing sync in progress, so this attempt to sync has been aborted.
*/
IN_PROGRESS,
/**
* Intermediate status - the plugin is about to check for updates.
*/
CHECKING_FOR_UPDATE,
/**
* Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled.
*/
AWAITING_USER_ACTION,
/**
* Intermediate status - the update package is about to be downloaded.
*/
DOWNLOADING_PACKAGE,
/**
* Intermediate status - the update package is about to be installed.
*/
INSTALLING_UPDATE
}
/**
* Defines the available install modes for updates.
*/
export enum InstallMode {
/**
* The update will be applied to the running application immediately. The application will be reloaded with the new content immediately.
*/
IMMEDIATE,
/**
* The update is downloaded but not installed immediately. The new content will be available the next time the application is started.
*/
ON_NEXT_RESTART,
/**
* The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first.
*/
ON_NEXT_RESUME
}
/**
* Defines the install operation options.
*/
export interface InstallOptions {
/**
* Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART.
*/
installMode?: InstallMode;
/**
* If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed.
*/
minimumBackgroundDuration?: number;
/**
* Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE.
*/
mandatoryInstallMode?: InstallMode;
}
/**
* Defines the sync operation options.
*/
export interface SyncOptions extends InstallOptions {
/**
* Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true.
*/
ignoreFailedUpdates?: boolean;
/**
* Used to enable, disable or customize the user interaction during sync.
* If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory.
* To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance.
*/
updateDialog?: boolean | UpdateDialogOptions;
/**
* Overrides the config.xml deployment key when checking for updates.
*/
deploymentKey?: string;
}
/**
* Defines the configuration options for the alert or confirmation dialog
*/
export interface UpdateDialogOptions {
/**
* If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update.
* The user will not be able to cancel the operation, since the update is mandatory.
*/
mandatoryUpdateMessage?: string;
/**
* If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog.
* If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded.
*/
optionalUpdateMessage?: string;
/**
* The title of the dialog box used for interacting with the user in case of a mandatory or optional update.
* This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set.
*/
updateTitle?: string;
/**
* The label of the confirmation button in case of an optional update.
*/
optionalInstallButtonLabel?: string;
/**
* The label of the cancel button in case of an optional update.
*/
optionalIgnoreButtonLabel?: string;
/**
* The label of the continue button in case of a mandatory update.
*/
mandatoryContinueButtonLabel?: string;
/**
* Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message.
*/
appendReleaseDescription?: boolean;
/**
* Optional prefix to add to the release description.
*/
descriptionPrefix?: string;
}
/**
* Defines the JSON format of the package diff manifest file.
*/
interface IDiffManifest {
deletedFiles: string[];
}
/**
* Defines the format of the DownloadProgress object, used to send periodical update notifications on the progress of the update download.
*/
export interface DownloadProgress {
totalBytes: number;
receivedBytes: number;
}
/**
* @name CodePush
* @description
* CodePush plugin for Cordova by Microsoft that supports iOS and Android.
*
* For more info, please see https://github.com/ksachdeva/ionic2-code-push-example
*
* @usage
* ```typescript
* import { CodePush } from 'ionic-native';
*
* // note - mostly error & completed methods of observable will not fire
* // as syncStatus will contain the current state of the update
* CodePush.sync().subscribe((syncStatus) => console.log(syncStatus));
*
* const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); }
* CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-code-push',
pluginRef: 'codePush',
repo: 'https://github.com/Microsoft/cordova-plugin-code-push',
platforms: ['Android', 'iOS']
})
export class CodePush {
/**
* Get the current package information.
*
* @param packageSuccess Callback invoked with the currently deployed package information.
* @param packageError Optional callback invoked in case of an error.
*/
@Cordova()
static getCurrentPackage(): Promise<ILocalPackage> {
return;
}
/**
* Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
* This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
*/
@Cordova()
static getPendingPackage(): Promise<ILocalPackage> {
return;
}
/**
* Checks with the CodePush server if an update package is available for download.
*
* @param querySuccess Callback invoked in case of a successful response from the server.
* The callback takes one RemotePackage parameter. A non-null package is a valid update.
* A null package means the application is up to date for the current native application version.
* @param queryError Optional callback invoked in case of an error.
* @param deploymentKey Optional deployment key that overrides the config.xml setting.
*/
@Cordova({
callbackOrder: 'reverse'
})
static checkForUpdate(deploymentKey?: string): Promise<IRemotePackage> {
return;
}
/**
* Notifies the plugin that the update operation succeeded and that the application is ready.
* Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
* If using sync API, calling this function is not required since sync calls it internally.
*
* @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
* @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
*/
@Cordova()
static notifyApplicationReady(): Promise<void> {
return;
}
/**
* Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
* will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
*/
@Cordova()
static restartApplication(): Promise<void> {
return;
}
/**
* Convenience method for installing updates in one method call.
* This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
*
* The algorithm of this method is the following:
* - Checks for an update on the CodePush server.
* - If an update is available
* - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
* The update package will then be downloaded and applied.
* - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
* If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
* - Otherwise, the update package will be downloaded and applied with no user interaction.
* - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
* - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
*
* @param syncCallback Optional callback to be called with the status of the sync operation.
* @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
*
*/
@Cordova({
observable: true,
successIndex: 0,
errorIndex: 3 // we don't need this, so we set it to a value higher than # of args
})
static sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): Observable<SyncStatus> {
return;
}
}

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

@@ -13,7 +13,7 @@ export interface DatePickerOptions {
* Platforms: iOS, Android, Windows
* Selected date
*/
date: Date;
date: Date | string | number;
/**
* Platforms: iOS, Android, Windows
@@ -21,7 +21,7 @@ export interface DatePickerOptions {
* Type: Date | empty String
* Default: empty String
*/
minDate?: Date;
minDate?: Date | string | number;
/**
* Platforms?: iOS, Android, Windows
@@ -29,7 +29,7 @@ export interface DatePickerOptions {
* Type?: Date | empty String
* Default?: empty String
*/
maxDate?: Date;
maxDate?: Date | string | number;
/**
* Platforms?: Android

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

@@ -8,6 +8,24 @@ import { Cordova, Plugin } from './plugin';
* @usage
* ```typescript
* import { Diagnostic } from 'ionic-native';
*
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
* let errorCallback = (e) => console.error(e);
*
* Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
*
* Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
*
*
* Diagnostic.getBluetoothState()
* .then((state) => {
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
* // do something
* } else {
* // do something else
* }
* }).catch(e => console.error(e));
*
* ```
*/
@Plugin({
@@ -16,8 +34,82 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
})
export class Diagnostic {
static permission = {
READ_CALENDAR: 'READ_CALENDAR',
WRITE_CALENDAR: 'WRITE_CALENDAR',
CAMERA: 'CAMERA',
READ_CONTACTS: 'READ_CONTACTS',
WRITE_CONTACTS: 'WRITE_CONTACTS',
GET_ACCOUNTS: 'GET_ACCOUNTS',
ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION',
ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION',
RECORD_AUDIO: 'RECORD_AUDIO',
READ_PHONE_STATE: 'READ_PHONE_STATE',
CALL_PHONE: 'CALL_PHONE',
ADD_VOICEMAIL: 'ADD_VOICEMAIL',
USE_SIP: 'USE_SIP',
PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS',
READ_CALL_LOG: 'READ_CALL_LOG',
WRITE_CALL_LOG: 'WRITE_CALL_LOG',
SEND_SMS: 'SEND_SMS',
RECEIVE_SMS: 'RECEIVE_SMS',
READ_SMS: 'READ_SMS',
RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH',
RECEIVE_MMS: 'RECEIVE_MMS',
WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE',
READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE',
BODY_SENSORS: 'BODY_SENSORS'
};
static permissionStatus = {
GRANTED: 'GRANTED',
GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS
RESTRICTED: 'RESTRICTED', // iOS
DENIED: 'DENIED',
DENIED_ALWAYS: 'DENIED_ALWAYS', // android
NOT_REQUESTED: 'NOT_REQUESTED'
};
static locationAuthorizationMode = {
ALWAYS: 'ALWAYS',
WHEN_IN_USE: 'WHEN_IN_USE'
};
static permissionGroups = {
CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
CAMERA: ['CAMERA'],
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
MICROPHONE: ['RECORD_AUDIO'],
PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
SENSORS: ['BODY_SENSORS'],
SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
};
static locationMode = {
HIGH_ACCURACY: 'high_accuracy',
DEVICE_ONLY: 'device_only',
BATTERY_SAVING: 'battery_saving',
LOCATION_OFF: 'location_off'
};
static bluetoothState = {
UNKNOWN: 'unknown',
RESETTING: 'resetting', // iOS
UNSUPPORTED: 'unsupported', // iOS
UNAUTHORIZED: 'unauthorized', // iOS
POWERED_OFF: 'powered_off',
POWERED_ON: 'powered_on',
POWERING_OFF: 'powering_off',
POWERING_ON: 'powering_on'
};
/**
* Checks if app is able to access device location.
* @returns {Promise<any>}
*/
@Cordova()
static isLocationAvailable(): Promise<any> { return; }
@@ -25,6 +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; }
@@ -32,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; }
@@ -39,70 +133,420 @@ export class Diagnostic {
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
* @returns {Promise<any>}
*/
@Cordova()
static isBluetoothAvailable(): Promise<any> { return; }
/**
* Displays the device location settings to allow user to enable location services/change location mode.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToLocationSettings(): void { }
/**
* Displays mobile settings to allow user to enable mobile data.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToMobileDataSettings(): void { }
/**
* Displays Bluetooth settings to allow user to enable Bluetooth.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToBluetoothSettings(): void { }
/**
* Displays WiFi settings to allow user to enable WiFi.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToWifiSettings(): void { }
/**
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'Windows 10'] })
static isWifiEnabled(): Promise<boolean> { return; }
/**
* Enables/disables WiFi on the device.
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
* @param state {boolean}
*/
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setWifiState(state: boolean): Promise<any> { return; }
/**
* Enables/disables Bluetooth on the device.
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
* @param state {boolean}
*/
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setBluetoothState(state: boolean): Promise<any> { return; }
/**
* Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isLocationEnabled(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use location.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
* @returns {Promise<any>}
*/
@Cordova()
static isLocationAuthorized(): Promise<any> { return; }
/**
* Returns the location authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getLocationAuthorizationStatus(): Promise<any> { return; }
/**
* Returns the location authorization status for the application.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({ platforms: ['Android', 'iOS'] })
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
/**
* Checks if the application is authorized to use location.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*/
@Cordova()
static isLocationAuthorized(): Promise<any> { return; }
/**
* Checks if camera hardware is present on device.
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraPresent(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraAuthorized(): Promise<any> { return; }
/**
* Returns the camera authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getCameraAuthorizationStatus(): Promise<any> { return; }
/**
* Requests camera authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCameraAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the microphone.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isMicrophoneAuthorized(): Promise<boolean> { return; }
/**
* Returns the microphone authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
/**
* Requests microphone authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestMicrophoneAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use contacts (address book).
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isContactsAuthorized(): Promise<boolean> { return; }
/**
* Returns the contacts authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getContactsAuthroizationStatus(): Promise<any> { return; }
/**
* Requests contacts authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestContactsAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the calendar.
*
* Notes for Android:
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
*
* Notes for iOS:
* - This relates to Calendar Events (not Calendar Reminders)
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isCalendarAuthorized(): Promise<boolean> { return; }
/**
* Returns the calendar authorization status for the application.
*
* Notes for Android:
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
*
* Notes for iOS:
* - This relates to Calendar Events (not Calendar Reminders)
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getCalendarAuthorizationStatus(): Promise<any> { return; }
/**
* Requests calendar authorization for the application.
*
* Notes for iOS:
* - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
* - This relates to Calendar Events (not Calendar Reminders)
*
* Notes for Android:
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
* - This requests permission for `READ_CALENDAR` run-time permission
* - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCalendarAuthorization(): Promise<any> { return; }
/**
* Opens settings page for this app.
* On Android, this opens the "App Info" page in the Settings app.
* On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static switchToSettings(): Promise<any> { return; }
/**
* Returns the state of Bluetooth on the device.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getBluetoothState(): Promise<any> { return; }
/**
* Registers a function to be called when a change in Bluetooth state occurs.
* @param handler
*/
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerBluetoothStateChangeHandler(handler: Function): void { }
/**
* Registers a function to be called when a change in Location state occurs.
* @param handler
*/
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerLocationStateChangeHandler(handler: Function): void { }
/**
* Checks if high-accuracy locations are available to the app from GPS hardware.
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isGpsLocationAvailable(): Promise<boolean> { return; }
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
* Returns true if Location mode is enabled and is set to either:
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
@Cordova({ platforms: ['Android'] })
static isGpsLocationEnabled(): Promise<any> { return; }
/**
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isNetworkLocationAvailable(): Promise<any> { return; }
/**
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to either:
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({ platforms: ['Android'] })
static isNetworkLocationEnabled(): Promise<any> { return; }
/**
* Checks if remote (push) notifications are enabled.
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
* Returns the current location mode setting for the device.
* @returns {Promise<any>}
*/
@Cordova()
static isRemoteNotificationsEnabled(): Promise<any> { return; }
@Cordova({ platforms: ['Android'] })
static getLocationMode(): Promise<any> { return; }
/**
* Returns the current authorisation status for a given permission.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
* @param permission
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
/**
* Returns the current authorisation status for multiple permissions.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
* @param permissions
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
/**
* Requests app to be granted authorisation for a runtime permission.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
* @param permission
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static requestRuntimePermission(permission: any): Promise<any> { return; }
/**
* Requests app to be granted authorisation for multiple runtime permissions.
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
* @param permissions
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
/**
* Checks if the device setting for Bluetooth is switched on.
* This requires `BLUETOOTH` permission on Android
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isBluetoothEnabled(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static hasBluetoothSupport(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static hasBluetoothLESupport(): Promise<boolean> { return; }
/**
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isCameraRollAuthorized(): Promise<boolean> { return; }
/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
/**
* Requests camera roll authorization for the application.
* Should only be called if authorization status is NOT_REQUESTED.
* Calling it when in any other state will have no effect.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestCameraRollAuthorization(): Promise<any> { return; }
/**
* Checks if remote (push) notifications are enabled.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isRemoteNotificationsEnabled(): Promise<boolean> { return; }
/**
* Indicates if the app is registered for remote (push) notifications on the device.
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
* @returns {Promise<boolean>}
*/
@Cordova()
static isRegisteredForRemoteNotifications(): Promise<any> { return; }
@Cordova({ platforms: ['iOS'] })
static isRegisteredForRemoteNotifications(): Promise<boolean> { return; }
/**
* Indicates the current setting of notification types for the app in the Settings app.
* Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static getRemoteNotificationTypes(): Promise<any> { return; }
/**
* Checks if the application is authorized to use reminders.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isRemindersAuthorized(): Promise<boolean> { return; }
/**
* Returns the reminders authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static getRemindersAuthorizationStatus(): Promise<any> { return; }
/**
* Requests reminders authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestRemindersAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized for background refresh.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
/**
* Returns the background refresh authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static getBackgroundRefreshStatus(): Promise<any> { return; }
}

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 {
@@ -59,8 +59,23 @@ export class EmailComposer {
*/
static isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); });
else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); });
if (app) {
cordova.plugins.email.isAvailable(app, (isAvailable) => {
if (isAvailable) {
resolve();
} else {
reject();
}
});
} else {
cordova.plugins.email.isAvailable((isAvailable) => {
if (isAvailable) {
resolve();
} else {
reject();
}
});
}
});
}

View File

@@ -0,0 +1,485 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name EstimoteBeacons
*
* @description
* This plugin enables communication between a phone and Estimote Beacons peripherals.
*
*/
@Plugin({
plugin: 'cordova-plugin-estimote',
pluginRef: 'estimote.beacons',
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
platforms: ['iOS', 'Android']
})
export class EstimoteBeacons {
/** Proximity value */
static ProximityUnknown = 0;
/** Proximity value */
static ProximityImmediate = 1;
/** Proximity value */
static ProximityNear = 2;
/** Proximity value */
static ProximityFar = 3;
/** Beacon colour */
static BeaconColorUnknown = 0;
/** Beacon colour */
static BeaconColorMintCocktail = 1;
/** Beacon colour */
static BeaconColorIcyMarshmallow = 2;
/** Beacon colour */
static BeaconColorBlueberryPie = 3;
/**
* Beacon colour.
*/
static BeaconColorSweetBeetroot = 4;
/** Beacon colour */
static BeaconColorCandyFloss = 5;
/** Beacon colour */
static BeaconColorLemonTart = 6;
/** Beacon colour */
static BeaconColorVanillaJello = 7;
/** Beacon colour */
static BeaconColorLiquoriceSwirl = 8;
/** Beacon colour */
static BeaconColorWhite = 9;
/** Beacon colour */
static BeaconColorTransparent = 10;
/** Region state */
static RegionStateUnknown = 'unknown';
/** Region state */
static RegionStateOutside = 'outside';
/** Region state */
static RegionStateInside = 'inside';
/**
* Ask the user for permission to use location services
* while the app is in the foreground.
* You need to call this function or requestAlwaysAuthorization
* on iOS 8+.
* Does nothing on other platforms.
*
* @usage
* ```
* EstimoteBeacons.requestWhenInUseAuthorization().then(
* () => { console.log('on success'); },
* () => { console.log('on error'); }
* );
* ```
*
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
* @return Returns a Promise.
*/
@Cordova()
static requestWhenInUseAuthorization(): Promise<any> { return; }
/**
* Ask the user for permission to use location services
* whenever the app is running.
* You need to call this function or requestWhenInUseAuthorization
* on iOS 8+.
* Does nothing on other platforms.
*
* @usage
* ```
* EstimoteBeacons.requestAlwaysAuthorization().then(
* () => { console.log('on success'); },
* () => { console.log('on error'); }
* );
* ```
*
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
* @return Returns a Promise.
*/
@Cordova()
static requestAlwaysAuthorization(): Promise<any> { return; }
/**
* Get the current location authorization status.
* Implemented on iOS 8+.
* Does nothing on other platforms.
*
* @usage
* ```
* EstimoteBeacons.authorizationStatus().then(
* (result) => { console.log('Location authorization status: ' + result); },
* (errorMessage) => { console.log('Error: ' + errorMessage); }
* );
* ```
*
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
* @return Returns a Promise.
*/
@Cordova()
static authorizationStatus(): Promise<any> { return; }
/**
* Start advertising as a beacon.
*
* @usage
* ```
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
* .then(() => { console.log('Beacon started'); });
* setTimeout(() => {
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
* }, 5000);
* ```
* @param uuid {string} UUID string the beacon should advertise (mandatory).
* @param major {number} Major value to advertise (mandatory).
* @param minor {number} Minor value to advertise (mandatory).
* @param regionId {string} Identifier of the region used to advertise (mandatory).
* @return Returns a Promise.
*/
@Cordova({
clearFunction: 'stopAdvertisingAsBeacon'
})
static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
/**
* Stop advertising as a beacon.
*
* @usage
* ```
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
* .then(() => { console.log('Beacon started'); });
* setTimeout(() => {
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
* }, 5000);
* ```
* @return Returns a Promise.
*/
@Cordova()
static stopAdvertisingAsBeacon(): Promise<any> { return; }
/**
* Enable analytics.
*
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
*
* @usage
* ```
* EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); });
* ```
* @param enable {number} Boolean value to turn analytics on or off (mandatory).
* @return Returns a Promise.
*/
@Cordova()
static enableAnalytics(enable: boolean): Promise<any> { return; }
/**
* Test if analytics is enabled.
*
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
*
* @usage
* ```
* EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); });
* ```
* @return Returns a Promise.
*/
@Cordova()
static isAnalyticsEnabled(): Promise<any> { return; }
/**
* Test if App ID and App Token is set.
*
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
*
* @usage
* ```
* EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); });
* ```
* @return Returns a Promise.
*/
@Cordova()
static isAuthorized(): Promise<any> { return; }
/**
* Set App ID and App Token.
*
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
*
* @usage
* ```
* EstimoteBeacons.setupAppIDAndAppToken('MyAppID', 'MyAppToken').then(() => { console.log('AppID and AppToken configured!'); });
* ```
* @param appID {string} The App ID (mandatory).
* @param appToken {string} The App Token (mandatory).
* @return Returns a Promise.
*/
@Cordova()
static setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
/**
* Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
* Available on iOS.
*
* @usage
* ```
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
* console.log(JSON.stringify(beacons));
* });
* setTimeout(() => {
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @return Returns an Observable that notifies of each beacon discovered.
*/
@Cordova({
observable: true,
clearFunction: 'stopEstimoteBeaconDiscovery'
})
static startEstimoteBeaconDiscovery(): Observable<any> { return; }
/**
* Stop CoreBluetooth scan. Available on iOS.
*
* @usage
* ```
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
* console.log(JSON.stringify(beacons));
* });
* setTimeout(() => {
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @return returns a Promise.
*/
@Cordova()
static stopEstimoteBeaconDiscovery(): Promise<any> { return; }
/**
* Start ranging beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
* console.log(JSON.stringify(info));
* });
* setTimeout(() => {
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @return Returns an Observable that notifies of each beacon discovered.
*/
@Cordova({
observable: true,
clearFunction: 'stopRangingBeaconsInRegion',
clearWithArgs: true
})
static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
/**
* Stop ranging beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
* console.log(JSON.stringify(info));
* });
* setTimeout(() => {
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
* }, 5000);
* ```
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @return returns a Promise.
*/
@Cordova()
static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start ranging secure beacons. Available on iOS.
* This function has the same parameters/behaviour as
* {@link EstimoteBeacons.startRangingBeaconsInRegion}.
* To use secure beacons set the App ID and App Token using
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
*/
@Cordova({
observable: true,
clearFunction: 'stopRangingSecureBeaconsInRegion',
clearWithArgs: true
})
static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
/**
* Stop ranging secure beacons. Available on iOS.
* This function has the same parameters/behaviour as
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
*/
@Cordova()
static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start monitoring beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
* console.log('Region state: ' + JSON.stringify(state));
* });
* ```
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
* are inside a region when the user turns display on, see
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
* for further details (optional, defaults to false, iOS only).
* @return Returns an Observable that notifies of each region state discovered.
*/
@Cordova({
observable: true,
clearFunction: 'stopMonitoringForRegion',
clearWithArgs: true,
successIndex: 1,
errorIndex: 2
})
static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
/**
* Stop monitoring beacons. Available on iOS and Android.
*
* @usage
* ```
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
* ```
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
* @return returns a Promise.
*/
@Cordova()
static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start monitoring secure beacons. Available on iOS.
* This function has the same parameters/behaviour as
* EstimoteBeacons.startMonitoringForRegion.
* To use secure beacons set the App ID and App Token using
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
* @see {@link EstimoteBeacons.startMonitoringForRegion}
* @param region {EstimoteBeaconRegion} Region
* @param notifyEntryStateOnDisplay {boolean}
*/
@Cordova({
observable: true,
clearFunction: 'stopSecureMonitoringForRegion',
clearWithArgs: true,
successIndex: 1,
errorIndex: 2
})
static startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
/**
* Stop monitoring secure beacons. Available on iOS.
* This function has the same parameters/behaviour as
* {@link EstimoteBeacons.stopMonitoringForRegion}.
* @param region {EstimoteBeaconRegion} Region
*/
@Cordova()
static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Connect to Estimote Beacon. Available on Android.
*
* @usage
* ```
* EstimoteBeacons.connectToBeacon(FF:0F:F0:00:F0:00);
* ```
* ```
* EstimoteBeacons.connectToBeacon({
* proximityUUID: '000000FF-F00F-0FF0-F000-000FF0F00000',
* major: 1,
* minor: 1
* });
* ```
* @param beacon {Beacon} Beacon to connect to.
* @return returns a Promise.
*/
@Cordova()
static connectToBeacon(beacon: any): Promise<any> { return; }
/**
* Disconnect from connected Estimote Beacon. Available on Android.
*
* @usage
* ```
* EstimoteBeacons.disconnectConnectedBeacon();
* ```
* @return returns a Promise.
*/
@Cordova()
static disconnectConnectedBeacon(): Promise<any> { return; }
/**
* Write proximity UUID to connected Estimote Beacon. Available on Android.
*
* @usage
* ```
* // Example that writes constant ESTIMOTE_PROXIMITY_UUID
* EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID);
*
* @param uuid {string} String to write as new UUID
* @return returns a Promise.
*/
@Cordova()
static writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
/**
* Write major to connected Estimote Beacon. Available on Android.
*
* @usage
* ```
* // Example that writes 1
* EstimoteBeacons.writeConnectedMajor(1);
*
* @param major {number} number to write as new major
* @return returns a Promise.
*/
@Cordova()
static writeConnectedMajor(major: number): Promise<any> { return; }
/**
* Write minor to connected Estimote Beacon. Available on Android.
*
* @usage
* ```
* // Example that writes 1
* EstimoteBeacons.writeConnectedMinor(1);
*
* @param minor {number} number to write as new minor
* @return returns a Promise.
*/
@Cordova()
static writeConnectedMinor(minor: number): Promise<any> { return; }
}
export interface EstimoteBeaconRegion {
state?: string;
major: number;
minor: number;
identifier?: string;
uuid: string;
}

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, Cordova } 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: FileEntry, encoding?: string): void;
readAsDataURL(fe: FileEntry): void;
readAsBinaryString(fe: FileEntry): void;
readAsArrayBuffer(fe: FileEntry): void;
readAsText(fe: File, encoding?: string): void;
readAsDataURL(fe: File): void;
readAsBinaryString(fe: File): void;
readAsArrayBuffer(fe: File): void;
}
declare var FileReader: {
@@ -341,6 +342,17 @@ declare var FileError: {
* @description
* This plugin implements a File API allowing read/write access to files residing on the device.
*
* The File class implements static convenience functions to access files and directories.
*
* Example:
* ```
* import { File } from 'ionic-native';
*
* declare var cordova: any;
* const fs:string = cordova.file.dataDirectory;
* File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
* ```
*
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
* The (now-defunct) Directories and System extensions Latest: http://www.w3.org/TR/2012/WD-file-system-api-20120417/
* 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/
@@ -379,14 +391,14 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} dir Name of directory to check
* @return Returns a Promise that resolves or rejects with an error.
* @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> {
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
if ((/^\//.test(dir))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<boolean>(err);
return Promise.reject<FileError>(err);
}
let fullpath = path + dir;
@@ -404,21 +416,21 @@ export class File {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} dirName Name of directory to create
* @param {boolean} replace If true, replaces file with same name. If false returns error
* @return Returns a Promise that resolves or rejects with an 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> {
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<DirectoryEntry>(err);
return Promise.reject<FileError>(err);
}
let options: Flags = {
create: true
};
if (replace) {
if (!replace) {
options.exclusive = true;
}
@@ -433,14 +445,14 @@ export class File {
*
* @param {string} path The path to the directory
* @param {string} dirName The directory name
* @return Returns a Promise that resolves or rejects with an error.
* @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> {
static removeDir(path: string, dirName: string): Promise<RemoveResult|FileError> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<RemoveResult>(err);
return Promise.reject<FileError>(err);
}
return File.resolveDirectoryUrl(path)
@@ -459,16 +471,16 @@ export class File {
* @param {string} dirName The source directory name
* @param {string} newPath The destionation path to the directory
* @param {string} newDirName The destination directory name
* @return Returns a Promise that resolves or rejects with an error.
* @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> {
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry|FileError> {
newDirName = newDirName || dirName;
if ((/^\//.test(newDirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<DirectoryEntry>(err);
return Promise.reject<FileError>(err);
}
return this.resolveDirectoryUrl(path)
@@ -490,13 +502,13 @@ export class File {
* @param {string} dirName Name of directory to copy
* @param {string} newPath Base FileSystem of new location
* @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
* @return Returns a Promise that resolves or rejects with an error.
* @return {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
*/
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<any> {
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry|FileError> {
if ((/^\//.test(newDirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject(err);
return Promise.reject<FileError>(err);
}
return this.resolveDirectoryUrl(path)
@@ -516,7 +528,7 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} dirName Name of directory
* @return Returns a Promise that resolves or rejects with an error.
* @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[]> {
@@ -541,7 +553,7 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} dirName Name of directory
* @return Returns a Promise that resolves or rejects with an error.
* @return {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
*/
static removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
@@ -565,14 +577,14 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file to check
* @return Returns a Promise that resolves or rejects with an error.
* @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> {
static checkFile(path: string, file: string): Promise<boolean|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file cannot start with \/';
return Promise.reject<boolean>(err);
return Promise.reject<FileError>(err);
}
return File.resolveLocalFilesystemUrl(path + file)
@@ -595,20 +607,20 @@ export class File {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName Name of file to create
* @param {boolean} replace If true, replaces file with same name. If false returns error
* @return Returns a Promise that resolves or rejects with an error.
* @return {Promise<FileEntry|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
*/
static createFile(path: string, fileName: string, replace: boolean): Promise<any> {
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry|FileError> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject(err);
return Promise.reject<FileError>(err);
}
let options: Flags = {
create: true
};
if (replace) {
if (!replace) {
options.exclusive = true;
}
@@ -623,14 +635,14 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName Name of file to remove
* @return Returns a Promise that resolves or rejects with an error.
* @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> {
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<RemoveResult>(err);
return Promise.reject<FileError>(err);
}
return File.resolveDirectoryUrl(path)
@@ -642,25 +654,29 @@ export class File {
});
}
/** Write a new file to the desired location.
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string | Blob} text content or blob to write
* @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information.
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeFile(path: string, fileName: string,
text: string, replaceOrOptions: boolean | WriteOptions): Promise<void> {
text: string | Blob, replaceOrOptions: boolean | WriteOptions): Promise<void> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject(err);
}
let opts: WriteOptions;
let opts: WriteOptions = {};
if (replaceOrOptions) {
if (typeof(replaceOrOptions) === 'boolean') {
opts.replace = <boolean>replaceOrOptions;
}
}
let cflags: Flags = {
create: true
};
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, fileName, opts);
@@ -681,7 +697,14 @@ export class File {
});
}
static writeExistingFile(path: string, fileName: string, text: string): Promise<void> {
/** Write to an existing file.
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string | 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 | Blob): Promise<void> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -700,11 +723,18 @@ export class File {
});
}
static readAsText(path: string, file: string): Promise<string> {
/**
* Read the contents of a file as text.
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
*/
static readAsText(path: string, file: string): Promise<string|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<string>(err);
return Promise.reject<FileError>(err);
}
return File.resolveDirectoryUrl(path)
@@ -713,7 +743,48 @@ 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);
} else if (reader.error !== undefined || reader.error !== null) {
reject(reader.error);
} else {
reject({code: null, message: 'READER_ONLOADEND_ERR'});
}
};
fe.file(file => {
reader.readAsText(file);
}, error => {
reject(error);
});
});
});
}
/**
* Read file and return data as a base64 encoded data url.
* A data url is of the form:
* data:[<mediatype>][;base64],<data>
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
*/
static readAsDataURL(path: string, file: string): Promise<string|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<FileError>(err);
}
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, file, {create: false});
})
.then((fe) => {
let reader = new FileReader();
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -724,16 +795,29 @@ export class File {
}
};
reader.readAsText(fe);
fe.file(file => {
reader.readAsDataURL(file);
}, error => {
reject(error);
});
});
});
}
static readAsDataURL(path: string, file: string): Promise<string> {
/**
* Read file and return data as a binary data.
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
*/
static readAsBinaryString(path: string, file: string): Promise<string|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<string>(err);
return Promise.reject<FileError>(err);
}
return File.resolveDirectoryUrl(path)
@@ -742,7 +826,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -753,16 +837,28 @@ export class File {
}
};
reader.readAsDataURL(fe);
fe.file(file => {
reader.readAsBinaryString(file);
}, error => {
reject(error);
});
});
});
}
static readAsBinaryString(path: string, file: string): Promise<string> {
/**
* Read file and return data as an ArrayBuffer.
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @return {Promise<ArrayBuffer|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
*/
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer|FileError> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<string>(err);
return Promise.reject<FileError>(err);
}
return File.resolveDirectoryUrl(path)
@@ -771,7 +867,7 @@ export class File {
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
@@ -782,36 +878,12 @@ export class File {
}
};
reader.readAsBinaryString(fe);
});
});
}
fe.file(file => {
reader.readAsArrayBuffer(file);
}, error => {
reject(error);
});
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<ArrayBuffer>(err);
}
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, file, {create: false});
})
.then((fe) => {
let reader = new FileReader();
return new Promise((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
resolve(reader.result);
} else if (reader.error !== undefined || reader.error !== null) {
reject(reader.error);
} else {
reject({code: null, message: 'READER_ONLOADEND_ERR'});
}
};
reader.readAsArrayBuffer(fe);
});
});
}
@@ -823,15 +895,15 @@ export class File {
* @param {string} fileName Name of file to move
* @param {string} newPath Base FileSystem of new location
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
* @return Returns a Promise that resolves or rejects with an error.
* @return {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
*/
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<any> {
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
let err = new FileError(5);
err.message = 'file name cannot start with \/';
return Promise.reject(err);
return Promise.reject<FileError>(err);
}
return this.resolveDirectoryUrl(path)
@@ -853,15 +925,15 @@ export class File {
* @param {string} fileName Name of file to copy
* @param {string} newPath Base FileSystem of new location
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
* @return Returns a Promise that resolves or rejects with an error.
* @return {Promise<Entry|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
*/
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<any> {
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
let err = new FileError(5);
err.message = 'file name cannot start with \/';
return Promise.reject(err);
return Promise.reject<FileError>(err);
}
return this.resolveDirectoryUrl(path)
@@ -879,13 +951,18 @@ export class File {
// these private methods help avoid cascading error handling
// in the public ones, primarily simply wrapping callback
// operations to return Promises that can then be chained.
/**
* @private
*/
private static fillErrorMessage(err: FileError): void {
err.message = File.cordovaFileError[err.code];
}
/**
* @private
*/
private static resolveLocalFilesystemUrl(furl: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
try {
window.resolveLocalFileSystemURL(furl, (entry) => {
resolve(entry);
@@ -900,6 +977,9 @@ export class File {
});
}
/**
* @private
*/
private static resolveDirectoryUrl(durl: string): Promise<DirectoryEntry> {
return File.resolveLocalFilesystemUrl(durl)
.then((de) => {
@@ -913,8 +993,11 @@ export class File {
});
}
/**
* @private
*/
private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise<DirectoryEntry> {
return new Promise((resolve, reject) => {
return new Promise<DirectoryEntry>((resolve, reject) => {
try {
fse.getDirectory(dn, flags, (de) => {
resolve(de);
@@ -929,8 +1012,11 @@ export class File {
});
}
/**
* @private
*/
private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise<FileEntry> {
return new Promise((resolve, reject) => {
return new Promise<FileEntry>((resolve, reject) => {
try {
fse.getFile(fn, flags, (fe) => {
resolve(fe);
@@ -945,8 +1031,11 @@ export class File {
});
}
/**
* @private
*/
private static remove(fe: Entry): Promise<RemoveResult> {
return new Promise((resolve, reject) => {
return new Promise<RemoveResult>((resolve, reject) => {
fe.remove(() => {
resolve({success: true, fileRemoved: fe});
}, (err) => {
@@ -956,8 +1045,11 @@ export class File {
});
}
/**
* @private
*/
private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
srce.moveTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
@@ -967,8 +1059,11 @@ export class File {
});
}
/**
* @private
*/
private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise((resolve, reject) => {
return new Promise<Entry>((resolve, reject) => {
srce.copyTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
@@ -978,8 +1073,11 @@ export class File {
});
}
/**
* @private
*/
private static readEntries(dr: DirectoryReader): Promise<Entry[]> {
return new Promise((resolve, reject) => {
return new Promise<Entry[]>((resolve, reject) => {
dr.readEntries((entries) => {
resolve(entries);
}, (err) => {
@@ -989,8 +1087,11 @@ export class File {
});
}
/**
* @private
*/
private static rimraf(de: DirectoryEntry): Promise<RemoveResult> {
return new Promise((resolve, reject) => {
return new Promise<RemoveResult>((resolve, reject) => {
de.removeRecursively(() => {
resolve({success: true, fileRemoved: de});
}, (err) => {
@@ -1000,8 +1101,11 @@ export class File {
});
}
/**
* @private
*/
private static createWriter(fe: FileEntry): Promise<FileWriter> {
return new Promise((resolve, reject) => {
return new Promise<FileWriter>((resolve, reject) => {
fe.createWriter((writer) => {
resolve(writer);
}, (err) => {
@@ -1011,7 +1115,14 @@ export class File {
});
}
private static write(writer: FileWriter, gu: string | Blob): Promise<void> {
/**
* @private
*/
private static write(writer: FileWriter, gu: string | Blob): Promise<any> {
if (gu instanceof Blob) {
return this.writeFileInChunks(writer, gu);
}
return new Promise<void>((resolve, reject) => {
writer.onwriteend = (evt) => {
if (writer.error) {
@@ -1023,4 +1134,32 @@ export class File {
writer.write(gu);
});
}
/**
* @private
*/
private static writeFileInChunks(writer: FileWriter, file: Blob) {
const BLOCK_SIZE = 1024 * 1024;
let writtenSize = 0;
function writeNextChunk() {
const size = Math.min(BLOCK_SIZE, file.size - writtenSize);
const chunk = file.slice(writtenSize, writtenSize + size);
writtenSize += size;
writer.write(chunk);
}
return new Promise<any>((resolve, reject) => {
writer.onerror = reject;
writer.onwrite = () => {
if (writtenSize < file.size) {
writeNextChunk();
} else {
resolve();
}
};
writeNextChunk();
});
}
}

162
src/plugins/geofence.ts Normal file
View File

@@ -0,0 +1,162 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name Geofence
* @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence.
* Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
* @usage
* ```
* import { Geofence } from 'ionic-native';
* import { Platform } from 'ionic-angular'
* ...
*
* constructor(private platform: Platform) {
* this.platform.ready().then(() => {
// initialize the plugin
* Geofence.initialize().then(
* // resolved promise does not return a value
* () => console.log('Geofence Plugin Ready'),
* (err) => console.log(err)
* )
* })
* }
*
* private addGeofence() {
* //options describing geofence
* let fence = {
* id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb", //any unique ID
* latitude: 37.285951, //center of geofence radius
* longitude: -121.936650,
* radius: 100, //radius to edge of geofence
* transitionType: 3, //see 'Transition Types' below
* notification: { //notification settings
* id: 1, //any unique ID
* title: "You crossed a fence", //notification title
* text: "You just arrived to Gliwice city center.", //notification body
* openAppOnClick: true //open app when notification is tapped
* }
* }
*
* Geofence.addOrUpdate(fence).then(
* () => console.log('Geofence added'),
* (err) => console.log('Geofence failed to add')
* );
* }
*
* ```
* ### Transition Types ###
* Transition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence.
*
* #### Supported values ####
* - 1: Enter
* - 2: Leave
* - 3: Both
*
* ### Defining a Geofence ###
* Geofences are defined by an object that is passed to `addOrUpdate()`. Object properties are:
* - id: Any unique ID for the geofence. This ID is used to remove and update a geofence
* - latitude: Latitude coordinate of the center of the geofence radius
* - longitude: Latitude coordinate of the center of the geofence radius
* - radius: Radius from the center to the edge of the geofence
* - transitionType: Type of geofence transition to monitor for. See 'Transition Types' above
* - notification: Object. Options for defining the notification sent when a geofence is crossed
* - id: Any unique ID
* - title: Notification title
* - text: Notification body
* - openAppOnClick: Boolean. Whether to open the app when the notification is tapped by the user
*
* ### Troubleshooting ###
* #### I get compile errors when I run `ionic build ios` or `ionic run ios`. ####
* This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly.
* Try running `ionic platform rm <platform>` then run `ionic platform add <platform>` to recreate the
* platform directories.
*/
declare var window: any;
@Plugin({
plugin: 'cordova-plugin-geofence',
pluginRef: 'geofence',
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
})
export class Geofence {
public static TransitionType = {
ENTER: 1,
EXIT: 2,
BOTH: 3
};
public static onTrasitionReceived: Function;
/**
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
*
* @return {Promise<any>}
*/
@Cordova()
static initialize(): Promise<void> { return; };
/**
* Adds a new geofence or array of geofences. For geofence object, see above.
*
* @return {Promise<any>}
*/
@Cordova()
static addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return; };
/**
* Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
* geofence was created.
*
* @return {Promise<any>}
*/
@Cordova()
static remove(geofenceId: string | Array<string>): Promise<void> { return; };
/**
* Removes all geofences.
*
* @return {Promise<any>}
*/
@Cordova()
static removeAll(): Promise<void> { return; };
/**
* Returns an array of geofences currently being monitored.
*
* @return {Promise<Array<string>>}
*/
@Cordova()
static getWatched(): Promise<string> { return; };
/**
* Called when a geofence is crossed in the direction specified by `TransitType`.
*
* @return {Promise<any>}
*/
static onTransitionReceived(): Observable<any> {
return new Observable<any>((observer) => {
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
return () => window.geofence.onTransitionReceived = () => {};
});
}
/**
* Called when the user clicks a geofence notification. iOS and Android only.
*
* @return {Promise<Object>}
*/
static onNotificationClicked(): Observable<any> {
return new Observable<any>((observer) => {
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
return () => window.geofence.onNotificationClicked = () => {};
});
}
}

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,36 +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()
static setUserId(id: string): Promise<any> { return; }
/**
* Enable verbose logging
*/
@Cordova()
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;

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 {
@@ -96,7 +97,7 @@ export class InAppBrowser {
*/
on(event: string): Observable<InAppBrowserEvent> {
return new Observable<InAppBrowserEvent>((observer) => {
this._objectInstance.addEventListener(event, observer.next.bind);
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
});
}

View File

@@ -0,0 +1,121 @@
import { Plugin, Cordova } from './plugin';
/**
* @name InAppPurchase
* @description
* A lightweight Cordova plugin for in app purchases on iOS/Android.
*
* @usage
* ```ts
* import {InAppPurchase} from 'ionic-native';
*
* InAppPurchase
* .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
* .then((products) => {
* console.log(products);
* // [{ productId: 'com.yourapp.prod1', 'title': '...', description: '...', price: '...' }, ...]
* })
* .catch((err) => {
* console.log(err);
* });
*
*
* InAppPurchase
* .buy('com.yourapp.prod1')
* .then((data)=> {
* console.log(data);
* // {
* // transactionId: ...
* // receipt: ...
* // signature: ...
* // }
* })
* .catch((err)=> {
* console.log(err);
* });
*
* ```
*
* @advanced
*
* ```ts
* // fist buy the product...
* InAppPurchase
* .buy('com.yourapp.consumable_prod1')
* .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature))
* .then(() => console.log('product was successfully consumed!'))
* .catch( err=> console.log(err))
* ```
*
*
*/
@Plugin({
plugin: 'cordova-plugin-inapppurchase',
pluginRef: 'inAppPurchase',
platforms: ['Android', 'iOS'],
repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase'
})
export class InAppPurchase {
/**
* Retrieves a list of full product data from Apple/Google. This method must be called before making purchases.
* @param {array<string>} productId an array of product ids.
* @returns {Promise} Returns a Promise that resolves with an array of objects.
*/
@Cordova({
otherPromise: true
})
static getProducts(productId: string[]): Promise<any> { return; }
/**
* Buy a product that matches the productId.
* @param {string} productId A string that matches the product you want to buy.
* @returns {Promise} Returns a Promise that resolves with the transaction details.
*/
@Cordova({
otherPromise: true
})
static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
/**
* Same as buy, but for subscription based products.
* @param {string} productId A string that matches the product you want to subscribe to.
* @returns {Promise} Returns a Promise that resolves with the transaction details.
*/
@Cordova({
otherPromise: true
})
static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
/**
* Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message:
* @param {string} productType
* @param {string} receipt
* @param {string} signature
*/
@Cordova({
otherPromise: true
})
static consume(productType: string, receipt: string, signature: string): Promise<any> { return; }
/**
* Restore all purchases from the store
* @returns {Promise} Returns a promise with an array of purchases.
*/
@Cordova({
otherPromise: true
})
static restorePurchases(): Promise<any> { return; }
/**
* Get the receipt.
* @returns {Promise<string>} Returns a promise that contains the string for the receipt
*/
@Cordova({
otherPromise: true,
platforms: ['iOS']
})
static getReceipt(): Promise<string> { return; }
}

57
src/plugins/instagram.ts Normal file
View File

@@ -0,0 +1,57 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Instagram
* @description Share a photo with the instagram app
*
* @usage
* ```
* import {Instagram} from 'ionic-native';
*
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
* .then(() => console.log('Shared!'))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
plugin: 'cordova-instagram-plugin',
pluginRef: 'Instagram',
repo: 'https://github.com/vstirbu/InstagramPlugin'
})
export class Instagram {
/**
* Detect if the Instagram application is installed on the device.
*
* @return {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
*/
@Cordova({
callbackStyle: 'node'
})
static isInstalled(): Promise<boolean|string> { return; }
/**
* Share an image on Instagram
* Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption.
*
* @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share
* @param caption The caption of the image
* @return {Promise<any>} Returns a promise that resolves if the image was shared
*/
@Cordova({
callbackStyle: 'node'
})
static share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
/**
* Share a library asset or video
* @param assetLocalIdentifier A local fileURI
* @return {Promise<any>} Returns a promise that resolves if the image was shared
*/
@Cordova({
callbackOrder: 'reverse'
})
static shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
}

35
src/plugins/is-debug.ts Normal file
View File

@@ -0,0 +1,35 @@
import { Plugin, Cordova } from './plugin';
/**
* @name IsDebug
* @description
* Detect if the app is running in debug mode or not.
* Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
*
* @usage
* ```
* import {IsDebug} from 'ionic-native';
*
* IsDebug.getIsDebug()
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-is-debug',
pluginRef: 'cordova.plugins.IsDebug',
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
})
export class IsDebug {
/**
* Determine if an app was installed via xcode / eclipse / the ionic CLI etc
* @return {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
*/
@Cordova()
static getIsDebug(): Promise<boolean> {
return;
}
}

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

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,9 +1,12 @@
import { CordovaInstance, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
import { CordovaInstance, Plugin, getPlugin, pluginWarn } from './plugin';
declare var Media: any;
export interface MediaError {
code: number;
message: string;
}
/**
* @name MediaPlugin
* @description
@@ -64,53 +67,91 @@ declare var Media: any;
*
* ```
*/
@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
@@ -146,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
@@ -189,12 +230,3 @@ export class MediaPlugin {
stop(): void { }
}
export class MediaError {
static get MEDIA_ERR_ABORTED() { return 1; }
static get MEDIA_ERR_NETWORK() { return 2; }
static get MEDIA_ERR_DECODE() { return 3; }
static get MEDIA_ERR_NONE_SUPPORTED() { return 4; }
code: number;
message: string;
}

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,91 @@
import { Plugin, Cordova } from './plugin';
/**
* @name NativeAudio
* @description Native Audio Playback
* @usage
* ```typescript
* import {NativeAudio} from 'ionic-native';
*
* NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
*
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
*
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
*
* NativeAudio.stop('uniqueId1').then(onSuccess,onError);
*
* NativeAudio.unload('uniqueId1').then(onSuccess,onError);
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-nativeaudio',
pluginRef: 'plugins.NativeAudio',
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
})
export class NativeAudio {
/**
* Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.
* @param id {string} unique ID for the audio file
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
* @returns {Promise<any>}
*/
@Cordova()
static preloadSimple(id: string, assetPath: string): Promise<any> {return; }
/**
* Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.
* @param id {string} unique ID for the audio file
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
* @param volume {number} the volume of the preloaded sound (0.1 to 1.0)
* @param voices {number} the number of multichannel voices available
* @param delay {number}
* @returns {Promise<any>}
*/
@Cordova()
static preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise<any> {return; }
/**
* Plays an audio asset
* @param id {string} unique ID for the audio file
* @param completeCallback {Function} callback to be invoked when audio is done playing
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static play(id: string, completeCallback: Function): Promise<any> {return; }
/**
* Stops playing an audio
* @param id {string} unique ID for the audio file
*/
@Cordova()
static stop(id: string): Promise<any> {return; }
/**
* Loops an audio asset infinitely, this only works for complex assets
* @param id {string} unique ID for the audio file
* @return {Promise<any>}
*/
@Cordova()
static loop(id: string): Promise<any> {return; }
/**
* Unloads an audio file from memory
* @param id {string} unique ID for the audio file
*/
@Cordova()
static unload(id: string): Promise<any> {return; }
/**
* Changes the volume for preloaded complex assets.
* @param id {string} unique ID for the audio file
* @param volume {number} the volume of the audio asset (0.1 to 1.0)
*/
@Cordova()
static setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
}

View File

@@ -0,0 +1,86 @@
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;
fixedPixelsTops?: number;
fixedPixelsBottom?: number;
}

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

@@ -14,13 +14,11 @@ import { Observable } from 'rxjs/Observable';
* ```typescript
* import { OneSignal } from 'ionic-native';
*
* let notificationOpenedCallback(jsonData: any) {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* };
*
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
* {googleProjectNumber: '703322744261'},
* notificationOpenedCallback);
* {googleProjectNumber: '703322744261'})
* .subscribe(jsonData => {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* });
*
* OneSignal.enableInAppAlertNotification(true);
* ```
@@ -36,7 +34,7 @@ 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 {string} 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.
*/
@@ -60,8 +58,8 @@ export class OneSignal {
* 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.
* @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 { }
@@ -70,7 +68,7 @@ export class OneSignal {
* 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"}
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
@Cordova({ sync: true })
static sendTags(json: any): void { }
@@ -86,7 +84,7 @@ export class OneSignal {
/**
* 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.
* @param {string} Key to remove.
*/
@Cordova({ sync: true })
static deleteTag(key: string): void { }
@@ -94,7 +92,7 @@ export class OneSignal {
/**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
*
* @param {keys} Keys to remove.
* @param {Array<string>} Keys to remove.
*/
@Cordova({ sync: true })
static deleteTags(keys: string[]): void { }
@@ -116,7 +114,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 { }
@@ -128,7 +126,7 @@ export class OneSignal {
* By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
* Passing false means that the device will only vibrate unless the device is set to a total silent mode.
*
* @param {enable} false to disable sound, true to re-enable it.
* @param {boolean} false to disable sound, true to re-enable it.
*/
@Cordova({ sync: true })
static enableSound(enable: boolean): void { }
@@ -140,7 +138,7 @@ export class OneSignal {
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
* If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
*
* @param {enable} enable
* @param {boolean} enable
*/
@Cordova({ sync: true })
static enableNotificationsWhenActive(enable: boolean): void { }
@@ -150,7 +148,7 @@ export class OneSignal {
* If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
* The notificationOpenedCallback is then fired after the alert box is closed.
*
* @param {enable} enable
* @param {boolean} enable
*/
@Cordova({ sync: true })
static enableInAppAlertNotification(enable: boolean): void { }
@@ -159,7 +157,7 @@ export class OneSignal {
* 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 { }
@@ -253,4 +251,4 @@ export class OneSignal {
visualLevel: number
}): void { }
}
}

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

@@ -24,5 +24,5 @@ export class PhotoViewer {
* @param options {any}
*/
@Cordova({sync: true})
show(url: string, title?: string, options?: {share?: boolean; }): void { }
static show(url: string, title?: string, options?: {share?: boolean; }): void { }
}

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,15 +41,44 @@ 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]
args.unshift(reject);
args.unshift(resolve);
} else if (opts.callbackStyle === 'node') {
args.push((err, result) => {
if (err) {
reject(err);
} else {
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);
args.splice(opts.errorIndex, 0, reject);
if (opts.successIndex > args.length) {
args[opts.successIndex] = resolve;
} else {
args.splice(opts.successIndex, 0, resolve);
}
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
if (opts.errorIndex > args.length) {
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
} else {
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
}
} else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
@@ -88,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();
}
}
@@ -200,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
@@ -251,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;
};
}
@@ -334,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

@@ -22,6 +22,19 @@ declare var window;
* ScreenOrientation.unlockOrientation();
* ```
*
* @advanced
*
* Accepted orientation values:
*
* | Value | Description |
* |-------------------------------|------------------------------------------------------------------------------|
* | portrait-primary | The orientation is in the primary portrait mode. |
* | portrait-secondary | The orientation is in the secondary portrait mode. |
* | landscape-primary | The orientation is in the primary landscape mode. |
* | landscape-secondary | The orientation is in the secondary landscape mode. |
* | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
* | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
*
*/
@Plugin({
plugin: 'cordova-plugin-screen-orientation',
@@ -33,18 +46,8 @@ export class ScreenOrientation {
/**
* Lock the orientation to the passed value.
*
* Accepted orientation values:
* | Value | Description |
* |-------------------------------|------------------------------------------------------------------------------|
* | portrait-primary | The orientation is in the primary portrait mode. |
* | portrait-secondary | The orientation is in the secondary portrait mode. |
* | landscape-primary | The orientation is in the primary landscape mode. |
* | landscape-secondary | The orientation is in the secondary landscape mode. |
* | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
* | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
*
* @param {orientation} The orientation which should be locked. Accepted values see table above.
* See below for accepted values
* @param {orientation} The orientation which should be locked. Accepted values see table below.
*/
@Cordova({ sync: true })
static lockOrientation(orientation: string): void { }

View File

@@ -1,4 +1,4 @@
import { Cordova, Plugin } from './plugin';
import { Plugin } from './plugin';
declare var navigator: any;
@@ -10,10 +10,10 @@ declare var navigator: any;
* import {Screenshot} from 'ionic-native';
*
* // Take a screenshot and save to file
* Screneshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
* Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
*
* // Take a screenshot and get temporary file URI
* Screneshot.URI(80).then(onSuccess, onError);
* Screenshot.URI(80).then(onSuccess, onError);
* ```
*/
@Plugin({

View File

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

35
src/plugins/shake.ts Normal file
View File

@@ -0,0 +1,35 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name Shake
* @description Handles shake gesture
* @usage
* ```typescript
* import {Shake} from 'ionic-native';
*
* let watch = Shake.startWatch(60).subscribe(() => {
* // do something
* });
*
* watch.unsubscribe();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-shake',
pluginRef: 'shake',
repo: 'https://github.com/leecrossley/cordova-plugin-shake'
})
export class Shake {
/**
* Watch for shake gesture
* @param sensitivity {number} Optional sensitivity parameter. Defaults to 40
*/
@Cordova({
observable: true,
clearFunction: 'stopWatch',
successIndex: 0,
errorIndex: 2
})
static startWatch(sensitivity?: number): Observable<any> {return; }
}

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

@@ -0,0 +1,47 @@
import { Plugin, Cordova } from './plugin';
export interface TTSOptions {
/** text to speak */
text: string;
/** a string like 'en-US', 'zh-CN', etc */
locale?: string;
/** speed rate, 0 ~ 1 */
rate?: number;
}
/**
* @name TextToSpeech
* @description
* Text to Speech plugin
*
* @usage
* ```
* import {TextToSpeech} from 'ionic-native';
*
* TextToSpeech.speak('Hello World')
* .then(() => console.log('Success'))
* .catch((reason: any) => console.log(reason));
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-tts',
pluginRef: 'TTS',
repo: 'https://github.com/vilic/cordova-plugin-tts'
})
export class TextToSpeech {
/**
* This function speaks
* @param options {string | TTSOptions} Text to speak or TTSOptions
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static speak(options: string | TTSOptions): Promise<any> {
return;
}
}

View File

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

View File

@@ -45,6 +45,13 @@ export class TwitterConnect {
*/
@Cordova()
static logout(): Promise<any> {return; }
/**
* Returns user's profile information
* @return {Promise<any>} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails
*/
@Cordova()
static showUser(): Promise<any> {return; }
}
export interface TwitterConnectResponse {
/**

200
src/plugins/video-editor.ts Normal file
View File

@@ -0,0 +1,200 @@
import { Plugin, Cordova } from './plugin';
export interface TranscodeOptions {
/** The path to the video on the device. */
fileUri: string;
/** The file name for the transcoded video */
outputFileName: string;
/** Instructions on how to encode the video. Android is always mp4 */
outputFileType?: number;
/** Should the video be processed with quailty or speed in mind. iOS only */
optimizeForNetworkUse?: number;
/** Save the new video the library. Not supported in windows. Defaults to true */
saveToLibrary?: boolean;
/** Delete the original video. Android only. Defaults to false */
deleteInputFile?: boolean;
/** iOS only. Defaults to true */
maintainAspectRatio?: boolean;
/** Width of the result */
width?: number;
/** Height of the result */
height?: number;
/** Bitrate in bits. Defaults to 1 megabit (1000000). */
videoBitrate?: number;
/** Frames per second of the result. Android only. Defaults to 24. */
fps?: number;
/** Number of audio channels. iOS only. Defaults to 2. */
audioChannels?: number;
/** Sample rate for the audio. iOS only. Defaults to 44100*/
audioSampleRate?: number;
/** Sample rate for the audio. iOS only. Defaults to 128 kilobits (128000). */
audioBitrate?: number;
/** Not supported in windows, progress on the transcode. info will be a number from 0 to 100 */
progress?: (info: number) => void;
}
export interface TrimOptions {
/** Path to input video. */
fileUri: string;
/** Time to start trimming in seconds */
trimStart: number;
/** Time to end trimming in seconds */
trimEnd: number;
/** Output file name */
outputFileName: string;
/** Progress on transcode. info will be a number from 0 to 100 */
progress?: (info: any) => void;
}
export interface CreateThumbnailOptions {
/** The path to the video on the device */
fileUri: string;
/** The file name for the JPEG image */
outputFileName: string;
/** Location in the video to create the thumbnail (in seconds) */
atTime?: number;
/** Width of the thumbnail. */
width?: number;
/** Height of the thumbnail. */
height?: number;
/** Quality of the thumbnail (between 1 and 100). */
quality?: number;
}
export interface GetVideoInfoOptions {
/** The path to the video on the device. */
fileUri: string;
}
export interface VideoInfo {
/** Width of the video in pixels. */
width: number;
/** Height of the video in pixels. */
height: number;
/** Orientation of the video. Will be either portrait or landscape. */
orientation: 'portrait' | 'landscape';
/** Duration of the video in seconds. */
duration: number;
/** Size of the video in bytes. */
size: number;
/** Bitrate of the video in bits per second. */
bitrate: number;
}
/**
* @name VideoEditor
* @description Edit videos using native device APIs
*
* @usage
* ```
* import {VideoEditor} from 'ionic-native';
*
* VideoEditor.transcodeVideo({
* fileUri: '/path/to/input.mov',
* outputFileName: 'output.mp4',
* outputFileType: VideoEditor.OutputFileType.MPEG4
* })
* .then((fileUri: string) => console.log('video transcode success', fileUri))
* .catch((error: any) => console.log('video transcode error', error));
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-video-editor',
pluginRef: 'VideoEditor',
repo: 'https://github.com/jbavari/cordova-plugin-video-editor',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class VideoEditor {
static OptimizeForNetworkUse = {
NO: 0,
YES: 1
};
static OutputFileType = {
M4V: 0,
MPEG4: 1,
M4A: 2,
QUICK_TIME: 3
};
/**
* Transcode a video
* @param options {TranscodeOptions} Options
* @return {Promise<string>} Returns a promise that resolves to the path of the transcoded video
*/
@Cordova({
callbackOrder: 'reverse'
})
static transcodeVideo(options: TranscodeOptions): Promise<string> { return; }
/**
* Trim a video
* @param options {TrimOptions} Options
* @return {Promise<string>} Returns a promise that resolves to the path of the trimmed video
*/
@Cordova({
callbackOrder: 'reverse',
platforms: ['iOS']
})
static trim(options: TrimOptions): Promise<string> { return; }
/**
* Create a JPEG thumbnail from a video
* @param options {CreateThumbnailOptions} Options
* @return {Promise<string>} Returns a promise that resolves to the path to the jpeg image on the device
*/
@Cordova({
callbackOrder: 'reverse'
})
static createThumbnail(options: CreateThumbnailOptions): Promise<string> { return; }
/**
* Get info on a video (width, height, orientation, duration, size, & bitrate)
* @param options {GetVideoInfoOptions} Options
* @return {Promise<VideoInfo>} Returns a promise that resolves to an object containing info on the video
*/
@Cordova({
callbackOrder: 'reverse'
})
static getVideoInfo(options: GetVideoInfoOptions): Promise<VideoInfo> { return; }
}

View File

@@ -59,4 +59,4 @@ export class VideoPlayer {
*/
@Cordova({ sync: true })
static close(): void { }
}
}

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;
}

39
src/plugins/zip.ts Normal file
View File

@@ -0,0 +1,39 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Zip
* @description
* A Cordova plugin to unzip files in Android and iOS.
*
* @usage
* ```
* import {Zip} from 'ionic-native';
*
* Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
* .then((result) => {
* if(result === 0) console.log('SUCCESS');
* if(result === -1) console.log('FAILED');
* });
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-zip',
pluginRef: 'zip',
repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip',
})
export class Zip {
/**
* Extracts files from a ZIP archive
* @param sourceZip {string} Source ZIP file
* @param destUrl {string} Destination folder
* @param onProgress {Function} optional callback to be called on progress update
* @return {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
*/
@Cordova({
successIndex: 2,
errorIndex: 4
})
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; }
}

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" />