Compare commits

...

129 Commits
v2.4.0 ... v2.x

Author SHA1 Message Date
Daniel Sogl
9c3bb41387 docs(readme): rename driftyco (#1636) 2017-06-01 14:56:56 -04:00
Ibby Hadeed
a9f6cd42e4 fix package 2017-06-01 14:43:03 -04:00
Ibby
8cd648db5c fix(health): fix queryAggregated return type
closes #1200
2017-03-20 16:20:46 -04:00
Ibby
f3407e5582 fix(music-controls): fix return types for methods 2017-03-20 16:18:55 -04:00
Aaron Czichon
d845519361 feat(pedo-meter): add pedometer plugin (#1135)
Closes #1104
2017-03-20 16:13:46 -04:00
Mossito
26db2cfcf9 feat(ble): add readRSSI method (#1189) 2017-03-20 16:11:37 -04:00
jaufgang
d0c0413140 docs(google-map): fix syntax error (#1190)
fixed syntax error caused by mismatched parentheses and braces in the description
2017-03-20 16:10:54 -04:00
Prabesh Niraula
234165c294 feat(music-controls): add missing options 2017-03-20 16:10:35 -04:00
apiaget
9bf4ee3fac feat(camera-preview): update signature to match 0.9.0 (#1192)
* feat(camera-preview): upgrade to 0.9.0

* fix(camera-preview): fix plugin name in decorator
2017-03-20 16:10:04 -04:00
neoassyrian
f8df8769c9 feat(music-controls): add updateDismissable method (#1195) 2017-03-20 16:06:44 -04:00
Julien Moulin
510cea67b7 docs(native-geocoder): fix docs (#1197)
Change address to street in example
2017-03-20 16:04:52 -04:00
Patrick Reames
55d6d11721 docs(diagnostic): change bluetoothStates to bluetoothState (#1199) 2017-03-20 15:06:20 -04:00
Ibby
97ba9b4fe1 chore(): update changelog 2017-03-18 18:34:42 -04:00
Ibby
96369db3a9 2.9.0 2017-03-18 18:34:29 -04:00
Ibby
961cff185d fix(background-geolocation): configure returns an observable
Configure no longer returns a promise or takes callbacks as parameters.
2017-03-18 18:33:01 -04:00
Quentin
9a733c3b4a docs(in-app-browser): fix typo (#1183)
text fix
2017-03-13 17:17:30 -04:00
gujiman
95ac7e1855 feat(background-mode): added moveToBackground and moveToForeground (#1181)
feat(background-mode): add missing functions moveToBackground and moveToForeground as explained in https://github.com/driftyco/ionic-native/issues/1180
2017-03-13 16:59:20 -04:00
Lukas Heddendorp
6683aa450c Updated AppPreferences docs (#1175)
Close code block to make it render properly
2017-03-12 14:59:37 -04:00
Ibby Hadeed
d0cb3049e5 Remove overeloads 2017-03-10 10:41:20 -05:00
Ibby
8036d6392d chore(): update changelog 2017-03-10 10:31:53 -05:00
Ibby
8602fde936 2.8.1 2017-03-10 10:31:03 -05:00
Ibby
0f8c3ce376 fix(health): fix return type 2017-03-10 10:30:57 -05:00
Ibby
5880491c0e chore(): update rxjs to 5.0.1 2017-03-10 10:29:34 -05:00
gujiman
62c7a60aee fix(paypal): sku param is optional (#1161)
'sku' needs to be made 'optional' as explained in the documented comment
2017-03-10 03:56:02 -05:00
Sabari Ferin
6fdeeaf6f2 fix(fingerprint-aio): add useBackup property (#1158) 2017-03-09 05:20:45 -05:00
Lukas Heddendorp
16ff420bfa Update File path plugin docs (#1153)
Fix demo code
2017-03-09 04:43:00 -05:00
Ibby
0009cbf3a0 feat(firebase): add new setScreenName method
closes #1149
2017-03-08 05:55:15 -05:00
Ibby
74971feb98 fix(bluetooth-serial): add missing disconnect method
closes #1151
2017-03-08 05:46:35 -05:00
Musa Haidari
683b808f27 docs(sqlite): syntax error resolved (#1142)
* Syntax error resolved

The `{}` should be `[]`, but since there is no binding we do not get error. In case we add one, then the syntax will be incorrect.

* Fixed a syntax error
2017-03-05 17:40:24 -05:00
Ibby
f11be169b0 chore(): update changelog 2017-03-04 08:21:10 -05:00
Ibby
3a4dc73229 2.8.0 2017-03-04 08:20:59 -05:00
Ibby
b851de9cc8 refactor(health): fix return types and prefix interfaces 2017-03-04 08:20:35 -05:00
Ibby
b8c8a1aa8d docs(background-geolocation): fix param docs 2017-03-04 08:15:21 -05:00
Ibby
8f1e729f0e Merge branch 'master' of github.com:driftyco/ionic-native 2017-03-04 08:11:46 -05:00
Ibby
b4583271b8 fix(file): fix return types
fixes #1139
2017-03-04 08:11:41 -05:00
Edoardo Tassinari
50c03b2a49 fix typo in ibeacon plugin (#1138) 2017-03-03 05:21:03 -05:00
Ibby Hadeed
27fdce7af2 refactor(safari-view-controller): hide returns promise 2017-03-03 01:13:57 -05:00
Alex
3500d80b9c feat(health): add wrapper for cordova-plugin-health (#1039)
* feat(health): add wrapper for cordova-plugin-health

* fix(Health): add optional params to QueryOptions for .query()

* docs(health): fix javadoc of interfaces

* fix(health): remove unused Plugin option

* docs(health): add missing documentation

* doc(health): add promise to return

* doc(health): remove empty lines

* doc(health): Add description & reference to repo

* doc(health: add "return {Promise<any>}"
2017-03-02 11:20:14 -05:00
viskin
f599b0418d refactor(photo-library): fixed circleci failing in 2.7.0 (#1132)
* feat(photo-library): added cordova-plugin-photo-library

* CordovaFiniteObservable moved to photo-library.
Overloads are marked as private.

* fixed typescript error in 2.7.0
2017-03-02 05:34:53 -05:00
viskin
384dfc263d feat(photo-library): added cordova-plugin-photo-library (#1102)
* feat(photo-library): added cordova-plugin-photo-library

* CordovaFiniteObservable moved to photo-library.
Overloads are marked as private.
2017-03-02 04:42:48 -05:00
Michel Ruffieux
12280dda2b feat(app-preferences): added cordova-plugin-app-preferences support (#1084)
* (feat) added cordova-plugin-app-preferences support

* replaced callback functions with promises

* updated example

* (feat) added cordova-plugin-browsertab support

* Revert "(feat) added cordova-plugin-browsertab support"

This reverts commit 00eb5cf5d8aaac9d798f9d8450e0f35f57ffb52a.

* (update) synchronize fetch
2017-03-01 23:33:43 -05:00
Ibby
5d091d21fb chore(): update changelog 2017-03-01 23:31:59 -05:00
Ibby
b83c1bf767 2.7.0 2017-03-01 23:31:23 -05:00
Ibby
6ebd2703ee remove beta from stripe 2017-03-01 22:13:58 -05:00
Ibby
3dfea7d02d set GoogleMapsMapTypeId to private 2017-03-01 22:13:13 -05:00
Ibby
44b7e301b5 tslint 2017-03-01 22:10:09 -05:00
Ibby
906401b236 feat(background-mode): add missing functions
closes #1078
2017-03-01 22:09:46 -05:00
Ibby
ffdbab7b26 feat(background-mode): replace event listeners with on method
The methods onactivate, ondeactive and onfailure no longer exist. You must now use `on` method.
2017-03-01 22:03:23 -05:00
Ibby
5144345c9e feat(diagnostic): add new methods
closes #1045
2017-03-01 21:56:56 -05:00
Ibby
47f48bae8d fix(file): fix writeExistingFile
closes #1044
2017-03-01 21:36:06 -05:00
Ibby
754c5ecbcb fix(core): dont check if method exists when overriding
fixes #1043
2017-03-01 21:34:05 -05:00
Ibby
86097b0ce6 chore(): update changelog 2017-03-01 21:29:34 -05:00
Ibby
d46067764b 2.6.0 2017-03-01 21:28:29 -05:00
Ibby
7f368b61be tslint and fix build issues 2017-03-01 21:28:05 -05:00
Ibby Hadeed
af4d5e8968 Revert "fix(File): typing where FileError can be thrown" (#1130) 2017-03-01 21:24:34 -05:00
Vlado Velichkovski
0378b1d7fd feat(gyroscope): add Gyroscope plugin (#1004)
* add gyroscope.ts to plugins

* add gyroscope to index

* Update gyroscope.ts

* Update gyroscope.ts
2017-03-01 21:16:57 -05:00
Josh Strange
57e2691889 feat(background-fetch): Adding Background Fetch requested in #990 (#1013)
* Adding Background Fetch (https://github.com/transistorsoft/cordova-plugin-background-fetch) requested in #990

* Adding BackgroundFetch to index
2017-03-01 21:16:31 -05:00
Sumama Waheed
09a7dcf594 feat(couchbase-lite): add CouchbaseLite cordova plugin (#1025)
* feat(CouchbaseLite): add CouchbaseLite cordova plugin

* add plugin url
2017-03-01 21:15:51 -05:00
Michael Trilus
fd8107b79a feat(appodeal): adds Appodeal SDK wrappers for iOS and Android (#1031)
* feat(Appodeal) bootrapping

* starting docs

* more docs

* feat(appodeal): add event Observables

* feat(appodeal): replace Cordova Observable events with #.fromEvent()

* feat(appodeal): update decorator metadata
2017-03-01 21:11:00 -05:00
Tom Sundstrom
4f86320696 feat(text-to-speech): Add stop method (#1063)
https://github.com/vilic/cordova-plugin-tts/pull/32
2017-03-01 21:01:39 -05:00
Ibby
39f1971471 fix plugin 2017-03-01 21:00:49 -05:00
David Pfeffer
60db10c1d3 feat(unique-device-add): add UniqueDeviceId plugin (#1064) 2017-03-01 20:59:41 -05:00
Rob
2a32624d9d feat(local-notifications): support for icon background color (#1079)
The Cordova plugin Ionic Natives uses allows specifying the background color of the smallIcon.  By not including it in your interface you force users to use the default color for their version of Android.  While the LocalNotification plugin is not well documented, it does include this feature, see Options.java line 253:

```
/**
     * @return
     *      The notification background color for the small icon
     *      Returns null, if no color is given.
     */
    public int getColor() {
        String hex = options.optString("color", null);

        if (hex == null) {
            return NotificationCompat.COLOR_DEFAULT;
        }

        int aRGB = Integer.parseInt(hex, 16);

        return aRGB + 0xFF000000;
    }
```

I've simply added the option to the interface as well as a short description.

This lets you go from the default color (varies by Android version): https://goo.gl/photos/nERcj4GZgapy8aee9
To any color you'd like: https://goo.gl/photos/t8V9WVba8jDU49aHA
And also works if you also specify a large icon: https://goo.gl/photos/gWQYwa12djmdXfYcA
2017-03-01 20:58:53 -05:00
Jan
2fba915b88 fix(file): platform Browser will raise a an DOMException (#1082)
fix(File): Platform Browser will raise a an DOMException on resoleLocalFilesystemUrl and tries to write on readonly property DOMException err.message in fillErrorMessage
2017-03-01 20:58:09 -05:00
Andrew Martin
318ad3f4e0 feat(google-maps): add constant for map type 2017-03-01 20:57:44 -05:00
Vegard Andreas Larsen
c1748bbc28 fix(file): remove FileError from return type (#1086)
Promises that reject with a `FileError` are not of the type `Promise<T|FileError>`, but `Promise<T>`.

The previous declarations of `Promise<T|FileError>` would break typing further down the chain where you are trying to use the value that the typing says could be `T|FileError` but in reality could only be `T`.
2017-03-01 20:56:21 -05:00
PERRONCEL
06fa7452dd docs(google-maps): improve docs (#1095)
Move `map.moveCamera(position);` inside the MAP_READY event.
Allow to zoom the map on first launch (both iOS and Android).
2017-03-01 20:55:42 -05:00
Xueron Nee
2eea3df2c4 feat(alipay): add alipay support. (#1097)
* add cordova-alipay-base plugin. to support Alipay payment

* change ALI_PID to APP_ID, make it same with the latest SDK

* rewrite comments
2017-03-01 20:54:27 -05:00
Ibby
13484f9843 docs(app-update): add docs 2017-03-01 20:33:21 -05:00
Ibby
91ee5bde5f Merge branch 'master' of github.com:driftyco/ionic-native 2017-03-01 20:29:44 -05:00
Xueron Nee
21d40888d8 feat(app-update): add cordova-plugin-app-update support (#1105)
* add new app-update plugin

* update plugin info
2017-03-01 20:29:38 -05:00
Ibby
f0e219570e feat(file): add system paths 2017-03-01 20:26:55 -05:00
JiaLiPassion
104532e1d7 fix(plugin): revert changes to support stable version (#1116)
fix #1001
2017-03-01 20:10:05 -05:00
Ibby
97cf22eedb Merge branch 'master' of github.com:driftyco/ionic-native 2017-03-01 20:06:11 -05:00
Ibby
9c5b593d6b fix(contacts): allow passing asterisk as contact field type
closes #1093
2017-03-01 20:06:03 -05:00
Ibby
26394865fc fix(contacts): allow passing asterisk as contact field type
closes 1093
2017-03-01 20:05:39 -05:00
Ibby
07c867d98e docs(background-geolocation): add return types and platforms 2017-03-01 19:53:50 -05:00
Ibby
fc879926b2 fix(background-geolocation): configure returns a promise
closes #1118
2017-03-01 19:50:40 -05:00
Ibby
281e37ee04 docs(browser-tab): add proper docs 2017-03-01 19:45:46 -05:00
Aaron Czichon
8de37939fb feat(browser-tab): add browser tab plugin (#1126)
* feature: added hasPermission function to Firebase fixes #1115

* feat: Implemented support for BrowserTab #1077
2017-03-01 19:41:54 -05:00
Ibby
448ec7a72b add success/error indices 2017-03-01 19:40:18 -05:00
Thomas Kemmer
da72500c4b fix(serial): Serial.requestPermission() options are optional (#1128) 2017-03-01 19:39:39 -05:00
idroxid
0c466d9739 refactor(paypal): fix type of items (#1125)
Type of items should be Array<PayPalItem> instead of string.
2017-03-01 19:38:43 -05:00
jsteffensen
8e0027b974 docs(stripe): fix type and naming issues (#1129) 2017-03-01 19:37:57 -05:00
Shane Smith
234ed6e9e7 fix(media): add missing pauseRecord and resumeRecord methods (#1122) 2017-02-28 17:31:35 -05:00
Ibby Hadeed
4426e59176 docs(google-maps): fix param type
closes #1110
2017-02-23 18:57:29 -05:00
Michael Nishikawa
f22874342a refactor(file): accept ArrayBuffer for data to write (#1109) 2017-02-23 18:56:26 -05:00
coreyroth
6bcd5d3183 Move marker code inside MAP_READY (#1108)
The code to set the camera position and marker should be moved inside the function handling MAP_READY.  Otherwise they execute before the event is fired and it doesn't work.
2017-02-23 18:55:19 -05:00
Robert Coie
407659a3ef update device orientation docs to reflect renaming of CompassHeading interface (#1107) 2017-02-23 04:30:18 -05:00
Musa Haidari
5ef669ae91 Update sqlite.ts (#1106)
Added a bracket to remove the syntax error
2017-02-23 04:30:02 -05:00
Eric Horodyski
4a39ebd873 Add InAppBrowserOptions interface to documentation. (#1103) 2017-02-23 04:29:33 -05:00
Josep Sayol
23b97f6b4a fix(file): add missing exports (#1101)
Any declaration that is not being exported is missing from the resulting d.ts declaration files.
2017-02-23 03:54:57 -05:00
Markus Wagner
093c8a8231 Update ibeacon.ts (#1099)
Return type of `getAuthorizationStatus()` made more explicit.
2017-02-23 03:53:11 -05:00
Noel De Martin
85a3a40795 fix(facebook): fixes issue when not supplying default params (#1088)
* Fix default facebook logEvent parameters

* Implement correct parameters format in facebook logEvent method
2017-02-23 03:52:49 -05:00
Xueron Nee
b4b7cfa473 fix(imagepicker): add outputType option (#1098) 2017-02-23 03:51:44 -05:00
Tommertom
884ce54181 docs(badge): fix example (#1096)
Error in code example (supplied parameters do not match call signature)
2017-02-23 03:50:05 -05:00
3dd13
70847d1b2b fix(push): add the missing option clearBadge (#1087) 2017-02-18 17:14:57 -05:00
Grisha Rozhnov
ff26f2a019 docs(media): update method usage (#1089) 2017-02-17 13:11:04 -05:00
Eric Horodyski
f4b8236c8d feat(inappbrowser): add interface for IAB options (#1065)
* Add InAppBrowserOptions Interface for better tooling.

* feat(inappbrowser): add  interface for IAB options

* Add more constructor tests.

* Add missing iOS options.
2017-02-15 16:57:16 -05:00
Tine
03ff0a58cf docs(device-motion): update interface names (#1076)
AccelerationData interface is wrongly named in docs. It should be DeviceMotionAccelerationData. And I added it to import statement.
2017-02-15 15:41:48 -05:00
Tedy Kanjirathinkal
c7a888e2de Update file-chooser.ts (#1071)
Removed semicolon after .then() in usage instructions
2017-02-13 18:18:52 -05:00
John Woodruff
439cceea23 fix(apprate): add missing Windows Store option (#1072) 2017-02-13 18:17:43 -05:00
Ibby Hadeed
83f57b9820 fix(zip): progress callback is optional (#1049) 2017-02-13 15:06:33 -05:00
Ibby
78fcdc8d80 chore(): update changelog 2017-02-07 11:32:53 -05:00
Ibby
53f7056b16 2.5.1 2017-02-07 11:32:28 -05:00
Ibby
b7701cdb16 fix(pin-dialog): add missing errorIndex 2017-02-07 10:19:32 -05:00
Ibby
94a4519f2b chore(): update changelog 2017-02-07 07:27:35 -05:00
Ibby
6fe52b610b 2.5.0 2017-02-07 07:27:16 -05:00
Ibby Hadeed
434a6c8ad3 Update stepcounter.ts 2017-02-06 08:33:10 -05:00
Tom Sundstrom
97489ba573 feat(barcodescanner): add option disableSuccessBeep (#1035)
https://github.com/phonegap/phonegap-plugin-barcodescanner/pull/408
2017-02-05 05:41:49 -05:00
Ibby Hadeed
f525a25b49 refractor(google-maps): use Observable.fromEvent instead of addEventListener (#1032) 2017-02-04 04:32:41 -05:00
Ibby
add49e8b4d refractor(): use Observable.fromEvent in wrapEventObservable 2017-02-04 04:16:57 -05:00
Eds
4ab87d8abb feat(inappbrowser): add hide function (#1018) 2017-02-01 01:42:07 -05:00
Prateek Kathal
69ff7afb48 docs(file): add link to additional information (#1022)
Adding a link to **cordova plugin file** for ease of understanding file management using cordova.

It took me almost a day to figure out how to properly save things like a pdf/image in a publicly accessible directory. Having a link to the main **cordova file** documentation will save a lot of time.
2017-02-01 01:40:55 -05:00
Ibby
62a30c7d8f Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-31 04:14:40 -05:00
Ibby
dc37d8f71c fix(safari-view-controller): fix issue caused by calling show without options 2017-01-31 04:14:28 -05:00
Huan LI
8864d1360a docs(streaming-media): add missing method name (#1016) 2017-01-31 01:39:21 -05:00
Ibby
613141998a docs(header-color): fix doc name 2017-01-30 11:45:36 -05:00
Ibby
c2fbb4fb64 docs(geolocation): update watchPosition example 2017-01-30 11:43:58 -05:00
Josh Strange
f0cf86076c feat(background-geolocation): add missing properties for Android 2017-01-30 05:45:42 -05:00
Ibby
a03afcf0fa fix(pinterest): fix PinterestPin interface 2017-01-29 06:49:28 -05:00
Ibby
3abe0bb97d Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-26 20:30:51 -05:00
Ibby
a5b4632ceb fix(file-transfer): fix return type of upload method
fixes #1002
2017-01-26 20:30:44 -05:00
Ibby Hadeed
1c78f77c0f docs(stepcounter): update repo and plugin
closes #1003
2017-01-25 22:22:05 -05:00
Ibby
cb7d3ef3e0 chore(): update changelog 2017-01-24 15:14:36 -05:00
Ibby
5e83a09056 2.4.1 2017-01-24 15:14:07 -05:00
Ibby
b85393de89 chore(): add CordovaOptions interface 2017-01-24 15:12:35 -05:00
Ibby
68c535fd79 style(): missing semicolon 2017-01-24 15:00:43 -05:00
Ibby
1c09ee1fbc fix(screen-orientation): lockOrientation returns a promise
closes #939
2017-01-24 15:00:20 -05:00
62 changed files with 8783 additions and 363 deletions

View File

@@ -1,5 +1,157 @@
<a name="2.9.0"></a>
# [2.9.0](https://github.com/driftyco/ionic-native/compare/v2.8.1...v2.9.0) (2017-03-18)
### Bug Fixes
* **background-geolocation:** configure returns an observable ([961cff1](https://github.com/driftyco/ionic-native/commit/961cff1))
### Features
* **background-mode:** added moveToBackground and moveToForeground ([#1181](https://github.com/driftyco/ionic-native/issues/1181)) ([95ac7e1](https://github.com/driftyco/ionic-native/commit/95ac7e1))
<a name="2.8.1"></a>
## [2.8.1](https://github.com/driftyco/ionic-native/compare/v2.8.0...v2.8.1) (2017-03-10)
### Bug Fixes
* **bluetooth-serial:** add missing disconnect method ([74971fe](https://github.com/driftyco/ionic-native/commit/74971fe)), closes [#1151](https://github.com/driftyco/ionic-native/issues/1151)
* **fingerprint-aio:** add useBackup property ([#1158](https://github.com/driftyco/ionic-native/issues/1158)) ([6fdeeaf](https://github.com/driftyco/ionic-native/commit/6fdeeaf))
* **health:** fix return type ([0f8c3ce](https://github.com/driftyco/ionic-native/commit/0f8c3ce))
* **paypal:** sku param is optional ([#1161](https://github.com/driftyco/ionic-native/issues/1161)) ([62c7a60](https://github.com/driftyco/ionic-native/commit/62c7a60))
### Features
* **firebase:** add new setScreenName method ([0009cbf](https://github.com/driftyco/ionic-native/commit/0009cbf)), closes [#1149](https://github.com/driftyco/ionic-native/issues/1149)
<a name="2.8.0"></a>
# [2.8.0](https://github.com/driftyco/ionic-native/compare/v2.7.0...v2.8.0) (2017-03-04)
### Bug Fixes
* **file:** fix return types ([b458327](https://github.com/driftyco/ionic-native/commit/b458327)), closes [#1139](https://github.com/driftyco/ionic-native/issues/1139)
### Features
* **app-preferences:** added cordova-plugin-app-preferences support ([#1084](https://github.com/driftyco/ionic-native/issues/1084)) ([12280dd](https://github.com/driftyco/ionic-native/commit/12280dd))
* **health:** add wrapper for cordova-plugin-health ([#1039](https://github.com/driftyco/ionic-native/issues/1039)) ([3500d80](https://github.com/driftyco/ionic-native/commit/3500d80))
* **photo-library:** added cordova-plugin-photo-library ([#1102](https://github.com/driftyco/ionic-native/issues/1102)) ([384dfc2](https://github.com/driftyco/ionic-native/commit/384dfc2))
<a name="2.7.0"></a>
# [2.7.0](https://github.com/driftyco/ionic-native/compare/v2.6.0...v2.7.0) (2017-03-02)
### Bug Fixes
* **core:** dont check if method exists when overriding ([754c5ec](https://github.com/driftyco/ionic-native/commit/754c5ec)), closes [#1043](https://github.com/driftyco/ionic-native/issues/1043)
* **file:** fix writeExistingFile ([47f48ba](https://github.com/driftyco/ionic-native/commit/47f48ba)), closes [#1044](https://github.com/driftyco/ionic-native/issues/1044)
### Features
* **background-mode:** add missing functions ([906401b](https://github.com/driftyco/ionic-native/commit/906401b)), closes [#1078](https://github.com/driftyco/ionic-native/issues/1078)
* **background-mode:** replace event listeners with on method ([ffdbab7](https://github.com/driftyco/ionic-native/commit/ffdbab7))
* **diagnostic:** add new methods ([5144345](https://github.com/driftyco/ionic-native/commit/5144345)), closes [#1045](https://github.com/driftyco/ionic-native/issues/1045)
<a name="2.6.0"></a>
# [2.6.0](https://github.com/driftyco/ionic-native/compare/v2.5.1...v2.6.0) (2017-03-02)
### Bug Fixes
* **apprate:** add missing Windows Store option ([#1072](https://github.com/driftyco/ionic-native/issues/1072)) ([439ccee](https://github.com/driftyco/ionic-native/commit/439ccee))
* **background-geolocation:** configure returns a promise ([fc87992](https://github.com/driftyco/ionic-native/commit/fc87992)), closes [#1118](https://github.com/driftyco/ionic-native/issues/1118)
* **contacts:** allow passing asterisk as contact field type ([9c5b593](https://github.com/driftyco/ionic-native/commit/9c5b593)), closes [#1093](https://github.com/driftyco/ionic-native/issues/1093)
* **contacts:** allow passing asterisk as contact field type ([2639486](https://github.com/driftyco/ionic-native/commit/2639486))
* **facebook:** fixes issue when not supplying default params ([#1088](https://github.com/driftyco/ionic-native/issues/1088)) ([85a3a40](https://github.com/driftyco/ionic-native/commit/85a3a40))
* **file:** add missing exports ([#1101](https://github.com/driftyco/ionic-native/issues/1101)) ([23b97f6](https://github.com/driftyco/ionic-native/commit/23b97f6))
* **file:** platform Browser will raise a an DOMException ([#1082](https://github.com/driftyco/ionic-native/issues/1082)) ([2fba915](https://github.com/driftyco/ionic-native/commit/2fba915))
* **file:** remove FileError from return type ([#1086](https://github.com/driftyco/ionic-native/issues/1086)) ([c1748bb](https://github.com/driftyco/ionic-native/commit/c1748bb))
* **imagepicker:** add outputType option ([#1098](https://github.com/driftyco/ionic-native/issues/1098)) ([b4b7cfa](https://github.com/driftyco/ionic-native/commit/b4b7cfa))
* **media:** add missing pauseRecord and resumeRecord methods ([#1122](https://github.com/driftyco/ionic-native/issues/1122)) ([234ed6e](https://github.com/driftyco/ionic-native/commit/234ed6e))
* **plugin:** revert changes to support stable version ([#1116](https://github.com/driftyco/ionic-native/issues/1116)) ([104532e](https://github.com/driftyco/ionic-native/commit/104532e)), closes [#1001](https://github.com/driftyco/ionic-native/issues/1001)
* **push:** add the missing option clearBadge ([#1087](https://github.com/driftyco/ionic-native/issues/1087)) ([70847d1](https://github.com/driftyco/ionic-native/commit/70847d1))
* **serial:** Serial.requestPermission() options are optional ([#1128](https://github.com/driftyco/ionic-native/issues/1128)) ([da72500](https://github.com/driftyco/ionic-native/commit/da72500))
* **zip:** progress callback is optional ([#1049](https://github.com/driftyco/ionic-native/issues/1049)) ([83f57b9](https://github.com/driftyco/ionic-native/commit/83f57b9))
### Features
* **alipay:** add alipay support. ([#1097](https://github.com/driftyco/ionic-native/issues/1097)) ([2eea3df](https://github.com/driftyco/ionic-native/commit/2eea3df))
* **app-update:** add cordova-plugin-app-update support ([#1105](https://github.com/driftyco/ionic-native/issues/1105)) ([21d4088](https://github.com/driftyco/ionic-native/commit/21d4088))
* **appodeal:** adds Appodeal SDK wrappers for iOS and Android ([#1031](https://github.com/driftyco/ionic-native/issues/1031)) ([fd8107b](https://github.com/driftyco/ionic-native/commit/fd8107b))
* **background-fetch:** Adding Background Fetch requested in [#990](https://github.com/driftyco/ionic-native/issues/990) ([#1013](https://github.com/driftyco/ionic-native/issues/1013)) ([57e2691](https://github.com/driftyco/ionic-native/commit/57e2691))
* **browser-tab:** add browser tab plugin ([#1126](https://github.com/driftyco/ionic-native/issues/1126)) ([8de3793](https://github.com/driftyco/ionic-native/commit/8de3793)), closes [#1115](https://github.com/driftyco/ionic-native/issues/1115)
* **couchbase-lite:** add CouchbaseLite cordova plugin ([#1025](https://github.com/driftyco/ionic-native/issues/1025)) ([09a7dcf](https://github.com/driftyco/ionic-native/commit/09a7dcf))
* **file:** add system paths ([f0e2195](https://github.com/driftyco/ionic-native/commit/f0e2195))
* **google-maps:** add constant for map type ([318ad3f](https://github.com/driftyco/ionic-native/commit/318ad3f))
* **gyroscope:** add Gyroscope plugin ([#1004](https://github.com/driftyco/ionic-native/issues/1004)) ([0378b1d](https://github.com/driftyco/ionic-native/commit/0378b1d))
* **inappbrowser:** add interface for IAB options ([#1065](https://github.com/driftyco/ionic-native/issues/1065)) ([f4b8236](https://github.com/driftyco/ionic-native/commit/f4b8236))
* **local-notifications:** support for icon background color ([#1079](https://github.com/driftyco/ionic-native/issues/1079)) ([2a32624](https://github.com/driftyco/ionic-native/commit/2a32624))
* **text-to-speech:** Add stop method ([#1063](https://github.com/driftyco/ionic-native/issues/1063)) ([4f86320](https://github.com/driftyco/ionic-native/commit/4f86320))
* **unique-device-add:** add UniqueDeviceId plugin ([#1064](https://github.com/driftyco/ionic-native/issues/1064)) ([60db10c](https://github.com/driftyco/ionic-native/commit/60db10c))
<a name="2.5.1"></a>
## [2.5.1](https://github.com/driftyco/ionic-native/compare/v2.5.0...v2.5.1) (2017-02-07)
### Bug Fixes
* **pin-dialog:** add missing errorIndex ([b7701cd](https://github.com/driftyco/ionic-native/commit/b7701cd))
<a name="2.5.0"></a>
# [2.5.0](https://github.com/driftyco/ionic-native/compare/v2.4.1...v2.5.0) (2017-02-07)
### Bug Fixes
* **file-transfer:** fix return type of upload method ([a5b4632](https://github.com/driftyco/ionic-native/commit/a5b4632)), closes [#1002](https://github.com/driftyco/ionic-native/issues/1002)
* **pinterest:** fix PinterestPin interface ([a03afcf](https://github.com/driftyco/ionic-native/commit/a03afcf))
* **safari-view-controller:** fix issue caused by calling show without options ([dc37d8f](https://github.com/driftyco/ionic-native/commit/dc37d8f))
### Features
* **background-geolocation:** add missing properties for Android ([f0cf860](https://github.com/driftyco/ionic-native/commit/f0cf860))
* **barcodescanner:** add option disableSuccessBeep ([#1035](https://github.com/driftyco/ionic-native/issues/1035)) ([97489ba](https://github.com/driftyco/ionic-native/commit/97489ba))
* **inappbrowser:** add hide function ([#1018](https://github.com/driftyco/ionic-native/issues/1018)) ([4ab87d8](https://github.com/driftyco/ionic-native/commit/4ab87d8))
<a name="2.4.1"></a>
## [2.4.1](https://github.com/driftyco/ionic-native/compare/v2.4.0...v2.4.1) (2017-01-24)
### Bug Fixes
* **screen-orientation:** lockOrientation returns a promise ([1c09ee1](https://github.com/driftyco/ionic-native/commit/1c09ee1)), closes [#939](https://github.com/driftyco/ionic-native/issues/939)
<a name="2.4.0"></a>
# [2.4.0](https://github.com/driftyco/ionic-native/compare/v2.3.2...v2.4.0) (2017-01-24)
# [2.4.0](https://github.com/driftyco/ionic-native/compare/v2.3.3...v2.4.0) (2017-01-24)
<a name="2.3.3"></a>
## [2.3.3](https://github.com/driftyco/ionic-native/compare/v2.3.2...v2.3.3) (2017-01-24)
### Bug Fixes
@@ -173,7 +325,7 @@
### BREAKING CHANGES
* device: device property no longer exists
* **device:** device property no longer exists

View File

@@ -1,4 +1,4 @@
[![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/)
[![Circle CI](https://circleci.com/gh/ionic-team/ionic-native.svg?style=shield)](https://circleci.com/gh/ionic-team/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)
[![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/)
@@ -81,7 +81,7 @@ npm install ionic-native --save
## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
# Credits

5915
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "2.4.0",
"version": "2.9.0",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/es5/index.js",
"module": "dist/esm/index.js",
@@ -9,7 +9,7 @@
"dist"
],
"dependencies": {
"rxjs": "5.0.0-beta.12"
"rxjs": "5.0.1"
},
"devDependencies": {
"browserify": "^13.3.0",
@@ -42,7 +42,7 @@
"tsify": "~3.0.0",
"tslint": "^3.15.1",
"tslint-ionic-rules": "0.0.7",
"typescript": "~2.0.10",
"typescript": "2.0.9",
"watchify": "~3.7.0"
},
"scripts": {

View File

@@ -3,14 +3,18 @@ import { initAngular1 } from './ng1';
const DEVICE_READY_TIMEOUT = 5000;
declare var window;
import { ActionSheet } from './plugins/actionsheet';
import { AdMob } from './plugins/admob';
import { Alipay } from './plugins/alipay';
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
import { AppAvailability } from './plugins/appavailability';
import { Appodeal } from './plugins/appodeal';
import { AppRate } from './plugins/apprate';
import { AppPreferences } from './plugins/apppreferences';
import { AppUpdate } from './plugins/app-update';
import { AppVersion } from './plugins/appversion';
import { Badge } from './plugins/badge';
import { BackgroundFetch } from './plugins/background-fetch';
import { BackgroundGeolocation } from './plugins/background-geolocation';
import { BackgroundMode } from './plugins/backgroundmode';
import { Backlight } from './plugins/backlight';
@@ -18,6 +22,7 @@ import { BarcodeScanner } from './plugins/barcodescanner';
import { Base64ToGallery } from './plugins/base64togallery';
import { BatteryStatus } from './plugins/batterystatus';
import { Brightness } from './plugins/brightness';
import { BrowserTab } from './plugins/browser-tab';
import { BLE } from './plugins/ble';
import { BluetoothSerial } from './plugins/bluetoothserial';
import { Broadcaster } from './plugins/broadcaster';
@@ -29,6 +34,7 @@ import { CardIO } from './plugins/card-io';
import { Clipboard } from './plugins/clipboard';
import { CodePush } from './plugins/code-push';
import { Contacts } from './plugins/contacts';
import { CouchbaseLite } from './plugins/couchbase-lite';
import { Crop } from './plugins/crop';
import { DatePicker } from './plugins/datepicker';
import { DBMeter } from './plugins/dbmeter';
@@ -57,7 +63,9 @@ import { Globalization } from './plugins/globalization';
import { GooglePlus } from './plugins/google-plus';
import { GoogleMap } from './plugins/googlemap';
import { GoogleAnalytics } from './plugins/googleanalytics';
import { Gyroscope } from './plugins/gyroscope';
import { HeaderColor } from './plugins/headercolor';
import { Health } from './plugins/health';
import { Hotspot } from './plugins/hotspot';
import { HTTP } from './plugins/http';
import { Httpd } from './plugins/httpd';
@@ -90,6 +98,8 @@ import { OneSignal } from './plugins/onesignal';
import { PhotoViewer } from './plugins/photo-viewer';
import { ScreenOrientation } from './plugins/screen-orientation';
import { PayPal } from './plugins/pay-pal';
import { Pedometer } from './plugins/pedometer';
import { PhotoLibrary } from './plugins/photo-library';
import { PinDialog } from './plugins/pin-dialog';
import { Pinterest } from './plugins/pinterest';
import { PowerManagement } from './plugins/power-management';
@@ -118,6 +128,7 @@ 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 { UniqueDeviceID } from './plugins/unique-device-id';
import { Vibration } from './plugins/vibration';
import { VideoEditor } from './plugins/video-editor';
import { VideoPlayer } from './plugins/video-player';
@@ -128,10 +139,15 @@ import { Zip } from './plugins/zip';
export * from './plugins/3dtouch';
export * from './plugins/actionsheet';
export * from './plugins/admob';
export * from './plugins/alipay';
export * from './plugins/android-fingerprint-auth';
export * from './plugins/appavailability';
export * from './plugins/apppreferences';
export * from './plugins/appodeal';
export * from './plugins/apprate';
export * from './plugins/app-update';
export * from './plugins/appversion';
export * from './plugins/background-fetch';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
export * from './plugins/backlight';
@@ -142,6 +158,7 @@ export * from './plugins/batterystatus';
export * from './plugins/ble';
export * from './plugins/bluetoothserial';
export * from './plugins/brightness';
export * from './plugins/browser-tab';
export * from './plugins/broadcaster';
export * from './plugins/calendar';
export * from './plugins/call-number';
@@ -151,6 +168,7 @@ export * from './plugins/card-io';
export * from './plugins/clipboard';
export * from './plugins/code-push';
export * from './plugins/contacts';
export * from './plugins/couchbase-lite';
export * from './plugins/crop';
export * from './plugins/datepicker';
export * from './plugins/dbmeter';
@@ -179,7 +197,9 @@ export * from './plugins/globalization';
export * from './plugins/google-plus';
export * from './plugins/googleanalytics';
export * from './plugins/googlemap';
export * from './plugins/gyroscope';
export * from './plugins/headercolor';
export * from './plugins/health';
export * from './plugins/hotspot';
export * from './plugins/http';
export * from './plugins/httpd';
@@ -210,6 +230,8 @@ export * from './plugins/network';
export * from './plugins/nfc';
export * from './plugins/onesignal';
export * from './plugins/pay-pal';
export * from './plugins/pedometer';
export * from './plugins/photo-library';
export * from './plugins/photo-viewer';
export * from './plugins/pin-dialog';
export * from './plugins/pinterest';
@@ -240,6 +262,7 @@ export * from './plugins/themeable-browser';
export * from './plugins/toast';
export * from './plugins/touchid';
export * from './plugins/twitter-connect';
export * from './plugins/unique-device-id';
export * from './plugins/vibration';
export * from './plugins/video-editor';
export * from './plugins/video-player';
@@ -252,18 +275,24 @@ export * from './plugins/zip';
window['IonicNative'] = {
ActionSheet,
AdMob,
Alipay,
AndroidFingerprintAuth,
AppAvailability,
AppPreferences,
Appodeal,
AppRate,
AppUpdate,
AppVersion,
Badge,
BackgroundGeolocation,
BackgroundFetch,
BackgroundMode,
Backlight,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BrowserTab,
BLE,
BluetoothSerial,
Broadcaster,
@@ -275,6 +304,7 @@ window['IonicNative'] = {
Clipboard,
CodePush,
Contacts,
CouchbaseLite,
Crop,
DatePicker,
DBMeter,
@@ -302,7 +332,9 @@ window['IonicNative'] = {
GooglePlus,
GoogleMap,
GoogleAnalytics,
Gyroscope,
HeaderColor,
Health,
Hotspot,
HTTP,
Httpd,
@@ -331,6 +363,8 @@ window['IonicNative'] = {
NavigationBar,
Network,
PayPal,
Pedometer,
PhotoLibrary,
NFC,
Printer,
Push,
@@ -364,6 +398,7 @@ window['IonicNative'] = {
TextToSpeech,
ThemeableBrowser,
TwitterConnect,
UniqueDeviceID,
VideoEditor,
VideoPlayer,
Vibration,

111
src/plugins/alipay.ts Normal file
View File

@@ -0,0 +1,111 @@
import { Plugin, Cordova } from './plugin';
/**
* @link https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.wlOhAE&treeId=193&articleId=105465&docType=1
*
* All values need be urlencoded.
*/
export interface AlipayOrder {
/**
* appId assigned by Alipay
*/
app_id: string;
/**
* Api name.
* Should be: alipay.trade.app.pay
*/
method: string;
/**
* Data format
* Default: "JSON"
*/
format?: string;
/**
* Charset
* Possible values: "UTF-8", "GBK"
* Default: "UTF-8"
*/
charset: string;
/**
* Sign method
* Default: 'RSA'
*/
sign_type: string;
/**
* Sign value. Should be got from server side.
* Default: 'RSA'
*/
sign: string;
/**
* Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
*/
timestamp: string;
/**
* Api version. Fixed value '1.0'
*/
version: string;
/**
* Notify url.
*/
notify_url: string;
/**
* biz content. formated in json. see alipay doc for detail.
*/
biz_content: string;
}
/**
* @name Alipay
* @description
* This plugin is used for Alipay APP support. Integrated with the latest SDK.
*
* Requires Cordova plugin: `cordova-alipay-base`. For more info, please see the [Alipay plugin docs](https://github.com/xueron/cordova-alipay-base).
*
* @usage
* ```
* import { Alipay } from 'ionic-native';
*
* // Should get from server side with sign.
* let alipayOrder = {
...
* };
*
* Alipay.pay(alipayOrder)
* .then(result => {
* console.log(result); // Success
* })
* .catch(error => {
* console.log(error); // Failed
* });
*
* ```
*
* @interfaces
* AlipayOrder
*/
@Plugin({
pluginName: 'Alipay',
plugin: 'cordova-alipay-base',
pluginRef: 'Alipay.Base',
repo: 'https://github.com/xueron/cordova-alipay-base',
platforms: ['Android', 'iOS'],
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
})
export class Alipay {
/**
* Open Alipay to perform App pay
* @param order { AlipayOrder } alipay options
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
*/
@Cordova()
static pay(order: AlipayOrder): Promise<any> { return; }
}

49
src/plugins/app-update.ts Normal file
View File

@@ -0,0 +1,49 @@
import { Plugin, Cordova } from './plugin';
/**
* @name AppUpdate
* @description
* This plugin does self-update for android
*
* @usage
*
* You should first host an XML file on your server with the following data in it:
* ```xml
* <update>
* <version>302048</version>
* <name>APK Name</name>
* <url>https://your-remote-api.com/YourApp.apk</url>
* </update>
* ```
*
* Then use the following code:
*
* ```
* import { AppUpdate } from 'ionic-native';
*
* let updateUrl = 'http://your-remote-api.com/update.xml';
*
* AppUpdate.checkAppUpdate(updateUrl);
* ```
*
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
*/
@Plugin({
pluginName: 'AppUpdate',
plugin: 'cordova-plugin-app-update',
pluginRef: 'AppUpdate',
repo: 'https://github.com/vaenow/cordova-plugin-app-update',
platforms: ['Android']
})
export class AppUpdate {
/**
* Check and update
* @param updateUrl {string} update api url
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova({
callbackOrder: 'reverse'
})
static checkAppUpdate(updateUrl: string): Promise<any> { return; }
}

443
src/plugins/appodeal.ts Normal file
View File

@@ -0,0 +1,443 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs';
/**
* @name Appodeal
* @description
* Plugin to serve ads through native Appodeal SDKs
*
* @usage
* ```
* import { Appodeal } from 'ionic-native';
*
* let appKey = '<your app key>';
* Appodeal.initialize(appKey, Appodeal.AD_TYPES.REWARDED_VIDEO);
* Appodeal.show(Appodeal.AD_TYPES.REWARDED_VIDEO);
*
* ```
*/
@Plugin({
pluginName: 'Appodeal',
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin',
pluginRef: 'Appodeal',
repo: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
platforms: [ 'ios', 'android' ]
})
export class Appodeal {
// available types of advertisements
static readonly AD_TYPES = {
INTERSTITIAL: 1,
SKIPPABLE_VIDEO: 2,
BANNER: 4,
BANNER_BOTTOM: 8,
BANNER_TOP: 16,
REWARDED_VIDEO: 128,
NON_SKIPPABLE_VIDEO: 256
};
/**
* initialize Appodeal SDK
* @param {string} appKey
* @param {number} adType
*/
@Cordova()
static initialize(appKey: string, adType: number): void {};
/**
* check if SDK has been initialized
* @returns {Promise<boolean>}
*/
@Cordova()
static isInitialized(): Promise<any> { return; };
/**
* show ad of specified type
* @param {number} adType
* @returns {Promise<boolean>}
*/
@Cordova()
static show(adType: number): Promise<any> { return; };
/**
* show ad of specified type with placement options
* @param {number} adType
* @param {any} placement
* @returns {Promise<boolean>}
*/
@Cordova()
static showWithPlacement(
adType: number,
placement: any
): Promise<any> { return; };
/**
* hide ad of specified type
* @param {number} adType
*/
@Cordova()
static hide(adType: number): void {};
/**
* confirm use of ads of specified type
* @param {number} adType
*/
@Cordova()
static confirm(adType: number): void {};
/**
* check if ad of specified type has been loaded
* @param {number} adType
* @returns {Promise<boolean>}
*/
@Cordova()
static isLoaded(adType: number): Promise<any> { return; };
/**
* check if ad of specified
* @param {number} adType
* @returns {Promise<boolean>}
*/
@Cordova()
static isPrecache(adType: number): Promise<any> { return; };
/**
*
* @param {number} adType
* @param autoCache
*/
@Cordova()
static setAutoCache(adType: number, autoCache: any): void {};
/**
* forcefully cache an ad by type
* @param {number} adType
*/
@Cordova()
static cache(adType: number): void {};
/**
*
* @param {boolean} set
*/
@Cordova()
static setOnLoadedTriggerBoth(set: boolean): void {};
/**
* enable or disable Smart Banners
* @param {boolean} enabled
*/
@Cordova()
static setSmartBanners(enabled: boolean): void {};
/**
* enable or disable banner backgrounds
* @param {boolean} enabled
*/
@Cordova()
static setBannerBackground(enabled: boolean): void {};
/**
* enable or disable banner animations
* @param {boolean} enabled
*/
@Cordova()
static setBannerAnimation(enabled: boolean): void {};
/**
*
* @param value
*/
@Cordova()
static set728x90Banners(value: any): void {};
/**
* enable or disable logging
* @param {boolean} logging
*/
@Cordova()
static setLogging(logging: boolean): void {};
/**
* enable or disable testing mode
* @param {boolean} testing
*/
@Cordova()
static setTesting(testing: boolean): void {};
/**
* reset device ID
*/
@Cordova()
static resetUUID(): void {};
/**
* get version of Appdeal SDK
*/
@Cordova()
static getVersion(): Promise<any> { return; };
/**
*
* @param {string} network
* @param {number} adType
*/
@Cordova()
static disableNetwork(network?: string, adType?: number): void {};
/**
*
* @param {string} network
* @param {number} adType
*/
@Cordova()
static disableNetworkType(network?: string, adType?: number): void {};
/**
* disable Location permissions for Appodeal SDK
*/
@Cordova()
static disableLocationPermissionCheck(): void {};
/**
* disable Storage permissions for Appodeal SDK
*/
@Cordova()
static disableWriteExternalStoragePermissionCheck(): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
static enableInterstitialCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
static enableSkippableVideoCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
static enableNonSkippableVideoCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
static enableBannerCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
static enableRewardedVideoCallbacks(enabled: boolean): void {};
/**
*
* @param {string} name - name of rule
* @param {boolean} value
*/
@Cordova()
static setCustomBooleanRule(name: string, value: boolean): void {};
/**
*
* @param {string} name - name of rule
* @param {number} value
*/
@Cordova()
static setCustomIntegerRule(name: string, value: number): void {};
/**
* set rule with float value
* @param {string} name
* @param {number} value
*/
@Cordova()
static setCustomDoubleRule(name: string, value: number): void {};
/**
* set rule with string value
* @param {string} name - name of rule
* @param {string} value
*/
@Cordova()
static setCustomStringRule(name: string, value: string): void {};
/**
* set ID preference in Appodeal for current user
* @param id
*/
@Cordova()
static setUserId(id: any): void {};
/**
* set Email preference in Appodeal for current user
* @param email
*/
@Cordova()
static setEmail(email: any): void {};
/**
* set Birthday preference in Appodeal for current user
* @param birthday
*/
@Cordova()
static setBirthday(birthday: any): void {};
/**
* et Age preference in Appodeal for current user
* @param age
*/
@Cordova()
static setAge(age: any): void {};
/**
* set Gender preference in Appodeal for current user
* @param gender
*/
@Cordova()
static setGender(gender: any): void {};
/**
* set Occupation preference in Appodeal for current user
* @param occupation
*/
@Cordova()
static setOccupation(occupation: any): void {};
/**
* set Relation preference in Appodeal for current user
* @param relation
*/
@Cordova()
static setRelation(relation: any): void {};
/**
* set Smoking preference in Appodeal for current user
* @param smoking
*/
@Cordova()
static setSmoking(smoking: any): void {};
/**
* set Alcohol preference in Appodeal for current user
* @param alcohol
*/
@Cordova()
static setAlcohol(alcohol: any): void {};
/**
* set Interests preference in Appodeal for current user
* @param interests
*/
@Cordova()
static setInterests(interests: any): void {};
/*********************
* event Observables *
*********************/
static onInterstitialLoaded(): Observable<any> {
return Observable.fromEvent(document, 'onInterstitialLoaded');
}
static onInterstitialFailedToLoad(): Observable<any> {
return Observable.fromEvent(document, 'onInterstitialFailedToLoad');
}
static onInterstitialShown(): Observable<any> {
return Observable.fromEvent(document, 'onInterstitialShown');
}
static onInterstitialClicked(): Observable<any> {
return Observable.fromEvent(document, 'onInterstitialClicked');
}
static onInterstitialClosed(): Observable<any> {
return Observable.fromEvent(document, 'onInterstitialClosed');
}
static onSkippableVideoLoaded(): Observable<any> {
return Observable.fromEvent(document, 'onSkippableVideoLoaded');
}
static onSkippableVideoFailedToLoad(): Observable<any> {
return Observable.fromEvent(document, 'onSkippableVideoFailedToLoad');
}
static onSkippableVideoShown(): Observable<any> {
return Observable.fromEvent(document, 'onSkippableVideoShown');
}
static onSkippableVideoFinished(): Observable<any> {
return Observable.fromEvent(document, 'onSkippableVideoFinished');
}
static onSkippableVideoClosed(): Observable<any> {
return Observable.fromEvent(document, 'onSkippableVideoClosed');
}
static onRewardedVideoLoaded(): Observable<any> {
return Observable.fromEvent(document, 'onRewardedVideoLoaded');
}
static onRewardedVideoFailedToLoad(): Observable<any> {
return Observable.fromEvent(document, 'onRewardedVideoFailedToLoad');
}
static onRewardedVideoShown(): Observable<any> {
return Observable.fromEvent(document, 'onRewardedVideoShown');
}
static onRewardedVideoFinished(): Observable<any> {
return Observable.fromEvent(document, 'onRewardedVideoFinished');
}
static onRewardedVideoClosed(): Observable<any> {
return Observable.fromEvent(document, 'onRewardedVideoClosed');
}
static onNonSkippableVideoLoaded(): Observable<any> {
return Observable.fromEvent(document, 'onNonSkippableVideoLoaded');
}
static onNonSkippableVideoFailedToLoad(): Observable<any> {
return Observable.fromEvent(document, 'onNonSkippableVideoFailedToLoad');
}
static onNonSkippableVideoShown(): Observable<any> {
return Observable.fromEvent(document, 'onNonSkippableVideoShown');
}
static onNonSkippableVideoFinished(): Observable<any> {
return Observable.fromEvent(document, 'onNonSkippableVideoFinished');
}
static onNonSkippableVideoClosed(): Observable<any> {
return Observable.fromEvent(document, 'onNonSkippableVideoClosed');
}
static onBannerClicked(): Observable<any> {
return Observable.fromEvent(document, 'onBannerClicked');
}
static onBannerFailedToLoad(): Observable<any> {
return Observable.fromEvent(document, 'onBannerFailedToLoad');
}
static onBannerLoaded(): Observable<any> {
return Observable.fromEvent(document, 'onBannerLoaded');
}
static onBannerShown(): Observable<any> {
return Observable.fromEvent(document, 'onBannerShown');
}
}

View File

@@ -0,0 +1,133 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name AppPreferences
* @description
* This plugin allows you to read and write app preferences
*
* @usage
* ```
* import { AppPreferences } from 'ionic-native';
*
* AppPreferences.fetch('key').then((res) => { console.log(res); });
*
*```
*/
@Plugin({
pluginName: 'AppPreferences',
plugin: 'cordova-plugin-app-preferences', // npm package name, example: cordova-plugin-camera
pluginRef: 'plugins.appPreferences', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/apla/me.apla.cordova.app-preferences', // the github repository URL for the plugin
})
export class AppPreferences {
/**
* Get a preference value
*
* @param {string} dict Dictionary for key (OPTIONAL)
* @param {string} key Key
* @return {Promise<any>} Returns a promise
*/
@Cordova({
sync: true,
callbackOrder: 'reverse'
})
static fetch(dict: string, key?: string): Promise<any> { return; }
/**
* Set a preference value
*
* @param {string} dict Dictionary for key (OPTIONAL)
* @param {string} key Key
* @param {string} value Value
* @return {Promise<any>} Returns a promise
*/
@Cordova({
callbackOrder: 'reverse'
})
static store(dict: string, key: string, value?: string): Promise<any> {
return;
}
/**
* Remove value from preferences
*
* @param {string} dict Dictionary for key (OPTIONAL)
* @param {string} key Key
* @return {Promise<any>} Returns a promise
*/
@Cordova({
callbackOrder: 'reverse'
})
static remove(dict: string, key?: string): Promise<any> { return; }
/**
* Clear preferences
*
* @return {Promise<any>} Returns a promise
*/
@Cordova({
callbackOrder: 'reverse'
})
static clearAll(): Promise<any> { return; }
/**
* Show native preferences interface
*
* @return {Promise<any>} Returns a promise
*/
@Cordova({
callbackOrder: 'reverse'
})
static show(): Promise<any> { return; }
/**
* Show native preferences interface
*
* @param {boolean} subscribe true value to subscribe, false - unsubscribe
* @return {Observable<any>} Returns an observable
*/
@Cordova({
observable: true
})
static watch(subscribe: boolean): Observable<any> { return; }
/**
* Return named configuration context
* In iOS you'll get a suite configuration, on Android — named file
* Supports: Android, iOS
* @param {string} suiteName suite name
* @returns {Object} Custom object, bound to that suite
*/
@Cordova({
platforms: ['Android']
})
static suite(suiteName: string): Object { return; }
@Cordova({
platforms: ['iOS']
})
static iosSuite(suiteName: string): Object { return; }
/**
* Return cloud synchronized configuration context
* Currently supports Windows and iOS/macOS
* @returns {Object} Custom object, bound to that suite
*/
@Cordova({
platforms: ['iOS', 'Windows', 'Windows Phone 8']
})
static cloudSync(): Object { return; }
/**
* Return default configuration context
* Currently supports Windows and iOS/macOS
* @returns {Object} Custom Object, bound to that suite
*/
@Cordova({
platforms: ['iOS', 'Windows', 'Windows Phone 8']
})
static defaults(): Object { return; }
}

View File

@@ -77,6 +77,11 @@ export interface AppRateStoreAppUrls {
*/
android?: string;
/**
* application URL in Windows Store
*/
windows?: string;
/**
* application URL in AppWorld
*/
@@ -103,6 +108,7 @@ export interface AppRateStoreAppUrls {
* AppRate.preferences.storeAppURL = {
* ios: '<my_app_id>',
* android: 'market://details?id=<package_name>',
* windows: 'ms-windows-store://review/?ProductId=<Store_ID>'
* };
*
* AppRate.promptForRating(false);
@@ -119,7 +125,7 @@ export interface AppRateStoreAppUrls {
plugin: 'cordova-plugin-apprate',
pluginRef: 'AppRate',
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
platforms: ['Android', 'iOS']
platforms: ['Android', 'iOS', 'Windows (experimental)']
})
export class AppRate {

View File

@@ -0,0 +1,107 @@
import {Cordova, Plugin} from './plugin';
declare var window;
export interface BackgroundFetchConfig {
/**
* Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
*/
stopOnTerminate?: boolean;
}
/**
* @name BackgroundFetch
* @description
* iOS Background Fetch Implementation. See: https://developer.apple.com/reference/uikit/uiapplication#1657399
* iOS Background Fetch is basically an API which wakes up your app about every 15 minutes (during the user's prime-time hours) and provides your app exactly 30s of background running-time. This plugin will execute your provided callbackFn whenever a background-fetch event occurs. There is no way to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible value of UIApplicationBackgroundFetchIntervalMinimum -- iOS determines the rate automatically based upon device usage and time-of-day (ie: fetch-rate is about ~15min during prime-time hours; less frequently when the user is presumed to be sleeping, at 3am for example).
* For more detail, please see https://github.com/transistorsoft/cordova-plugin-background-fetch
*
* @usage
*
* ```typescript
* import { BackgroundFetch } from 'ionic-native';
*
*
* // When device is ready :
* platform.ready().then(() => {
*
* let config = {
* stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
* };
*
* BackgroundFetch.configure(() => {
console.log('[js] BackgroundFetch initiated');
// perform some ajax request to server here
You MUST called #finish so that native-side can signal completion of the background-thread to the os.
BackgroundFetch.finish();
* }, (error) => {
* console.log('- BackgroundFetch failed', error);
* }, config);
*
* });
*
* // Start the background-fetch API. Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
* BackgroundFetch.start();
*
* // Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
* BackgroundFetch.stop();
*
* ```
* @interfaces
* BackgroundFetchConfig
*
*/
@Plugin({
pluginName: 'BackgroundFetch',
plugin: 'cordova-plugin-background-fetch',
pluginRef: 'BackgroundFetch',
repo: 'https://github.com/transistorsoft/cordova-plugin-background-fetch',
platforms: ['iOS']
})
export class BackgroundFetch {
/**
* Configures the plugin's fetch callbackFn
*
* @param {Function} callbackFn This callback will fire each time an iOS background-fetch event occurs (typically every 15 min).
* @param {Function} errorCallback The failureFn will be called if the device doesn't support background-fetch.
* @param {BackgroundFetchConfig} config Configuration for plugin
* @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.
*/
@Cordova({
sync: true
})
static configure(callbackFn: Function, errorCallback: Function, config: BackgroundFetchConfig): any { return; }
/**
* Start the background-fetch API.
* Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
* @returns {Promise<any>}
*/
@Cordova()
static start(): Promise<any> { return; }
/**
* Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
* @returns {Promise<any>}
*/
@Cordova()
static stop(): Promise<any> { return; }
/**
* You MUST call this method in your fetch callbackFn provided to #configure in order to signal to iOS that your fetch action is complete. iOS provides only 30s of background-time for a fetch-event -- if you exceed this 30s, iOS will kill your app.
*/
@Cordova()
static finish() { }
}

View File

@@ -1,4 +1,5 @@
import {Cordova, Plugin} from './plugin';
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
declare var window;
@@ -126,10 +127,14 @@ export interface BackgroundGeolocationConfig {
/**
* ANDROID, WP8 ONLY
* The minimum time interval between location updates in seconds.
* When using BackgroundGeolocation.LocationProvider.ANDROID_DISTANCE_FILTER_PROVIDER:
* The minimum time interval between location updates in milliseconds.
* @see Android docs (http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent))
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
* for more information
* When using BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER:
* Rate in milliseconds at which your app prefers to receive location updates.
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getInterval())
*/
interval?: number;
@@ -225,6 +230,28 @@ export interface BackgroundGeolocationConfig {
* Defaults to 10000
*/
maxLocations?: number;
/**
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
*
* Fastest rate in milliseconds at which your app can handle location updates.
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval())
*/
fastestInterval?: number;
/**
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
*
* Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life.
*/
activitiesInterval?: number;
/**
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
*
* stop() is forced, when the STILL activity is detected (default is true)
*/
stopOnStillActivity?: boolean;
}
/**
@@ -336,17 +363,14 @@ export class BackgroundGeolocation {
/**
* Configure the plugin.
*
* @param {Function} callback callback will be called when background location is determined.
* @param {Function} errorCallback callback to be executed every time a geolocation error occurs.
* @param {Config} options An object of type Config
* @return Location object, which tries to mimic w3c Coordinates interface.
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
* Callback to be executed every time a geolocation is recorded in the background.
* @param options {BackgroundGeolocationConfig} options An object of type Config
* @return {Observable<any>}
*/
@Cordova({
sync: true
callbackOrder: 'reverse',
observable: true
})
static configure(callback: Function, errorCallback: Function, options: BackgroundGeolocationConfig): any { return; }
static configure(options: BackgroundGeolocationConfig): Observable<any> { return; }
/**
* Turn ON the background-geolocation system.
@@ -365,20 +389,26 @@ export class BackgroundGeolocation {
/**
* Inform the native plugin that you're finished, the background-task may be completed
* NOTE: IOS, WP only
* @returns {Promise<any>}
*/
@Cordova()
static finish() { }
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static finish(): Promise<any> { return; }
/**
* Force the plugin to enter "moving" or "stationary" state
* NOTE: IOS, WP only
* @param isMoving {boolean}
* @returns {Promise<any>}
*/
@Cordova()
static changePace(isMoving: boolean) { }
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static changePace(isMoving: boolean): Promise<any> { return; }
/**
* Setup configuration
* @param options {BackgroundGeolocationConfig}
* @returns {Promise<any>}
*/
@Cordova({
@@ -388,27 +418,30 @@ export class BackgroundGeolocation {
/**
* Returns current stationaryLocation if available. null if not
* NOTE: IOS, WP only
* @returns {Promise<Location>}
*/
@Cordova()
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
/**
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
* your #success callback will be executed with #location param containing #radius of region
* NOTE: IOS, WP only
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static onStationary(): Promise<any> { return; }
/**
* Check if location is enabled on the device
* @returns {Promise<number>} Returns a promise with int argument that takes values 0, 1 (true).
* NOTE: ANDROID only
*/
@Cordova()
@Cordova({
platforms: ['Android']
})
static isLocationEnabled(): Promise<number> { return; }
/**
@@ -427,18 +460,21 @@ export class BackgroundGeolocation {
* Method can be used to detect user changes in location services settings.
* If user enable or disable location services then success callback will be executed.
* In case or error (SettingNotFoundException) fail callback will be executed.
* NOTE: ANDROID only
* @returns {Promise<boolean>}
*/
@Cordova()
@Cordova({
platforms: ['Android']
})
static watchLocationMode(): Promise<boolean> { return; }
/**
* Stop watching for location mode changes.
* NOTE: ANDROID only
* @returns {Promise<any>}
*/
@Cordova()
static stopWatchingLocationMode() { }
@Cordova({
platforms: ['Android']
})
static stopWatchingLocationMode(): Promise<any> { return; }
/**
* Method will return all stored locations.
@@ -447,10 +483,11 @@ export class BackgroundGeolocation {
* by the system
* or
* - option.debug is true
* NOTE: ANDROID only
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
platforms: ['Android']
})
static getLocations(): Promise<any> { return; }
/**
@@ -462,18 +499,21 @@ export class BackgroundGeolocation {
/**
* Delete stored location by given locationId.
* NOTE: ANDROID only
* @param locationId {number}
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
platforms: ['Android']
})
static deleteLocation(locationId: number): Promise<any> { return; }
/**
* Delete all stored locations.
* NOTE: ANDROID only
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
platforms: ['Android']
})
static deleteAllLocations(): Promise<any> { return; }
/**
@@ -485,20 +525,20 @@ export class BackgroundGeolocation {
*
* BackgroundGeolocation.Mode.FOREGROUND
* BackgroundGeolocation.Mode.BACKGROUND
*
* NOTE: iOS only
*
* @param {number} See above.
**
* @param modeId {number}
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
platforms: ['iOS']
})
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
* @param limit {number} Limits the number of entries
* @returns {Promise<any>}
*/
@Cordova()

View File

@@ -1,5 +1,4 @@
import { Cordova, CordovaFunctionOverride, Plugin } from './plugin';
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
@@ -113,24 +112,77 @@ export class BackgroundMode {
static configure(options?: BackgroundModeConfiguration): Promise<any> { return; }
/**
* Called when background mode is activated.
* @returns {Observable<any>} returns an observable that emits when background mode is activated
*/
@CordovaFunctionOverride()
static onactivate(): Observable<any> { return; };
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
* @param event {string} Event name
* @returns {Observable<any>}
*/
@Cordova({
observable: true,
clearFunction: 'un',
clearWithArgs: true
})
static on(event: string): Observable<any> { return; }
/**
* Called when background mode is deactivated.
* @returns {Observable<any>} returns an observable that emits when background mode is deactivated
*/
@CordovaFunctionOverride()
static ondeactivate(): Observable<any> { return; };
* Android allows to programmatically move from foreground to background.
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static moveToBackground(): void {}
/**
* Called when background mode fails
* @returns {Observable<any>} returns an observable that emits when background mode fails
*/
@CordovaFunctionOverride()
static onfailure(): Observable<any> { return; };
* Android allows to programmatically move from background to foreground.
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static moveToForeground(): void {}
/**
* Override the back button on Android to go to background instead of closing the app.
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static overrideBackButton(): void {}
/**
* Exclude the app from the recent task list works on Android 5.0+.
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static excludeFromTaskList(): void {}
/**
* The method works async instead of isActive() or isEnabled().
*/
@Cordova({
platforms: ['Android']
})
static isScreenOff(): Promise<boolean> { return; }
/**
* Turn screen on
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static wakeUp(): void {}
/**
* Turn screen on and show app even locked
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static unlock(): void {}
}

View File

@@ -13,7 +13,7 @@ import { Cordova, Plugin } from './plugin';
*
*
* Badge.set(10);
* Badge.increase();
* Badge.increase(1);
* Badge.clear();
* ```
*/

View File

@@ -22,6 +22,11 @@ export interface BarcodeScannerOptions {
*/
disableAnimations?: boolean;
/**
* Disable success beep. Supported on iOS only.
*/
disableSuccessBeep?: boolean;
/**
* Prompt text. Supported on Android only.
*/

View File

@@ -423,4 +423,15 @@ export class BLE {
@Cordova()
static enable(): Promise<any> { return; }
/**
* Read the RSSI value on the device connection.
*
* @param {string} deviceId UUID or MAC address of the peripheral
*
*@returns {Promise<any>}
*/
@Cordova()
static readRSSI(
deviceId: string,
): Promise<any> { return; }
}

View File

@@ -60,6 +60,13 @@ export class BluetoothSerial {
})
static connectInsecure(macAddress: string): Observable<any> { return; }
/**
* Disconnect from the connected device
* @returns {Promise<any>}
*/
@Cordova()
static disconnect(): Promise<any> { return; }
/**
* Writes data to the serial port
* @param {any} data ArrayBuffer of data

View File

@@ -0,0 +1,57 @@
import { Plugin, Cordova } from './plugin';
/**
* @name BrowserTab
* @description
* This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
*
* @usage
* ```
* import { BrowserTab } from 'ionic-native';
*
* BrowserTab.isAvailable()
* .then((isAvailable: boolean) => {
*
* if (isAvailable) {
*
* BrowserTab.openUrl('https://ionic.io');
*
* } else {
* // open url with InAppBrowser instead
* }
*
* });
*
* ```
*/
@Plugin({
pluginName: 'BrowserTab',
plugin: 'cordova-plugin-browsertab',
pluginRef: 'cordova.plugins.browsertab',
repo: 'https://github.com/google/cordova-plugin-browsertab',
platforms: ['Android', 'iOS']
})
export class BrowserTab {
/**
* Check if BrowserTab option is available
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
*/
@Cordova()
static isAvailable(): Promise<any> { return; }
/**
* Opens the provided URL using a browser tab
* @param {string} url The URL you want to open
* @return {Promise<any>} Returns a promise that resolves when check open was successful
*/
@Cordova()
static openUrl(url: string): Promise<any> { return; }
/**
* Closes browser tab
* @return {Promise<any>} Returns a promise that resolves when close was finished
*/
@Cordova()
static close(): Promise<any> { return; }
}

View File

@@ -1,24 +1,50 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
export interface CameraPreviewRect {
x: number;
y: number;
width: number;
height: number;
export interface CameraPreviewDimensions {
/** The width of the camera preview, default to window.screen.width */
width?: number;
/** The height of the camera preview, default to window.screen.height */
height?: number;
}
export interface CameraPreviewSize {
export interface CameraPreviewOptions {
/** The left edge in pixels, default 0 */
x?: number;
maxWidth: number;
/** The top edge in pixels, default 0 */
y?: number;
maxHeight: number;
/** The width in pixels, default window.screen.width */
width?: number;
/** The height in pixels, default window.screen.height */
height?: number;
/** Choose the camera to use 'front' or 'rear', default 'front' */
camera?: string;
/** Tap to take a photo, default true (picture quality by default : 85) */
tapPhoto?: boolean;
/** Preview box drag across the screen, default 'false' */
previewDrag?: boolean;
/** Preview box to the back of the webview (true => back, false => front) , default false */
toBack?: boolean;
/** Alpha channel of the preview box, float, [0,1], default 1 */
alpha?: number;
}
export interface PictureOptions {
/** The width in pixels, default 0 */
width?: number;
/** The height in pixels, default 0 */
height?: number;
/** The picture quality, 0 - 100, default 85 */
quality?: number;
}
/**
@@ -26,45 +52,52 @@ export interface CameraPreviewSize {
* @name CameraPreview
* @description
* Showing camera preview in HTML
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
* Requires Cordova plugin: `https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git`. For more info, please see the [Cordova Camera Preview docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
* @usage
* ```
* import { CameraPreview, CameraPreviewRect } from 'ionic-native';
* ```typescript
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions, } from 'ionic-native';
*
* // camera options (Size and location)
* let cameraRect: CameraPreviewRect = {
* x: 100,
* y: 100,
* width: 200,
* height: 200
* // camera options (Size and location). In the following example, the preview uses the rear camera and display the preview in the back of the webview
* public cameraPreviewOpts: CameraPreviewOptions = {
* x: 0,
* y: 0,
* width: window.screen.width,
* height: window.screen.height,
* camera: 'rear',
* tapPhoto: true,
* previewDrag: true,
* toBack: true,
* alpha: 1
* };
*
*
* // start camera
* CameraPreview.startCamera(
* cameraRect, // position and size of preview
* 'front', // default camera
* true, // tap to take picture
* false, // disable drag
* false, // keep preview in front. Set to true (back of the screen) to apply overlaying elements
* 1 // set the preview alpha
* );
*
* // Set the handler to run every time we take a picture
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
* console.log(result);
* // do something with the result
* });
* CameraPreview.startCamera(this.cameraPreviewOpts).then(
* (res) => {
* console.log(res)
* },
* (err) => {
* console.log(err)
* });
*
*
* // picture options
* public pictureOpts: PictureOptions = {
* width: 1280,
* height: 1280,
* quality: 85
* }
*
* // take a picture
* CameraPreview.takePicture({
* maxWidth: 640,
* maxHeight: 640
* CameraPreview.takePicture(this.pictureOpts).then((imageData) => {
* this.picture = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
* console.log(err);
* this.picture = 'assets/img/test.jpg';
* });
*
*
* // Switch camera
* CameraPreview.switchCamera();
*
@@ -77,96 +110,119 @@ export interface CameraPreviewSize {
* ```
*
* @interfaces
* CameraPreviewRect
* CameraPreviewSize
* CameraPreviewOptions
* PictureOptions
* CameraPreviewDimensions
*/
@Plugin({
pluginName: 'CameraPreview',
plugin: 'cordova-plugin-camera-preview',
pluginRef: 'cordova.plugins.camerapreview',
pluginRef: 'CameraPreview',
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
platforms: ['Android', 'iOS']
})
export class CameraPreview {
/**
* Starts the camera preview instance.
* @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
* Starts the camera preview instance. (iOS & Android)
* @param {CameraPreviewOptions} options
*/
@Cordova({
sync: true
successIndex: 1,
errorIndex: 2
})
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }
static startCamera(options: CameraPreviewOptions): Promise<any> { return; }
/**
* Stops the camera preview instance.
* Stops the camera preview instance. (iOS & Android)
*/
@Cordova({
sync: true
successIndex: 0,
errorIndex: 1
})
static stopCamera(): void { }
static stopCamera(): Promise<any> { return; }
/**
* Take the picture, the parameter size is optional
* @param {CameraPreviewSize} optional - size of the picture to take
* Switch from the rear camera and front camera, if available. (iOS & Android)
*/
@Cordova({
sync: true
successIndex: 0,
errorIndex: 1
})
static takePicture(size?: CameraPreviewSize): void { }
static switchCamera(): Promise<any> { return; }
/**
* Register a callback function that receives the original picture and the image captured from the preview box.
* @returns {Observable<any>}
* Hide the camera preview box. (iOS & Android)
*/
@Cordova({
observable: true
successIndex: 0,
errorIndex: 1
})
static setOnPictureTakenHandler(): Observable<any> { return; }
static hide(): Promise<any> { return; }
/**
* Switch from the rear camera and front camera, if available.
* Show the camera preview box. (iOS & Android)
*/
@Cordova({
sync: true
successIndex: 0,
errorIndex: 1
})
static switchCamera(): void { }
static show(): Promise<any> { return; }
/**
* Show the camera preview box.
* Take the picture (base64), the parameter size is optional (iOS & Android)
* @param {PictureOptions} optional - size and quality of the picture to take
*/
@Cordova({
sync: true
successIndex: 1,
errorIndex: 2
})
static show(): void { }
static takePicture(opts?: PictureOptions): Promise<any> { return; }
/**
* Hide the camera preview box.
*
* Set camera color effect. (iOS partial & Android)
* @static
* @param {string} effect name : 'none' (iOS & Android), 'aqua' (Android), 'blackboard' (Android), 'mono' (iOS & Android), 'negative' (iOS & Android), 'posterize' (iOS & Android), 'sepia' (iOS & Android), 'solarize' (Android) or 'whiteboard' (Android)
*
* @memberOf CameraPreview
*/
@Cordova({
sync: true
successIndex: 1,
errorIndex: 2
})
static hide(): void { }
static setColorEffect(effect: string): Promise<any> { return; }
/**
* Disables the camera preview
* Set the zoom (Android)
* @param Zoom value (integer)
*/
@Cordova({
sync: true
successIndex: 1,
errorIndex: 2
})
static disable(): void { }
static setZoom(zoom?: number): Promise<any> { return; }
/**
* Set camera color effect.
* Set the preview Size (Android)
* @param dimensions
*/
@Cordova({
sync: true
successIndex: 1,
errorIndex: 2
})
static setColorEffect(effect: string): void { }
static setPreviewSize(dimensions?: CameraPreviewDimensions): Promise<any> { return; }
/**
* Set the flashmode (iOS partial & Android)
* @param flashMode 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static setFlashMode(flashMode?: string): Promise<any> { return; }
}

View File

@@ -3,7 +3,7 @@ import { CordovaInstance, InstanceProperty, Plugin, getPromise } from './plugin'
declare var window: any,
navigator: any;
export type ContactFieldType = 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
/**
* @private

View File

@@ -0,0 +1,35 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Couchbase Lite
* @description
* Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android
*
* @usage
* ```
* import { CouchbaseLite } from 'ionic-native';
*
* CouchbaseLite.getURL()
* .then((url: any) => console.log(url))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
pluginName: 'CouchbaseLite',
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
pluginRef: 'cblite',
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
})
export class CouchbaseLite {
/**
* Get the database url
* @return {Promise<any>} Returns a promise that resolves with the local database url
*/
@Cordova({
callbackStyle: 'node'
})
static getURL(): Promise<any> { return; }
}

View File

@@ -41,17 +41,17 @@ export interface DeviceMotionAccelerometerOptions {
*
* @usage
* ```typescript
* import { DeviceMotion } from 'ionic-native';
* import { DeviceMotion, DeviceMotionAccelerationData } from 'ionic-native';
*
*
* // Get the device current acceleration
* DeviceMotion.getCurrentAcceleration().then(
* (acceleration: AccelerationData) => console.log(acceleration),
* (acceleration: DeviceMotionAccelerationData) => console.log(acceleration),
* (error: any) => console.log(error)
* );
*
* // Watch device acceleration
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
* console.log(acceleration);
* });
*

View File

@@ -46,19 +46,19 @@ export interface DeviceOrientationCompassOptions {
*
* @usage
* ```typescript
* // CompassHeading is an interface for compass
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
* // DeviceOrientationCompassHeading is an interface for compass
* import { DeviceOrientation, DeviceOrientationCompassHeading } from 'ionic-native';
*
*
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
* (data: CompassHeading) => console.log(data),
* (data: DeviceOrientationCompassHeading) => console.log(data),
* (error: any) => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
* (data: CompassHeading) => console.log(data)
* (data: DeviceOrientationCompassHeading) => console.log(data)
* );
*
* // Stop watching heading change

View File

@@ -19,7 +19,7 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
*
* Diagnostic.getBluetoothState()
* .then((state) => {
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
* if (state == Diagnostic.bluetoothState.POWERED_ON){
* // do something
* } else {
* // do something else
@@ -109,6 +109,15 @@ export class Diagnostic {
POWERING_ON: 'powering_on'
};
@CordovaProperty
static NFCState: {
UNKNOWN: string;
POWERED_OFF: string;
POWERED_ON: string;
POWERING_ON: string;
POWERING_OFF: string;
};
/**
* Checks if app is able to access device location.
@@ -190,6 +199,9 @@ export class Diagnostic {
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setBluetoothState(state: boolean): Promise<any> { return; }
// ANDROID AND IOS ONLY
/**
* 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>}
@@ -367,6 +379,9 @@ export class Diagnostic {
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerLocationStateChangeHandler(handler: Function): void { }
// ANDROID ONLY
/**
* 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.
@@ -493,6 +508,96 @@ export class Diagnostic {
@Cordova({ platforms: ['Android'] })
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use external storage.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isExternalStorageAuthorized(): Promise<boolean> { return; }
/**
* CReturns the external storage authorization status for the application.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static getExternalStorageAuthorizationStatus(): Promise<any> { return; }
/**
* Requests external storage authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static requestExternalStorageAuthorization(): Promise<any> { return; }
/**
* Returns details of external SD card(s): absolute path, is writable, free space.
*
* The intention of this method is to return the location and details of removable external SD cards.
* This differs from the "external directories" returned by cordova-plugin-file which return mount points relating to non-removable (internal) storage.
*
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getexternalsdcarddetails)
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static getExternalSdCardDetails(): Promise<any> { return; }
/**
* Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
*/
@Cordova({
platforms: ['Android'],
sync: true
})
switchToWirelessSettings(): void { }
/**
* Displays NFC settings to allow user to enable NFC.
*/
@Cordova({
platforms: ['Android'],
sync: true
})
switchToNFCSettings(): void { }
/**
* Checks if NFC hardware is present on device.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isNFCPresent(): Promise<boolean> { return; }
/**
* Checks if the device setting for NFC is switched on.
* Note: this operation does not require NFC permission in the manifest.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isNFCEnabled(): Promise<boolean> { return; }
/**
* Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on.
* Note: this operation does not require NFC permission in the manifest.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isNFCAvailable(): Promise<boolean> { return; }
/**
* Registers a function to be called when a change in NFC state occurs. Pass in a falsey value to de-register the currently registered function.
* @param hander {Function} callback function to be called when NFC state changes
* @returns {Promise<any>}
*/
@Cordova({
platforms: ['Android'],
sync: true
})
registerNFCStateChangeHandler(handler: Function): void { }
// IOS ONLY
/**
* Checks if the application is authorized to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
@@ -573,4 +678,40 @@ export class Diagnostic {
@Cordova({ platforms: ['iOS'] })
static getBackgroundRefreshStatus(): Promise<any> { return; }
/**
* Requests Bluetooth authorization for the application.
*
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestbluetoothauthorization)
* @return {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestBluetoothAuthorization(): Promise<any> { return; }
/**
* Checks if motion tracking is available on the current device.
* @return {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isMotionAvailable(): Promise<boolean> { return; }
/**
* Checks if it's possible to determine the outcome of a motion authorization request on the current device.
* There's no direct way to determine if authorization was granted or denied, so the Pedometer API must be used to indirectly determine this:
* therefore, if the device supports motion tracking but not Pedometer Event Tracking, the outcome of requesting motion detection cannot be determined.
*
* @return {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isMotionRequestOutcomeAvailable(): Promise<boolean> { return; }
/**
* Requests and checks motion authorization for the application: there is no way to independently request only or check only, so both must be done in one operation.
*
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestandcheckmotionauthorization)
*
* @return {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestAndCheckMotionAuthorization(): Promise<any> { return; }
}

View File

@@ -232,7 +232,10 @@ export class Facebook {
* @param {number} [valueToSum] any value to be added to added to a sum on each event
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
successIndex: 3,
errorIndex: 4
})
static logEvent(
name: string,
params?: Object,

View File

@@ -11,7 +11,7 @@ import { Plugin, Cordova } from './plugin';
* import {FileChooser} from 'ionic-native';
*
* FileChooser.open()
* .then(uri => console.log(uri));
* .then(uri => console.log(uri))
* .catch(e => console.log(e));
*
* ```

View File

@@ -1,4 +1,4 @@
import { Plugin, pluginWarn } from './plugin';
import {CordovaProperty, Plugin, pluginWarn} from './plugin';
declare var window: any;
declare var cordova: any;
@@ -171,7 +171,6 @@ export interface Flags {
}
export interface WriteOptions {
create?: boolean;
replace?: boolean;
append?: boolean;
truncate?: number; // if present, number of bytes to truncate file to before writing
@@ -267,7 +266,7 @@ export interface FileWriter extends FileSaver {
* Write the supplied data to the file at position.
* @param {Blob} data The blob to write.
*/
write(data: Blob | string): void;
write(data: ArrayBuffer | Blob | string): void;
/**
* The file position at which the next write will occur.
* @param offset If nonnegative, an absolute byte offset into the file.
@@ -283,7 +282,7 @@ export interface FileWriter extends FileSaver {
}
/* FileWriter states */
declare var FileWriter: {
export declare var FileWriter: {
INIT: number;
WRITING: number;
DONE: number
@@ -308,7 +307,7 @@ export interface FileReader {
readAsArrayBuffer(fe: File | Blob): void;
}
declare var FileReader: {
export declare var FileReader: {
EMPTY: number;
LOADING: number;
DONE: number;
@@ -322,7 +321,7 @@ export interface FileError {
message: string;
}
declare var FileError: {
export declare var FileError: {
new (code: number): FileError;
NOT_FOUND_ERR: number;
SECURITY_ERR: number;
@@ -350,9 +349,9 @@ declare var FileError: {
* ```
* 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'));
* const dataDirectory: string = File.dataDirectory;
*
* File.checkDir(dataDirectory, '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/
@@ -367,6 +366,80 @@ declare var FileError: {
repo: 'https://github.com/apache/cordova-plugin-file'
})
export class File {
/**
* Read-only directory where the application is installed.
*/
@CordovaProperty
static applicationDirectory: string;
/**
* Read-only directory where the application is installed.
*/
@CordovaProperty
static applicationStorageDirectory: string;
/**
* Where to put app-specific data files.
*/
@CordovaProperty
static dataDirectory: string;
/**
* Cached files that should survive app restarts.
* Apps should not rely on the OS to delete files in here.
*/
@CordovaProperty
static cacheDirectory: string;
/**
* Android: the application space on external storage.
*/
@CordovaProperty
static externalApplicationStorageDirectory: string;
/**
* Android: Where to put app-specific data files on external storage.
*/
@CordovaProperty
static externalDataDirectory: string;
/**
* Android: the application cache on external storage.
*/
@CordovaProperty
static externalCacheDirectory: string;
/**
* Android: the external storage (SD card) root.
*/
@CordovaProperty
static externalRootDirectory: string;
/**
* iOS: Temp directory that the OS can clear at will.
*/
@CordovaProperty
static tempDirectory: string;
/**
* iOS: Holds app-specific files that should be synced (e.g. to iCloud).
*/
@CordovaProperty
static syncedDataDirectory: string;
/**
* iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
*/
@CordovaProperty
static documentsDirectory: string;
/**
* BlackBerry10: Files globally available to all apps
*/
@CordovaProperty
static sharedDirectory: string;
static cordovaFileError: {} = {
1: 'NOT_FOUND_ERR',
2: 'SECURITY_ERR',
@@ -407,13 +480,13 @@ 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
* @returns {Promise<boolean|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
* @returns {Promise<boolean>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
*/
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
static checkDir(path: string, dir: string): Promise<boolean> {
if ((/^\//.test(dir))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
let fullpath = path + dir;
@@ -431,13 +504,13 @@ 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
* @returns {Promise<DirectoryEntry|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
* @returns {Promise<DirectoryEntry>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
*/
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
let options: Flags = {
@@ -459,13 +532,13 @@ export class File {
*
* @param {string} path The path to the directory
* @param {string} dirName The directory name
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
*/
static removeDir(path: string, dirName: string): Promise<RemoveResult|FileError> {
static removeDir(path: string, dirName: string): Promise<RemoveResult> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
@@ -484,15 +557,15 @@ 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
* @returns {Promise<DirectoryEntry|Entry|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
* @returns {Promise<DirectoryEntry|Entry>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
*/
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry|FileError> {
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> {
newDirName = newDirName || dirName;
if ((/^\//.test(newDirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return this.resolveDirectoryUrl(path)
@@ -514,13 +587,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)
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
*/
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry|FileError> {
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> {
if ((/^\//.test(newDirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return this.resolveDirectoryUrl(path)
@@ -587,13 +660,13 @@ 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
* @returns {Promise<boolean|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
* @returns {Promise<boolean>} Returns a Promise that resolves with a boolean or rejects with an error.
*/
static checkFile(path: string, file: string): Promise<boolean|FileError> {
static checkFile(path: string, file: string): Promise<boolean> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveLocalFilesystemUrl(path + file)
@@ -616,13 +689,13 @@ 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
* @returns {Promise<FileEntry|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
* @returns {Promise<FileEntry>} Returns a Promise that resolves to a FileEntry or rejects with an error.
*/
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry|FileError> {
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
let options: Flags = {
@@ -644,13 +717,13 @@ 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
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
*/
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
static removeFile(path: string, fileName: string): Promise<RemoveResult> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
@@ -671,7 +744,7 @@ export class File {
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
*/
static writeFile(path: string, fileName: string,
text: string | Blob, options: WriteOptions = {}): Promise<any> {
text: string | Blob | ArrayBuffer, options: WriteOptions = {}): Promise<any> {
if ((/^\//.test(fileName))) {
const err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -700,7 +773,7 @@ export class File {
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
*/
private static writeFileEntry(fe: FileEntry, text: string | Blob, options: WriteOptions) {
private static writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
return File.createWriter(fe)
.then((writer) => {
if (options.append) {
@@ -725,7 +798,7 @@ export class File {
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
return File.writeFile(path, fileName, text, { create: false });
return File.writeFile(path, fileName, text, { replace: true });
}
/**
@@ -733,13 +806,13 @@ export class File {
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
* @returns {Promise<string>} 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> {
static readAsText(path: string, file: string): Promise<string> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
@@ -774,13 +847,13 @@ export class File {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
* @returns {Promise<string>} 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> {
static readAsDataURL(path: string, file: string): Promise<string> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
@@ -816,13 +889,13 @@ export class File {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @returns {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
* @returns {Promise<string>} 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> {
static readAsBinaryString(path: string, file: string): Promise<string> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
@@ -857,13 +930,13 @@ export class File {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @returns {Promise<ArrayBuffer|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
* @returns {Promise<ArrayBuffer>} 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> {
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<FileError>(err);
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
@@ -900,15 +973,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)
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry or rejects with an error.
*/
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
let err = new FileError(5);
err.message = 'file name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return this.resolveDirectoryUrl(path)
@@ -930,15 +1003,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)
* @returns {Promise<Entry|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
* @returns {Promise<Entry>} Returns a Promise that resolves to an Entry or rejects with an error.
*/
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry|FileError> {
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
let err = new FileError(5);
err.message = 'file name cannot start with \/';
return Promise.reject<FileError>(err);
return Promise.reject<any>(err);
}
return this.resolveDirectoryUrl(path)
@@ -953,14 +1026,13 @@ 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];
try {
err.message = File.cordovaFileError[err.code];
} catch (e) {}
}
/**
@@ -1133,7 +1205,7 @@ export class File {
/**
* @private
*/
private static write(writer: FileWriter, gu: string | Blob): Promise<any> {
private static write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise<any> {
if (gu instanceof Blob) {
return this.writeFileInChunks(writer, gu);
}

View File

@@ -13,8 +13,8 @@ declare var window: any;
* import {FilePath} from 'ionic-native';
*
* FilePath.resolveNativePath(path)
* .then(filePath => console.log(filePath);
* .catch(err => console.log(err);
* .then(filePath => console.log(filePath))
* .catch(err => console.log(err));
*
* ```
*/

View File

@@ -173,6 +173,10 @@ export interface FileTransferError {
* cd files
* ls
* ```
*
* To store files in a different/publicly accessible directory, please refer to the following link
* https://github.com/apache/cordova-plugin-file#where-to-store-files
*
* @interfaces
* FileUploadOptions
* FileUploadResult
@@ -223,7 +227,7 @@ export class Transfer {
successIndex: 2,
errorIndex: 3
})
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult | FileTransferError> {
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
return;
}

View File

@@ -11,6 +11,11 @@ export interface FingerprintOptions {
* Secret password. Only for android
*/
clientSecret?: string;
/**
* Disable 'use backup' option. Only for android (optional)
*/
disableBackup?: boolean;
}
/**
@@ -26,7 +31,8 @@ export interface FingerprintOptions {
*
* FingerprintAIO.show({
* clientId: "Fingerprint-Demo",
* clientSecret: "password" //Only necessary for Android
* clientSecret: "password", //Only necessary for Android
* disableBackup:true //Only for Android(optional)
* })
* .then((result: any) => console.log(any))
* .catch((error: any) => console.log(error));

View File

@@ -62,6 +62,15 @@ export class Firebase {
})
static grantPermission(): Promise<any> { return; }
/**
* Check permission to recieve push notifications
* @return {Promise<any>}
*/
@Cordova({
platforms: ['iOS']
})
static hasPermission(): Promise<any> { return; }
/**
* Set icon badge number. Set to 0 to clear the badge.
* @param badgeNumber {number}
@@ -102,6 +111,14 @@ export class Firebase {
@Cordova()
static logEvent(type: string, data: any): Promise<any> { return; }
/**
* Set the name of the current screen in Analytics
* @param name {string} Screen name
* @return {Promise<any>}
*/
@Cordova()
static setScreenName(name: string): Promise<any> { return; }
/**
* Set a user id for use in Analytics
* @param userId {string}

View File

@@ -167,7 +167,7 @@ export class Geolocation {
*
* ```typescript
* var subscription = Geolocation.watchPosition()
* .filter((p) => p.code === undefined) //Filter Out Errors
* .filter((p) => p.coords !== undefined) //Filter Out Errors
* .subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
* });

View File

@@ -125,7 +125,7 @@ export class GoogleAnalytics {
/**
* Add a Custom Dimension
* https://developers.google.com/analytics/devguides/platform/customdimsmets
* @param key {string}
* @param key {number}
* @param value {string}
* @returns {Promise<any>}
*/

View File

@@ -1,5 +1,6 @@
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var plugin: any;
@@ -36,6 +37,18 @@ export const GoogleMapsAnimation = {
DROP: 'DROP'
};
/**
* @private
*/
export const GoogleMapsMapTypeId = {
HYBRID: 'MAP_TYPE_HYBRID',
NONE: 'MAP_TYPE_NONE',
NORMAL: 'MAP_TYPE_NORMAL',
ROADMAP: 'MAP_TYPE_ROADMAP',
SATELLITE: 'MAP_TYPE_SATELLITE',
TERAIN: 'MAP_TYPE_TERRAIN'
};
/**
* @name Google Maps
* @description This plugin uses the native Google Maps SDK
@@ -47,7 +60,8 @@ export const GoogleMapsAnimation = {
* GoogleMapsLatLng,
* CameraPosition,
* GoogleMapsMarkerOptions,
* GoogleMapsMarker
* GoogleMapsMarker,
* GoogleMapsMapTypeId
* } from 'ionic-native';
*
* export class MapPage {
@@ -70,9 +84,6 @@ export const GoogleMapsAnimation = {
*
* let map = new GoogleMap(element);
*
* // listen to MAP_READY event
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
*
* // create LatLng object
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
*
@@ -83,8 +94,12 @@ export const GoogleMapsAnimation = {
* tilt: 30
* };
*
* // move the map's camera to position
* map.moveCamera(position);
* // listen to MAP_READY event
* map.one(GoogleMapsEvent.MAP_READY).then(() => {
* // move the map's camera to position
* map.moveCamera(position); // works on iOS and Android
* });
*
*
* // create new marker
* let markerOptions: GoogleMapsMarkerOptions = {
@@ -97,7 +112,6 @@ export const GoogleMapsAnimation = {
* marker.showInfoWindow();
* });
* }
*
* }
* ```
*/
@@ -139,12 +153,7 @@ export class GoogleMap {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -262,7 +271,7 @@ export class GoogleMap {
setZoom(zoomLevel: number): void { }
@CordovaInstance({ sync: true })
setMapTypeId(typeId: string): void { }
setMapTypeId(mapTypeId: string): void { }
@CordovaInstance({ sync: true })
setTilt(tiltLevel: number): void { }
@@ -631,12 +640,7 @@ export class GoogleMapsMarker {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -911,12 +915,7 @@ export class GoogleMapsCircle {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -1055,12 +1054,7 @@ export class GoogleMapsPolyline {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -1200,12 +1194,7 @@ export class GoogleMapsPolygon {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -1347,12 +1336,7 @@ export class GoogleMapsTileOverlay {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -1481,12 +1465,7 @@ export class GoogleMapsGroundOverlay {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -1606,12 +1585,7 @@ export class GoogleMapsKmlOverlay {
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**

100
src/plugins/gyroscope.ts Normal file
View File

@@ -0,0 +1,100 @@
import { Plugin, Cordova} from './plugin';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
/**
* Interface that represent output data
*/
export interface GyroscopeOrientation {
/**
* Represent x-axis
*/
x: number;
/**
* Represent y-axis
*/
y: number;
/**
* Represent z-axis
*/
z: number;
/**
* Represent timestamp of sensor read. Default is 10000ms
*/
timestamp: number;
}
/**
* Interface that represent option data
*/
export interface GyroscopeOptions {
/**
* Represent how often (in milliseconds) sensor should be read. Default is 10000 ms
*/
frequency: number;
}
/**
* @name Gyroscope
* @description Read Gyroscope sensor data
* @usage
* ```
* import { Gyroscope, GyroscopeOrientation, GyroscopeOptions } from 'ionic-native';
*
*
* let options: GyroscopeOptions = {
* frequency: 1000
* };
*
* Gyroscope.getCurrent(options)
* .then((orientation: GyroscopeOrientation) => {
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
* })
* .catch()
*
*
* Gyroscope.watch()
* .subscribe((orientation: GyroscopeOrientation) => {
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
* });
*
* ```
*/
@Plugin({
pluginName: 'Gyroscope',
plugin: 'cordova-plugin-gyroscope',
pluginRef: 'navigator.gyroscope',
repo: 'https://github.com/NeoLSN/cordova-plugin-gyroscope',
platforms: ['Android', 'iOS']
})
export class Gyroscope {
/**
* Watching for gyroscope sensor changes
* @param options {GyroscopeOptions} (optional)
* @return {Observable<GyroscopeOrientation>} Returns an Observable that resolves GyroscopeOrientation
*/
static watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
return new Observable<GyroscopeOrientation> (
(observer: any) => {
let watchId = navigator.gyroscope.watch(observer.next.bind(observer), observer.next.bind(observer), options);
return () => navigator.gyroscope.clearWatch(watchId);
}
);
}
/**
* Get current data from gyroscope sensor
* @param options {GyroscopeOptions} (optional)
* @return {Promise<GyroscopeOrientation>} Returns a promise that resolves GyroscopeOrientation
*/
@Cordova({
callbackOrder: 'reverse'
})
static getCurrent(options?: GyroscopeOptions): Promise<GyroscopeOrientation> { return; }
}

View File

@@ -1,7 +1,7 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Headerolor
* @name HeaderColor
* @description
* Cordova plugin to change color of header in multitask view
*

303
src/plugins/health.ts Normal file
View File

@@ -0,0 +1,303 @@
import {Plugin, Cordova} from './plugin';
export interface HealthQueryOptions {
/**
* Start date from which to get data
*/
startDate: Date;
/**
* End date from which to get data
*/
endDate: Date;
/**
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
*/
dataType: string;
/**
* Optional limit the number of values returned. Defaults to 1000
*/
limit?: number;
/**
* Optional indicator to sort values ascending or descending
*/
ascending?: boolean;
/**
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
* In the latter case the query object must contain the field filtered: true.
*/
filtered?: boolean;
}
export interface HealthQueryOptionsAggregated {
/**
* Start date from which to get data
*/
startDate: Date;
/**
* End date from which to get data
*/
endDate: Date;
/**
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
*/
dataType: string;
/**
* if specified, aggregation is grouped an array of "buckets" (windows of time),
* supported values are: 'hour', 'day', 'week', 'month', 'year'.
*/
bucket: string;
}
export interface HealthStoreOptions {
/**
* Start date from which to get data
*/
startDate: Date;
/**
* End date from which to get data
*/
endDate: Date;
/**
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
*/
dataType: string;
/**
* Value of corresponding Datatype (see "Overview of valid datatypes")
*/
value: string;
/*
* The source that produced this data. In iOS this is ignored and
* set automatically to the name of your app.
*/
sourceName: string;
/*
* The complete package of the source that produced this data.
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
* set automatically to the bunde id of the app.
*/
sourceBundleId: string;
}
export interface HealthData {
/**
* Start date from which to get data
*/
startDate: Date;
/**
* End date from which to get data
*/
endDate: Date;
/**
* Value of corresponding Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
*/
value: string;
/**
* Unit of corresponding value of Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
*/
unit: string;
/**
* The source that produced this data. In iOS this is ignored and
* set automatically to the name of your app.
*/
sourceName: string;
/**
* The complete package of the source that produced this data.
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
* set automatically to the bunde id of the app.
*/
sourceBundleId: string;
}
/**
* @name Health
* @description
* A plugin that abstracts fitness and health repositories like Apple HealthKit or Google Fit.
*
* @usage
* ```
* import { Health } from 'ionic-native';
*
* ```
* See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples.
* @interfaces
* HealthQueryOptions
* HealthQueryOptionsAggregated
* HealthStoreOptions
* HealthData
*/
@Plugin({
pluginName: 'Health',
plugin: 'cordova-plugin-health',
pluginRef: 'navigator.health',
repo: 'https://github.com/dariosalvi78/cordova-plugin-health'
})
export class Health {
/**
* Tells if either Google Fit or HealthKit are available.
*
* @return {Promise<boolean>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static isAvailable(): Promise<boolean> {
return;
};
/**
* Checks if recent Google Play Services and Google Fit are installed. If the play services are not installed,
* or are obsolete, it will show a pop-up suggesting to download them. If Google Fit is not installed,
* it will open the Play Store at the location of the Google Fit app.
* The plugin does not wait until the missing packages are installed, it will return immediately.
* If both Play Services and Google Fit are available, this function just returns without any visible effect.
*
* This function is only available on Android.
*
* @return {Promise<any>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static promptInstallFit(): Promise<any> {
return;
};
/**
* Requests read and write access to a set of data types. It is recommendable to always explain why the app
* needs access to the data before asking the user to authorize it.
* This function must be called before using the query and store functions, even if the authorization has already
* been given at some point in the past.
*
* Quirks of requestAuthorization()
* In Android, it will try to get authorization from the Google Fit APIs.
* It is necessary that the app's package name and the signing key are registered in the Google API console.
* In Android, be aware that if the activity is destroyed (e.g. after a rotation) or is put in background,
* the connection to Google Fit may be lost without any callback. Going through the authorization will ensure that
* the app is connected again.
* In Android 6 and over, this function will also ask for some dynamic permissions if needed
* (e.g. in the case of "distance", it will need access to ACCESS_FINE_LOCATION).
*
* @param {Array<String>} datatypes a list of data types you want to be granted access to
*
* @return {Promise<any>}
*/
@Cordova()
static requestAuthorization(datatypes: Array<string>): Promise<any> {
return;
};
/**
* Check if the app has authorization to read/write a set of datatypes.
* This function is similar to requestAuthorization() and has similar quirks.
*
* @param {Array<String>} datatypes a list of data types you want to be granted access to
* @return {Promise<any>}
*/
@Cordova()
static isAuthorized(datatypes: Array<string>): Promise<any> {
return;
};
/**
* Gets all the data points of a certain data type within a certain time window.
* Warning: if the time span is big, it can generate long arrays!
*
* Quirks of query()
*
* In iOS, the amount of datapoints is limited to 1000 by default.
* You can override this by adding a limit: xxx to your query object.
* In iOS, datapoints are ordered in an descending fashion (from newer to older).
* You can revert this behaviour by adding ascending: true to your query object.
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
* In the latter case the query object must contain the field filtered: true.
* In Google Fit, calories.basal is returned as an average per day, and usually is not available in all days.
* In Google Fit, calories.active is computed by subtracting the basal calories from the total.
* As basal energy expenditure, an average is computed from the week before endDate.
* While Google Fit calculates basal and active calories automatically,
* HealthKit needs an explicit input from some app.
* When querying for activities, Google Fit is able to determine some activities automatically
* (still, walking, running, biking, in vehicle), while HealthKit only relies on the input of
* the user or of some external app.
* When querying for activities, calories and distance are also provided in HealthKit (units are kcal and meters) and
* never in Google Fit.
* When querying for nutrition, Google Fit always returns all the nutrition elements it has,
* while HealthKit returns only those that are stored as correlation. To be sure to get all stored the quantities
* (regardless of they are stored as correlation or not), it's better to query single nutrients.
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
* Automatic conversion is not trivial and depends on the actual substance.
*
* @param queryOptions {HealthQueryOptions}
* @return {Promise<HealthData>}
*/
@Cordova()
static query(queryOptions: HealthQueryOptions): Promise<HealthData> {
return;
};
/**
* Gets aggregated data in a certain time window. Usually the sum is returned for the given quantity.
*
* Quirks of queryAggregated()
* In Android, to query for steps as filtered by the Google Fit app, the flag filtered:
* true must be added into the query object.
* When querying for activities, calories and distance are provided
* when available in HealthKit and never in Google Fit.
* In Android, the start and end dates returned are the date of the first and the last available samples.
* If no samples are found, start and end may not be set.
* When bucketing, buckets will include the whole hour / day / month / week / year where start and end times
* fall into. For example, if your start time is 2016-10-21 10:53:34,
* the first daily bucket will start at 2016-10-21 00:00:00.
* Weeks start on Monday.
* When querying for nutrition, HealthKit returns only those that are stored as correlation.
* To be sure to get all the stored quantities, it's better to query single nutrients.
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
*
* @param queryOptionsAggregated {HealthQueryOptionsAggregated}
* @return {Promise<HealthData[]>}
*/
@Cordova()
static queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData[]> {
return;
};
/**
* Stores a data point.
*
* Quirks of store()
*
* Google Fit doesn't allow you to overwrite data points that overlap with others already stored of the same type (see here). At the moment there is no support for update nor delete.
* In iOS you cannot store the total calories, you need to specify either basal or active. If you use total calories, the active ones will be stored.
* In Android you can only store active calories, as the basal are estimated automatically. If you store total calories, these will be treated as active.
* In iOS distance is assumed to be of type WalkingRunning, if you want to explicitly set it to Cycling you need to add the field cycling: true.
* In iOS storing the sleep activities is not supported at the moment.
* Storing of nutrients is not supported at the moment.
* @param storeOptions
* @return {Promise<any>}
*/
@Cordova()
static store(storeOptions: HealthStoreOptions): Promise<any> {
return;
};
}

View File

@@ -546,11 +546,11 @@ export class IBeacon {
/**
* Queries the native layer to determine the current authorization in effect.
*
* @returns {Promise<any>} Returns a promise which is resolved with the
* @returns {Promise<IBeaconPluginResult>} Returns a promise which is resolved with the
* requested authorization status.
*/
@Cordova({otherPromise: true})
static getAuthorizationStatus(): Promise<any> { return; }
static getAuthorizationStatus(): Promise<IBeaconPluginResult> { return; }
/**
* For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
@@ -566,7 +566,7 @@ export class IBeacon {
/**
* See the docuemntation of {@code requestWhenInUseAuthorization} for further details.
* See the documentation of {@code requestWhenInUseAuthorization} for further details.
*
* @returns {Promise<void>} Returns a promise which is resolved when the native layer
* shows the request dialog.

View File

@@ -20,6 +20,11 @@ export interface ImagePickerOptions {
* Quality of images, defaults to 100
*/
quality?: number;
/**
* Output type, defaults to 0 (FILE_URI).
*/
outputType?: number;
}
/**

View File

@@ -3,6 +3,50 @@ import { Observable } from 'rxjs/Observable';
declare var cordova: any;
export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
location?: 'yes' | 'no';
/** Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
* Omit or set to no (default) to have the browser open and load normally. */
hidden?: 'yes' | 'no';
/** Set to yes to have the browser's cookie cache cleared before the new window is opened. */
clearcache?: 'yes';
/** Set to yes to have the session cookie cache cleared before the new window is opened. */
clearsessioncache?: 'yes';
/** (Android Only) set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */
zoom?: 'yes' | 'no';
/** Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
* If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser. */
hardwareback?: 'yes' | 'no';
/** Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no). */
mediaPlaybackRequiresUserAction?: 'yes' | 'no';
/** (Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) */
shouldPauseOnSuspend?: 'yes' | 'no';
/** (iOS Only) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself. */
closebuttoncaption?: string;
/** (iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. */
disallowoverscroll?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) */
toolbar?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
enableViewportScale?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no) */
allowInlineMediaPlayback?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */
keyboardDisplayRequiresUserAction?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). */
suppressesIncrementalRendering?: 'yes' | 'no';
/** (iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). */
presentationstyle?: 'pagesheet' | 'formsheet' | 'fullscreen';
/** (iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). */
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */
toolbarposition?: 'top' | 'bottom';
/** (Windows only) Set to yes to create the browser control without a border around it.
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes';
}
export interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
type: string;
@@ -31,6 +75,7 @@ export interface InAppBrowserEvent extends Event {
* ```
* @interfaces
* InAppBrowserEvent
* InAppBrowserOptions
*/
@Plugin({
pluginName: 'InAppBrowser',
@@ -50,8 +95,12 @@ export class InAppBrowser {
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
constructor(url: string, target?: string, options?: string) {
constructor(url: string, target?: string, options?: InAppBrowserOptions);
constructor(url: string, target?: string, options?: string);
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
try {
if (options && typeof options !== 'string')
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url);
@@ -63,22 +112,29 @@ export class InAppBrowser {
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
@CordovaInstance({sync: true})
@CordovaInstance({ sync: true })
show(): void { }
/**
* Closes the InAppBrowser window.
*/
@CordovaInstance({sync: true})
@CordovaInstance({ sync: true })
close(): void { }
/**
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
* if the InAppBrowser was already hidden.
*/
@CordovaInstance({ sync: true })
hide(): void { }
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
@CordovaInstance()
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
executeScript(script: { file?: string, code?: string }): Promise<any> { return; }
/**
* Injects CSS into the InAppBrowser window.
@@ -86,7 +142,7 @@ export class InAppBrowser {
* @returns {Promise<any>}
*/
@CordovaInstance()
insertCSS(css: {file?: string, code?: string}): Promise<any> {return; }
insertCSS(css: { file?: string, code?: string }): Promise<any> { return; }
/**
* A method that allows you to listen to events happening in the browser.

View File

@@ -65,6 +65,13 @@ export interface ILocalNotification {
*/
smallIcon?: string;
/**
* ANDROID ONLY
* RGB value for the background color of the smallIcon.
* Default: Androids COLOR_DEFAULT, which will vary based on Android version.
*/
color?: string;
/**
* ANDROID ONLY

View File

@@ -45,9 +45,7 @@ export interface MediaError {
* });
*
* // get file duration
* file.getDuration().then((duration) => {
* console.log(position);
* });
* file.getDuration();
*
* // skip to 10 seconds (expects int value in ms)
* file.seekTo(10000);
@@ -227,6 +225,21 @@ export class MediaPlugin {
})
stopRecord(): void { }
/**
* Pauses recording
*/
@CordovaInstance({
sync: true
})
pauseRecord(): void { }
/**
* Resumes recording
*/
@CordovaInstance({
sync: true
})
resumeRecord(): void { }
/**
* Stops playing an audio file.

View File

@@ -10,6 +10,9 @@ export interface MusicControlsOptions {
hasPrev: boolean;
hasNext: boolean;
hasClose: boolean;
album:string;
duration: number;
elapsed:number;
ticker: string;
}
@@ -38,6 +41,11 @@ export interface MusicControlsOptions {
* hasNext : false, // show next button, optional, default: true
* hasClose : true, // show close button, optional, default: false
*
* // iOS only, optional
* album : 'Absolution' // optional, default: ''
* duration : 60, // optional, default: 0
* elapsed : 10, // optional, default: 0
*
* // Android only, optional
* // text displayed in the status bar when the notification (and the ticker) are updated
* ticker : 'Now playing "Time is Running Out"'
@@ -129,7 +137,13 @@ export class MusicControls {
* Toggle play/pause:
* @param isPlaying {boolean}
*/
@Cordova({sync: true})
@Cordova()
static updateIsPlaying(isPlaying: boolean): void {}
/**
* Toggle dismissable:
* @param dismissable {boolean}
*/
@Cordova()
static updateDismissable(dismissable: boolean): void {}
}

View File

@@ -11,7 +11,7 @@ import { Plugin, Cordova } from './plugin';
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from 'ionic-native';
*
* NativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.address + " in " + result.countryCode))
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.street + " in " + result.countryCode))
* .catch((error: any) => console.log(error));
*
* NativeGeocoder.forwardGeocode("Berlin")

View File

@@ -193,7 +193,7 @@ export class PayPalPayment {
/**
* Optional array of PayPalItem objects.
*/
items: string;
items: Array<PayPalItem>;
/**
* Optional customer shipping address, if your app wishes to provide this to the SDK.
@@ -220,7 +220,7 @@ export class PayPalItem {
* @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) {
constructor(name: string, quantity: number, price: string, currency: string, sku?: string) {
this.name = name;
this.quantity = quantity;
this.price = price;
@@ -246,7 +246,7 @@ export class PayPalItem {
/**
* The stock keeping unit for this item. 50 characters max (optional)
*/
sku: string;
sku?: string;
}
/**

103
src/plugins/pedometer.ts Normal file
View File

@@ -0,0 +1,103 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* Interface of a pedometer data object which is returned by watching for new data or by recieving historical data
*/
export interface IPedometerData {
startDate?: number;
endDate?: number;
numberOfSteps: number;
distance: number;
floorsAscended: number;
floorsDescended: number;
}
/**
* @name Pedometer
* @description
* Fetch pedestrian-related pedometer data,
* such as step counts and other information about the distance travelled.
*
* @usage
* ```
* import { Pedometer } from 'ionic-native';
*
* Pedometer.isDistanceAvailable()
* .then((available: boolean) => console.log(available))
* .catch((error: any) => console.log(error));
*
* Pedometer.startPedometerUpdates()
* .subscribe((data: IPedometerData) => {
* console.log(data);
* });
* ```
*/
@Plugin({
pluginName: 'Pedometer',
plugin: 'cordova-plugin-pedometer',
pluginRef: 'pedometer',
repo: 'https://github.com/leecrossley/cordova-plugin-pedometer',
platforms: ['Android', 'iOS']
})
export class Pedometer {
/**
* Checks if step counting is available. Only works on iOS.
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
*/
@Cordova()
static isStepCountingAvailable(): Promise<boolean> { return; }
/**
* Distance estimation indicates the ability to use step information to supply the approximate distance travelled by the user.
* This capability is not supported on all devices, even with iOS 8.
* Only works on iOS.
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
*/
@Cordova()
static isDistanceAvailable(): Promise<boolean> { return; }
/**
* Floor counting indicates the ability to count the number of floors the user walks up or down using stairs.
* This capability is not supported on all devices, even with iOS 8.
* Only works on iOS.
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
*/
@Cordova()
static isFloorCountingAvailable(): Promise<boolean> { return; }
/**
* Starts the delivery of recent pedestrian-related data to your Cordova app.
*
* When the app is suspended, the delivery of updates stops temporarily.
* Upon returning to foreground or background execution, the pedometer object begins updates again.
* @return {Observable<IPedometerData>} Returns a Observable that recieves repeatly data from pedometer in background.
*/
@Cordova({
observable: true,
clearFunction: 'stopPedometerUpdates'
})
static startPedometerUpdates(): Observable<IPedometerData> { return; }
/**
* Stops the delivery of recent pedestrian data updates to your Cordova app.
* @return {Promise<boolean>} Returns a promise that resolves when pedometer watching was stopped
*/
@Cordova()
static stopPedometerUpdates(): Promise<any> { return; }
/**
* Retrieves the data between the specified start and end dates.
* The startDate and endDate options are required and can be constructed in any valid JavaScript way
* (e.g. new Date(2015, 4, 1, 15, 20, 00) is also valid, as is milliseconds).
* Only works on iOS.
* @param {any} options start date and en date where you want to get pedometer data
* @return {Promise<IPedometerData>} Returns a promise that resolves when pedometer data found
*/
@Cordova({
callbackOrder: 'reverse'
})
static queryData(options: { startDate: Date, endDate: Date }): Promise<IPedometerData> { return; }
}

View File

@@ -0,0 +1,207 @@
import { Plugin, Cordova, CordovaFiniteObservable } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name PhotoLibrary
* @description
* The PhotoLibrary plugin allows access to photos from device by url. So you can use plain img tag to display photos and their thumbnails, and different 3rd party libraries as well.
* Saving photos and videos to the library is also supported.
* cdvphotolibrary urls should be trusted by Angular. See plugin homepage to learn how.
*
* @usage
* ```
* import { PhotoLibrary } from 'ionic-native';
*
* PhotoLibrary.requestAuthorization().then(() => {
* PhotoLibrary.getLibrary().subscribe({
* next: library => {
* library.forEach(function(libraryItem) {
* console.log(libraryItem.id); // ID of the photo
* console.log(libraryItem.photoURL); // Cross-platform access to photo
* console.log(libraryItem.thumbnailURL);// Cross-platform access to thumbnail
* console.log(libraryItem.fileName);
* console.log(libraryItem.width);
* console.log(libraryItem.height);
* console.log(libraryItem.creationDate);
* console.log(libraryItem.latitude);
* console.log(libraryItem.longitude);
* console.log(libraryItem.albumIds); // array of ids of appropriate AlbumItem, only of includeAlbumsData was used
* });
* },
* error: err => {},
* complete: () => { console.log("could not get photos"); }
* });
* })
* .catch(err => console.log("permissions weren't granted"));
*
* ```
*/
@Plugin({
pluginName: 'PhotoLibrary',
plugin: 'cordova-plugin-photo-library',
pluginRef: 'cordova.plugins.photoLibrary',
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"'
})
export class PhotoLibrary {
/**
* Retrieves library items. Library item contains photo metadata like width and height, as well as photoURL and thumbnailURL.
* @param options {GetLibraryOptions} Optional, like thumbnail size and chunks settings.
* @return {Observable<LibraryItem[]>} Returns library items. If appropriate option was set, will be returned by chunks.
*/
@CordovaFiniteObservable({
callbackOrder: 'reverse',
resultFinalPredicate: (result: {isLastChunk: boolean}) => { return result.isLastChunk; },
resultTransform: (result: {library: LibraryItem[]}) => { return result.library; },
})
static getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> { return; }
/**
* Asks user permission to access photo library.
* @param options {RequestAuthorizationOptions} Optional, like whether only read access needed or read/write.
* @return { Promise<void>} Returns a promise that resolves when permissions are granted, and fails when not.
*/
@Cordova({
callbackOrder: 'reverse',
})
static requestAuthorization(options?: RequestAuthorizationOptions): Promise<void> { return; }
/**
* Returns list of photo albums on device.
* @return {Promise<AlbumItem[]>} Resolves to list of albums.
*/
@Cordova({
callbackOrder: 'reverse',
})
static getAlbums(): Promise<AlbumItem[]> { return; }
/**
* Provides means to request URL of thumbnail, with specified size or quality.
* @param photo {string | LibraryItem} Id of photo, or LibraryItem.
* @param options {GetThumbnailOptions} Options, like thumbnail size or quality.
* @return {Promise<string>} Resolves to URL of cdvphotolibrary schema.
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getThumbnailURL(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<string> { return; }
/**
* Provides means to request photo URL by id.
* @param photo {string | LibraryItem} Id or LibraryItem.
* @param options {GetPhotoOptions} Optional options.
* @return {Promise<string>} Resolves to URL of cdvphotolibrary schema.
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getPhotoURL(photo: string | LibraryItem, options?: GetPhotoOptions): Promise<string> { return; }
/**
* Returns thumbnail as Blob.
* @param photo {string | LibraryItem} Id or LibraryItem.
* @param options {GetThumbnailOptions} Options, like thumbnail size or quality.
* @return {Promise<Blob>} Resolves requested thumbnail as blob.
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getThumbnail(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<Blob> { return; }
/**
* Returns photo as Blob.
* @param photo {string | LibraryItem} Id or LibraryItem.
* @param options {GetPhotoOptions} Optional options.
* @return {Promise<Blob>} Resolves requested photo as blob.
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getPhoto(photo: string | LibraryItem, options?: GetPhotoOptions): Promise<Blob> { return; }
/**
* Saves image to specified album. Album will be created if not exists.
* LibraryItem that represents saved image is returned.
* @param url {string} URL of a file, or DataURL.
* @param album {AlbumItem | string} Name of an album or AlbumItem object.
* @param options {GetThumbnailOptions} Options, like thumbnail size for resulting LibraryItem.
* @return {Promise<LibraryItem>} Resolves to LibraryItem that represents saved image.
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
static saveImage(url: string, album: AlbumItem | string, options?: GetThumbnailOptions): Promise<LibraryItem> { return; }
/**
* Saves video to specified album. Album will be created if not exists.
* @param url {string} URL of a file, or DataURL.
* @param album {AlbumItem | string} Name of an album or AlbumItem object.
* @return {Promise<void>} Resolves when save operation completes.
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
static saveVideo(url: string, album: AlbumItem | string): Promise<void> { return; }
}
export interface LibraryItem {
/**
* Local id of the photo
*/
id: string;
/**
* URL of cdvphotolibrary schema.
*/
photoURL: string;
/**
* URL of cdvphotolibrary schema.
*/
thumbnailURL: string;
fileName: string;
width: number;
height: number;
creationDate: Date;
latitude?: number;
longitude?: number;
albumIds?: string[];
}
export interface AlbumItem {
/**
* Local id of the album
*/
id: string;
title: string;
}
export interface GetLibraryOptions {
thumbnailWidth?: number;
thumbnailHeight?: number;
quality?: number;
itemsInChunk?: number;
chunkTimeSec?: number;
useOriginalFileNames?: boolean;
includeAlbumData?: boolean;
}
export interface RequestAuthorizationOptions {
read?: boolean;
write?: boolean;
}
export interface GetThumbnailOptions {
thumbnailWidth?: number;
thumbnailHeight?: number;
quality?: number;
}
export interface GetPhotoOptions {
}

View File

@@ -34,7 +34,8 @@ export class PinDialog {
* @returns {Promise<{ buttonIndex: number, input1: string }>}
*/
@Cordova({
successIndex: 1
successIndex: 1,
errorIndex: 4 // no error callback
})
static prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number, input1: string }> { return; }

View File

@@ -118,7 +118,7 @@ export interface PinterestPin {
/**
* The Pins image. The default response returns the images URL, width and height.
*/
image?; any;
image?: any;
/**
* Extra information about the Pin for Rich Pins. Includes the Pin type (e.g., article, recipe) and related information (e.g., ingredients, author).
*/

View File

@@ -1,9 +1,106 @@
import { get } from '../util';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var window;
declare var Promise;
/**
* @private
*/
export interface PluginConfig {
/**
* Plugin name, this should match the class name
*/
pluginName: string;
/**
* Plugin NPM package name
*/
plugin: string;
/**
* Plugin object reference
*/
pluginRef: string;
/**
* Github repository URL
*/
repo: string;
/**
* Custom install command
*/
install?: string;
/**
* Supported platforms
*/
platforms?: string[];
}
/**
* @private
*/
export interface CordovaOptions {
/**
* Set to true if the wrapped method is a sync function
*/
sync?: boolean;
/**
* Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method takes.
*/
callbackOrder?: 'reverse';
/**
* Callback style
*/
callbackStyle?: 'node' | 'object';
/**
* Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
*/
successIndex?: number;
/**
* Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
*/
errorIndex?: number;
/**
* Success function property name. This must be set if callbackStyle is set to object.
*/
successName?: string;
/**
* Error function property name. This must be set if callbackStyle is set to object.
*/
errorName?: string;
/**
* Set to true to return an observable
*/
observable?: boolean;
/**
* If observable is set to true, this can be set to a different function name that will cancel the observable.
*/
clearFunction?: string;
/**
* This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function.
*/
clearWithArgs?: boolean;
/**
* Creates an observable that wraps a global event. Replaces document.addEventListener
*/
eventObservable?: boolean;
/**
* Event name, this must be set if eventObservable is set to true
*/
event?: string;
/**
* Element to attach the event listener to, this is optional, defaults to `window`
*/
element?: any;
/**
* Set to true if the wrapped method returns a promise
*/
otherPromise?: boolean;
/**
* Supported platforms
*/
platforms?: string[];
}
/**
* @private
* @param pluginRef
@@ -245,14 +342,12 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
/**
* Wrap the event with an observable
* @param event
* @param event even name
* @param element The element to attach the event listener to
* @returns {Observable}
*/
function wrapEventObservable(event: string): Observable<any> {
return new Observable(observer => {
window.addEventListener(event, observer.next.bind(observer), false);
return () => window.removeEventListener(event, observer.next.bind(observer), false);
});
function wrapEventObservable(event: string, element: any = window): Observable<any> {
return Observable.fromEvent(element, event);
}
/**
@@ -283,14 +378,6 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts:
return;
}
let method = pluginInstance[methodName];
if (!method) {
observer.error({
error: 'no_such_method'
});
observer.complete();
return;
}
pluginInstance[methodName] = observer.next.bind(observer);
});
}
@@ -303,7 +390,7 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts:
* @param opts
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
*/
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
return (...args) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
@@ -311,7 +398,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
} else if (opts.observable) {
return wrapObservable(pluginObj, methodName, args, opts);
} else if (opts.eventObservable && opts.event) {
return wrapEventObservable(opts.event);
return wrapEventObservable(opts.event, opts.element);
} else if (opts.otherPromise) {
return wrapOtherPromise(pluginObj, methodName, args, opts);
} else {
@@ -320,35 +407,6 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
};
};
/**
* @private
*/
export interface PluginConfig {
/**
* Plugin name, this should match the class name
*/
pluginName: string;
/**
* Plugin NPM package name
*/
plugin: string;
/**
* Plugin object reference
*/
pluginRef: string;
/**
* Github repository URL
*/
repo: string;
/**
* Custom install command
*/
install?: string;
/**
* Supported platforms
*/
platforms?: string[];
}
/**
* @private
@@ -405,7 +463,7 @@ export function Plugin(config: PluginConfig) {
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export function Cordova(opts: any = {}) {
export function Cordova(opts: CordovaOptions = {}) {
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
return {
value: function(...args: any[]) {
@@ -494,3 +552,52 @@ export function CordovaFunctionOverride(opts: any = {}) {
};
};
}
/**
* @private
*/
export interface CordovaFiniteObservableOptions extends CordovaOptions {
/**
* Function that gets a result returned from plugin's success callback, and decides whether it is last value and observable should complete.
*/
resultFinalPredicate?: (result: any) => boolean;
/**
* Function that gets called after resultFinalPredicate, and removes service data that indicates end of stream from the result.
*/
resultTransform?: (result: any) => any;
}
/**
* @private
*
* Wraps method that returns an observable that can be completed. Provided opts.resultFinalPredicate dictates when the observable completes.
*
*/
export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {}) {
if (opts.observable === false) {
throw new Error('CordovaFiniteObservable decorator can only be used on methods that returns observable. Please provide correct option.');
}
opts.observable = true;
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
return {
value: function(...args: any[]) {
let wrappedObservable: Observable<any> = wrap(this, methodName, opts).apply(this, args);
return new Observable<any>((observer) => {
let wrappedSubscription = wrappedObservable.subscribe({
next: (x) => {
observer.next(opts.resultTransform ? opts.resultTransform(x) : x);
if (opts.resultFinalPredicate && opts.resultFinalPredicate(x)) {
observer.complete();
}
},
error: (err) => { observer.error(err); },
complete: () => { observer.complete(); }
});
return () => {
wrappedSubscription.unsubscribe();
};
});
}
};
};
}

View File

@@ -275,6 +275,11 @@ export interface AndroidPushOptions {
*/
vibrate?: boolean | string;
/**
* If true the icon badge will be cleared on init and before push messages are processed.
*/
clearBadge?: boolean | string;
/**
* If true the app clears all pending notifications when it is closed.
*/

View File

@@ -71,14 +71,17 @@ export class SafariViewController {
* @param options {SafariViewControllerOptions} optional
* @returns {Promise<any>}
*/
@Cordova()
@Cordova({
successIndex: 1,
errorIndex: 2
})
static show(options?: SafariViewControllerOptions): Promise<any> { return; }
/**
* Hides Safari View Controller
*/
@Cordova()
static hide(): void { }
static hide(): Promise<any> { return; }
/**
* Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.

View File

@@ -48,7 +48,7 @@ export class ScreenOrientation {
/**
* Lock the orientation to the passed value.
* See below for accepted values
* @param orientation {string} The orientation which should be locked. Accepted values see table below.
* @param orientation {string} The orientation which should be locked. Accepted values see table above.
*/
@Cordova({ sync: true })
static lockOrientation(orientation: string): void { }

View File

@@ -23,13 +23,9 @@ export interface SerialOpenOptions {
* ```
* import { Serial } from 'ionic-native';
*
* Serial.requestPermission({
* vid: '0403',
* pid: '6001',
* driver: 'FtdiSerialDriver'
* }).then(() => {
* Serial.requestPermission().then(() => {
* Serial.open({
* baudRate: 38400
* baudRate: 9800
* }).then(() => {
* console.log('Serial connection opened');
* });
@@ -49,11 +45,14 @@ export class Serial {
/**
* Request permission to connect to a serial device
*
* @param options {SerialPermissionOptions} Options used to request serial permissions
* @param options {SerialPermissionOptions} Options used to request serial permissions for an unknown device
* @return {Promise<any>} Returns a promise that resolves when permissions are granted
*/
@Cordova()
static requestPermission(options: SerialPermissionOptions): Promise<any> { return; }
@Cordova({
successIndex: 1,
errorIndex: 2
})
static requestPermission(options?: SerialPermissionOptions): Promise<any> { return; }
/**
* Open connection to a serial device

View File

@@ -21,10 +21,10 @@ declare var sqlitePlugin;
* })
* .then((db: SQLite) => {
*
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {}).catch(() => {});
* db.executeSql('create table danceMoves(name VARCHAR(32))', []).then(() => {}).catch(() => {});
*
* })
* .catch(error => console.error('Error opening database', error);
* .catch(error => console.error('Error opening database', error));
*
*
* // OPTION B: Create a new instance of SQLite
@@ -33,7 +33,7 @@ declare var sqlitePlugin;
* name: 'data.db',
* location: 'default' // the location field is required
* }).then(() => {
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
* db.executeSql('create table danceMoves(name VARCHAR(32))', []).then(() => {
*
* }, (err) => {
* console.error('Unable to execute sql: ', err);

View File

@@ -21,9 +21,9 @@ import { Plugin, Cordova } from './plugin';
*/
@Plugin({
pluginName: 'Stepcounter',
plugin: 'https://github.com/texh/cordova-plugin-stepcounter',
plugin: 'https://github.com/Slidee/cordova-plugin-stepcounter',
pluginRef: 'stepcounter',
repo: 'https://github.com/texh/cordova-plugin-stepcounter',
repo: 'https://github.com/Slidee/cordova-plugin-stepcounter',
platforms: ['Android']
})
export class Stepcounter {

View File

@@ -30,7 +30,7 @@ export interface StreamingAudioOptions {
* orientation: 'landscape'
* };
*
* StreamingMedia.('https://path/to/video/stream', options);
* StreamingMedia.playVideo('https://path/to/video/stream', options);
*
* ```
* @interfaces

View File

@@ -52,7 +52,6 @@ export interface StripeCardTokenParams {
}
/**
* @beta
* @name Stripe
* @description
* A plugin that allows you to use Stripe's Native SDKs for Android and iOS.
@@ -67,10 +66,10 @@ export interface StripeCardTokenParams {
* number: '4242424242424242',
* expMonth: 12,
* expYear: 2020,
* cvc: 220
* cvc: '220'
* };
*
* Stripe.createToken(card)
* Stripe.createCardToken(card)
* .then(token => console.log(token))
* .catch(error => console.error(error));
*

View File

@@ -47,4 +47,8 @@ export class TextToSpeech {
return;
}
static stop(): Promise<any> {
return;
}
}

View File

@@ -0,0 +1,33 @@
import { Plugin, Cordova } from './plugin';
/**
* @name UniqueDeviceID
* @description
* This plugin produces a unique, cross-install, app-specific device id.
*
* @usage
* ```
* import { UniqueDeviceID } from 'ionic-native';
*
* UniqueDeviceID.get()
* .then((uuid: any) => console.log(uuid))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
pluginName: 'UniqueDeviceID',
plugin: 'cordova-plugin-uniquedeviceid',
pluginRef: 'window.plugins.uniqueDeviceID',
repo: 'https://github.com/Paldom/UniqueDeviceID'
})
export class UniqueDeviceID {
/**
* Gets a unique, cross-install, app-specific device id.
* @return {Promise<string>} Returns a promise that resolves when something happens
*/
@Cordova()
static get(): Promise<string> { return; }
}

View File

@@ -35,6 +35,6 @@ export class Zip {
successIndex: 2,
errorIndex: 4
})
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; }
static unzip(sourceZip: string, destUrl: string, onProgress?: Function): Promise<number> {return; }
}

View File

@@ -0,0 +1,30 @@
import { InAppBrowser, InAppBrowserEvent, InAppBrowserOptions } from '../../src/plugins/inappbrowser';
declare var window: any;
window.cordova = {
InAppBrowser: {
open: window.open
}
};
describe('InAppBrowser', () => {
const options: InAppBrowserOptions = { hidden: 'yes', hardwareback: 'no' };
let object;
it('should create an object using strings and InAppBrowserOptions signature', () => {
object = new InAppBrowser('http://google.com', '_self', options);
expect(object).toBeDefined();
});
it('should create an object using string only signature', () => {
object = new InAppBrowser('http://google.com', '_self', 'location=no');
expect(object).toBeDefined();
});
it('should create an object with the least amount of parameters', () => {
object = new InAppBrowser('http://google.com');
expect(object).toBeDefined();
});
});