Compare commits

...

60 Commits

Author SHA1 Message Date
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
Ibby
8b921165bb fix merge conflict 2017-01-24 00:49:14 -05:00
Ibby
0c837de499 chore(): update changelog 2017-01-24 00:48:42 -05:00
Ibby
a44500d206 2.4.0 2017-01-24 00:48:07 -05:00
Ibby
e063613c8c 2.3.3 2017-01-24 00:46:51 -05:00
Ibby
416071a5a1 fix(google-maps): fix event listeners
fixes #999
2017-01-24 00:46:37 -05:00
Ibby
93fdb7eabb fix typo 2017-01-23 23:00:56 -05:00
Ibby
466437a683 feat(pinterest): add pinterest plugin 2017-01-23 22:59:37 -05:00
Ibby
a34723b53c legal name change 2017-01-23 22:22:19 -05:00
Ibby
b9bd5100a2 chore(): update changelog 2017-01-23 22:20:09 -05:00
Ibby
51bafccf38 2.3.2 2017-01-23 22:19:48 -05:00
Ibby
c3127d35bb fix(googlemaps): fix GoogleMapsLaLngBounds
closes #972
2017-01-23 22:02:31 -05:00
Ibby
1322c1b089 test(): fix test plugin meta 2017-01-22 17:37:04 -05:00
Ibby
9bf7895386 chore(): update changelog 2017-01-22 17:34:13 -05:00
Ibby
538dcb98eb 2.3.1 2017-01-22 17:33:59 -05:00
Ibby
3da0efe38e fix(battery-status): add missing pluginRef 2017-01-22 17:27:52 -05:00
Ibby
b983de2145 feat(core): add PluginConfig interface
closes #996
2017-01-22 17:24:43 -05:00
Guille
9f98f8ef46 feat(google-maps): add base class functions (#993) 2017-01-22 17:17:13 -05:00
Ibby
3e2964b385 Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-22 17:13:59 -05:00
Guille
77ab2c21da refractor(): name to pluginName (#994) 2017-01-22 17:13:42 -05:00
guille
94025a7fd2 fix(plugin): adds subscribe() and unsubscribe() 2017-01-22 17:13:13 -05:00
guille
8c021bcaa0 fix(): add clearAllNotifications() 2017-01-22 17:13:13 -05:00
Ibby
da7a3707fa fix(core): fix plugin check 2017-01-22 17:12:24 -05:00
Peter Kelly
cb293639bc fix(core): fix exception in CordovaProperty (#998)
This reverts part of commit 67adb23, which moved the call to getPlugin()
from within CordovaProperty() to a point where it was called too early.

When the CordovaProperty decorator is called on a property, the class
containing that call has not yet had its Plugin decorator called. Only
when the latter happens does pluginRef get set. Thus, attempting to
access pluginRef within CordovaProperty at the time of the call will
give undefined, and attemping to call getPlugin with an undefined value
will throw an exception:

    Runtime Error
    Cannot read property 'split' of undefined

    TypeError: Cannot read property 'split' of undefined
        at get
        at getPlugin
        at CordovaProperty
        at __decorate
        ...

The above message can be seen in the browser after running the 'ionic
serve' command.

This commit moves the getPlugin call back to the getters and setters
established by CordovaProperty, which are only called *after* the Plugin
decorator has finished executing.

closes #992
2017-01-22 17:11:52 -05:00
Ibby
16f0712462 chore(): update changelog 2017-01-20 16:34:25 -05:00
Ibby
e9b2b93486 2.3.0 2017-01-20 16:33:57 -05:00
Ibby
a8258ec998 docs(): add beta tags 2017-01-20 16:33:43 -05:00
Ibby
09747cd746 docs(firebase): improve docs 2017-01-20 16:29:15 -05:00
Ibby
2f89ae0e84 Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-20 16:24:22 -05:00
Megan Kearl
ac748abf78 feat(serial): add Serial plugin (#952)
* style: fix whitespace lint issue

* feat(serial): add serial plugin

* docs(serial): remove unnecessary comments
2017-01-20 16:16:12 -05:00
Guillaume
1279114b73 feat(backlight): add Backlight plugin (#973)
* feat(backlight): add Backlight plugin

* fix(backlight): set as beta
2017-01-20 16:14:29 -05:00
Peter Bakondy
7c30718369 feat(speech-recognition): add SpeechRecognition plugin (#897) 2017-01-20 16:13:58 -05:00
Kim Biesbjerg
9c75a06131 feat(launch-review): add LaunchReview plugin (#949)
* Add LaunchReview

* Fix pluginRef
2017-01-20 16:11:57 -05:00
Guillaume
1e38a6c005 feat(broadcaster): add Broadcaster plugin (#877)
* feat(broadcaster): add Broadcaster plugin

* fix(broadcaster): return Obserable for addEventListener

- also remove the listener when clearing observable
2017-01-20 16:11:19 -05:00
Ibby
23639ee859 docs(): add beta tag 2017-01-20 16:10:39 -05:00
Ibby
be20c51996 Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-20 16:09:27 -05:00
Niklas Merz
1615b74065 feat(fingerprint-aio): add cordova-plugin-fingerprint-aio (#845) 2017-01-20 16:09:21 -05:00
Ibby
5638f90783 refractor(): remove default value from optional param 2017-01-20 16:07:28 -05:00
Ibby
47b6164e99 docs(): add beta tags 2017-01-20 16:07:05 -05:00
Lucas A. Moulin
229f5509e9 feat(rollbar): add Rollbar plugin (#832)
* Add Rollbar plugin

* Add documentation

* Add return type to init function

* Remove init params
2017-01-20 16:05:06 -05:00
John-Luke
70c15c31ca feat(navigationbar): add NavigationBar plugin (#826)
* feat(navigationbar): add NavigationBar plugin

* fix(navigationbar) typo in chore

* Implement changes requested

* fix(): add return

* fix(docs): remove callback parameter

* Update navigationbar.ts
2017-01-20 16:04:31 -05:00
Ibby
a98ccc726f Merge branch 'John-Luke-master' 2017-01-20 16:04:09 -05:00
Ibby
538ebfe9fe fix merge conflict 2017-01-20 16:03:58 -05:00
Ibby Hadeed
8e98481609 feat(firebase): add firebase plugin (#914)
closes #608
2017-01-20 16:02:33 -05:00
Ibby Hadeed
0ec46b03b5 feat(stripe): add stripe plugin (#913)
* feat(stripe): add stripe plugin

* add stripe to index

* add param doc
2017-01-20 16:02:17 -05:00
Ibby
f10f152d2c docs(native-geocoder): add interfaces 2017-01-20 16:01:54 -05:00
Ibby
d746a98ef4 refractor(native-geocoder): refractor interface names 2017-01-20 16:01:29 -05:00
Ibby
dbf95ea4bd fix(native-geocoder): fix callback order 2017-01-20 16:00:05 -05:00
Sebastian Baar
911537b61b feat(nativegeocoder): add NativeGeocoder plugin (#800) 2017-01-20 15:56:16 -05:00
John-Luke
2e926f4a94 Update headercolor.ts 2017-01-19 09:06:58 -03:00
John-Luke
292a9f08e9 solve conflict 2017-01-18 19:06:27 -02:00
John-Luke
b2cd106aae Update headercolor.ts 2017-01-18 18:58:27 -02:00
John-Luke
3fdc4a8acd fix(): add return 2016-12-01 16:27:50 -03:00
John-Luke
db99482157 Implement changes requested 2016-11-30 20:24:33 -03:00
John-Luke
bab2971c58 fix(headercolor): solve typo in usage and chore 2016-11-24 14:37:57 -03:00
John Luke
93696d53f7 feat(headercolor): add HeaderColor plugin
fix [#760](https://github.com/driftyco/ionic-native/issues/760)
2016-11-23 16:47:34 -03:00
24 changed files with 2254 additions and 33 deletions

View File

@@ -1,3 +1,88 @@
<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.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
* **google-maps:** fix event listeners ([416071a](https://github.com/driftyco/ionic-native/commit/416071a)), closes [#999](https://github.com/driftyco/ionic-native/issues/999)
### Features
* **pinterest:** add pinterest plugin ([466437a](https://github.com/driftyco/ionic-native/commit/466437a))
<a name="2.3.2"></a>
## [2.3.2](https://github.com/driftyco/ionic-native/compare/v2.3.1...v2.3.2) (2017-01-24)
### Bug Fixes
* **googlemaps:** fix GoogleMapsLaLngBounds ([c3127d3](https://github.com/driftyco/ionic-native/commit/c3127d3)), closes [#972](https://github.com/driftyco/ionic-native/issues/972)
<a name="2.3.1"></a>
## [2.3.1](https://github.com/driftyco/ionic-native/compare/v2.3.0...v2.3.1) (2017-01-22)
### Bug Fixes
* add clearAllNotifications() ([8c021bc](https://github.com/driftyco/ionic-native/commit/8c021bc))
* **battery-status:** add missing pluginRef ([3da0efe](https://github.com/driftyco/ionic-native/commit/3da0efe))
* **core:** fix exception in CordovaProperty ([#998](https://github.com/driftyco/ionic-native/issues/998)) ([cb29363](https://github.com/driftyco/ionic-native/commit/cb29363)), closes [#992](https://github.com/driftyco/ionic-native/issues/992)
* **core:** fix plugin check ([da7a370](https://github.com/driftyco/ionic-native/commit/da7a370))
* **plugin:** adds subscribe() and unsubscribe() ([94025a7](https://github.com/driftyco/ionic-native/commit/94025a7))
### Features
* **core:** add PluginConfig interface ([b983de2](https://github.com/driftyco/ionic-native/commit/b983de2)), closes [#996](https://github.com/driftyco/ionic-native/issues/996)
* **google-maps:** add base class functions ([#993](https://github.com/driftyco/ionic-native/issues/993)) ([9f98f8e](https://github.com/driftyco/ionic-native/commit/9f98f8e))
<a name="2.3.0"></a>
# [2.3.0](https://github.com/driftyco/ionic-native/compare/v2.2.17...v2.3.0) (2017-01-20)
### Bug Fixes
* **native-geocoder:** fix callback order ([dbf95ea](https://github.com/driftyco/ionic-native/commit/dbf95ea))
### Features
* **backlight:** add Backlight plugin ([#973](https://github.com/driftyco/ionic-native/issues/973)) ([1279114](https://github.com/driftyco/ionic-native/commit/1279114))
* **broadcaster:** add Broadcaster plugin ([#877](https://github.com/driftyco/ionic-native/issues/877)) ([1e38a6c](https://github.com/driftyco/ionic-native/commit/1e38a6c))
* **fingerprint-aio:** add cordova-plugin-fingerprint-aio ([#845](https://github.com/driftyco/ionic-native/issues/845)) ([1615b74](https://github.com/driftyco/ionic-native/commit/1615b74))
* **firebase:** add firebase plugin ([#914](https://github.com/driftyco/ionic-native/issues/914)) ([8e98481](https://github.com/driftyco/ionic-native/commit/8e98481)), closes [#608](https://github.com/driftyco/ionic-native/issues/608)
* **launch-review:** add LaunchReview plugin ([#949](https://github.com/driftyco/ionic-native/issues/949)) ([9c75a06](https://github.com/driftyco/ionic-native/commit/9c75a06))
* **nativegeocoder:** add NativeGeocoder plugin ([#800](https://github.com/driftyco/ionic-native/issues/800)) ([911537b](https://github.com/driftyco/ionic-native/commit/911537b))
* **navigationbar:** add NavigationBar plugin ([#826](https://github.com/driftyco/ionic-native/issues/826)) ([70c15c3](https://github.com/driftyco/ionic-native/commit/70c15c3))
* **rollbar:** add Rollbar plugin ([#832](https://github.com/driftyco/ionic-native/issues/832)) ([229f550](https://github.com/driftyco/ionic-native/commit/229f550))
* **serial:** add Serial plugin ([#952](https://github.com/driftyco/ionic-native/issues/952)) ([ac748ab](https://github.com/driftyco/ionic-native/commit/ac748ab))
* **speech-recognition:** add SpeechRecognition plugin ([#897](https://github.com/driftyco/ionic-native/issues/897)) ([7c30718](https://github.com/driftyco/ionic-native/commit/7c30718))
* **stripe:** add stripe plugin ([#913](https://github.com/driftyco/ionic-native/issues/913)) ([0ec46b0](https://github.com/driftyco/ionic-native/commit/0ec46b0))
<a name="2.2.17"></a>
## [2.2.17](https://github.com/driftyco/ionic-native/compare/v2.2.16...v2.2.17) (2017-01-20)
@@ -136,8 +221,10 @@
### Bug Fixes
* add return ([3fdc4a8](https://github.com/driftyco/ionic-native/commit/3fdc4a8))
* **card-io:** fix typo in options ([e6700a3](https://github.com/driftyco/ionic-native/commit/e6700a3))
* **globalization:** add missing parameter to numberToString function ([1072ab1](https://github.com/driftyco/ionic-native/commit/1072ab1)), closes [#835](https://github.com/driftyco/ionic-native/issues/835)
* **headercolor:** solve typo in usage and chore ([bab2971](https://github.com/driftyco/ionic-native/commit/bab2971))
### Features
@@ -169,6 +256,7 @@
* **camera-preview:** add disable method ([6ad54ec](https://github.com/driftyco/ionic-native/commit/6ad54ec))
* **google-analytics:** new interval period parameter ([abd910d](https://github.com/driftyco/ionic-native/commit/abd910d)), closes [#816](https://github.com/driftyco/ionic-native/issues/816)
* **google-map:** add get and set methods to Marker class ([51ab03d](https://github.com/driftyco/ionic-native/commit/51ab03d)), closes [#798](https://github.com/driftyco/ionic-native/issues/798)
* **headercolor:** add HeaderColor plugin ([93696d5](https://github.com/driftyco/ionic-native/commit/93696d5)), closes [#760](https://github.com/driftyco/ionic-native/issues/760)

View File

@@ -86,7 +86,7 @@ Let us know or submit a PR! Take a look at [the Developer Guide](https://github.
# Credits
Ibrahim Hadeed - [@ihadeed](http://github.com/ihadeed)
Ibby Hadeed - [@ihadeed](http://github.com/ihadeed)
Tim Lancina - [@timlancina](http://twitter.com/timlancina)

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "2.2.17",
"version": "2.4.1",
"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",

View File

@@ -13,12 +13,14 @@ import { AppVersion } from './plugins/appversion';
import { Badge } from './plugins/badge';
import { BackgroundGeolocation } from './plugins/background-geolocation';
import { BackgroundMode } from './plugins/backgroundmode';
import { Backlight } from './plugins/backlight';
import { BarcodeScanner } from './plugins/barcodescanner';
import { Base64ToGallery } from './plugins/base64togallery';
import { BatteryStatus } from './plugins/batterystatus';
import { Brightness } from './plugins/brightness';
import { BLE } from './plugins/ble';
import { BluetoothSerial } from './plugins/bluetoothserial';
import { Broadcaster } from './plugins/broadcaster';
import { Calendar } from './plugins/calendar';
import { CallNumber } from './plugins/call-number';
import { Camera } from './plugins/camera';
@@ -46,6 +48,8 @@ import { FileChooser } from './plugins/file-chooser';
import { FileOpener } from './plugins/file-opener';
import { FilePath } from './plugins/filepath';
import { Transfer } from './plugins/filetransfer';
import { FingerprintAIO } from './plugins/fingerprint-aio';
import { Firebase } from './plugins/firebase';
import { Flashlight } from './plugins/flashlight';
import { Geofence } from './plugins/geofence';
import { Geolocation } from './plugins/geolocation';
@@ -53,6 +57,7 @@ import { Globalization } from './plugins/globalization';
import { GooglePlus } from './plugins/google-plus';
import { GoogleMap } from './plugins/googlemap';
import { GoogleAnalytics } from './plugins/googleanalytics';
import { HeaderColor } from './plugins/headercolor';
import { Hotspot } from './plugins/hotspot';
import { HTTP } from './plugins/http';
import { Httpd } from './plugins/httpd';
@@ -66,12 +71,15 @@ import { Instagram } from './plugins/instagram';
import { IsDebug } from './plugins/is-debug';
import { Keyboard } from './plugins/keyboard';
import { LaunchNavigator } from './plugins/launchnavigator';
import { LaunchReview } from './plugins/launch-review';
import { LocalNotifications } from './plugins/localnotifications';
import { LocationAccuracy } from './plugins/location-accuracy';
import { MediaCapture } from './plugins/media-capture';
import { NativeAudio } from './plugins/native-audio';
import { NativeGeocoder } from './plugins/native-geocoder';
import { NativePageTransitions } from './plugins/native-page-transitions';
import { NativeStorage } from './plugins/nativestorage';
import { NavigationBar } from './plugins/navigationbar';
import { Market } from './plugins/market';
import { MediaPlugin } from './plugins/media';
import { Mixpanel } from './plugins/mixpanel';
@@ -83,22 +91,27 @@ import { PhotoViewer } from './plugins/photo-viewer';
import { ScreenOrientation } from './plugins/screen-orientation';
import { PayPal } from './plugins/pay-pal';
import { PinDialog } from './plugins/pin-dialog';
import { Pinterest } from './plugins/pinterest';
import { PowerManagement } from './plugins/power-management';
import { Printer } from './plugins/printer';
import { Push } from './plugins/push';
import { Rollbar } from './plugins/rollbar';
import { SafariViewController } from './plugins/safari-view-controller';
import { Screenshot } from './plugins/screenshot';
import { SecureStorage } from './plugins/securestorage';
import { Serial } from './plugins/serial';
import { Shake } from './plugins/shake';
import { Sim } from './plugins/sim';
import { SMS } from './plugins/sms';
import { SocialSharing } from './plugins/socialsharing';
import { SpeechRecognition } from './plugins/speech-recognition';
import { SpinnerDialog } from './plugins/spinnerdialog';
import { Splashscreen } from './plugins/splashscreen';
import { SQLite } from './plugins/sqlite';
import { StatusBar } from './plugins/statusbar';
import { Stepcounter } from './plugins/stepcounter';
import { StreamingMedia } from './plugins/streaming-media';
import { Stripe } from './plugins/stripe';
import { ThreeDeeTouch } from './plugins/3dtouch';
import { Toast } from './plugins/toast';
import { TouchID } from './plugins/touchid';
@@ -121,6 +134,7 @@ export * from './plugins/apprate';
export * from './plugins/appversion';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
export * from './plugins/backlight';
export * from './plugins/badge';
export * from './plugins/barcodescanner';
export * from './plugins/base64togallery';
@@ -128,6 +142,7 @@ export * from './plugins/batterystatus';
export * from './plugins/ble';
export * from './plugins/bluetoothserial';
export * from './plugins/brightness';
export * from './plugins/broadcaster';
export * from './plugins/calendar';
export * from './plugins/call-number';
export * from './plugins/camera';
@@ -154,7 +169,9 @@ export * from './plugins/file';
export * from './plugins/file-chooser';
export * from './plugins/file-opener';
export * from './plugins/filetransfer';
export * from './plugins/firebase';
export * from './plugins/filepath';
export * from './plugins/fingerprint-aio';
export * from './plugins/flashlight';
export * from './plugins/geofence';
export * from './plugins/geolocation';
@@ -162,6 +179,7 @@ export * from './plugins/globalization';
export * from './plugins/google-plus';
export * from './plugins/googleanalytics';
export * from './plugins/googlemap';
export * from './plugins/headercolor';
export * from './plugins/hotspot';
export * from './plugins/http';
export * from './plugins/httpd';
@@ -175,6 +193,7 @@ export * from './plugins/instagram';
export * from './plugins/is-debug';
export * from './plugins/keyboard';
export * from './plugins/launchnavigator';
export * from './plugins/launch-review';
export * from './plugins/localnotifications';
export * from './plugins/location-accuracy';
export * from './plugins/market';
@@ -183,32 +202,39 @@ export * from './plugins/media-capture';
export * from './plugins/mixpanel';
export * from './plugins/music-controls';
export * from './plugins/native-audio';
export * from './plugins/native-geocoder';
export * from './plugins/native-page-transitions';
export * from './plugins/nativestorage';
export * from './plugins/navigationbar';
export * from './plugins/network';
export * from './plugins/nfc';
export * from './plugins/onesignal';
export * from './plugins/pay-pal';
export * from './plugins/photo-viewer';
export * from './plugins/pin-dialog';
export * from './plugins/pinterest';
export * from './plugins/plugin';
export * from './plugins/power-management';
export * from './plugins/printer';
export * from './plugins/push';
export * from './plugins/rollbar';
export * from './plugins/safari-view-controller';
export * from './plugins/screen-orientation';
export * from './plugins/screenshot';
export * from './plugins/securestorage';
export * from './plugins/serial';
export * from './plugins/shake';
export * from './plugins/sim';
export * from './plugins/sms';
export * from './plugins/socialsharing';
export * from './plugins/speech-recognition';
export * from './plugins/spinnerdialog';
export * from './plugins/splashscreen';
export * from './plugins/sqlite';
export * from './plugins/statusbar';
export * from './plugins/stepcounter';
export * from './plugins/streaming-media';
export * from './plugins/stripe';
export * from './plugins/text-to-speech';
export * from './plugins/themeable-browser';
export * from './plugins/toast';
@@ -233,12 +259,14 @@ window['IonicNative'] = {
Badge,
BackgroundGeolocation,
BackgroundMode,
Backlight,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
Broadcaster,
Calendar,
CallNumber,
Camera,
@@ -265,13 +293,16 @@ window['IonicNative'] = {
FileChooser,
FileOpener,
FilePath,
FingerprintAIO,
Flashlight,
Firebase,
Geofence,
Geolocation,
Globalization,
GooglePlus,
GoogleMap,
GoogleAnalytics,
HeaderColor,
Hotspot,
HTTP,
Httpd,
@@ -285,6 +316,7 @@ window['IonicNative'] = {
IsDebug,
Keyboard,
LaunchNavigator,
LaunchReview,
LocalNotifications,
LocationAccuracy,
Market,
@@ -293,8 +325,10 @@ window['IonicNative'] = {
Mixpanel,
MusicControls,
NativeAudio,
NativeGeocoder,
NativePageTransitions,
NativeStorage,
NavigationBar,
Network,
PayPal,
NFC,
@@ -304,10 +338,13 @@ window['IonicNative'] = {
PhotoViewer,
ScreenOrientation,
PinDialog,
Pinterest,
PowerManagement,
Rollbar,
SafariViewController,
Screenshot,
SecureStorage,
Serial,
Shake,
Sim,
SMS,
@@ -316,8 +353,10 @@ window['IonicNative'] = {
Splashscreen,
SQLite,
StatusBar,
SpeechRecognition,
Stepcounter,
StreamingMedia,
Stripe,
ThreeDeeTouch,
Toast,
TouchID,

44
src/plugins/backlight.ts Normal file
View File

@@ -0,0 +1,44 @@
import { Plugin, Cordova } from './plugin';
/**
* @beta
* @name Backlight
* @description
* This plugin adds turning on/off the device backlight.
*
* @usage
* ```
* import { Backlight } from 'ionic-native';
*
* // Turn backlight on
* Backlight.on().then(() => console.log('backlight on'));
*
* // Turn backlight off
* Backlight.off().then(() => console.log('backlight off'));
*
* ```
*/
@Plugin({
pluginName: 'Backlight',
plugin: 'cordova-plugin-backlight',
pluginRef: 'cordova.plugins.Backlight',
repo: 'https://github.com/mebibou/cordova-plugin-backlight',
platforms: ['Android']
})
export class Backlight {
/**
* This function turns backlight on
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
*/
@Cordova()
static on(): Promise<any> { return; }
/**
* This function turns backlight off
* @return {Promise<any>} Returns a promise that resolves when the backlight is off
*/
@Cordova()
static off(): Promise<any> { return; }
}

View File

@@ -42,6 +42,7 @@ export interface BatteryStatusResponse {
@Plugin({
pluginName: 'BatteryStatus',
plugin: 'cordova-plugin-battery-status',
pluginRef: 'navigator.battery',
repo: 'https://github.com/apache/cordova-plugin-battery-status',
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})

View File

@@ -0,0 +1,51 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name Broadcaster
* @description
* This plugin adds exchanging events between native code and your app.
*
* @usage
* ```
* import { Broadcaster } from 'ionic-native';
*
* // Listen to events from Native
* Broadcaster.addEventListener('eventName').then((event) => console.log(event));
*
* // Send event to Native
* Broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));
*
* ```
*/
@Plugin({
pluginName: 'Broadcaster',
plugin: 'cordova-plugin-broadcaster',
pluginRef: 'broadcaster',
repo: 'https://github.com/bsorrentino/cordova-broadcaster',
platforms: ['Android', 'iOS']
})
export class Broadcaster {
/**
* This function listen to an event sent from the native code
* @param eventName {string}
* @return {Observable<any>} Returns an observable to watch when an event is received
*/
@Cordova({
observable: true,
clearFunction: 'removeEventListener',
clearWithArgs: true
})
static addEventListener(eventName: string): Observable<any> { return; }
/**
* This function sends data to the native code
* @param eventName {string}
* @param eventData {any}
* @return {Promise<any>} Returns a promise that resolves when an event is successfully fired
*/
@Cordova()
static fireNativeEvent(eventName: string, eventData: any): Promise<any> { return; }
}

View File

@@ -0,0 +1,62 @@
import { Plugin, Cordova } from './plugin';
export interface FingerprintOptions {
/**
* Key for platform keychain
*/
clientId: string;
/**
* Secret password. Only for android
*/
clientSecret?: string;
}
/**
* @beta
* @name FingerprintAIO
* @description
* Use simple fingerprint authentication on Android and iOS.
* Requires Cordova plugin: cordova-plugin-fingerprint-aio. For more info about plugin, vist: https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio
*
* @usage
* ```typescript
* import { FingerprintAIO } from 'ionic-native';
*
* FingerprintAIO.show({
* clientId: "Fingerprint-Demo",
* clientSecret: "password" //Only necessary for Android
* })
* .then((result: any) => console.log(any))
* .catch((error: any) => console.log(error));
*
* ```
* @interfaces
* FingerprintOptions
*/
@Plugin({
pluginName: 'FingerprintAIO',
plugin: 'cordova-plugin-fingerprint-aio',
pluginRef: 'Fingerprint',
repo: 'https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio',
platforms: ['Android', 'iOS']
})
export class FingerprintAIO {
/**
* Check if fingerprint authentication is available
* @return {Promise<any>} Returns a promise with result
*/
@Cordova()
static isAvailable(): Promise<any> { return; }
/**
* Show authentication dialogue
* @param options {FingerprintOptions} options for platform specific fingerprint API
* @return {Promise<any>} Returns a promise that resolves when authentication was successfull
*/
@Cordova()
static show(options: FingerprintOptions): Promise<any> { return; }
}

201
src/plugins/firebase.ts Normal file
View File

@@ -0,0 +1,201 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name Firebase
* @description
* This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).
*
* @usage
* ```
* import { Firebase } from 'ionic-native';
*
* Firebase.getToken()
* .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
* .catch(error => console.error('Error getting token', error));
*
* Firebase.onTokenRefresh()
* .subscribe((token: string) => console.log(`Got a new token ${token}`));
*
* ```
*/
@Plugin({
pluginName: 'Firebase',
plugin: 'cordova-plugin-firebase',
pluginRef: 'FirebasePlugin',
repo: 'https://github.com/arnesson/cordova-plugin-firebase',
platforms: ['Android', 'iOS']
})
export class Firebase {
/**
* Get the device token
* @return {Promise<any>}
*/
@Cordova()
static getToken(): Promise<any> { return; }
/**
* Get notified when a token is refreshed
* @return {Observable<any>}
*/
@Cordova({
observable: true
})
static onTokenRefresh(): Observable<any> { return; }
/**
* Get notified when the user opens a notification
* @return {Observable<any>}
*/
@Cordova({
observable: true
})
static onNotificationOpen(): Observable<any> { return; }
/**
* Grant permission to recieve push notifications
* @return {Promise<any>}
*/
@Cordova({
platforms: ['iOS']
})
static grantPermission(): Promise<any> { return; }
/**
* Set icon badge number. Set to 0 to clear the badge.
* @param badgeNumber {number}
* @return {Promise<any>}
*/
@Cordova()
static setBadgeNumber(badgeNumber: number): Promise<any> { return; }
/**
* Get icon badge number
* @return {Promise<any>}
*/
@Cordova()
static getBadgeNumber(): Promise<any> { return; }
/**
* Subscribe to a topic
* @param topic {string}
* @return {Promise<any>}
*/
@Cordova()
static subscribe(topic: string): Promise<any> { return; }
/**
* Unsubscribe from a topic
* @param topic {string}
* @return {Promise<any>}
*/
@Cordova()
static unsubscribe(topic: string): Promise<any> { return; }
/**
* Log an event using Analytics
* @param type {string}
* @param data {Object}
* @return {Promise<any>}
*/
@Cordova()
static logEvent(type: string, data: any): Promise<any> { return; }
/**
* Set a user id for use in Analytics
* @param userId {string}
* @return {Promise<any>}
*/
@Cordova()
static setUserId(userId: string): Promise<any> { return; }
/**
* Set a user property for use in Analytics
* @param name {string}
* @param value {string}
* @return {Promise<any>}
*/
@Cordova()
static setUserProperty(name: string, value: string): Promise<any> { return; }
/**
* Fetch Remote Config parameter values for your app
* @param cacheExpirationSeconds
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android'],
successIndex: 1,
errorIndex: 2
})
static fetch(cacheExpirationSeconds?: number): Promise<any> { return; }
/**
* Activate the Remote Config fetched config
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android']
})
static activateFetched(): Promise<any> { return; }
/**
* Retrieve a Remote Config value
* @param key {string}
* @param namespace {string}
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android'],
successIndex: 2,
errorIndex: 3
})
static getValue(key: string, namespace?: string): Promise<any> { return; }
/**
* Retrieve a Remote Config byte array
* @param key {string}
* @param namespace {string}
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android'],
successIndex: 2,
errorIndex: 3
})
static getByteArray(key: string, namespace?: string): Promise<any> { return; }
/**
* Get the current state of the FirebaseRemoteConfig singleton object
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android']
})
static getInfo(): Promise<any> { return; }
/**
* Change the settings for the FirebaseRemoteConfig object's operations
* @param settings {Object}
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android']
})
static setConfigSettings(settings: any): Promise<any> { return; }
/**
* Set defaults in the Remote Config
* @param defaults {Object}
* @param namespace {string}
* @return {Promise<any>}
*/
@Cordova({
platforms: ['Android'],
successIndex: 2,
errorIndex: 3
})
static setDefaults(defaults: any, namespace: string): Promise<any> { return; }
}

View File

@@ -119,7 +119,7 @@ export class GoogleMap {
@Cordova()
static isAvailable(): Promise<boolean> { return; }
constructor(element: string|HTMLElement, options?: any) {
constructor(element: string | HTMLElement, options?: any) {
if (!!getPlugin('plugin.google.maps.Map')) {
if (typeof element === 'string') {
element = document.getElementById(<string>element);
@@ -133,12 +133,55 @@ export class GoogleMap {
}
}
/**
* Adds an event listener.
*
* @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));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(event: any): Observable<any> {
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
@@ -147,7 +190,7 @@ export class GoogleMap {
return new Observable(
(observer) => {
this._objectInstance.on(event, observer.next.bind(observer));
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
@@ -158,15 +201,21 @@ export class GoogleMap {
*
* @returns {Promise<any>}
*/
one(event: any): Promise<any> {
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(event, resolve)
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
setDebuggable(isDebuggable: boolean): void { }
@@ -576,20 +625,39 @@ export class GoogleMapsMarker {
constructor(private _objectInstance: any) { }
addEventListener(event: any): Observable<any> {
/**
* Adds an event listener.
*
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({sync: true})
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
@@ -597,9 +665,49 @@ export class GoogleMapsMarker {
* @param key
* @param value
*/
@CordovaInstance({sync: true})
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
/**
* Return true if the marker is visible
*/
@@ -797,15 +905,89 @@ export class GoogleMapsCircle {
constructor(private _objectInstance: any) { }
addEventListener(event: any): Observable<any> {
/**
* Adds an event listener.
*
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
getCenter(): GoogleMapsLatLng { return; }
@@ -867,15 +1049,89 @@ export interface GoogleMapsPolylineOptions {
export class GoogleMapsPolyline {
constructor(private _objectInstance: any) { }
addEventListener(event: any): Observable<any> {
/**
* Adds an event listener.
*
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
getPoints(): Array<GoogleMapsLatLng> { return; }
@@ -938,15 +1194,89 @@ export class GoogleMapsPolygon {
constructor(private _objectInstance: any) { }
addEventListener(event: any): Observable<any> {
/**
* Adds an event listener.
*
* @returns {Observable<any>}
*/
addEventListener(eventName: string): Observable<any> {
return new Observable(
(observer) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
this._objectInstance.addEventListener(eventName, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(eventName, observer.next.bind(observer));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
getPoints(): Array<GoogleMapsLatLng> { return; }
@@ -1011,6 +1341,89 @@ export class GoogleMapsTileOverlay {
constructor(private _objectInstance: any) { }
/**
* Adds an event listener.
*
* @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));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
getVisible(): boolean { return; }
@@ -1062,6 +1475,89 @@ export class GoogleMapsGroundOverlay {
constructor(private _objectInstance: any) { }
/**
* Adds an event listener.
*
* @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));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
setBearing(bearing: number): void { }
@@ -1104,6 +1600,89 @@ export class GoogleMapsKmlOverlay {
constructor(private _objectInstance: any) { }
/**
* Adds an event listener.
*
* @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));
}
);
}
/**
* Adds an event listener that works once.
*
* @returns {Promise<any>}
*/
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
/**
* Gets a value
* @param key
*/
@CordovaInstance({ sync: true })
get(key: string): any { return; }
/**
* Sets a value
* @param key
* @param value
*/
@CordovaInstance({ sync: true })
set(key: string, value: any): void { }
/**
* Listen to a map event.
*
* @returns {Observable<any>}
*/
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
}
/**
* Listen to a map event only once.
*
* @returns {Promise<any>}
*/
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
}
/**
* Clears all stored values
*/
@CordovaInstance({ sync: true })
empty(): void { }
@CordovaInstance({ sync: true })
remove(): void { }
@@ -1117,9 +1696,9 @@ export class GoogleMapsKmlOverlay {
export class GoogleMapsLatLngBounds {
private _objectInstance: any;
@InstanceProperty get northeast(): GoogleMapsLatLng { return; }
@InstanceProperty get southwest(): GoogleMapsLatLng { return; }
@InstanceProperty get type(): string { return; }
@InstanceProperty northeast: GoogleMapsLatLng;
@InstanceProperty southwest: GoogleMapsLatLng;
@InstanceProperty type: string;
constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) {
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;

View File

@@ -0,0 +1,36 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Headerolor
* @description
* Cordova plugin to change color of header in multitask view
*
* @usage
* ```typescript
* import { HeaderColor } from 'ionic-native';
*
* HeaderColor.tint("#becb29");
* ```
*/
@Plugin({
pluginName: 'HeaderColor',
plugin: 'cordova-plugin-headercolor',
pluginRef: 'plugins.headerColor',
repo: 'https://github.com/tomloprod/cordova-plugin-headercolor',
platforms: ['Android']
})
export class HeaderColor {
/**
* Set a color to the task header
* @param color {string} The hex value of the color
* @returns {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'failure'
})
static tint(color: string): Promise<any> { return; }
}

View File

@@ -0,0 +1,36 @@
import { Plugin, Cordova } from './plugin';
/**
* @name LaunchReview
* @description
*
* This launches the native store app in order for the user to leave a review.
* On Android, the plugin opens the the app's storepage in the Play Store where the user can leave a review by pressing the stars to give a rating.
* On iOS, the plugin opens the app's storepage in the App Store and focuses the Review tab, where the user can leave a review by pressing "Write a review".
*
* @usage
* ```
* import { LaunchReview } from 'ionic-native';
*
* const appId: string = 'yourAppId';
* LaunchReview.launch(appId)
* .then(() => console.log('Successfully launched store app');
* ```
*/
@Plugin({
pluginName: 'LaunchReview',
plugin: 'cordova-launch-review',
pluginRef: 'LaunchReview',
repo: 'https://github.com/dpa99c/cordova-launch-review',
platforms: ['Android', 'iOS']
})
export class LaunchReview {
/**
* Launch store app using given app ID
* @returns {Promise<void>}
*/
@Cordova()
static launch(appId: string): Promise<void> { return; }
}

View File

@@ -0,0 +1,98 @@
import { Plugin, Cordova } from './plugin';
/**
* @beta
* @name NativeGeocoder
* @description
* Cordova plugin for native forward and reverse geocoding
*
* @usage
* ```typescript
* 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))
* .catch((error: any) => console.log(error));
*
* NativeGeocoder.forwardGeocode("Berlin")
* .then((coordinates: NativeGeocoderForwardResult) => console.log("The coordinates are latitude=" + coordinates.latitude + " and longitude=" + coordinates.longitude))
* .catch((error: any) => console.log(error));
* ```
* @interfaces
* NativeGeocoderReverseResult
* NativeGeocoderForwardResult
*/
@Plugin({
pluginName: 'NativeGeocoder',
plugin: 'cordova-plugin-nativegeocoder',
pluginRef: 'nativegeocoder',
repo: 'https://github.com/sebastianbaar/cordova-plugin-nativegeocoder',
platforms: ['iOS', 'Android']
})
export class NativeGeocoder {
/**
* Reverse geocode a given latitude and longitude to find location address
* @param latitude {number} The latitude
* @param longitude {number} The longitude
* @return {Promise<any>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static reverseGeocode(latitude: number, longitude: number): Promise<NativeGeocoderReverseResult> { return; }
/**
* Forward geocode a given address to find coordinates
* @param addressString {string} The address to be geocoded
* @return {Promise<any>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static forwardGeocode(addressString: string): Promise<NativeGeocoderForwardResult> { return; }
}
/**
* Encapsulates format information about a reverse geocoding result.
*/
export interface NativeGeocoderReverseResult {
/**
* The street.
*/
street: string;
/**
* The house number.
*/
houseNumber: string;
/**
* The postal code.
*/
postalCode: string;
/**
* The city.
*/
city: string;
/**
* The country name.
*/
countryName: string;
/**
* The country code.
*/
countryCode: string;
}
/**
* Encapsulates format information about a forward geocoding result.
*/
export interface NativeGeocoderForwardResult {
/**
* The latitude.
*/
latitude: string;
/**
* The longitude.
*/
longitude: string;
}

View File

@@ -0,0 +1,50 @@
import { Cordova, Plugin } from './plugin';
/**
* @beta
* @name NavigationBar
* @description
* The NavigationBar plugin can you to hide and auto hide the android navigation bar.
*
* @usage
* ```typescript
* import { NavigationBar } from 'ionic-native';
*
* let autoHide: boolean = true;
* NavigationBar.hide(autoHide);
* ```
*/
@Plugin({
pluginName: 'NavigationBar',
plugin: 'cordova-plugin-navigationbar',
pluginRef: 'navigationbar',
repo: 'https://github.com/cranberrygame/cordova-plugin-navigationbar',
platforms: ['Android']
})
export class NavigationBar {
/**
* hide automatically (or not) the navigation bar.
* @param autohide {boolean}  
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'failure'
})
static setUp(autohide?: boolean): Promise<any> { return; }
/**
* Hide the navigation bar. 
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'failure'
})
static hideNavigationBar(): Promise<any> { return; }
}

361
src/plugins/pinterest.ts Normal file
View File

@@ -0,0 +1,361 @@
import { Plugin, Cordova, CordovaProperty } from './plugin';
export interface PinterestUser {
/**
* The unique string of numbers and letters that identifies the user on Pinterest.
*/
id?: string;
/**
* The users Pinterest username.
*/
username?: string;
/**
* The users first name.
*/
first_name?: string;
/**
* The users last name.
*/
last_name?: string;
/**
* The text in the users “About you” section in their profile.
*/
bio?: string;
/**
* The date the user created their account in ISO 8601 format
*/
created_at?: string;
/**
* The users stats, including how many Pins, follows, boards and likes they have.
*/
counts?: any;
/**
* The users profile image. The response returns the images URL, width and height.
*/
image?: any;
}
export interface PinterestBoard {
/**
* The unique string of numbers and letters that identifies the board on Pinterest.
*/
id?: string;
/**
* The name of the board.
*/
name?: string;
/**
* The link to the board.
*/
url?: string;
/**
* The user-entered description of the board.
*/
description?: string;
/**
* The first and last name, ID and profile URL of the user who created the board.
*/
creator?: PinterestUser;
/**
* The date the user created the board.
*/
created_at?: string;
/**
* The boards stats, including how many Pins, followers, user's following and collaborators it has.
*/
counts?: any;
/**
* The users profile image. The response returns the images URL, width and height.
*/
image?: any;
}
export interface PinterestPin {
/**
* The unique string of numbers and letters that identifies the Pin on Pinterest.
*/
id?: string;
/**
* The URL of the webpage where the Pin was created.
*/
link?: string;
/**
* The URL of the Pin on Pinterest.
*/
url?: string;
/**
* The first and last name, ID and profile URL of the user who created the board.
*/
creator?: PinterestUser;
/**
* The board that the Pin is on.
*/
board?: PinterestBoard;
/**
* The date the Pin was created.
*/
created_at?: string;
/**
* The user-entered description of the Pin.
*/
note?: string;
/**
* The dominant color of the Pins image in hex code format.
*/
color?: string;
/**
* The Pins stats, including the number of repins, comments and likes.
*/
counts?: any;
/**
* The media type of the Pin (image or video).
*/
media?: any;
/**
* The source data for videos, including the title, URL, provider, author name, author URL and provider name.
*/
attribution?: any;
/**
* The Pins image. The default response returns the images URL, width and height.
*/
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).
*/
metadata?: any;
}
/**
* @beta
* @name Pinterest
* @description
* Cordova plugin for Pinterest
*
* @usage
* ```
* import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from 'ionic-native';
*
* const scopes = [
* Pinterest.SCOPES.READ_PUBLIC,
* Pinterest.SCOPES.WRITE_PUBLIC,
* Pinterest.SCOPES.READ_RELATIONSHIPS,
* Pinterest.SCOPES.WRITE_RELATIONSHIPS
* ];
*
* Pinterest.login(scopes)
* .then(res => console.log('Logged in!', res))
* .catch(err => console.error('Error loggin in', err));
*
* Pinterest.getMyPins()
* .then((pins: Array<PinterestPin>) => console.log(pins))
* .catch(err => console.error(err));
*
* Pinterest.getMe()
* .then((user: PinterestUser) => console.log(user));
*
* Pinterest.getMyBoards()
* .then((boards: Array<PinterestBoard>) => console.log(boards));
*
* ```
* @interfaces
* PinterestUser
* PinterestBoard
* PinterestPin
*/
@Plugin({
pluginName: 'Pinterest',
plugin: 'cordova-plugin-pinterest',
pluginRef: 'cordova.plugins.Pinterest',
repo: 'https://github.com/zyramedia/cordova-plugin-pinterest',
install: 'ionic plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
platforms: ['Android', 'iOS']
})
export class Pinterest {
/**
* Convenience constant for authentication scopes
*/
@CordovaProperty
SCOPES: {
READ_PUBLIC: string;
WRITE_PUBLIC: string;
READ_RELATIONSHIPS: string;
WRITE_RELATIONSHIPS: string;
};
/**
* Logs the user in using their Pinterest account.
* @param scopes {Array<string>} Array of scopes that you need access to. You can use Pinterest.SCOPES constant for convenience.
* @returns {Promise<any>} The response object will contain the user's profile data, as well as the access token (if you need to use it elsewhere, example: send it to your server and perform actions on behalf of the user).
*/
@Cordova()
static login(scopes: string[]): Promise<any> { return; }
/**
* Gets the authenticated user's profile
* @param fields {string} Fields to retrieve, separated by commas. Defaults to all available fields.
* @returns {Promise<PinterestUser>} Returns a promise that resolves with the user's object
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMe(fields?: string): Promise<PinterestUser> { return; }
/**
*
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<Array<PinterestPin>>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMyPins(fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
/**
*
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<Array<PinterestBoard>>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMyBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>> { return; }
/**
* Get the authenticated user's likes.
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<Array<PinterestPin>>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMyLikes(fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
/**
* Get the authenticated user's followers.
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<Array<PinterestUser>>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMyFollowers(fields?: string, limit?: number): Promise<Array<PinterestUser>> { return; }
/**
* Get the authenticated user's followed boards.
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<Array<PinterestBoard>>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMyFollowedBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>> { return; }
/**
* Get the authenticated user's followed interests.
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<any>}
*/
@Cordova({
callbackOrder: 'reverse'
})
static getMyFollowedInterests(fields?: string, limit?: number): Promise<any> { return; }
/**
* Get a user's profile.
* @param username
* @param fields
* @returns {Promise<PinterestUser>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getUser(username: string, fields?: string): Promise<PinterestUser> { return; }
/**
* Get a board's data.
* @param boardId
* @param fields
* @returns {Promise<PinterestBoard>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getBoard(boardId: string, fields?: string): Promise<PinterestBoard> { return; }
/**
* Get Pins of a specific board.
* @param boardId {string} The ID of the board
* @param fields {string} Optional fields separated by comma
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
* @returns {Promise<Array<PinterestPin>>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getBoardPins(boardId: string, fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
/**
* Delete a board.
* @param boardId {string} The ID of the board
* @returns {Promise<PinterestUser>}
*/
@Cordova()
static deleteBoard(boardId: string): Promise<any> { return; }
/**
* Create a new board for the authenticated user.
* @param name {string} Name of the board
* @param desc {string} Optional description of the board
* @returns {Promise<PinterestBoard>}
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
static createBoard(name: string, desc?: string): Promise<PinterestBoard> { return; }
/**
* Get a Pin by ID.
* @param pinId {string} The ID of the Pin
* @param fields {string} Optional fields separated by comma
* @returns {Promise<PinterestPin>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static getPin(pinId: string, fields?: string): Promise<PinterestPin> { return; }
/**
* Deletes a pin
* @param pinId {string} The ID of the pin
* @returns {Promise<any>}
*/
@Cordova()
static deletePin(pinId: string): Promise<any> { return; }
/**
* Creates a Pin
* @param note {string} Note/Description of the pin
* @param boardId {string} Board ID to put the Pin under
* @param imageUrl {string} URL of the image to share
* @param link {string} Optional link to share
* @returns {Promise<PinterestPin>}
*/
@Cordova({
successIndex: 4,
errorIndex: 5
})
static createPin(note: string, boardId: string, imageUrl: string, link?: string): Promise<PinterestPin> { return; }
}

View File

@@ -4,6 +4,98 @@ import { Observable } from 'rxjs/Observable';
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;
/**
* Set to true if the wrapped method returns a promise
*/
otherPromise?: boolean;
/**
* Supported platforms
*/
platforms?: string[];
}
/**
* @private
* @param pluginRef
@@ -303,7 +395,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
@@ -320,6 +412,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
};
};
/**
* @private
*
@@ -339,7 +432,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
* }
* ```
*/
export function Plugin(config) {
export function Plugin(config: PluginConfig) {
return function(cls) {
// Add these fields to the class
@@ -375,7 +468,7 @@ export function Plugin(config) {
* 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[]) {
@@ -407,9 +500,9 @@ export function CordovaInstance(opts: any = {}) {
* Before calling the original method, ensure Cordova and the plugin are installed.
*/
export function CordovaProperty(target: any, key: string) {
const pluginInstance = getPlugin(target.pluginRef);
const exists = () => {
if (!pluginInstance || pluginInstance[key] === 'undefined') {
let pluginInstance = getPlugin(target.pluginRef);
if (!pluginInstance || typeof pluginInstance[key] === 'undefined') {
pluginWarn(target, key);
return false;
}
@@ -419,14 +512,14 @@ export function CordovaProperty(target: any, key: string) {
Object.defineProperty(target, key, {
get: () => {
if (exists()) {
return pluginInstance[key];
return getPlugin(target.pluginRef)[key];
} else {
return null;
}
},
set: (value) => {
if (exists()) {
pluginInstance[key] = value;
getPlugin(target.pluginRef)[key] = value;
}
}
});

View File

@@ -110,6 +110,25 @@ export interface PushNotification {
unregister(successHandler: () => any, errorHandler?: () => any): void;
/**
* The subscribe method is used when the application wants to subscribe a new topic to receive push notifications.
* @param {string} topic: Topic to subscribe to.
* @param successHandler
* @param errorHandler
*/
subscribe(topic: string, successHandler: () => any, errorHandler?: () => any): void;
/**
* The unsubscribe method is used when the application no longer wants to receive push notifications
* from a specific topic but continue to receive other push messages.
* @param {string} topic: Topic to subscribe to.
* @param successHandler
* @param errorHandler
*/
unsubscribe(topic: string, successHandler: () => any, errorHandler?: () => any): void;
/**
* iOS & android only
*
* Set the badge count visible when the app is not running
*
* The count is an integer indicating what number should show up in the badge.
@@ -121,6 +140,8 @@ export interface PushNotification {
*/
setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count?: number): void;
/**
* iOS only
*
* Get the current badge count visible when the app is not running
* successHandler gets called with an integer which is the current badge count
* @param successHandler
@@ -130,6 +151,7 @@ export interface PushNotification {
/**
* iOS only
*
* Tells the OS that you are done processing a background push notification.
* successHandler gets called when background push processing is successfully completed.
* @param successHandler
@@ -137,6 +159,16 @@ export interface PushNotification {
* @param id
*/
finish(successHandler: () => any, errorHandler: () => any, id?: string): void;
/**
* iOS & android only
*
* Tells the OS to clear all notifications from the Notification Center.
* successHandler gets called when the api successfully clears the notifications
* @param successHandler
* @param errorHandler
*/
clearAllNotifications(successHandler: () => any, errorHandler: () => any): void;
}
export interface IOSPushOptions {

34
src/plugins/rollbar.ts Normal file
View File

@@ -0,0 +1,34 @@
import { Plugin, Cordova } from './plugin';
/**
* @beta
* @name Rollbar
* @description
* This plugin adds Rollbar App monitoring to your application
*
* @usage
* ```
* import { Rollbar } from 'ionic-native';
*
* Rollbar.init();
*
* ```
*/
@Plugin({
pluginName: 'Rollbar',
plugin: 'resgrid-cordova-plugins-rollbar',
pluginRef: 'Rollbar',
repo: 'https://github.com/Resgrid/cordova-plugins-rollbar',
platforms: ['Android', 'iOS'],
install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"'
})
export class Rollbar {
/**
* This function initializes the monitoring of your application
* @return {Promise<any>} Returns a promise that resolves when the plugin successfully initializes
*/
@Cordova()
static init(): Promise<any> { return; }
}

View File

@@ -49,9 +49,10 @@ 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.
* @returns {Promise<any>} returns a promise that resolves when the screen orientation is locked, and rejects when an error occurs.
*/
@Cordova({ sync: true })
static lockOrientation(orientation: string): void { }
@Cordova({ otherPromise: true })
static lockOrientation(orientation: string): Promise<string> { return; }
/**
* Unlock and allow all orientations.

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

@@ -0,0 +1,111 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
declare var serial: any;
export interface SerialPermissionOptions {
vid: string;
pid: string;
driver: string;
}
export interface SerialOpenOptions {
baudRate: number;
}
/**
* @name Serial
* @description
* This plugin provides functions for working with Serial connections
*
* @usage
*
* ```
* import { Serial } from 'ionic-native';
*
* Serial.requestPermission({
* vid: '0403',
* pid: '6001',
* driver: 'FtdiSerialDriver'
* }).then(() => {
* Serial.open({
* baudRate: 38400
* }).then(() => {
* console.log('Serial connection opened');
* });
* }).catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
pluginName: 'Serial',
plugin: 'cordovarduino',
pluginRef: 'serial',
repo: 'https://github.com/xseignard/cordovarduino',
platforms: ['Android']
})
export class Serial {
/**
* Request permission to connect to a serial device
*
* @param options {SerialPermissionOptions} Options used to request serial permissions
* @return {Promise<any>} Returns a promise that resolves when permissions are granted
*/
@Cordova()
static requestPermission(options: SerialPermissionOptions): Promise<any> { return; }
/**
* Open connection to a serial device
*
* @param options {SerialOpenOptions} Options used to open serial connection
* @return {Promise<any>} Returns a promise that resolves when the serial connection is opened
*/
@Cordova()
static open(options: SerialOpenOptions): Promise<any> { return; }
/**
* Write to a serial connection
*
* @param data {any} data to write to the serial connection
* @return {Promise<any>} Returns a promise that resolves when the write is complete
*/
@Cordova()
static write(data: any): Promise<any> { return; }
/**
* Write hex to a serial connection
*
* @param data {any} data to write to the serial connection
* @return {Promise<any>} Returns a promise that resolves when the write is complete
*/
@Cordova()
static writeHex(data: any): Promise<any> { return; }
/**
* Read from a serial connection
*
* @return {Promise<any>} Returns a promise that resolves with data read from the serial connection
*/
@Cordova()
static read(): Promise<any> { return; }
/**
* Watch the incoming data from the serial connection. Clear the watch by unsubscribing from the observable
*
* @returns {Observable<any>} Observable returns an observable that you can subscribe to
*/
@Cordova({
observable: true
})
static registerReadCallback(): Observable<any> { return; }
/**
* Close the serial connection
*
* @return {Promise<any>} Returns a promise that resolves when the serial connection is closed
*/
@Cordova()
static close(): Promise<any> { return; }
}

View File

@@ -0,0 +1,157 @@
import { Plugin, Cordova } from './plugin';
import { Observable } from 'rxjs/Observable';
export type SpeechRecognitionListeningOptions = SpeechRecognitionListeningOptionsIOS | SpeechRecognitionListeningOptionsAndroid;
export interface SpeechRecognitionListeningOptionsIOS {
/**
* used language for recognition (default `"en-US"`)
*/
language?: string;
/**
* umber of return matches (default `5`)
*/
matches?: number;
/**
* Allow partial results to be returned (default `false`)
*/
showPartial?: boolean;
}
export interface SpeechRecognitionListeningOptionsAndroid {
/**
* used language for recognition (default `"en-US"`)
*/
language?: string;
/**
* number of return matches (maximum number of matches)
*/
matches?: number;
/**
* displayed prompt of listener popup window
*/
prompt?: string;
/**
* display listener popup window with prompt (default `true`)
*/
showPopup?: boolean;
}
/**
* @beta
* @name SpeechRecognition
* @description
* This plugin does speech recognition using cloud services
*
* @usage
* ```
* import { SpeechRecognition } from 'ionic-native';
*
* // Check feature available
* SpeechRecognition.isRecognitionAvailable()
* .then((available: boolean) => console.log(available))
*
* // Start the recognition process
* SpeechRecognition.startListening(options)
* .subscribe(
* (matches: Array<string>) => console.log(matches),
* (onerror) => console.log('error:', onerror)
* )
*
* // Stop the recognition process (iOS only)
* SpeechRecognition.stopListening()
*
* // Get the list of supported languages
* SpeechRecognition.getSupportedLanguages()
* .then(
* (languages: Array<string>) => console.log(languages),
* (error) => console.log(error)
* )
*
* // Check permission
* SpeechRecognition.hasPermission()
* .then((hasPermission: boolean) => console.log(hasPermission))
*
* // Request permissions
* SpeechRecognition.requestPermission()
* .then(
* () => console.log('Granted'),
* () => console.log('Denied')
* )
*
* ```
*/
@Plugin({
pluginName: 'SpeechRecognition',
plugin: 'cordova-plugin-speechrecognition',
pluginRef: 'plugins.speechRecognition',
repo: 'https://github.com/pbakondy/cordova-plugin-speechrecognition',
platforms: ['Android', 'iOS']
})
export class SpeechRecognition {
/**
* Check feature available
* @return {Promise<boolean>}
*/
@Cordova()
static isRecognitionAvailable(): Promise<boolean> {
return;
}
/**
* Start the recognition process
* @return {Promise< Array<string> >} list of recognized terms
*/
@Cordova({
callbackOrder: 'reverse',
observable: true,
})
static startListening(options?: SpeechRecognitionListeningOptions): Observable<Array<string>> {
return;
}
/**
* Stop the recognition process
*/
@Cordova({
platforms: ['iOS']
})
static stopListening(): Promise<void> {
return;
}
/**
* Get the list of supported languages
* @return {Promise< Array<string> >} list of languages
*/
@Cordova()
static getSupportedLanguages(): Promise<Array<string>> {
return;
}
/**
* Check permission
* @return {Promise<boolean>} has permission
*/
@Cordova()
static hasPermission(): Promise<boolean> {
return;
}
/**
* Request permissions
* @return {Promise<void>}
*/
@Cordova()
static requestPermission(): Promise<void> {
return;
}
}

106
src/plugins/stripe.ts Normal file
View File

@@ -0,0 +1,106 @@
import {Plugin, Cordova} from './plugin';
export interface StripeCardTokenParams {
/**
* Card number
*/
number: string;
/**
* Expiry month
*/
expMonth: number;
/**
* Expiry year
*/
expYear: number;
/**
* CVC / CVV
*/
cvc?: string;
/**
* Cardholder name
*/
name?: string;
/**
* Address line 1
*/
address_line1?: string;
/**
* Address line 2
*/
address_line2?: string;
/**
* City
*/
address_city?: string;
/**
* State / Province
*/
address_state?: string;
/**
* Country
*/
address_country?: string;
/**
* Postal code / ZIP Code
*/
postal_code?: string;
/**
* 3-letter ISO code for currency
*/
currency?: string;
}
/**
* @beta
* @name Stripe
* @description
* A plugin that allows you to use Stripe's Native SDKs for Android and iOS.
*
* @usage
* ```
* import { Stripe } from 'ionic-native';
*
* Stripe.setPublishableKey('my_publishable_key');
*
* let card = {
* number: '4242424242424242',
* expMonth: 12,
* expYear: 2020,
* cvc: 220
* };
*
* Stripe.createToken(card)
* .then(token => console.log(token))
* .catch(error => console.error(error));
*
* ```
*
* @interfaces
* StripeCardTokenParams
*/
@Plugin({
pluginName: 'Stripe',
plugin: 'cordova-plugin-stripe',
pluginRef: 'cordova.plugins.stripe',
repo: 'https://github.com/zyramedia/cordova-plugin-stripe'
})
export class Stripe {
/**
* Set publishable key
* @param publishableKey {string} Publishable key
* @return {Promise<void>}
*/
@Cordova()
static setPublishableKey(publishableKey: string): Promise<void> { return; }
/**
* Create Credit Card Token
* @param params {StripeCardTokenParams} Credit card information
* @return {Promise<string>} returns a promise that resolves with the token, or reject with an error
*/
@Cordova()
static createCardToken(params: StripeCardTokenParams): Promise<string> { return; }
}

View File

@@ -9,6 +9,7 @@ window.plugins = {
};
const testPluginMeta = {
pluginName: 'Test',
plugin: 'cordova-plugin-test',
pluginRef: 'plugins.test',
repo: 'https://github.com/apache/cordova-plugin-test',

View File

@@ -0,0 +1,40 @@
import { GoogleMapsLatLngBounds, GoogleMapsLatLng } from '../../src/plugins/googlemap';
declare var window: any;
class LatLngBounds {
public southwest: GoogleMapsLatLng;
public northeast: GoogleMapsLatLng;
constructor(latLngArray: GoogleMapsLatLng[]) {
this.southwest = latLngArray[0];
this.northeast = latLngArray[1];
}
}
window.plugin = {
google: {
maps: {
LatLngBounds
}
}
};
describe('GoogleMapsLatLngBounds', () => {
const southwest = new GoogleMapsLatLng(1,1);
const northeast = new GoogleMapsLatLng(4,4);
let object;
it('should create an object', () => {
object = new GoogleMapsLatLngBounds([southwest, northeast]);
expect(object).toBeDefined();
});
it('northwest property should be defined', () => expect(object.northeast).toBeDefined());
it('southwest property should be defined', () => expect(object.southwest).toBeDefined());
});