mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
Merge branch 'master' of github.com:driftyco/ionic-native
This commit is contained in:
commit
2f89ae0e84
15
src/index.ts
15
src/index.ts
@ -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';
|
||||
@ -69,6 +71,7 @@ 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';
|
||||
@ -95,10 +98,12 @@ 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';
|
||||
@ -128,6 +133,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';
|
||||
@ -135,6 +141,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';
|
||||
@ -185,6 +192,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';
|
||||
@ -212,10 +220,12 @@ 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';
|
||||
@ -247,12 +257,14 @@ window['IonicNative'] = {
|
||||
Badge,
|
||||
BackgroundGeolocation,
|
||||
BackgroundMode,
|
||||
Backlight,
|
||||
BarcodeScanner,
|
||||
Base64ToGallery,
|
||||
BatteryStatus,
|
||||
Brightness,
|
||||
BLE,
|
||||
BluetoothSerial,
|
||||
Broadcaster,
|
||||
Calendar,
|
||||
CallNumber,
|
||||
Camera,
|
||||
@ -302,6 +314,7 @@ window['IonicNative'] = {
|
||||
IsDebug,
|
||||
Keyboard,
|
||||
LaunchNavigator,
|
||||
LaunchReview,
|
||||
LocalNotifications,
|
||||
LocationAccuracy,
|
||||
Market,
|
||||
@ -328,6 +341,7 @@ window['IonicNative'] = {
|
||||
SafariViewController,
|
||||
Screenshot,
|
||||
SecureStorage,
|
||||
Serial,
|
||||
Shake,
|
||||
Sim,
|
||||
SMS,
|
||||
@ -336,6 +350,7 @@ window['IonicNative'] = {
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
SpeechRecognition,
|
||||
Stepcounter,
|
||||
StreamingMedia,
|
||||
Stripe,
|
||||
|
44
src/plugins/backlight.ts
Normal file
44
src/plugins/backlight.ts
Normal 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; }
|
||||
|
||||
}
|
51
src/plugins/broadcaster.ts
Normal file
51
src/plugins/broadcaster.ts
Normal 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; }
|
||||
|
||||
}
|
36
src/plugins/launch-review.ts
Normal file
36
src/plugins/launch-review.ts
Normal 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; }
|
||||
|
||||
}
|
111
src/plugins/serial.ts
Normal file
111
src/plugins/serial.ts
Normal 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; }
|
||||
|
||||
}
|
156
src/plugins/speech-recognition.ts
Normal file
156
src/plugins/speech-recognition.ts
Normal file
@ -0,0 +1,156 @@
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user