Compare commits

..

12 Commits
v2.9.0 ... v2.x

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

* fix(camera-preview): fix plugin name in decorator
2017-03-20 16:10:04 -04:00
neoassyrian
f8df8769c9 feat(music-controls): add updateDismissable method (#1195) 2017-03-20 16:06:44 -04:00
Julien Moulin
510cea67b7 docs(native-geocoder): fix docs (#1197)
Change address to street in example
2017-03-20 16:04:52 -04:00
Patrick Reames
55d6d11721 docs(diagnostic): change bluetoothStates to bluetoothState (#1199) 2017-03-20 15:06:20 -04:00
12 changed files with 6189 additions and 88 deletions

View File

@@ -1,4 +1,4 @@
[![Circle CI](https://circleci.com/gh/driftyco/ionic-native.svg?style=shield)](https://circleci.com/gh/driftyco/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Circle CI](https://circleci.com/gh/ionic-team/ionic-native.svg?style=shield)](https://circleci.com/gh/ionic-team/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native)
[![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/)
@@ -81,7 +81,7 @@ npm install ionic-native --save
## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
# Credits

5915
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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": {

View File

@@ -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,

View File

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

View File

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

View File

@@ -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

View File

@@ -112,7 +112,6 @@ export const GoogleMapsMapTypeId = {
* marker.showInfoWindow();
* });
* }
* });
* }
* ```
*/

View File

@@ -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;
};

View File

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

View File

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

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

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