Merge pull request #47 from driftyco/add-plugins

Add plugins
This commit is contained in:
Ibrahim Hadeed 2016-03-13 15:23:07 -04:00
commit 21dba101f1
5 changed files with 284 additions and 0 deletions

View File

@ -0,0 +1,31 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
* @platforms Android, iOS, Windows Phone
* @usage
* ```ts
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
* res => console.log("Saved image to gallery ", res),
* err => console.log("Error saving image to gallery ", err)
* );
* ```
*/
@Plugin({
plugin: 'cordova-base64-to-gallery',
pluginRef: 'cordova',
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery'
})
export class Base64ToGallery {
/**
*
* @param data
* @param prefix
*/
@Cordova()
base64ToGallery(data : string , prefix? : string ) : Promise<any> {
return
}
}

67
src/plugins/dbmeter.ts Normal file
View File

@ -0,0 +1,67 @@
import {Plugin, Cordova} from './plugin'
import {Observable} from "rxjs/Observable";
/**
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
* @platforms Android, iOS
* @usage
* ```ts
* // Start listening
* let subscription = DBMeter.start().subscribe(
* data => console.log(data)
* );
*
* // Check if we are listening
* DBMeter.isListening().then(
* (isListening : boolean) => console.log(isListening)
* );
*
* // Stop listening
* subscription.unsubscribe();
*
* // Delete DBMeter instance from memory
* DBMeter.delete().then(
* () => console.log("Deleted DB Meter instance"),
* error => console.log("Error occurred while deleting DB Meter instance")
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-dbmeter',
pluginRef: 'DBMeter',
repo: 'https://github.com/akofman/cordova-plugin-dbmeter'
})
export class DBMeter {
/**
* Starts listening
* @return {Observable<string>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
*/
@Cordova({
observable: true,
clearFunction: 'stop'
})
static start () : Observable<any> {return}
/**
* Stops listening
* @private
*/
@Cordova()
static stop () : Promise<any> {return}
/**
* Check if the DB Meter is listening
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
*/
@Cordova()
static isListening() : Promise<boolean> {return}
/**
* Delete the DB Meter instance
* @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/
@Cordova()
static delete() : Promise<any> {return}
}

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

@ -0,0 +1,100 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Hotspot
* @description
* @platforms Android
* @usage
*/
@Plugin({
plugin: 'cordova-plugin-hotspot',
pluginRef: 'cordova.plugnis.hotspot',
repo: 'https://github.com/hypery2k/cordova-hotspot-plugin'
})
export class Hotspot {
@Cordova()
static isAvailable() : Promise<boolean> {return}
@Cordova()
static toggleWifi() : Promise<any> {return}
@Cordova()
static createHotspot(ssid : string, mode : string, password : string) : Promise<any> {return}
@Cordova()
static startHotspot() : Promise<any> {return}
@Cordova()
static configureHotspot(ssid : string, mode : string, password : string) : Promise<any> {return}
@Cordova()
static stopHotspot() : Promise<any> {return}
@Cordova()
static isHotspotEnabled() : Promise<any> {return}
@Cordova()
static getAllHotspotDevices() : Promise<any> {return}
@Cordova()
static connectToHotspot(ssid, password) : Promise<any> {return}
@Cordova()
static connectToWifiAuthEncrypt(ssid, password, authentication, encryption) : Promise<any> {return}
@Cordova()
static addWifiNetwork(ssid, mode, password) : Promise<any> {return}
@Cordova()
static removeWifiNetwork(ssid) : Promise<any> {return}
@Cordova()
static isConnectedToInternet() : Promise<any> {return}
@Cordova()
static isConnectedToInternetViaWifi() : Promise<any> {return}
@Cordova()
static isWifiOn() : Promise<any> {return}
@Cordova()
static isWifiSupported() : Promise<any> {return}
@Cordova()
static isWifiDirectSupported() : Promise<any> {return}
@Cordova()
static scanWifi() : Promise<any> {return}
@Cordova()
static scanWifiByLevel() : Promise<any> {return}
@Cordova()
static startPeriodicallyScan(interval, duration) : Promise<any> {return}
@Cordova()
static stopPeriodicallyScan() : Promise<any> {return}
@Cordova()
static getNetConfig() : Promise<any> {return}
@Cordova()
static getConnectionInfo() : Promise<any> {return}
@Cordova()
static pingHost(ip) : Promise<any> {return}
@Cordova()
static getMacAddressOfHost(ip) : Promise<any> {return}
@Cordova()
static isDnsLive(ip) : Promise<any> {return}
@Cordova()
static isPortLife(ip) : Promise<any> {return}
@Cordova()
static isRooted() : Promise<any> {return}
}

50
src/plugins/keyboard.ts Normal file
View File

@ -0,0 +1,50 @@
import {Cordova, Plugin} from './plugin'
import {Observable} from "rxjs/Observable";
@Plugin({
plugin: 'ionic-plugin-keyboard',
pluginRef: 'cordova.plugins.Keyboard',
repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
})
export class Keyboard {
/**
* Hide the keyboard accessory bar with the next, previous and done buttons.
* @param hide {boolean}
*/
@Cordova({
sync: true
})
static hideKeyboardAccessoryBar(hide : boolean) : void {}
/**
* Close the keyboard if open
*/
@Cordova({
sync: true
})
static close() : void {}
@Cordova({
sync: true
})
static disableScroll(disable : boolean) : void {}
@Cordova({
sync: true
})
static show() : void {}
@Cordova({
sync: true
})
static close() : void {}
//static onKeyboardShow() : Observable<any> {
// return new Observable(
// observer => {
//
// }
// );
//}
}

View File

@ -0,0 +1,36 @@
import {Plugin, Cordova} from './plugin'
/**
* @name Splashscreen
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
* @usage
* ```ts
* Splashscreen.show();
*
* Splashscreen.hide();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-splashscreen',
pluginRef: 'navigator.splashscreen',
repo: 'https://github.com/apache/cordova-plugin-splashscreen'
})
export class Splashscreen {
/**
* Shows the splashscreen
*/
@Cordova({
sync: true
})
static show() : void {}
/**
* Hides the splashscreen
*/
@Cordova({
sync: true
})
static hide() : void {}
}