mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-07-16 00:00:04 +08:00
docs(): update plugin docs
This commit is contained in:
@@ -44,14 +44,18 @@ export interface DeviceMotionAccelerometerOptions {
|
||||
* ```typescript
|
||||
* import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion';
|
||||
*
|
||||
* constructor(private deviceMotion: DeviceMotion) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Get the device current acceleration
|
||||
* DeviceMotion.getCurrentAcceleration().then(
|
||||
* this.deviceMotion.getCurrentAcceleration().then(
|
||||
* (acceleration: DeviceMotionAccelerationData) => console.log(acceleration),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch device acceleration
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
|
||||
* var subscription = this.deviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
|
||||
* console.log(acceleration);
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -50,15 +50,18 @@ export interface DeviceOrientationCompassOptions {
|
||||
* // DeviceOrientationCompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation';
|
||||
*
|
||||
* constructor(private deviceOrientation: DeviceOrientation) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Get the device current compass heading
|
||||
* DeviceOrientation.getCurrentHeading().then(
|
||||
* this.deviceOrientation.getCurrentHeading().then(
|
||||
* (data: DeviceOrientationCompassHeading) => console.log(data),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch the device compass heading change
|
||||
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
||||
* var subscription = this.deviceOrientation.watchHeading().subscribe(
|
||||
* (data: DeviceOrientationCompassHeading) => console.log(data)
|
||||
* );
|
||||
*
|
||||
|
||||
@@ -10,17 +10,21 @@ import {Cordova, Plugin, CordovaProperty} from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { Diagnostic } from '@ionic-native/diagnostic';
|
||||
*
|
||||
* constructor(private diagnostic: Diagnostic) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
|
||||
* let errorCallback = (e) => console.error(e);
|
||||
*
|
||||
* Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
|
||||
* this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
|
||||
*
|
||||
* Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
|
||||
* this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
|
||||
*
|
||||
*
|
||||
* Diagnostic.getBluetoothState()
|
||||
* this.diagnostic.getBluetoothState()
|
||||
* .then((state) => {
|
||||
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
|
||||
* if (state == this.diagnostic.bluetoothStates.POWERED_ON){
|
||||
* // do something
|
||||
* } else {
|
||||
* // do something else
|
||||
|
||||
@@ -28,7 +28,13 @@ export interface DialogsPromptCallback {
|
||||
* ```typescript
|
||||
* import { Dialogs } from '@ionic-native/dialogs';
|
||||
*
|
||||
* constructor(private dialogs: Dialogs) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.dialogs.alert('Hello world')
|
||||
* .then(() => console.log('Dialog dismissed'))
|
||||
* .catch(e => console.log('Error displaying dialog', e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
@@ -55,11 +61,7 @@ export class Dialogs {
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
alert(
|
||||
message,
|
||||
title: string = 'Alert',
|
||||
buttonName: string = 'OK'
|
||||
): Promise<any> { return; }
|
||||
alert(message: string, title?: string, buttonName?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Displays a customizable confirmation dialog box.
|
||||
@@ -72,11 +74,7 @@ export class Dialogs {
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
confirm(
|
||||
message,
|
||||
title: string = 'Confirm',
|
||||
buttonLabels: Array<string> = ['OK', 'Cancel']
|
||||
): Promise<number> { return; }
|
||||
confirm(message, title?: string, buttonLabels?: string[]): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
||||
@@ -90,12 +88,7 @@ export class Dialogs {
|
||||
successIndex: 1,
|
||||
errorIndex: 5
|
||||
})
|
||||
prompt(
|
||||
message?: string,
|
||||
title: string = 'Prompt',
|
||||
buttonLabels: Array<string> = ['OK', 'Cancel'],
|
||||
defaultText: string = ''
|
||||
): Promise<DialogsPromptCallback> { return; }
|
||||
prompt(message?: string, title?: string, buttonLabels?: string[], defaultText?: string): Promise<DialogsPromptCallback> { return; }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Cordova, Plugin, CordovaCheck } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
@@ -38,8 +38,12 @@ export interface EmailComposerOptions {
|
||||
* ```typescript
|
||||
* import { EmailComposer } from '@ionic-native/email-composer';
|
||||
*
|
||||
* constructor(private emailComposer: EmailComposer) { }
|
||||
*
|
||||
* EmailComposer.isAvailable().then((available: boolean) =>{
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.emailComposer.isAvailable().then((available: boolean) =>{
|
||||
* if(available) {
|
||||
* //Now we know we can send
|
||||
* }
|
||||
@@ -61,7 +65,7 @@ export interface EmailComposerOptions {
|
||||
* };
|
||||
*
|
||||
* // Send a text message using default options
|
||||
* EmailComposer.open(email);
|
||||
* this.emailComposer.open(email);
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
@@ -83,6 +87,7 @@ export class EmailComposer {
|
||||
* @param app {string?} An optional app id or uri scheme.
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
|
||||
@@ -22,6 +22,20 @@ export interface EstimoteBeaconRegion {
|
||||
* @description
|
||||
* This plugin enables communication between a phone and Estimote Beacons peripherals.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { EstimoteBeacons } from '@ionic-native/estimote-beacons';
|
||||
*
|
||||
* constructor(private eb: EstimoteBeacons) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.eb.requestAlwaysAuthorization();
|
||||
*
|
||||
* this.eb.enableAnalytics(true);
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* EstimoteBeaconRegion
|
||||
*/
|
||||
|
||||
@@ -93,8 +93,15 @@ export interface FacebookLoginResponse {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Facebook } from '@ionic-native/facebook';
|
||||
* import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
|
||||
*
|
||||
* constructor(private fb: Facebook) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fb.login(['public_profile', 'user_friends', 'email'])
|
||||
* .then((res: FacebookLoginResponse) => console.log('Logged into Facebook!', res))
|
||||
* .catch(e => console.log('Error logging into Facebook', e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -9,9 +9,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileChooser} from '@ionic-native/file';
|
||||
* import { FileChooser } from '@ionic-native/file-chooser';
|
||||
*
|
||||
* FileChooser.open()
|
||||
* constructor(private fileChooser: FileChooser) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fileChooser.open()
|
||||
* .then(uri => console.log(uri))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
|
||||
@@ -8,9 +8,15 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileOpener} from '@ionic-native/file-opener';
|
||||
* import { FileOpener } from '@ionic-native/file-opener';
|
||||
*
|
||||
* constructor(private fileOpener: FileOpener) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fileOpener.open('path/to/file.pdf', 'application/pdf')
|
||||
* .then(() => console.log('File is opened'))
|
||||
* .catch(e => console.log('Error openening file', e));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
+7
-3
@@ -4,16 +4,20 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
declare var window: any;
|
||||
|
||||
/**
|
||||
* @name FilePath
|
||||
* @name File Path
|
||||
* @description
|
||||
*
|
||||
* This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FilePath} from '@ionic-native/filepath';
|
||||
* import { FilePath } from '@ionic-native/file-path';
|
||||
*
|
||||
* FilePath.resolveNativePath(path)
|
||||
* constructor(private filePath: FilePath) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.filePath.resolveNativePath(path)
|
||||
* .then(filePath => console.log(filePath);
|
||||
* .catch(err => console.log(err);
|
||||
*
|
||||
@@ -355,6 +355,7 @@ export declare var FileError: {
|
||||
* ...
|
||||
*
|
||||
* this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesnt exist'));
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
|
||||
|
||||
@@ -25,7 +25,11 @@ export interface FingerprintOptions {
|
||||
* ```typescript
|
||||
* import { FingerprintAIO } from '@ionic-native/fingerprint-aio';
|
||||
*
|
||||
* FingerprintAIO.show({
|
||||
* constructor(private faio: FingerpirntAIO) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.faio.show({
|
||||
* clientId: "Fingerprint-Demo",
|
||||
* clientSecret: "password" //Only necessary for Android
|
||||
* })
|
||||
|
||||
@@ -11,11 +11,15 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```
|
||||
* import { Firebase } from '@ionic-native/firebase';
|
||||
*
|
||||
* Firebase.getToken()
|
||||
* constructor(private firebase: Firebase) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.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()
|
||||
* this.firebase.onTokenRefresh()
|
||||
* .subscribe((token: string) => console.log(`Got a new token ${token}`));
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -11,6 +11,11 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { Flashlight } from '@ionic-native/flashlight';
|
||||
*
|
||||
* constructor(private flashlight: FlashLight) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.flashlight.switchOn();
|
||||
*
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -11,20 +11,20 @@ declare var window: any;
|
||||
* @usage
|
||||
* ```
|
||||
* import { Geofence } from '@ionic-native/geofence';
|
||||
* import { Platform } from 'ionic-angular'
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* constructor(private platform: Platform) {
|
||||
* this.platform.ready().then(() => {
|
||||
// initialize the plugin
|
||||
* Geofence.initialize().then(
|
||||
* // resolved promise does not return a value
|
||||
* () => console.log('Geofence Plugin Ready'),
|
||||
* (err) => console.log(err)
|
||||
* )
|
||||
* })
|
||||
* constructor(private geofence: Geofence) {
|
||||
* // initialize the plugin
|
||||
* geofence.initialize().then(
|
||||
* // resolved promise does not return a value
|
||||
* () => console.log('Geofence Plugin Ready'),
|
||||
* (err) => console.log(err)
|
||||
* )
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* private addGeofence() {
|
||||
* //options describing geofence
|
||||
* let fence = {
|
||||
@@ -41,7 +41,7 @@ declare var window: any;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Geofence.addOrUpdate(fence).then(
|
||||
* this.geofence.addOrUpdate(fence).then(
|
||||
* () => console.log('Geofence added'),
|
||||
* (err) => console.log('Geofence failed to add')
|
||||
* );
|
||||
|
||||
@@ -8,6 +8,16 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { Globalization } from '@ionic-native/globalization';
|
||||
*
|
||||
* constructor(private globalization: Globalization) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.globalization.getPreferredLanguage()
|
||||
* .then(res => console.log(res))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,11 @@ declare var window;
|
||||
* ```typescript
|
||||
* import { GoogleAnalytics } from '@ionic-native/google-analytics';
|
||||
*
|
||||
* GoogleAnalytics.startTrackerWithId('YOUR_TRACKER_ID')
|
||||
* constructor(private ga: GoogleAnalytics) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.ga.startTrackerWithId('YOUR_TRACKER_ID')
|
||||
* .then(() => {
|
||||
* console.log('Google analytics is ready now');
|
||||
* // Tracker is ready
|
||||
|
||||
@@ -437,6 +437,16 @@ export class GoogleMap {
|
||||
* ```
|
||||
* @classes
|
||||
* GoogleMap
|
||||
* Marker
|
||||
* LatLng
|
||||
* Geocoder
|
||||
* @interfaces
|
||||
* AnimateCameraOptions
|
||||
* MarkerOptions
|
||||
* MyLocation
|
||||
* MyLocationOptions
|
||||
* VisibleRegion
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GoogleMaps',
|
||||
|
||||
@@ -8,7 +8,11 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { GooglePlus } from '@ionic-native/google-plus';
|
||||
*
|
||||
* GooglePlus.login()
|
||||
* constructor(private googlePlus: GooglePlus) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.googlePlus.login()
|
||||
* .then(res => console.log(res))
|
||||
* .catch(err => console.error(err));
|
||||
*
|
||||
|
||||
@@ -10,7 +10,11 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { HeaderColor } from '@ionic-native/header-color';
|
||||
*
|
||||
* HeaderColor.tint("#becb29");
|
||||
* constructor(private headerColor: HeaderColor) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.headerColor.tint("#becb29");
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -87,13 +87,13 @@ export interface HealthStoreOptions {
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/*
|
||||
/**
|
||||
* The source that produced this data. In iOS this is ignored and
|
||||
* set automatically to the name of your app.
|
||||
*/
|
||||
sourceName: string;
|
||||
|
||||
/*
|
||||
/**
|
||||
* The complete package of the source that produced this data.
|
||||
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
|
||||
* set automatically to the bunde id of the app.
|
||||
@@ -151,6 +151,12 @@ export interface HealthData {
|
||||
*
|
||||
* constructor(private health: Health) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.health.isAvailable()
|
||||
* .then(res => console.log(res))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples.
|
||||
|
||||
@@ -90,13 +90,11 @@ export interface HotspotNetworkConfig {
|
||||
export interface HotspotDevice {
|
||||
|
||||
/**
|
||||
* ip
|
||||
* Hotspot IP Address
|
||||
*/
|
||||
ip: string;
|
||||
|
||||
/**
|
||||
* mac
|
||||
* Hotspot MAC Address
|
||||
*/
|
||||
mac: string;
|
||||
@@ -109,10 +107,14 @@ export interface HotspotDevice {
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Hotspot, Network } from '@ionic-native/hotspot';
|
||||
* import { Hotspot, HotspotNetwork } from '@ionic-native/hotspot';
|
||||
*
|
||||
* constructor(private hotspot: Hotspot) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
||||
* this.hotspot.scanWifi().then((networks: Array<HotspotNetwork>) => {
|
||||
* console.log(networks);
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -33,7 +33,11 @@ export interface HTTPResponse {
|
||||
* ```
|
||||
* import { HTTP } from '@ionic-native/http';
|
||||
*
|
||||
* HTTP.get('http://ionic.io', {}, {})
|
||||
* constructor(private http: HTTP) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.http.get('http://ionic.io', {}, {})
|
||||
* .then(data => {
|
||||
*
|
||||
* console.log(data.status);
|
||||
|
||||
@@ -26,7 +26,12 @@ export interface HttpdOptions {
|
||||
* Embedded httpd for Cordova apps. Light weight HTTP server.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Httpd, HttpdOptions} from '@ionic-native/httpd';
|
||||
* import { Httpd, HttpdOptions } from '@ionic-native/httpd';
|
||||
*
|
||||
* constructor(private httpd: Httpd) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let options: HttpdOptions = {
|
||||
* www_root: 'httpd_root', // relative path to app's www directory
|
||||
@@ -34,7 +39,7 @@ export interface HttpdOptions {
|
||||
* localhost_only: false
|
||||
* };
|
||||
*
|
||||
* Httpd.startServer(options).subscribe((data) => {
|
||||
* this.httpd.startServer(options).subscribe((data) => {
|
||||
* console.log('Server is live');
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
import { Cordova, Plugin, CordovaCheck } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
@@ -234,11 +234,15 @@ export interface IBeaconDelegate {
|
||||
* ```typescript
|
||||
* import { IBeacon } from '@ionic-native/ibeacon';
|
||||
*
|
||||
* constructor(private ibeacon: IBeacon) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Request permission to use location on iOS
|
||||
* IBeacon.requestAlwaysAuthorization();
|
||||
* this.ibeacon.requestAlwaysAuthorization();
|
||||
* // create a new delegate and register it with the native layer
|
||||
* let delegate = IBeacon.Delegate();
|
||||
* let delegate = this.ibeacon.Delegate();
|
||||
*
|
||||
* // Subscribe to some of the delegate's event handlers
|
||||
* delegate.didRangeBeaconsInRegion()
|
||||
@@ -258,9 +262,9 @@ export interface IBeaconDelegate {
|
||||
* }
|
||||
* );
|
||||
*
|
||||
* let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
|
||||
* let beaconRegion = this.ibeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
|
||||
*
|
||||
* IBeacon.startMonitoringForRegion(beaconRegion)
|
||||
* this.ibeacon.startMonitoringForRegion(beaconRegion)
|
||||
* .then(
|
||||
* () => console.log('Native layer recieved the request to monitoring'),
|
||||
* error => console.error('Native layer failed to begin monitoring: ', error)
|
||||
@@ -290,6 +294,7 @@ export class IBeacon {
|
||||
*
|
||||
* @returns {IBeaconDelegate} An instance of the type {@type Delegate}.
|
||||
*/
|
||||
@CordovaCheck({ sync: true })
|
||||
Delegate(): IBeaconDelegate {
|
||||
let delegate = new cordova.plugins.locationManager.Delegate();
|
||||
|
||||
@@ -390,6 +395,7 @@ export class IBeacon {
|
||||
*
|
||||
* @returns {BeaconRegion} Returns the BeaconRegion that was created
|
||||
*/
|
||||
@CordovaCheck({ sync: true })
|
||||
BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||
}
|
||||
|
||||
@@ -41,12 +41,16 @@ export interface ImagePickerOptions {
|
||||
* import { ImagePicker } from '@ionic-native/image-picker';
|
||||
*
|
||||
*
|
||||
* constructor(private imagePicker: ImagePicker) { }
|
||||
*
|
||||
* ImagePicker.getPictures(options).then((results) => {
|
||||
* ...
|
||||
*
|
||||
* this.imagePicker.getPictures(options).then((results) => {
|
||||
* for (var i = 0; i < results.length; i++) {
|
||||
* console.log('Image URI: ' + results[i]);
|
||||
* }
|
||||
* }, (err) => { });
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* ImagePickerOptions
|
||||
|
||||
@@ -51,6 +51,10 @@ export interface ImageResizerOptions {
|
||||
* ```typescript
|
||||
* import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer';
|
||||
*
|
||||
* constructor(private imageResizer: ImageResizer) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let options = {
|
||||
* uri: uri,
|
||||
* folderName: 'Protonet',
|
||||
@@ -59,12 +63,11 @@ export interface ImageResizerOptions {
|
||||
* height: 1280
|
||||
* } as ImageResizerOptions;
|
||||
*
|
||||
* ImageResizer
|
||||
* .resize(options)
|
||||
* .then(
|
||||
* (filePath: string) => { console.log('FilePath', filePath); },
|
||||
* () => { console.log('Error occured'); }
|
||||
* )
|
||||
* this.imageResizer
|
||||
* .resize(options)
|
||||
* .then((filePath: string) => console.log('FilePath', filePath))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* ImageResizerOptions
|
||||
|
||||
@@ -137,16 +137,20 @@ export class InAppBrowserObject {
|
||||
* @description Launches in app Browser
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {InAppBrowser} from '@ionic-native/in-app-browser';
|
||||
* import { InAppBrowser } from '@ionic-native/in-app-browser';
|
||||
*
|
||||
* constructor(private iab: InAppBrowser) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let browser = new InAppBrowser('https://ionic.io', '_system');
|
||||
* const browser = this.iab.create('https://ionic.io');
|
||||
*
|
||||
* browser.executeScript(...);
|
||||
* browser.insertCSS(...);
|
||||
* browser.close();
|
||||
*
|
||||
* ```
|
||||
* @classes
|
||||
* InAppBrowserObject
|
||||
|
||||
@@ -9,9 +9,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {InAppPurchase} from '@ionic-native/in-app-purchase';
|
||||
* import { InAppPurchase } from '@ionic-native/in-app-purchase';
|
||||
*
|
||||
* InAppPurchase
|
||||
* constructor(private iap: InAppPurchase) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.iap
|
||||
* .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
|
||||
* .then((products) => {
|
||||
* console.log(products);
|
||||
@@ -22,7 +26,7 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* });
|
||||
*
|
||||
*
|
||||
* InAppPurchase
|
||||
* this.iap
|
||||
* .buy('com.yourapp.prod1')
|
||||
* .then((data)=> {
|
||||
* console.log(data);
|
||||
@@ -42,14 +46,12 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* ```ts
|
||||
* // fist buy the product...
|
||||
* InAppPurchase
|
||||
* this.iap
|
||||
* .buy('com.yourapp.consumable_prod1')
|
||||
* .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature))
|
||||
* .then(data => this.iap.consume(data.productType, data.receipt, data.signature))
|
||||
* .then(() => console.log('product was successfully consumed!'))
|
||||
* .catch( err=> console.log(err))
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppPurchase',
|
||||
|
||||
@@ -11,14 +11,17 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { Insomnia } from '@ionic-native/insomnia';
|
||||
*
|
||||
* constructor(private insomnia: Insomnia) { }
|
||||
*
|
||||
* Insomnia.keepAwake()
|
||||
* ...
|
||||
*
|
||||
* this.insomnia.keepAwake()
|
||||
* .then(
|
||||
* () => console.log('success'),
|
||||
* () => console.log('error')
|
||||
* );
|
||||
*
|
||||
* Insomnia.allowSleepAgain()
|
||||
* this.insomnia.allowSleepAgain()
|
||||
* .then(
|
||||
* () => console.log('success'),
|
||||
* () => console.log('error')
|
||||
|
||||
@@ -7,9 +7,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Instagram} from '@ionic-native/instagram';
|
||||
* import { Instagram } from '@ionic-native/instagram';
|
||||
*
|
||||
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
|
||||
* constructor(private instagram: Instagram) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
|
||||
* .then(() => console.log('Shared!'))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
|
||||
@@ -9,9 +9,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {IsDebug} from '@ionic-native/is-debug';
|
||||
* import { IsDebug } from '@ionic-native/is-debug';
|
||||
*
|
||||
* IsDebug.getIsDebug()
|
||||
* constructor(private isDebug: IsDebug) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.isDebug.getIsDebug()
|
||||
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
|
||||
@@ -10,7 +10,13 @@ import { Observable } from 'rxjs/Observable';
|
||||
* ```typescript
|
||||
* import { Keyboard } from '@ionic-native/keyboard';
|
||||
*
|
||||
* constructor(private keyboard: Keyboard) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.keyboard.show();
|
||||
*
|
||||
* this.keyboard.close();
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -69,12 +69,16 @@ export interface LaunchNavigatorOptions {
|
||||
* ```typescript
|
||||
* import { LaunchNavigator, LaunchNavigatorOptions } from '@ionic-native/launch-navigator';
|
||||
*
|
||||
* constructor(private launchNavigator: LaunchNavigator) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let options: LaunchNavigatorOptions = {
|
||||
* start: 'London, ON',
|
||||
* app: LaunchNavigator.APPS.UBER
|
||||
* };
|
||||
*
|
||||
* LaunchNavigator.navigate('Toronto, ON', options)
|
||||
* this.launchNavigator.navigate('Toronto, ON', options)
|
||||
* .then(
|
||||
* success => console.log('Launched navigator'),
|
||||
* error => console.log('Error launching navigator', error)
|
||||
|
||||
@@ -13,8 +13,12 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* ```
|
||||
* import { LaunchReview } from '@ionic-native/launch-review';
|
||||
*
|
||||
* constructor(private launchReview: LaunchReview) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const appId: string = 'yourAppId';
|
||||
* LaunchReview.launch(appId)
|
||||
* this.launchReview.launch(appId)
|
||||
* .then(() => console.log('Successfully launched store app');
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -101,8 +101,13 @@ export interface ILocalNotification {
|
||||
* import { LocalNotifications } from '@ionic-native/local-notifications';
|
||||
*
|
||||
*
|
||||
* constructor(private localNotifications: LocalNotifications) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Schedule a single notification
|
||||
* LocalNotifications.schedule({
|
||||
* this.localNotifications.schedule({
|
||||
* id: 1,
|
||||
* text: 'Single ILocalNotification',
|
||||
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
|
||||
@@ -111,7 +116,7 @@ export interface ILocalNotification {
|
||||
*
|
||||
*
|
||||
* // Schedule multiple notifications
|
||||
* LocalNotifications.schedule([{
|
||||
* this.localNotifications.schedule([{
|
||||
* id: 1,
|
||||
* text: 'Multi ILocalNotification 1',
|
||||
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
|
||||
@@ -125,7 +130,7 @@ export interface ILocalNotification {
|
||||
*
|
||||
*
|
||||
* // Schedule delayed notification
|
||||
* LocalNotifications.schedule({
|
||||
* this.localNotifications.schedule({
|
||||
* text: 'Delayed ILocalNotification',
|
||||
* at: new Date(new Date().getTime() + 3600),
|
||||
* led: 'FF0000',
|
||||
|
||||
@@ -9,11 +9,15 @@ import {Plugin, Cordova} from '@ionic-native/core';
|
||||
* ```
|
||||
* import { LocationAccuracy } from '@ionic-native/location-accuracy';
|
||||
*
|
||||
* LocationAccuracy.canRequest().then((canRequest: boolean) => {
|
||||
* constructor(private locationAccuracy: LocationAccuracy) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.locationAccuracy.canRequest().then((canRequest: boolean) => {
|
||||
*
|
||||
* if(canRequest) {
|
||||
* // the accuracy option will be ignored by iOS
|
||||
* LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
|
||||
* this.locationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
|
||||
* () => console.log('Request successful'),
|
||||
* error => console.log('Error requesting location permissions', error)
|
||||
* );
|
||||
|
||||
@@ -7,9 +7,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Market} from '@ionic-native/market';
|
||||
* import { Market } from '@ionic-native/market';
|
||||
*
|
||||
* Market.open('your.package.name');
|
||||
* constructor(private market: Market) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.market.open('your.package.name');
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -117,8 +117,13 @@ export interface ConfigurationData {
|
||||
* import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@ionic-native/media-capture';
|
||||
*
|
||||
*
|
||||
* constructor(private mediaCapture: MediaCapture) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let options: CaptureImageOptions = { limit: 3 };
|
||||
* MediaCapture.captureImage(options)
|
||||
* this.mediaCapture.captureImage(options)
|
||||
* .then(
|
||||
* (data: MediaFile[]) => console.log(data),
|
||||
* (err: CaptureError) => console.error(err)
|
||||
|
||||
@@ -189,13 +189,18 @@ export class MediaObject {
|
||||
* import { MediaPlugin } from '@ionic-native/media';
|
||||
*
|
||||
*
|
||||
* constructor(private media: MediaPlugin) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Create a MediaPlugin instance. Expects path to file or url as argument
|
||||
* // We can optionally pass a second argument to track the status of the media
|
||||
*
|
||||
* const onStatusUpdate = (status) => console.log(status);
|
||||
*
|
||||
* const file = new MediaPlugin('path/to/file.mp3', onStatusUpdate);
|
||||
* const file = this.media.create('path/to/file.mp3', onStatusUpdate);
|
||||
*
|
||||
* // Catch the Success & Error Output
|
||||
* // Platform Quirks
|
||||
@@ -236,7 +241,7 @@ export class MediaObject {
|
||||
* file.release();
|
||||
*
|
||||
* // Recording to a file
|
||||
* var newFile = new MediaPlugin('path/to/file.mp3');
|
||||
* var newFile = this.media.create('path/to/file.mp3');
|
||||
* newFile.startRecord();
|
||||
*
|
||||
* newFile.stopRecord();
|
||||
|
||||
@@ -10,9 +10,13 @@ declare var mixpanel: any;
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Mixpanel} from '@ionic-native/mixpanel';
|
||||
* import { Mixpanel } from '@ionic-native/mixpanel';
|
||||
*
|
||||
* Mixpanel.init(token)
|
||||
* constructor(private mixpanel: Mixpanel) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.mixpanel.init(token)
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
*
|
||||
|
||||
@@ -23,9 +23,13 @@ export interface MusicControlsOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {MusicControls} from '@ionic-native/music-controls';
|
||||
* import { MusicControls } from '@ionic-native/music-controls';
|
||||
*
|
||||
* MusicControls.create({
|
||||
* constructor(private musicControls: MusicControls) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.musicControls.create({
|
||||
* track : 'Time is Running Out', // optional, default : ''
|
||||
* artist : 'Muse', // optional, default : ''
|
||||
* cover : 'albums/absolution.jpg', // optional, default : nothing
|
||||
@@ -44,7 +48,7 @@ export interface MusicControlsOptions {
|
||||
* ticker : 'Now playing "Time is Running Out"'
|
||||
* });
|
||||
*
|
||||
* MusicControls.subscribe().subscribe(action => {
|
||||
* this.musicControls.subscribe().subscribe(action => {
|
||||
*
|
||||
* switch(action) {
|
||||
* case 'music-controls-next':
|
||||
@@ -79,9 +83,9 @@ export interface MusicControlsOptions {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* MusicControls.listen(); // activates the observable above
|
||||
* this.musicControls.listen(); // activates the observable above
|
||||
*
|
||||
* MusicControls.updateIsPlaying(true);
|
||||
* this.musicControls.updateIsPlaying(true);
|
||||
*
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -5,23 +5,27 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* @description Native Audio Playback
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {NativeAudio} from '@ionic-native/native-audio';
|
||||
* import { NativeAudio } from '@ionic-native/native-audio';
|
||||
*
|
||||
* NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
|
||||
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
|
||||
* constructor(private nativeAudio: NativeAudio) { }
|
||||
*
|
||||
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
|
||||
* ...
|
||||
*
|
||||
* this.nativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
|
||||
* this.nativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
|
||||
*
|
||||
* this.nativeAudio.play('uniqueId1').then(onSuccess, onError);
|
||||
*
|
||||
* // can optionally pass a callback to be called when the file is done playing
|
||||
* NativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing'));
|
||||
* this.nativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing'));
|
||||
*
|
||||
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
|
||||
* this.nativeAudio.loop('uniqueId2').then(onSuccess, onError);
|
||||
*
|
||||
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
|
||||
* this.nativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
|
||||
*
|
||||
* NativeAudio.stop('uniqueId1').then(onSuccess,onError);
|
||||
* this.nativeAudio.stop('uniqueId1').then(onSuccess,onError);
|
||||
*
|
||||
* NativeAudio.unload('uniqueId1').then(onSuccess,onError);
|
||||
* this.nativeAudio.unload('uniqueId1').then(onSuccess,onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -11,11 +11,15 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder';
|
||||
*
|
||||
* NativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
|
||||
* constructor(private nativeGeocoder: NativeGeocoder) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.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")
|
||||
* this.nativeGeocoder.forwardGeocode("Berlin")
|
||||
* .then((coordinates: NativeGeocoderForwardResult) => console.log("The coordinates are latitude=" + coordinates.latitude + " and longitude=" + coordinates.longitude))
|
||||
* .catch((error: any) => console.log(error));
|
||||
* ```
|
||||
|
||||
@@ -23,7 +23,11 @@ export interface NativeTransitionOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {NativePageTransitions, NativeTransitionOptions} from '@ionic-native/native-page-transitions';
|
||||
* import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';
|
||||
*
|
||||
* constructor(private nativePageTransitions: NativePageTransitions) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let options: NativeTransitionOptions = {
|
||||
* direction: 'up',
|
||||
@@ -37,7 +41,7 @@ export interface NativeTransitionOptions {
|
||||
* fixedPixelsBottom: 60
|
||||
* };
|
||||
*
|
||||
* NativePageTransitions.slide(options)
|
||||
* this.nativePageTransitions.slide(options)
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
*
|
||||
|
||||
@@ -10,13 +10,17 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { NativeStorage } from '@ionic-native/native-storage';
|
||||
*
|
||||
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
|
||||
* constructor(private nativeStorage: NativeStorage) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
|
||||
* .then(
|
||||
* () => console.log('Stored item!'),
|
||||
* error => console.error('Error storing item', error)
|
||||
* );
|
||||
*
|
||||
* NativeStorage.getItem('myitem')
|
||||
* this.nativeStorage.getItem('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.error(error)
|
||||
|
||||
@@ -12,8 +12,12 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { NavigationBar } from '@ionic-native/navigation-bar';
|
||||
*
|
||||
* constructor(private navigationBar: NavigationBar) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let autoHide: boolean = true;
|
||||
* NavigationBar.hide(autoHide);
|
||||
* this.navigationBar.hide(autoHide);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -14,8 +14,12 @@ declare var navigator: any;
|
||||
* ```typescript
|
||||
* import { Network } from '@ionic-native/network';
|
||||
*
|
||||
* constructor(private network: Network) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // watch network for a disconnect
|
||||
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
|
||||
* let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
|
||||
* console.log('network was disconnected :-(');
|
||||
* });
|
||||
*
|
||||
@@ -24,7 +28,7 @@ declare var navigator: any;
|
||||
*
|
||||
*
|
||||
* // watch network for a connection
|
||||
* let connectSubscription = Network.onConnect().subscribe(() => {
|
||||
* let connectSubscription = this.network.onConnect().subscribe(() => {
|
||||
* console.log('network connected!');
|
||||
* // We just got a connection but we need to wait briefly
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
|
||||
@@ -17,10 +17,14 @@ declare let window: any;
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {NFC, Ndef} from '@ionic-native/nfc';
|
||||
* import { NFC, Ndef } from '@ionic-native/nfc';
|
||||
*
|
||||
* let message = Ndef.textRecord('Hello world');
|
||||
* NFC.share([message]).then(onSuccess).catch(onError);
|
||||
* constructor(private nfc: NFC, private ndef: Ndef) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let message = this.ndef.textRecord('Hello world');
|
||||
* this.nfc.share([message]).then(onSuccess).catch(onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@@ -181,19 +185,12 @@ export class NFC {
|
||||
* @private
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
pluginName: 'NFC',
|
||||
plugin: 'phonegap-nfc',
|
||||
pluginRef: 'ndef'
|
||||
})
|
||||
export class Ndef {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static pluginName = 'NFC';
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static plugin = 'phonegap-nfc';
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static pluginRef = 'ndef';
|
||||
|
||||
@Cordova({ sync: true })
|
||||
uriRecord(uri: string): any { return; }
|
||||
|
||||
@@ -272,19 +272,23 @@ export enum OSActionType {
|
||||
* ```typescript
|
||||
* import { OneSignal } from '@ionic-native/onesignal';
|
||||
*
|
||||
* OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
|
||||
* constructor(private oneSignal: OneSignal) { }
|
||||
*
|
||||
* OneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
|
||||
* ...
|
||||
*
|
||||
* OneSignal.handleNotificationReceived().subscribe(() => {
|
||||
* this.oneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
|
||||
*
|
||||
* this.oneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
|
||||
*
|
||||
* this.oneSignal.handleNotificationReceived().subscribe(() => {
|
||||
* // do something when notification is received
|
||||
* });
|
||||
*
|
||||
* OneSignal.handleNotificationOpened().subscribe(() => {
|
||||
* this.oneSignal.handleNotificationOpened().subscribe(() => {
|
||||
* // do something when a notification is opened
|
||||
* });
|
||||
*
|
||||
* OneSignal.endInit();
|
||||
* this.oneSignal.endInit();
|
||||
* ```
|
||||
* @interfaces
|
||||
* OSNotification
|
||||
|
||||
@@ -7,19 +7,24 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {PayPal, PayPalPayment, PayPalConfiguration} from "@ionic-native/pay-pal";
|
||||
* import { PayPal, PayPalPayment, PayPalConfiguration } from '@ionic-native/pay-pal';
|
||||
*
|
||||
* PayPal.init({
|
||||
* "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
|
||||
* "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
|
||||
* constructor(private payPal: PayPal) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.payPal.init({
|
||||
* PayPalEnvironmentProduction: "YOUR_PRODUCTION_CLIENT_ID",
|
||||
* PayPalEnvironmentSandbox: "YOUR_SANDBOX_CLIENT_ID"
|
||||
* }).then(() => {
|
||||
* // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
|
||||
* PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
|
||||
* this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
|
||||
* // Only needed if you get an "Internal Service Error" after PayPal login!
|
||||
* //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
|
||||
* })).then(() => {
|
||||
* let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
|
||||
* PayPal.renderSinglePaymentUI(payment).then(() => {
|
||||
* this.payPal.renderSinglePaymentUI(payment).then(() => {
|
||||
* // Successfully paid
|
||||
*
|
||||
* // Example sandbox response
|
||||
|
||||
@@ -7,9 +7,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { PhotoViewer } from '@ionic-native/photo-viewer';
|
||||
*
|
||||
* PhotoViewer.show('https://mysite.com/path/to/image.jpg');
|
||||
* constructor(private photoViewer: PhotoViewer) { }
|
||||
*
|
||||
* PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
|
||||
* ...
|
||||
*
|
||||
* this.photoViewer.show('https://mysite.com/path/to/image.jpg');
|
||||
*
|
||||
* this.photoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -8,10 +8,14 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PinDialog } from '@ionic-native/'pin-dialog;
|
||||
* import { PinDialog } from '@ionic-native/pin-dialog';
|
||||
*
|
||||
*
|
||||
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
|
||||
* constructor(private pinDialog: PinDialog) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.pinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
|
||||
* .then(
|
||||
* (result: any) => {
|
||||
* if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
|
||||
|
||||
@@ -136,25 +136,29 @@ export interface PinterestPin {
|
||||
* ```
|
||||
* import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from '@ionic-native/pinterest';
|
||||
*
|
||||
* constructor(private pinterest: Pinterest) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const scopes = [
|
||||
* Pinterest.SCOPES.READ_PUBLIC,
|
||||
* Pinterest.SCOPES.WRITE_PUBLIC,
|
||||
* Pinterest.SCOPES.READ_RELATIONSHIPS,
|
||||
* Pinterest.SCOPES.WRITE_RELATIONSHIPS
|
||||
* this.pinterest.SCOPES.READ_PUBLIC,
|
||||
* this.pinterest.SCOPES.WRITE_PUBLIC,
|
||||
* this.pinterest.SCOPES.READ_RELATIONSHIPS,
|
||||
* this.pinterest.SCOPES.WRITE_RELATIONSHIPS
|
||||
* ];
|
||||
*
|
||||
* Pinterest.login(scopes)
|
||||
* this.pinterest.login(scopes)
|
||||
* .then(res => console.log('Logged in!', res))
|
||||
* .catch(err => console.error('Error loggin in', err));
|
||||
*
|
||||
* Pinterest.getMyPins()
|
||||
* this.pinterest.getMyPins()
|
||||
* .then((pins: Array<PinterestPin>) => console.log(pins))
|
||||
* .catch(err => console.error(err));
|
||||
*
|
||||
* Pinterest.getMe()
|
||||
* this.pinterest.getMe()
|
||||
* .then((user: PinterestUser) => console.log(user));
|
||||
*
|
||||
* Pinterest.getMyBoards()
|
||||
* this.pinterest.getMyBoards()
|
||||
* .then((boards: Array<PinterestBoard>) => console.log(boards));
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -8,9 +8,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {PowerManagement} from '@ionic-native/power-management';
|
||||
* import { PowerManagement } from '@ionic-native/power-management';
|
||||
*
|
||||
* PowerManagement.acquire()
|
||||
* constructor(private powerManagement: PowerManagement) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.powerManagement.acquire()
|
||||
* .then(onSuccess)
|
||||
* .catch(onError);
|
||||
*
|
||||
|
||||
@@ -46,9 +46,13 @@ export interface PrintOptions {
|
||||
* @description Prints documents or HTML rendered content
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Printer, PrintOptions} from '@ionic-native/printer';
|
||||
* import { Printer, PrintOptions } from '@ionic-native/printer';
|
||||
*
|
||||
* Printer.isAvailable().then(onSuccess, onError);
|
||||
* constructor(private printer: Printer) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.printer.isAvailable().then(onSuccess, onError);
|
||||
*
|
||||
* let options: PrintOptions = {
|
||||
* name: 'MyDocument',
|
||||
@@ -58,7 +62,7 @@ export interface PrintOptions {
|
||||
* grayscale: true
|
||||
* };
|
||||
*
|
||||
* Printer.print(content, options).then(onSuccess, onError);
|
||||
* this.p.print(content, options).then(onSuccess, onError);
|
||||
* ```
|
||||
* @interfaces
|
||||
* PrintOptions
|
||||
|
||||
@@ -11,7 +11,11 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* ```
|
||||
* import { Rollbar } from '@ionic-native/rollbar';
|
||||
*
|
||||
* Rollbar.init();
|
||||
* constructor(private rollbar: Rollbar) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.rollbar.init();
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -19,13 +19,15 @@ export interface SafariViewControllerOptions {
|
||||
* ```
|
||||
* import { SafariViewController } from '@ionic-native/safari-view-controller';
|
||||
*
|
||||
* constructor(private safariViewController: SafariViewController) { }
|
||||
*
|
||||
* SafariViewController.isAvailable()
|
||||
* .then(
|
||||
* (available: boolean) => {
|
||||
* if(available){
|
||||
* ...
|
||||
*
|
||||
* SafariViewController.show({
|
||||
* this.safariViewController.isAvailable()
|
||||
* .then((available: boolean) => {
|
||||
* if (available) {
|
||||
*
|
||||
* this.safariViewController.show({
|
||||
* url: 'http://ionic.io',
|
||||
* hidden: false,
|
||||
* animated: false,
|
||||
@@ -33,8 +35,7 @@ export interface SafariViewControllerOptions {
|
||||
* enterReaderModeIfAvailable: true,
|
||||
* tintColor: '#ff0000'
|
||||
* })
|
||||
* .then(
|
||||
* (result: any) => {
|
||||
* .then((result: any) => {
|
||||
* if(result.event === 'opened') console.log('Opened');
|
||||
* else if(result.event === 'loaded') console.log('Loaded');
|
||||
* else if(result.event === 'closed') console.log('Closed');
|
||||
|
||||
@@ -15,12 +15,16 @@ declare var window;
|
||||
* ```typescript
|
||||
* import { ScreenOrientation } from '@ionic-native/screen-orientation';
|
||||
*
|
||||
* constructor(private screenOrientation: ScreenOrientation) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // set to either landscape
|
||||
* ScreenOrientation.lockOrientation('landscape');
|
||||
* this.screenOrientation.lockOrientation('landscape');
|
||||
*
|
||||
* // allow user rotate
|
||||
* ScreenOrientation.unlockOrientation();
|
||||
* this.screenOrientation.unlockOrientation();
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
|
||||
@@ -8,13 +8,17 @@ declare var navigator: any;
|
||||
* @description Captures a screen shot
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Screenshot} from '@ionic-native/screenshot';
|
||||
* import { Screenshot } from '@ionic-native/screenshot';
|
||||
*
|
||||
* constructor(private screenshot: Screenshot) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Take a screenshot and save to file
|
||||
* Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
|
||||
* this.screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
|
||||
*
|
||||
* // Take a screenshot and get temporary file URI
|
||||
* Screenshot.URI(80).then(onSuccess, onError);
|
||||
* this.screenshot.URI(80).then(onSuccess, onError);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin } from '@ionic-native/core';
|
||||
import { CordovaInstance, Plugin, CordovaCheck } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
@@ -53,32 +53,36 @@ export class SecureStorageObject {
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { SecureStorage } from '@ionic-native/secure-storage';
|
||||
* import { SecureStorage, SecureStorageOBject } from '@ionic-native/secure-storage';
|
||||
*
|
||||
* let secureStorage: SecureStorage = new SecureStorage();
|
||||
* secureStorage.create('my_store_name')
|
||||
* .then(
|
||||
* () => console.log('Storage is ready!'),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
* constructor(private secureStorage: SecureStorage) { }
|
||||
*
|
||||
* secureStorage.get('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
* ...
|
||||
*
|
||||
* this.secureStorage.create('my_store_name')
|
||||
* .then((storage: SecureStorageObject) => {
|
||||
*
|
||||
* storage.get('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* storage.set('myitem', 'myvalue')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* storage.remove('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* });
|
||||
*
|
||||
* secureStorage.set('myitem', 'myvalue')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.remove('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
* ```
|
||||
* @classes
|
||||
* SecureStorageObject
|
||||
@@ -98,6 +102,7 @@ export class SecureStorage {
|
||||
* @param store {string}
|
||||
* @returns {Promise<SecureStorageObject>}
|
||||
*/
|
||||
@CordovaCheck()
|
||||
create(store: string): Promise<SecureStorageObject> {
|
||||
return new Promise((res, rej) => {
|
||||
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
|
||||
|
||||
@@ -24,8 +24,12 @@ export interface SerialOpenOptions {
|
||||
* ```
|
||||
* import { Serial } from '@ionic-native/serial';
|
||||
*
|
||||
* Serial.requestPermission().then(() => {
|
||||
* Serial.open({
|
||||
* constructor(private serial: Serial) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.serial.requestPermission().then(() => {
|
||||
* this.serial.open({
|
||||
* baudRate: 9800
|
||||
* }).then(() => {
|
||||
* console.log('Serial connection opened');
|
||||
|
||||
@@ -6,9 +6,13 @@ import { Observable } from 'rxjs/Observable';
|
||||
* @description Handles shake gesture
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Shake} from '@ionic-native/shake';
|
||||
* import { Shake } from '@ionic-native/shake';
|
||||
*
|
||||
* let watch = Shake.startWatch(60).subscribe(() => {
|
||||
* constructor(private shake: Shake) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const watch = this.shake.startWatch(60).subscribe(() => {
|
||||
* // do something
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -14,16 +14,20 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* import { Sim } from '@ionic-native/sim';
|
||||
*
|
||||
*
|
||||
* Sim.getSimInfo().then(
|
||||
* constructor(private sim: Sim) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.sim.getSimInfo().then(
|
||||
* (info) => console.log('Sim info: ', info),
|
||||
* (err) => console.log('Unable to get sim info: ', err)
|
||||
* );
|
||||
*
|
||||
* Sim.hasReadPermission().then(
|
||||
* this.sim.hasReadPermission().then(
|
||||
* (info) => console.log('Has permission: ', info)
|
||||
* );
|
||||
*
|
||||
* Sim.requestReadPermission().then(
|
||||
* this.sim.requestReadPermission().then(
|
||||
* () => console.log('Permission granted'),
|
||||
* () => console.log('Permission denied')
|
||||
* );
|
||||
|
||||
@@ -35,9 +35,14 @@ export interface SmsOptionsAndroid {
|
||||
* ```typescript
|
||||
* import { SMS } from '@ionic-native/sms';
|
||||
*
|
||||
* constructor(private sms: SMS) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Send a text message using default options
|
||||
* SMS.send('416123456', 'Hello world!');
|
||||
* this.sms.send('416123456', 'Hello world!');
|
||||
* ```
|
||||
* @interfaces
|
||||
* SmsOptions
|
||||
|
||||
@@ -10,15 +10,19 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { SocialSharing } from '@ionic-native/social-sharing';
|
||||
*
|
||||
* constructor(private socialSharing: SocialSharing) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Check if sharing via email is supported
|
||||
* SocialSharing.canShareViaEmail().then(() => {
|
||||
* this.socialSharing.canShareViaEmail().then(() => {
|
||||
* // Sharing via email is possible
|
||||
* }).catch(() => {
|
||||
* // Sharing via email is not possible
|
||||
* });
|
||||
*
|
||||
* // Share via email
|
||||
* SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
|
||||
* this.socialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
|
||||
* // Success!
|
||||
* }).catch(() => {
|
||||
* // Error!
|
||||
|
||||
@@ -53,33 +53,39 @@ export interface SpeechRecognitionListeningOptionsAndroid {
|
||||
* ```
|
||||
* import { SpeechRecognition } from '@ionic-native/speech-recognition';
|
||||
*
|
||||
* constructor(private speechRecognition: SpeechRecognition) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Check feature available
|
||||
* SpeechRecognition.isRecognitionAvailable()
|
||||
* this.speechRecognition.isRecognitionAvailable()
|
||||
* .then((available: boolean) => console.log(available))
|
||||
*
|
||||
* // Start the recognition process
|
||||
* SpeechRecognition.startListening(options)
|
||||
* this.speechRecognition.startListening(options)
|
||||
* .subscribe(
|
||||
* (matches: Array<string>) => console.log(matches),
|
||||
* (onerror) => console.log('error:', onerror)
|
||||
* )
|
||||
*
|
||||
* // Stop the recognition process (iOS only)
|
||||
* SpeechRecognition.stopListening()
|
||||
* this.speechRecognition.stopListening()
|
||||
*
|
||||
* // Get the list of supported languages
|
||||
* SpeechRecognition.getSupportedLanguages()
|
||||
* this.speechRecognition.getSupportedLanguages()
|
||||
* .then(
|
||||
* (languages: Array<string>) => console.log(languages),
|
||||
* (error) => console.log(error)
|
||||
* )
|
||||
*
|
||||
* // Check permission
|
||||
* SpeechRecognition.hasPermission()
|
||||
* this.speechRecognition.hasPermission()
|
||||
* .then((hasPermission: boolean) => console.log(hasPermission))
|
||||
*
|
||||
* // Request permissions
|
||||
* SpeechRecognition.requestPermission()
|
||||
* this.speechRecognition.requestPermission()
|
||||
* .then(
|
||||
* () => console.log('Granted'),
|
||||
* () => console.log('Denied')
|
||||
|
||||
@@ -15,10 +15,13 @@ export interface SpinnerDialogIOSOptions {
|
||||
* ```typescript
|
||||
* import { SpinnerDialog } from '@ionic-native/spinner-dialog';
|
||||
*
|
||||
* constructor(private spinnerDialog: SpinnerDialog) { }
|
||||
*
|
||||
* SpinnerDialog.show();
|
||||
* ...
|
||||
*
|
||||
* SpinnerDialog.hide();
|
||||
* this.spinnerDialog.show();
|
||||
*
|
||||
* this.spinnerDialog.hide();
|
||||
* ```
|
||||
* @interfaces
|
||||
* SpinnerDialogIOSOptions
|
||||
|
||||
@@ -9,10 +9,13 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { SplashScreen } from '@ionic-native/splash-screen';
|
||||
*
|
||||
* constructor(private splashScreen: SplashScreen) { }
|
||||
*
|
||||
* Splashscreen.show();
|
||||
* ...
|
||||
*
|
||||
* Splashscreen.hide();
|
||||
* this.splashScreen.show();
|
||||
*
|
||||
* this.splashScreen.hide();
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -148,35 +148,27 @@ export class SQLiteObject {
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { SQLite } from '@ionic-native/sqlite';
|
||||
* import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
|
||||
*
|
||||
* // OPTION A: Use static constructor
|
||||
* SQLite.openDatabase({
|
||||
* constructor(private sqlite: SQLite) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.sqlite.create({
|
||||
* name: 'data.db',
|
||||
* location: 'default'
|
||||
* })
|
||||
* .then((db: SQLite) => {
|
||||
* .then((db: SQLiteObject) => {
|
||||
*
|
||||
*
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {})
|
||||
* .then(() => console.log('Executed SQL'))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {}).catch(() => {});
|
||||
*
|
||||
* })
|
||||
* .catch(error => console.error('Error opening database', error);
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
*
|
||||
* // OPTION B: Create a new instance of SQLite
|
||||
* let db = new SQLite();
|
||||
* db.openDatabase({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql: ', err);
|
||||
* });
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database: ', err);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @classes
|
||||
|
||||
@@ -15,10 +15,14 @@ declare var window;
|
||||
* ```typescript
|
||||
* import { StatusBar } from '@ionic-native/status-bar';
|
||||
*
|
||||
* constructor(private statusBar: StatusBar) { }
|
||||
*
|
||||
* StatusBar.overlaysWebView(true); // let status bar overlay webview
|
||||
* ...
|
||||
*
|
||||
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
|
||||
*
|
||||
* this.statusBar.overlaysWebView(true); // let status bar overlay webview
|
||||
*
|
||||
* this.statusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -13,10 +13,14 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
* ```
|
||||
* import { Stepcounter } from '@ionic-native/stepcounter';
|
||||
*
|
||||
* let startingOffset = 0;
|
||||
* Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure));
|
||||
* constructor(private stepcounter: Stepcounter) { }
|
||||
*
|
||||
* Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure));
|
||||
* ...
|
||||
*
|
||||
* let startingOffset = 0;
|
||||
* this.stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure));
|
||||
*
|
||||
* this.stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,9 @@ export interface StreamingAudioOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {StreamingMedia, StreamingVideoOptions} from '@ionic-native/streaming-media';
|
||||
* import { StreamingMedia, StreamingVideoOptions } from '@ionic-native/streaming-media';
|
||||
*
|
||||
* constructor(private streamingMedia: StreamingMedia) { }
|
||||
*
|
||||
* let options: StreamingVideoOptions = {
|
||||
* successCallback: () => { console.log('Video played') },
|
||||
@@ -31,7 +33,7 @@ export interface StreamingAudioOptions {
|
||||
* orientation: 'landscape'
|
||||
* };
|
||||
*
|
||||
* StreamingMedia.playVideo('https://path/to/video/stream', options);
|
||||
* this.streamingMedia.playVideo('https://path/to/video/stream', options);
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
|
||||
@@ -61,7 +61,11 @@ export interface StripeCardTokenParams {
|
||||
* ```
|
||||
* import { Stripe } from '@ionic-native/stripe';
|
||||
*
|
||||
* Stripe.setPublishableKey('my_publishable_key');
|
||||
* constructor(private stripe: Stripe) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.stripe.setPublishableKey('my_publishable_key');
|
||||
*
|
||||
* let card = {
|
||||
* number: '4242424242424242',
|
||||
@@ -70,7 +74,7 @@ export interface StripeCardTokenParams {
|
||||
* cvc: '220'
|
||||
* };
|
||||
*
|
||||
* Stripe.createCardToken(card)
|
||||
* this.stripe.createCardToken(card)
|
||||
* .then(token => console.log(token))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
|
||||
@@ -17,9 +17,13 @@ export interface TTSOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {TextToSpeech} from '@ionic-native/text-to-speech';
|
||||
* import { TextToSpeech } from '@ionic-native/text-to-speech';
|
||||
*
|
||||
* TextToSpeech.speak('Hello World')
|
||||
* constructor(private tts: TextToSpeech) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.tts.speak('Hello World')
|
||||
* .then(() => console.log('Success'))
|
||||
* .catch((reason: any) => console.log(reason));
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, CordovaInstance } from '@ionic-native/core';
|
||||
import { Plugin, CordovaInstance, InstanceCheck } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
@@ -124,6 +124,7 @@ export class ThemeableBrowserObject {
|
||||
* @param event Event name
|
||||
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
*/
|
||||
@InstanceCheck({ observable: true })
|
||||
on(event: string): Observable<any> {
|
||||
return new Observable<any>((observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
@@ -140,13 +141,17 @@ export class ThemeableBrowserObject {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { ThemeableBrowser } from '@ionic-native/themeable-browser';
|
||||
* import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';
|
||||
*
|
||||
* constructor(private themeableBrowser: ThemeableBrowser) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // can add options from the original InAppBrowser in a JavaScript object form (not string)
|
||||
* // This options object also takes additional parameters introduced by the ThemeableBrowser plugin
|
||||
* // This example only shows the additional parameters for ThemeableBrowser
|
||||
* // Note that that `image` and `imagePressed` values refer to resources that are stored in your app
|
||||
* let options = {
|
||||
* const options: ThemeableBrowserOptions = {
|
||||
* statusbar: {
|
||||
* color: '#ffffffff'
|
||||
* },
|
||||
@@ -204,7 +209,7 @@ export class ThemeableBrowserObject {
|
||||
* backButtonCanClose: true
|
||||
* };
|
||||
*
|
||||
* let browser = new ThemeableBrowser('https://ionic.io', '_blank', options);
|
||||
* const browser: ThemeableBrowserObject = this.themeableBrowser.create('https://ionic.io', '_blank', options);
|
||||
*
|
||||
* ```
|
||||
* We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here.
|
||||
|
||||
@@ -59,20 +59,20 @@ export interface ThreeDeeTouchForceTouch {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name 3DTouch
|
||||
* @name 3D Touch
|
||||
* @description
|
||||
* @usage
|
||||
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
|
||||
* ```
|
||||
* import { ThreeDeeTiouch } from '@ionic-native/three-dee-touch';
|
||||
* import { ThreeDeeTouch, ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from '@ionic-native/three-dee-touch';
|
||||
*
|
||||
* constructor(private threeDeeTouch: ThreeDeeTouch) { }
|
||||
*
|
||||
* // import for type completion on variables
|
||||
* import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from '@ionic-native/3dtouch';
|
||||
* ...
|
||||
*
|
||||
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
|
||||
* this.threeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
|
||||
*
|
||||
* ThreeDeeTouch.watchForceTouches()
|
||||
* this.threeDeeTouch.watchForceTouches()
|
||||
* .subscribe(
|
||||
* (data: ThreeDeeTouchForceTouch) => {
|
||||
* console.log("Force touch %" + data.force);
|
||||
@@ -106,9 +106,10 @@ export interface ThreeDeeTouchForceTouch {
|
||||
* iconTemplate: 'HeartTemplate'
|
||||
* }
|
||||
* ];
|
||||
* ThreeDeeTouch.configureQuickActions(actions);
|
||||
*
|
||||
* ThreeDeeTouch.onHomeIconPressed().subscribe(
|
||||
* this.threeDeeTouch.configureQuickActions(actions);
|
||||
*
|
||||
* this.threeDeeTouch.onHomeIconPressed().subscribe(
|
||||
* (payload) => {
|
||||
* // returns an object that is the button you presed
|
||||
* console.log('Pressed the ${payload.title} button')
|
||||
|
||||
@@ -47,8 +47,11 @@ export interface ToastOptions {
|
||||
* ```typescript
|
||||
* import { Toast } from '@ionic-native/toast';
|
||||
*
|
||||
* constructor(private toast: Toast) { }
|
||||
*
|
||||
* Toast.show("I'm a toast", '5000', 'center').subscribe(
|
||||
* ...
|
||||
*
|
||||
* thisoast.show("I'm a toast", '5000', 'center').subscribe(
|
||||
* toast => {
|
||||
* console.log(toast);
|
||||
* }
|
||||
@@ -79,11 +82,7 @@ export class Toast {
|
||||
observable: true,
|
||||
clearFunction: 'hide'
|
||||
})
|
||||
show(
|
||||
message: string,
|
||||
duration: string,
|
||||
position: string
|
||||
): Observable<any> { return; }
|
||||
show(message: string, duration: string, position: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Manually hide any currently visible toast.
|
||||
|
||||
@@ -10,22 +10,20 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
|
||||
*
|
||||
* @usage
|
||||
* ### Import Touch ID Plugin into Project
|
||||
* ```typescript
|
||||
* import { TouchID } from '@ionic-native/touch-id';
|
||||
* ```
|
||||
* ### Check for Touch ID Availability
|
||||
* ```typescript
|
||||
* TouchID.isAvailable()
|
||||
*
|
||||
* constructor(private touchId: TouchID) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.touchId.isAvailable()
|
||||
* .then(
|
||||
* res => console.log('TouchID is available!'),
|
||||
* err => console.error('TouchID is not available', err)
|
||||
* );
|
||||
* ```
|
||||
* ### Invoke Touch ID w/ Custom Message
|
||||
*
|
||||
* ```typescript
|
||||
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
||||
* this.touchId.verifyFingerprint('Scan your fingerprint please')
|
||||
* .then(
|
||||
* res => console.log('Ok', res),
|
||||
* err => console.error('Error', err)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin } from '@ionic-native/core';
|
||||
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability } from '@ionic-native/core';
|
||||
|
||||
declare var FileTransfer;
|
||||
|
||||
@@ -116,48 +116,42 @@ export interface FileTransferError {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Transfer } from '@ionic-native/transfer';
|
||||
* import { Transfer, FileUploadOptions } from '@ionic-native/transfer';
|
||||
* import { File } from '@ionic-native/file';
|
||||
*
|
||||
* constructor(private transfer: Transfer, private file: File) { }
|
||||
*
|
||||
* // Create instance:
|
||||
* const fileTransfer = new Transfer();
|
||||
* ...
|
||||
*
|
||||
* // Upload a file:
|
||||
* fileTransfer.upload(..).then(..).catch(..);
|
||||
* this.transfer.upload(..).then(..).catch(..);
|
||||
*
|
||||
* // Download a file:
|
||||
* fileTransfer.download(..).then(..).catch(..);
|
||||
* this.transfer.download(..).then(..).catch(..);
|
||||
*
|
||||
* // Abort active transfer:
|
||||
* fileTransfer.abort();
|
||||
* this.transfer.abort();
|
||||
*
|
||||
* E.g
|
||||
*
|
||||
* upload(){
|
||||
* const fileTransfer = new Transfer();
|
||||
* var options: any;
|
||||
*
|
||||
* options = {
|
||||
* // full example
|
||||
* upload() {
|
||||
* let options: FileUploadOptions = {
|
||||
* fileKey: 'file',
|
||||
* fileName: 'name.jpg',
|
||||
* headers: {}
|
||||
* .....
|
||||
* }
|
||||
* fileTransfer.upload("<file path>", "<api endpoint>", options)
|
||||
*
|
||||
* this.transfer.upload("<file path>", "<api endpoint>", options)
|
||||
* .then((data) => {
|
||||
* // success
|
||||
* }, (err) => {
|
||||
* // error
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* // Cordova
|
||||
* declare var cordova: any;
|
||||
*
|
||||
**
|
||||
* download() {
|
||||
* const fileTransfer = new Transfer();
|
||||
* let url = 'http://www.example.com/file.pdf';
|
||||
* fileTransfer.download(url, cordova.file.dataDirectory + 'file.pdf').then((entry) => {
|
||||
* this.transfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => {
|
||||
* console.log('download complete: ' + entry.toURL());
|
||||
* }, (error) => {
|
||||
* // handle error
|
||||
@@ -166,15 +160,6 @@ export interface FileTransferError {
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* Note: You will not see your documents using a file explorer on your device. Use adb:
|
||||
*
|
||||
* ```
|
||||
* adb shell
|
||||
* run-as com.your.app
|
||||
* cd files
|
||||
* ls
|
||||
* ```
|
||||
*
|
||||
* To store files in a different/publicly accessible directory, please refer to the following link
|
||||
* https://github.com/apache/cordova-plugin-file#where-to-store-files
|
||||
*
|
||||
@@ -213,7 +198,9 @@ export class Transfer {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = new FileTransfer();
|
||||
if (checkAvailability('FileTransfer', null, 'FileTransfer') === true) {
|
||||
this._objectInstance = new FileTransfer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,6 +241,7 @@ export class Transfer {
|
||||
* Registers a listener that gets called whenever a new chunk of data is transferred.
|
||||
* @param listener {function} Listener that takes a progress event.
|
||||
*/
|
||||
@InstanceCheck({ sync: true })
|
||||
onProgress(listener: (event: ProgressEvent) => any): void {
|
||||
this._objectInstance.onprogress = listener;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ export interface TwitterConnectResponse {
|
||||
* Plugin to use Twitter Single Sign On
|
||||
* Uses Twitter's Fabric SDK
|
||||
* ```typescript
|
||||
* import {TwitterConnect} from '@ionic-native/twitter-connect';
|
||||
* import { TwitterConnect } from '@ionic-native/twitter-connect';
|
||||
*
|
||||
* constructor(private twitter: TwitterConnect) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* function onSuccess(response) {
|
||||
* console.log(response);
|
||||
@@ -40,9 +44,9 @@ export interface TwitterConnectResponse {
|
||||
* // }
|
||||
* }
|
||||
*
|
||||
* TwitterConnect.login().then(onSuccess, onError);
|
||||
* this.twitter.login().then(onSuccess, onError);
|
||||
*
|
||||
* TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
|
||||
* this.twitter.logout().then(onLogoutSuccess, onLogoutError);
|
||||
* ```
|
||||
* @interfaces
|
||||
* TwitterConnectResponse
|
||||
|
||||
@@ -9,20 +9,23 @@ import { Cordova, Plugin } from '@ionic-native/core';
|
||||
* ```typescript
|
||||
* import { Vibration } from '@ionic-native/vibration';
|
||||
*
|
||||
* constructor(private vibration: Vibration) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Vibrate the device for a second
|
||||
* // Duration is ignored on iOS.
|
||||
* Vibration.vibrate(1000);
|
||||
* this.vibration.vibrate(1000);
|
||||
*
|
||||
* // Vibrate 2 seconds
|
||||
* // Pause for 1 second
|
||||
* // Vibrate for 2 seconds
|
||||
* // Patterns work on Android and Windows only
|
||||
* Vibration.vibrate([2000,1000,2000]);
|
||||
* this.vibration.vibrate([2000,1000,2000]);
|
||||
*
|
||||
* // Stop any current vibrations immediately
|
||||
* // Works on Android and Windows only
|
||||
* Vibration.vibrate(0);
|
||||
* this.vibration.vibrate(0);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -125,9 +125,13 @@ export interface VideoInfo {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {VideoEditor} from '@ionic-native/video-editor';
|
||||
* import { VideoEditor } from '@ionic-native/video-editor';
|
||||
*
|
||||
* VideoEditor.transcodeVideo({
|
||||
* constructor(private videoEditor: VideoEditor) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.videoEditor.transcodeVideo({
|
||||
* fileUri: '/path/to/input.mov',
|
||||
* outputFileName: 'output.mp4',
|
||||
* outputFileType: VideoEditor.OutputFileType.MPEG4
|
||||
|
||||
@@ -28,9 +28,12 @@ export interface VideoOptions {
|
||||
* ```typescript
|
||||
* import { VideoPlayer } from '@ionic-native/video-player;
|
||||
*
|
||||
* constructor(private videoPlayer: VideoPlayer) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Playing a video.
|
||||
* VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
|
||||
* this.videoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
|
||||
* console.log('video completed');
|
||||
* }).catch(err => {
|
||||
* console.log(err);
|
||||
|
||||
@@ -11,9 +11,13 @@ declare var window;
|
||||
* For usage information please refer to the plugin's Github repo.
|
||||
*
|
||||
* ```typescript
|
||||
* import {WebIntent} from '@ionic-native/web-intent';
|
||||
* import { WebIntent } from '@ionic-native/web-intent';
|
||||
*
|
||||
* WebIntent.startActivity(options).then(onSuccess, onError);
|
||||
* constructor(private webIntent: WebIntent) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.webIntent.startActivity(options).then(onSuccess, onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -7,9 +7,14 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {YoutubeVideoPlayer} from '@ionic-native/youtube-video-player';
|
||||
* import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player';
|
||||
*
|
||||
* YoutubeVideoPlayer.openVideo('myvideoid');
|
||||
* constructor(private youtube: YoutubeVideoPlayer) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.youtube.openVideo('myvideoid');
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -44,14 +44,18 @@ export interface ZBarOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { ZBar } from '@ionic-native/z-bar';
|
||||
* import { ZBar, ZBarOptions } from '@ionic-native/z-bar';
|
||||
*
|
||||
* let zBarOptions = {
|
||||
* constructor(private zbar: ZBar) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let ZBarOptions = {
|
||||
* flash: "off",
|
||||
* drawSight: false
|
||||
* };
|
||||
*
|
||||
* ZBar.scan(zBarOptions)
|
||||
* this.zbar.scan(zBarOptions)
|
||||
* .then(result => {
|
||||
* console.log(result); // Scanned code
|
||||
* })
|
||||
|
||||
@@ -8,9 +8,13 @@ import { Plugin, Cordova } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Zip} from '@ionic-native/zip';
|
||||
* import { Zip } from '@ionic-native/zip';
|
||||
*
|
||||
* Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
|
||||
* constructor(private zip: Zip) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
|
||||
* .then((result) => {
|
||||
* if(result === 0) console.log('SUCCESS');
|
||||
* if(result === -1) console.log('FAILED');
|
||||
|
||||
Reference in New Issue
Block a user