mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c3bb41387 | ||
|
|
a9f6cd42e4 | ||
|
|
8cd648db5c | ||
|
|
f3407e5582 | ||
|
|
d845519361 | ||
|
|
26db2cfcf9 | ||
|
|
d0c0413140 | ||
|
|
234165c294 | ||
|
|
9bf4ee3fac | ||
|
|
f8df8769c9 | ||
|
|
510cea67b7 | ||
|
|
55d6d11721 |
@@ -1,4 +1,4 @@
|
||||
[](https://circleci.com/gh/driftyco/ionic-native) [](http://commitizen.github.io/cz-cli/)
|
||||
[](https://circleci.com/gh/ionic-team/ionic-native) [](http://commitizen.github.io/cz-cli/)
|
||||
[](https://www.npmjs.com/package/ionic-native)
|
||||
|
||||
[](https://nodei.co/npm/ionic-native/)
|
||||
@@ -81,7 +81,7 @@ npm install ionic-native --save
|
||||
|
||||
|
||||
## Plugin Missing?
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
|
||||
|
||||
# Credits
|
||||
|
||||
5915
package-lock.json
generated
Normal file
5915
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@
|
||||
"tsify": "~3.0.0",
|
||||
"tslint": "^3.15.1",
|
||||
"tslint-ionic-rules": "0.0.7",
|
||||
"typescript": "2.0.09",
|
||||
"typescript": "2.0.9",
|
||||
"watchify": "~3.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -98,6 +98,7 @@ import { OneSignal } from './plugins/onesignal';
|
||||
import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||
import { PayPal } from './plugins/pay-pal';
|
||||
import { Pedometer } from './plugins/pedometer';
|
||||
import { PhotoLibrary } from './plugins/photo-library';
|
||||
import { PinDialog } from './plugins/pin-dialog';
|
||||
import { Pinterest } from './plugins/pinterest';
|
||||
@@ -229,6 +230,7 @@ export * from './plugins/network';
|
||||
export * from './plugins/nfc';
|
||||
export * from './plugins/onesignal';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/pedometer';
|
||||
export * from './plugins/photo-library';
|
||||
export * from './plugins/photo-viewer';
|
||||
export * from './plugins/pin-dialog';
|
||||
@@ -361,6 +363,7 @@ window['IonicNative'] = {
|
||||
NavigationBar,
|
||||
Network,
|
||||
PayPal,
|
||||
Pedometer,
|
||||
PhotoLibrary,
|
||||
NFC,
|
||||
Printer,
|
||||
|
||||
@@ -423,4 +423,15 @@ export class BLE {
|
||||
@Cordova()
|
||||
static enable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Read the RSSI value on the device connection.
|
||||
*
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
*
|
||||
*@returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static readRSSI(
|
||||
deviceId: string,
|
||||
): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -1,24 +1,50 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface CameraPreviewRect {
|
||||
|
||||
x: number;
|
||||
|
||||
y: number;
|
||||
|
||||
width: number;
|
||||
|
||||
height: number;
|
||||
export interface CameraPreviewDimensions {
|
||||
/** The width of the camera preview, default to window.screen.width */
|
||||
width?: number;
|
||||
|
||||
/** The height of the camera preview, default to window.screen.height */
|
||||
height?: number;
|
||||
}
|
||||
|
||||
export interface CameraPreviewSize {
|
||||
export interface CameraPreviewOptions {
|
||||
/** The left edge in pixels, default 0 */
|
||||
x?: number;
|
||||
|
||||
maxWidth: number;
|
||||
/** The top edge in pixels, default 0 */
|
||||
y?: number;
|
||||
|
||||
maxHeight: number;
|
||||
/** The width in pixels, default window.screen.width */
|
||||
width?: number;
|
||||
|
||||
/** The height in pixels, default window.screen.height */
|
||||
height?: number;
|
||||
|
||||
/** Choose the camera to use 'front' or 'rear', default 'front' */
|
||||
camera?: string;
|
||||
|
||||
/** Tap to take a photo, default true (picture quality by default : 85) */
|
||||
tapPhoto?: boolean;
|
||||
|
||||
/** Preview box drag across the screen, default 'false' */
|
||||
previewDrag?: boolean;
|
||||
|
||||
/** Preview box to the back of the webview (true => back, false => front) , default false */
|
||||
toBack?: boolean;
|
||||
|
||||
/** Alpha channel of the preview box, float, [0,1], default 1 */
|
||||
alpha?: number;
|
||||
}
|
||||
|
||||
export interface PictureOptions {
|
||||
/** The width in pixels, default 0 */
|
||||
width?: number;
|
||||
/** The height in pixels, default 0 */
|
||||
height?: number;
|
||||
/** The picture quality, 0 - 100, default 85 */
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,45 +52,52 @@ export interface CameraPreviewSize {
|
||||
* @name CameraPreview
|
||||
* @description
|
||||
* Showing camera preview in HTML
|
||||
*
|
||||
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
*
|
||||
* Requires Cordova plugin: `https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git`. For more info, please see the [Cordova Camera Preview docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { CameraPreview, CameraPreviewRect } from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions, } from 'ionic-native';
|
||||
*
|
||||
* // camera options (Size and location)
|
||||
* let cameraRect: CameraPreviewRect = {
|
||||
* x: 100,
|
||||
* y: 100,
|
||||
* width: 200,
|
||||
* height: 200
|
||||
* // camera options (Size and location). In the following example, the preview uses the rear camera and display the preview in the back of the webview
|
||||
* public cameraPreviewOpts: CameraPreviewOptions = {
|
||||
* x: 0,
|
||||
* y: 0,
|
||||
* width: window.screen.width,
|
||||
* height: window.screen.height,
|
||||
* camera: 'rear',
|
||||
* tapPhoto: true,
|
||||
* previewDrag: true,
|
||||
* toBack: true,
|
||||
* alpha: 1
|
||||
* };
|
||||
*
|
||||
*
|
||||
* // start camera
|
||||
* CameraPreview.startCamera(
|
||||
* cameraRect, // position and size of preview
|
||||
* 'front', // default camera
|
||||
* true, // tap to take picture
|
||||
* false, // disable drag
|
||||
* false, // keep preview in front. Set to true (back of the screen) to apply overlaying elements
|
||||
* 1 // set the preview alpha
|
||||
* );
|
||||
*
|
||||
* // Set the handler to run every time we take a picture
|
||||
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
|
||||
* console.log(result);
|
||||
* // do something with the result
|
||||
* });
|
||||
* CameraPreview.startCamera(this.cameraPreviewOpts).then(
|
||||
* (res) => {
|
||||
* console.log(res)
|
||||
* },
|
||||
* (err) => {
|
||||
* console.log(err)
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // picture options
|
||||
* public pictureOpts: PictureOptions = {
|
||||
* width: 1280,
|
||||
* height: 1280,
|
||||
* quality: 85
|
||||
* }
|
||||
*
|
||||
* // take a picture
|
||||
* CameraPreview.takePicture({
|
||||
* maxWidth: 640,
|
||||
* maxHeight: 640
|
||||
* CameraPreview.takePicture(this.pictureOpts).then((imageData) => {
|
||||
* this.picture = 'data:image/jpeg;base64,' + imageData;
|
||||
* }, (err) => {
|
||||
* console.log(err);
|
||||
* this.picture = 'assets/img/test.jpg';
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Switch camera
|
||||
* CameraPreview.switchCamera();
|
||||
*
|
||||
@@ -77,96 +110,119 @@ export interface CameraPreviewSize {
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* CameraPreviewRect
|
||||
* CameraPreviewSize
|
||||
* CameraPreviewOptions
|
||||
* PictureOptions
|
||||
* CameraPreviewDimensions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CameraPreview',
|
||||
plugin: 'cordova-plugin-camera-preview',
|
||||
pluginRef: 'cordova.plugins.camerapreview',
|
||||
pluginRef: 'CameraPreview',
|
||||
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class CameraPreview {
|
||||
|
||||
/**
|
||||
* Starts the camera preview instance.
|
||||
* @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number}
|
||||
* @param {string} which camera to use - 'front' | 'back'
|
||||
* @param {boolean} enable tap to take picture
|
||||
* @param {boolean} enable preview box drag across the screen
|
||||
* @param {boolean} send preview box to the back of the webview
|
||||
* @param {number} alpha of the preview box
|
||||
* Starts the camera preview instance. (iOS & Android)
|
||||
* @param {CameraPreviewOptions} options
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }
|
||||
static startCamera(options: CameraPreviewOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stops the camera preview instance.
|
||||
* Stops the camera preview instance. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static stopCamera(): void { }
|
||||
static stopCamera(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Take the picture, the parameter size is optional
|
||||
* @param {CameraPreviewSize} optional - size of the picture to take
|
||||
* Switch from the rear camera and front camera, if available. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static takePicture(size?: CameraPreviewSize): void { }
|
||||
static switchCamera(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Register a callback function that receives the original picture and the image captured from the preview box.
|
||||
* @returns {Observable<any>}
|
||||
* Hide the camera preview box. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static setOnPictureTakenHandler(): Observable<any> { return; }
|
||||
static hide(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Switch from the rear camera and front camera, if available.
|
||||
* Show the camera preview box. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static switchCamera(): void { }
|
||||
static show(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the camera preview box.
|
||||
* Take the picture (base64), the parameter size is optional (iOS & Android)
|
||||
* @param {PictureOptions} optional - size and quality of the picture to take
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static show(): void { }
|
||||
static takePicture(opts?: PictureOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Hide the camera preview box.
|
||||
*
|
||||
* Set camera color effect. (iOS partial & Android)
|
||||
* @static
|
||||
* @param {string} effect name : 'none' (iOS & Android), 'aqua' (Android), 'blackboard' (Android), 'mono' (iOS & Android), 'negative' (iOS & Android), 'posterize' (iOS & Android), 'sepia' (iOS & Android), 'solarize' (Android) or 'whiteboard' (Android)
|
||||
*
|
||||
* @memberOf CameraPreview
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static hide(): void { }
|
||||
static setColorEffect(effect: string): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Disables the camera preview
|
||||
* Set the zoom (Android)
|
||||
* @param Zoom value (integer)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static disable(): void { }
|
||||
static setZoom(zoom?: number): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
* Set the preview Size (Android)
|
||||
* @param dimensions
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static setColorEffect(effect: string): void { }
|
||||
static setPreviewSize(dimensions?: CameraPreviewDimensions): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Set the flashmode (iOS partial & Android)
|
||||
* @param flashMode 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static setFlashMode(flashMode?: string): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
|
||||
*
|
||||
* Diagnostic.getBluetoothState()
|
||||
* .then((state) => {
|
||||
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
|
||||
* if (state == Diagnostic.bluetoothState.POWERED_ON){
|
||||
* // do something
|
||||
* } else {
|
||||
* // do something else
|
||||
|
||||
@@ -112,7 +112,6 @@ export const GoogleMapsMapTypeId = {
|
||||
* marker.showInfoWindow();
|
||||
* });
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -273,11 +273,11 @@ export class Health {
|
||||
* To be sure to get all the stored quantities, it's better to query single nutrients.
|
||||
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
|
||||
*
|
||||
* @param queryOptionsAggregated
|
||||
* @return {Promise<HealthData>}
|
||||
* @param queryOptionsAggregated {HealthQueryOptionsAggregated}
|
||||
* @return {Promise<HealthData[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
static queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData> {
|
||||
static queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData[]> {
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ export interface MusicControlsOptions {
|
||||
hasPrev: boolean;
|
||||
hasNext: boolean;
|
||||
hasClose: boolean;
|
||||
album:string;
|
||||
duration: number;
|
||||
elapsed:number;
|
||||
ticker: string;
|
||||
}
|
||||
|
||||
@@ -38,6 +41,11 @@ export interface MusicControlsOptions {
|
||||
* hasNext : false, // show next button, optional, default: true
|
||||
* hasClose : true, // show close button, optional, default: false
|
||||
*
|
||||
* // iOS only, optional
|
||||
* album : 'Absolution' // optional, default: ''
|
||||
* duration : 60, // optional, default: 0
|
||||
* elapsed : 10, // optional, default: 0
|
||||
*
|
||||
* // Android only, optional
|
||||
* // text displayed in the status bar when the notification (and the ticker) are updated
|
||||
* ticker : 'Now playing "Time is Running Out"'
|
||||
@@ -129,7 +137,13 @@ export class MusicControls {
|
||||
* Toggle play/pause:
|
||||
* @param isPlaying {boolean}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova()
|
||||
static updateIsPlaying(isPlaying: boolean): void {}
|
||||
|
||||
/**
|
||||
* Toggle dismissable:
|
||||
* @param dismissable {boolean}
|
||||
*/
|
||||
@Cordova()
|
||||
static updateDismissable(dismissable: boolean): void {}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from 'ionic-native';
|
||||
*
|
||||
* NativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
|
||||
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.address + " in " + result.countryCode))
|
||||
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.street + " in " + result.countryCode))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* NativeGeocoder.forwardGeocode("Berlin")
|
||||
|
||||
103
src/plugins/pedometer.ts
Normal file
103
src/plugins/pedometer.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* Interface of a pedometer data object which is returned by watching for new data or by recieving historical data
|
||||
*/
|
||||
|
||||
export interface IPedometerData {
|
||||
startDate?: number;
|
||||
endDate?: number;
|
||||
numberOfSteps: number;
|
||||
distance: number;
|
||||
floorsAscended: number;
|
||||
floorsDescended: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Pedometer
|
||||
* @description
|
||||
* Fetch pedestrian-related pedometer data,
|
||||
* such as step counts and other information about the distance travelled.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Pedometer } from 'ionic-native';
|
||||
*
|
||||
* Pedometer.isDistanceAvailable()
|
||||
* .then((available: boolean) => console.log(available))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* Pedometer.startPedometerUpdates()
|
||||
* .subscribe((data: IPedometerData) => {
|
||||
* console.log(data);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Pedometer',
|
||||
plugin: 'cordova-plugin-pedometer',
|
||||
pluginRef: 'pedometer',
|
||||
repo: 'https://github.com/leecrossley/cordova-plugin-pedometer',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Pedometer {
|
||||
|
||||
/**
|
||||
* Checks if step counting is available. Only works on iOS.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
|
||||
*/
|
||||
@Cordova()
|
||||
static isStepCountingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Distance estimation indicates the ability to use step information to supply the approximate distance travelled by the user.
|
||||
* This capability is not supported on all devices, even with iOS 8.
|
||||
* Only works on iOS.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
|
||||
*/
|
||||
@Cordova()
|
||||
static isDistanceAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Floor counting indicates the ability to count the number of floors the user walks up or down using stairs.
|
||||
* This capability is not supported on all devices, even with iOS 8.
|
||||
* Only works on iOS.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
|
||||
*/
|
||||
@Cordova()
|
||||
static isFloorCountingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Starts the delivery of recent pedestrian-related data to your Cordova app.
|
||||
*
|
||||
* When the app is suspended, the delivery of updates stops temporarily.
|
||||
* Upon returning to foreground or background execution, the pedometer object begins updates again.
|
||||
* @return {Observable<IPedometerData>} Returns a Observable that recieves repeatly data from pedometer in background.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopPedometerUpdates'
|
||||
})
|
||||
static startPedometerUpdates(): Observable<IPedometerData> { return; }
|
||||
|
||||
/**
|
||||
* Stops the delivery of recent pedestrian data updates to your Cordova app.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when pedometer watching was stopped
|
||||
*/
|
||||
@Cordova()
|
||||
static stopPedometerUpdates(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Retrieves the data between the specified start and end dates.
|
||||
* The startDate and endDate options are required and can be constructed in any valid JavaScript way
|
||||
* (e.g. new Date(2015, 4, 1, 15, 20, 00) is also valid, as is milliseconds).
|
||||
* Only works on iOS.
|
||||
* @param {any} options start date and en date where you want to get pedometer data
|
||||
* @return {Promise<IPedometerData>} Returns a promise that resolves when pedometer data found
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static queryData(options: { startDate: Date, endDate: Date }): Promise<IPedometerData> { return; }
|
||||
}
|
||||
Reference in New Issue
Block a user