From fe8a380902c71f6a4abf755cc59fc21dc2511bf2 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 7 Mar 2017 05:52:20 -0500 Subject: [PATCH] docs(): update docs --- .../plugins/action-sheet/index.ts | 8 +- src/@ionic-native/plugins/alipay/index.ts | 3 - .../plugins/android-fingerprint-auth/index.ts | 83 +++++++++++-------- .../plugins/app-availability/index.ts | 12 ++- src/@ionic-native/plugins/app-rate/index.ts | 8 +- .../plugins/app-version/index.ts | 13 ++- .../plugins/background-mode/index.ts | 66 ++++++++------- src/@ionic-native/plugins/backlight/index.ts | 8 +- src/@ionic-native/plugins/badge/index.ts | 9 +- .../plugins/barcode-scanner/index.ts | 6 +- .../plugins/base64-to-gallery/index.ts | 7 +- .../plugins/battery-status/index.ts | 6 +- src/@ionic-native/plugins/ble/index.ts | 8 ++ .../plugins/bluetooth-serial/index.ts | 10 ++- src/@ionic-native/plugins/brightness/index.ts | 5 +- .../plugins/broadcaster/index.ts | 8 +- src/@ionic-native/plugins/calendar/index.ts | 3 +- .../plugins/call-number/index.ts | 7 +- .../plugins/camera-preview/index.ts | 16 ++-- src/@ionic-native/plugins/camera/index.ts | 6 +- src/@ionic-native/plugins/card-io/index.ts | 6 +- src/@ionic-native/plugins/clipboard/index.ts | 15 ++-- src/@ionic-native/plugins/code-push/index.ts | 8 +- src/@ionic-native/plugins/contacts/index.ts | 3 +- src/@ionic-native/plugins/crop/index.ts | 4 +- .../plugins/date-picker/index.ts | 7 +- src/@ionic-native/plugins/db-meter/index.ts | 10 ++- src/@ionic-native/plugins/deeplinks/index.ts | 52 ++++++------ .../plugins/device-accounts/index.ts | 19 +++++ .../plugins/device-feedback/index.ts | 11 ++- src/@ionic-native/plugins/device/index.ts | 5 +- 31 files changed, 282 insertions(+), 150 deletions(-) diff --git a/src/@ionic-native/plugins/action-sheet/index.ts b/src/@ionic-native/plugins/action-sheet/index.ts index f4c84a585..c580e7846 100644 --- a/src/@ionic-native/plugins/action-sheet/index.ts +++ b/src/@ionic-native/plugins/action-sheet/index.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin } from '@ionic-native/core'; - export interface ActionSheetOptions { /** @@ -57,6 +56,11 @@ export interface ActionSheetOptions { * ```typescript * import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet'; * + * constructor(private actionSheet: ActionSheet) { } + * + * ... + * + * * let buttonLabels = ['Share via Facebook', 'Share via Twitter']; * * const options: ActionSheetOptions = { @@ -66,7 +70,7 @@ export interface ActionSheetOptions { * addDestructiveButtonWithLabel: 'Delete' * }; * - * ActionSheet.show(options).then((buttonIndex: number) => { + * this.actionSheet.show(options).then((buttonIndex: number) => { * console.log('Button pressed: ' + buttonIndex); * }); * ``` diff --git a/src/@ionic-native/plugins/alipay/index.ts b/src/@ionic-native/plugins/alipay/index.ts index 939ddcd31..74fd39d21 100644 --- a/src/@ionic-native/plugins/alipay/index.ts +++ b/src/@ionic-native/plugins/alipay/index.ts @@ -1,9 +1,6 @@ import { Plugin, Cordova } from '@ionic-native/core'; import { Injectable } from '@angular/core'; -/** - * @private - */ export interface AlipayOrder { /** * appId assigned by Alipay diff --git a/src/@ionic-native/plugins/android-fingerprint-auth/index.ts b/src/@ionic-native/plugins/android-fingerprint-auth/index.ts index bd7c84b4b..8ba69e5dc 100644 --- a/src/@ionic-native/plugins/android-fingerprint-auth/index.ts +++ b/src/@ionic-native/plugins/android-fingerprint-auth/index.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin } from '@ionic-native/core'; -export interface AuthOptions { +export interface AFAAuthOptions { /** * Required @@ -65,20 +65,56 @@ export interface AuthOptions { } +export interface AFADecryptOptions { + /** + * Biometric authentication + */ + withFingerprint: boolean; + /** + * Authentication using backup credential activity + */ + withBackup: boolean; + /** + * FingerprintAuth.CipherMode.DECRYPT + * Decrypted password + */ + password: string; +} + +export interface AFAEncryptResponse { + /** + * Biometric authentication + */ + withFingerprint: boolean; + /** + * Authentication using backup credential activity + */ + withBackup: boolean; + /** + * base64encoded string representation of user credentials + */ + token: string; +} + /** * @name Android Fingerprint Auth * @description * This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup. * @usage * ```typescript - * import { AndroidFingerprintAuth, AuthOptions } from '@ionic-native/android-fingerprint-auth'; + * import { AndroidFingerprintAuth, AFAAuthOptions } from '@ionic-native/android-fingerprint-auth'; * - * AndroidFingerprintAuth.isAvailable() + * constructor(private androidFingerprintAuth: AndroidFingerprintAuth) { } + * + * ... + * + * + * this.androidFingerprintAuth.isAvailable() * .then((result)=> { * if(result.isAvailable){ * // it is available * - * AndroidFingerprintAuth.encrypt({ clientId: "myAppName", username: "myUsername", password: "myPassword" }) + * this.androidFingerprintAuth.encrypt({ clientId: "myAppName", username: "myUsername", password: "myPassword" }) * .then(result => { * if (result.withFingerprint) { * console.log("Successfully encrypted credentials."); @@ -100,7 +136,9 @@ export interface AuthOptions { * .catch(error => console.error(error)); * ``` * @interfaces - * AuthOptions + * AFAAuthOptions + * AFAEncryptResponse + * AFADecryptOptions */ @Plugin({ pluginName: 'AndroidFingerprintAuth', @@ -113,46 +151,19 @@ export class AndroidFingerprintAuth { /** * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device. - * @param options {AuthOptions} Options + * @param options {AFAAuthOptions} Options * @returns {Promise} */ @Cordova() - encrypt(options: AuthOptions): Promise<{ - /** - * Biometric authentication - */ - withFingerprint: boolean; - /** - * Authentication using backup credential activity - */ - withBackup: boolean; - /** - * base64encoded string representation of user credentials - */ - token: string; - }> {return; } + encrypt(options: AFAAuthOptions): Promise {return; } /** * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device. - * @param options {AuthOptions} Options + * @param options {AFAAuthOptions} Options * @returns {Promise} */ @Cordova() - decrypt(options: AuthOptions): Promise<{ - /** - * Biometric authentication - */ - withFingerprint: boolean; - /** - * Authentication using backup credential activity - */ - withBackup: boolean; - /** - * FingerprintAuth.CipherMode.DECRYPT - * Decrypted password - */ - password: string; - }> {return; } + decrypt(options: AFAAuthOptions): Promise {return; } /** * Check if service is available diff --git a/src/@ionic-native/plugins/app-availability/index.ts b/src/@ionic-native/plugins/app-availability/index.ts index 6f792acfc..f31230a04 100644 --- a/src/@ionic-native/plugins/app-availability/index.ts +++ b/src/@ionic-native/plugins/app-availability/index.ts @@ -10,18 +10,22 @@ import { Cordova, Plugin } from '@ionic-native/core'; * * @usage * ```typescript - * import { AppAvailability, Device } from '@ionic-native/app-availability'; + * import { AppAvailability } from '@ionic-native/app-availability'; + * import { Platform } from 'ionic-angular'; * + * constructor(private appAvailability: AppAvailability, private platform: Platform) { } + * + * ... * * let app; * - * if (Device.platform === 'iOS') { + * if (this.platform.is('ios')) { * app = 'twitter://'; - * } else if (Device.platform === 'Android') { + * } else if (this.platform.is('android')) { * app = 'com.twitter.android'; * } * - * AppAvailability.check(app) + * this.appAvailability.check(app) * .then( * (yes: string) => console.log(app + ' is available'), * (no: string) => console.log(app + ' is NOT available') diff --git a/src/@ionic-native/plugins/app-rate/index.ts b/src/@ionic-native/plugins/app-rate/index.ts index 8491e6384..cb1b57c70 100644 --- a/src/@ionic-native/plugins/app-rate/index.ts +++ b/src/@ionic-native/plugins/app-rate/index.ts @@ -107,13 +107,17 @@ export interface AppUrls { * ```typescript * import { AppRate } from '@ionic-native/app-rate'; * - * AppRate.preferences.storeAppURL = { + * constructor(private appRate: AppRate) { } + * + * ... + * + * this.appRate.preferences.storeAppURL = { * ios: '', * android: 'market://details?id=', * windows: 'ms-windows-store://review/?ProductId=' * }; * - * AppRate.promptForRating(false); + * this.appRate.promptForRating(false); * ``` * * @interfaces diff --git a/src/@ionic-native/plugins/app-version/index.ts b/src/@ionic-native/plugins/app-version/index.ts index e4f5299a4..2c09da5f2 100644 --- a/src/@ionic-native/plugins/app-version/index.ts +++ b/src/@ionic-native/plugins/app-version/index.ts @@ -14,11 +14,16 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { AppVersion } from '@ionic-native/app-version'; * + * constructor(private appVersion: AppVersion) { } + * + * ... + * + * + * this.appVersion.getAppName(); + * this.appVersion.getPackageName(); + * this.appVersion.getVersionCode(); + * this.appVersion.getVersionNumber(); * - * AppVersion.getAppName(); - * AppVersion.getPackageName(); - * AppVersion.getVersionCode(); - * AppVersion.getVersionNumber(); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/background-mode/index.ts b/src/@ionic-native/plugins/background-mode/index.ts index 4808f1ba7..77c5cb496 100644 --- a/src/@ionic-native/plugins/background-mode/index.ts +++ b/src/@ionic-native/plugins/background-mode/index.ts @@ -36,20 +36,24 @@ export interface BackgroundModeConfiguration { } /** -* @name Background Mode -* @description -* Cordova plugin to prevent the app from going to sleep while in background. -* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode -*@usage -* ```typescript -* import { BackgroundMode } from '@ionic-native/background-mode'; -* -* BackgroundMode.enable(); -* ``` + * @name Background Mode + * @description + * Cordova plugin to prevent the app from going to sleep while in background. + * Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode + *@usage + * ```typescript + * import { BackgroundMode } from '@ionic-native/background-mode'; + * + * constructor(private backgroundMode: BackgroundMode) { } + * + * ... + * + * this.backgroundMode.enable(); + * ``` * * @interfaces * BackgroundModeConfiguration -*/ + */ @Plugin({ pluginName: 'BackgroundMode', plugin: 'cordova-plugin-background-mode', @@ -61,54 +65,54 @@ export interface BackgroundModeConfiguration { export class BackgroundMode { /** - * Enable the background mode. - * Once called, prevents the app from being paused while in background. - */ + * Enable the background mode. + * Once called, prevents the app from being paused while in background. + */ @Cordova({ sync: true }) enable(): void { } /** - * Disable the background mode. - * Once the background mode has been disabled, the app will be paused when in background. - */ + * Disable the background mode. + * Once the background mode has been disabled, the app will be paused when in background. + */ @Cordova() disable(): Promise { return; } /** - * Checks if background mode is enabled or not. - * @returns {boolean} returns a boolean that indicates if the background mode is enabled. - */ + * Checks if background mode is enabled or not. + * @returns {boolean} returns a boolean that indicates if the background mode is enabled. + */ @Cordova({ sync: true }) isEnabled(): boolean { return; } /** - * Can be used to get the information if the background mode is active. - * @returns {boolean} returns a boolean that indicates if the background mode is active. - */ + * Can be used to get the information if the background mode is active. + * @returns {boolean} returns a boolean that indicates if the background mode is active. + */ @Cordova({ sync: true }) isActive(): boolean { return; } /** - * Override the default title, ticker and text. - * Available only for Android platform. - * @param {Configure} options List of option to configure. See table below - */ + * Override the default title, ticker and text. + * Available only for Android platform. + * @param {Configure} options List of option to configure. See table below + */ @Cordova({ platforms: ['Android'] }) setDefaults(options?: BackgroundModeConfiguration): Promise { return; } /** - * Modify the displayed information. - * Available only for Android platform. - * @param {Configure} options Any options you want to update. See table below. - */ + * Modify the displayed information. + * Available only for Android platform. + * @param {Configure} options Any options you want to update. See table below. + */ @Cordova({ platforms: ['Android'] }) diff --git a/src/@ionic-native/plugins/backlight/index.ts b/src/@ionic-native/plugins/backlight/index.ts index 97290f8fd..31f3ccd30 100644 --- a/src/@ionic-native/plugins/backlight/index.ts +++ b/src/@ionic-native/plugins/backlight/index.ts @@ -12,11 +12,15 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ``` * import { Backlight } from '@ionic-native/backlight'; * + * constructor(private backlight: Backlight) { } + * + * ... + * * // Turn backlight on - * Backlight.on().then(() => console.log('backlight on')); + * this.backlight.on().then(() => console.log('backlight on')); * * // Turn backlight off - * Backlight.off().then(() => console.log('backlight off')); + * this.backlight.off().then(() => console.log('backlight off')); * * ``` */ diff --git a/src/@ionic-native/plugins/badge/index.ts b/src/@ionic-native/plugins/badge/index.ts index 916ed8e16..225046978 100644 --- a/src/@ionic-native/plugins/badge/index.ts +++ b/src/@ionic-native/plugins/badge/index.ts @@ -13,10 +13,13 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Badge } from '@ionic-native/badge'; * + * constructor(private badge: Badge) { } * - * Badge.set(10); - * Badge.increase(1); - * Badge.clear(); + * ... + * + * this.badge.set(10); + * this.badge.increase(1); + * this.badge.clear(); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/barcode-scanner/index.ts b/src/@ionic-native/plugins/barcode-scanner/index.ts index 7927d7230..cb2605016 100644 --- a/src/@ionic-native/plugins/barcode-scanner/index.ts +++ b/src/@ionic-native/plugins/barcode-scanner/index.ts @@ -67,8 +67,12 @@ export interface BarcodeScannerOptions { * ```typescript * import { BarcodeScanner } from '@ionic-native/barcode-scanner'; * + * constructor(private barcodeScanner: BarcodeScanner) { } * - * BarcodeScanner.scan().then((barcodeData) => { + * ... + * + * + * this.barcodeScanner.scan().then((barcodeData) => { * // Success! Barcode data is here * }, (err) => { * // An error occurred diff --git a/src/@ionic-native/plugins/base64-to-gallery/index.ts b/src/@ionic-native/plugins/base64-to-gallery/index.ts index 6eca0af89..0e78238a2 100644 --- a/src/@ionic-native/plugins/base64-to-gallery/index.ts +++ b/src/@ionic-native/plugins/base64-to-gallery/index.ts @@ -8,8 +8,13 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Base64ToGallery } from '@ionic-native/base64-to-gallery'; * + * constructor(private base64ToGallery: Base64ToGallery) { } * - * Base64ToGallery.base64ToGallery(base64Data, 'img_').then( + * + * ... + * + * + * this.base64ToGallery.base64ToGallery(base64Data, { prefix: '_img' }).then( * res => console.log('Saved image to gallery ', res), * err => console.log('Error saving image to gallery ', err) * ); diff --git a/src/@ionic-native/plugins/battery-status/index.ts b/src/@ionic-native/plugins/battery-status/index.ts index 2f2ec9604..72fbf385f 100644 --- a/src/@ionic-native/plugins/battery-status/index.ts +++ b/src/@ionic-native/plugins/battery-status/index.ts @@ -25,9 +25,13 @@ export interface BatteryStatusResponse { * ```typescript * import { BatteryStatus } from '@ionic-native/battery-status'; * + * constructor(private batteryStatus: BatteryStatus) { } + * + * ... + * * * // watch change in battery status - * let subscription = BatteryStatus.onChange().subscribe( + * let subscription = this.batteryStatus.onChange().subscribe( * (status: StatusObject) => { * console.log(status.level, status.isPlugged); * } diff --git a/src/@ionic-native/plugins/ble/index.ts b/src/@ionic-native/plugins/ble/index.ts index e435a5222..603784785 100644 --- a/src/@ionic-native/plugins/ble/index.ts +++ b/src/@ionic-native/plugins/ble/index.ts @@ -21,6 +21,14 @@ import { Observable } from 'rxjs/Observable'; * * @usage * + * ```typescript + * + * import { BLE } from '@ionic-native/ble'; + * + * constructor(private ble: BLE) { } + * + * ``` + * * ## Peripheral Data * * Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning. diff --git a/src/@ionic-native/plugins/bluetooth-serial/index.ts b/src/@ionic-native/plugins/bluetooth-serial/index.ts index 0001ca885..2204f4b96 100644 --- a/src/@ionic-native/plugins/bluetooth-serial/index.ts +++ b/src/@ionic-native/plugins/bluetooth-serial/index.ts @@ -9,12 +9,14 @@ import { Observable } from 'rxjs/Observable'; * ```typescript * import { BluetoothSerial } from '@ionic-native/bluetooth-serial'; * + * constructor(private bluetoothSerial: BluetoothSerial) { } + * * * // Write a string - * BluetoothSerial.write("hello world").then(success, failure); + * this.bluetoothSerial.write("hello world").then(success, failure); * * // Array of int or bytes - * BluetoothSerial.write([186, 220, 222]).then(success, failure); + * this.bluetoothSerial.write([186, 220, 222]).then(success, failure); * * // Typed Array * var data = new Uint8Array(4); @@ -22,10 +24,10 @@ import { Observable } from 'rxjs/Observable'; * data[1] = 0x42; * data[2] = 0x43; * data[3] = 0x44; - * BluetoothSerial.write(data).then(success, failure); + * this.bluetoothSerial.write(data).then(success, failure); * * // Array Buffer - * BluetoothSerial.write(data.buffer).then(success, failure); + * this.bluetoothSerial.write(data.buffer).then(success, failure); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/brightness/index.ts b/src/@ionic-native/plugins/brightness/index.ts index b5c946372..29c5eb658 100644 --- a/src/@ionic-native/plugins/brightness/index.ts +++ b/src/@ionic-native/plugins/brightness/index.ts @@ -12,9 +12,12 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Brightness } from '@ionic-native/brightness'; * + * constructor(private brightness: Brightness) { } + * + * ... * * let brightnessValue: number = 0.8; - * Brightness.setBrightness(brightnessValue); + * this.brightness.setBrightness(brightnessValue); * ``` * */ diff --git a/src/@ionic-native/plugins/broadcaster/index.ts b/src/@ionic-native/plugins/broadcaster/index.ts index f8a8c2ced..4c7424422 100644 --- a/src/@ionic-native/plugins/broadcaster/index.ts +++ b/src/@ionic-native/plugins/broadcaster/index.ts @@ -11,11 +11,15 @@ import { Observable } from 'rxjs/Observable'; * ``` * import { Broadcaster } from '@ionic-native/broadcaster'; * + * constructor(private broadcaster: Broadcaster) { } + * + * ... + * * // Listen to events from Native - * Broadcaster.addEventListener('eventName').then((event) => console.log(event)); + * this.broadcaster.addEventListener('eventName').then((event) => console.log(event)); * * // Send event to Native - * Broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success')); + * this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success')); * * ``` */ diff --git a/src/@ionic-native/plugins/calendar/index.ts b/src/@ionic-native/plugins/calendar/index.ts index d2d251d7c..dba090199 100644 --- a/src/@ionic-native/plugins/calendar/index.ts +++ b/src/@ionic-native/plugins/calendar/index.ts @@ -65,9 +65,10 @@ export interface CalendarOptions { * ``` * import {Calendar} from '@ionic-native/calendar'; * + * constructor(private calendar: Calendar) { } * * - * Calendar.createCalendar('MyCalendar').then( + * this.calendar.createCalendar('MyCalendar').then( * (msg) => { console.log(msg); }, * (err) => { console.log(err); } * ); diff --git a/src/@ionic-native/plugins/call-number/index.ts b/src/@ionic-native/plugins/call-number/index.ts index bc023623c..452c2f3c3 100644 --- a/src/@ionic-native/plugins/call-number/index.ts +++ b/src/@ionic-native/plugins/call-number/index.ts @@ -9,7 +9,12 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ``` * import {CallNumber} from '@ionic-native/call-number'; * - * CallNumber.callNumber(18001010101, true) + * constructor(private callNumber: CallNumber) { } + * + * ... + * + * + * this.callNumber.callNumber(18001010101, true) * .then(() => console.log('Launched dialer!')) * .catch(() => console.log('Error launching dialer')); * diff --git a/src/@ionic-native/plugins/camera-preview/index.ts b/src/@ionic-native/plugins/camera-preview/index.ts index b15433ef0..7eace116c 100644 --- a/src/@ionic-native/plugins/camera-preview/index.ts +++ b/src/@ionic-native/plugins/camera-preview/index.ts @@ -33,6 +33,10 @@ export interface CameraPreviewSize { * ``` * import { CameraPreview, CameraPreviewRect } from '@ionic-native/camera-preview'; * + * constructor(private cameraPreview: CameraPreview) { } + * + * ... + * * // camera options (Size and location) * let cameraRect: CameraPreviewRect = { * x: 100, @@ -43,7 +47,7 @@ export interface CameraPreviewSize { * * * // start camera - * CameraPreview.startCamera( + * this.cameraPreview.startCamera( * cameraRect, // position and size of preview * 'front', // default camera * true, // tap to take picture @@ -53,26 +57,26 @@ export interface CameraPreviewSize { * ); * * // Set the handler to run every time we take a picture - * CameraPreview.setOnPictureTakenHandler().subscribe((result) => { + * this.cameraPreview.setOnPictureTakenHandler().subscribe((result) => { * console.log(result); * // do something with the result * }); * * * // take a picture - * CameraPreview.takePicture({ + * this.cameraPreview.takePicture({ * maxWidth: 640, * maxHeight: 640 * }); * * // Switch camera - * CameraPreview.switchCamera(); + * this.cameraPreview.switchCamera(); * * // set color effect to negative - * CameraPreview.setColorEffect('negative'); + * this.cameraPreview.setColorEffect('negative'); * * // Stop the camera preview - * CameraPreview.stopCamera(); + * this.cameraPreview.stopCamera(); * * ``` * diff --git a/src/@ionic-native/plugins/camera/index.ts b/src/@ionic-native/plugins/camera/index.ts index 95f617c5b..df61ac95d 100644 --- a/src/@ionic-native/plugins/camera/index.ts +++ b/src/@ionic-native/plugins/camera/index.ts @@ -96,8 +96,12 @@ export interface CameraPopoverOptions { * ```typescript * import { Camera } from '@ionic-native/camera'; * + * constructor(private camera: Camera) { } * - * Camera.getPicture(options).then((imageData) => { + * ... + * + * + * this.camera.getPicture(options).then((imageData) => { * // imageData is either a base64 encoded string or a file URI * // If it's base64: * let base64Image = 'data:image/jpeg;base64,' + imageData; diff --git a/src/@ionic-native/plugins/card-io/index.ts b/src/@ionic-native/plugins/card-io/index.ts index 27973b502..86eb3823c 100644 --- a/src/@ionic-native/plugins/card-io/index.ts +++ b/src/@ionic-native/plugins/card-io/index.ts @@ -136,8 +136,12 @@ export interface CardIOResponse { * ``` * import { CardIO } from '@ionic-native/card-io'; * + * constructor(private cardIO: CardIO) { } * - * CardIO.canScan() + * ... + * + * + * this.cardIO.canScan() * .then( * (res: boolean) => { * if(res){ diff --git a/src/@ionic-native/plugins/clipboard/index.ts b/src/@ionic-native/plugins/clipboard/index.ts index b268aeebf..577c541c8 100644 --- a/src/@ionic-native/plugins/clipboard/index.ts +++ b/src/@ionic-native/plugins/clipboard/index.ts @@ -12,18 +12,21 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Clipboard } from '@ionic-native/clipboard'; * + * constructor(private clipboard: Clipboard) { } * - * Clipboard.copy('Hello world'); + * ... * - * Clipboard.paste().then( + * + * this.clipboard.copy('Hello world'); + * + * this.clipboard.paste().then( * (resolve: string) => { - * alert(resolve); + * alert(resolve); * }, * (reject: string) => { - * alert('Error: ' + reject); + * alert('Error: ' + reject); * } - * ); - * ); + * ); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/code-push/index.ts b/src/@ionic-native/plugins/code-push/index.ts index 359c0449e..d95224eea 100644 --- a/src/@ionic-native/plugins/code-push/index.ts +++ b/src/@ionic-native/plugins/code-push/index.ts @@ -406,12 +406,16 @@ export interface DownloadProgress { * ```typescript * import { CodePush } from '@ionic-native/code-push'; * + * constructor(private codePush: CodePush) { } + * + * ... + * * // note - mostly error & completed methods of observable will not fire * // as syncStatus will contain the current state of the update - * CodePush.sync().subscribe((syncStatus) => console.log(syncStatus)); + * this.codePush.sync().subscribe((syncStatus) => console.log(syncStatus)); * * const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); } - * CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus)); + * this.codePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus)); * * ``` */ diff --git a/src/@ionic-native/plugins/contacts/index.ts b/src/@ionic-native/plugins/contacts/index.ts index a5c378499..5cde81c2c 100644 --- a/src/@ionic-native/plugins/contacts/index.ts +++ b/src/@ionic-native/plugins/contacts/index.ts @@ -262,8 +262,9 @@ export class ContactFindOptions implements IContactFindOptions { * ```typescript * import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts'; * + * constructor(private contacts: Contacts) { } * - * let contact: Contact = Contacts.create(); + * let contact: Contact = this.contacts.create(); * * contact.name = new ContactName(null, 'Smith', 'John'); * contact.phoneNumbers = [new ContactField('mobile', '6471234567')]; diff --git a/src/@ionic-native/plugins/crop/index.ts b/src/@ionic-native/plugins/crop/index.ts index 9e884ced6..abe9f91e0 100644 --- a/src/@ionic-native/plugins/crop/index.ts +++ b/src/@ionic-native/plugins/crop/index.ts @@ -8,9 +8,11 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ``` * import {Crop} from '@ionic-native/crop'; * + * constructor(private crop: Crop) { } + * * ... * - * Crop.crop('path/to/image.jpg', {quality: 75}) + * this.crop.crop('path/to/image.jpg', {quality: 75}) * .then( * newImage => console.log("new image path is: " + newImage), * error => console.error("Error cropping image", error) diff --git a/src/@ionic-native/plugins/date-picker/index.ts b/src/@ionic-native/plugins/date-picker/index.ts index d1b625f90..a749c077f 100644 --- a/src/@ionic-native/plugins/date-picker/index.ts +++ b/src/@ionic-native/plugins/date-picker/index.ts @@ -128,8 +128,13 @@ export interface DatePickerOptions { * ```typescript * import { DatePicker } from '@ionic-native/date-picker'; * + * constructor(private datePicker: DatePicker) { } * - * DatePicker.show({ + * + * ... + * + * + * this.datePicker.show({ * date: new Date(), * mode: 'date' * }).then( diff --git a/src/@ionic-native/plugins/db-meter/index.ts b/src/@ionic-native/plugins/db-meter/index.ts index 24c4b1333..ba9750608 100644 --- a/src/@ionic-native/plugins/db-meter/index.ts +++ b/src/@ionic-native/plugins/db-meter/index.ts @@ -9,14 +9,18 @@ import { Observable } from 'rxjs/Observable'; * ```typescript * import { DBMeter } from '@ionic-native/db-meter'; * + * constructor(private dbMeter: DBMeter) { } + * + * ... + * * * // Start listening - * let subscription = DBMeter.start().subscribe( + * let subscription = this.dbMeter.start().subscribe( * data => console.log(data) * ); * * // Check if we are listening - * DBMeter.isListening().then( + * this.dbMeter.isListening().then( * (isListening: boolean) => console.log(isListening) * ); * @@ -24,7 +28,7 @@ import { Observable } from 'rxjs/Observable'; * subscription.unsubscribe(); * * // Delete DBMeter instance from memory - * DBMeter.delete().then( + * this.dbMeter.delete().then( * () => console.log('Deleted DB Meter instance'), * error => console.log('Error occurred while deleting DB Meter instance') * ); diff --git a/src/@ionic-native/plugins/deeplinks/index.ts b/src/@ionic-native/plugins/deeplinks/index.ts index bdfedbca5..069552e63 100644 --- a/src/@ionic-native/plugins/deeplinks/index.ts +++ b/src/@ionic-native/plugins/deeplinks/index.ts @@ -32,37 +32,39 @@ export interface DeeplinkMatch { * ```typescript * import { Deeplinks } from '@ionic-native/deeplinks'; * - * Deeplinks.route({ - '/about-us': AboutPage, - '/universal-links-test': AboutPage, - '/products/:productId': ProductPage - }).subscribe((match) => { - // match.$route - the route we matched, which is the matched entry from the arguments to route() - // match.$args - the args passed in the link - // match.$link - the full link data - console.log('Successfully matched route', match); - }, (nomatch) => { - // nomatch.$link - the full link data - console.error('Got a deeplink that didn\'t match', nomatch); - }); + * constructor(private deepLinks: DeepLinks) { } + * + * this.deepLinks.route({ + * '/about-us': AboutPage, + * '/universal-links-test': AboutPage, + * '/products/:productId': ProductPage + * }).subscribe((match) => { + * // match.$route - the route we matched, which is the matched entry from the arguments to route() + * // match.$args - the args passed in the link + * // match.$link - the full link data + * console.log('Successfully matched route', match); + * }, (nomatch) => { + * // nomatch.$link - the full link data + * console.error('Got a deeplink that didn\'t match', nomatch); + * }); * ``` * * Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles * the actual navigation for you: * * ```typescript - * Deeplinks.routeWithNavController(this.navController, { - '/about-us': AboutPage, - '/products/:productId': ProductPage - }).subscribe((match) => { - // match.$route - the route we matched, which is the matched entry from the arguments to route() - // match.$args - the args passed in the link - // match.$link - the full link data - console.log('Successfully matched route', match); - }, (nomatch) => { - // nomatch.$link - the full link data - console.error('Got a deeplink that didn\'t match', nomatch); - }); + * this.deepLinks.routeWithNavController(this.navController, { + * '/about-us': AboutPage, + * '/products/:productId': ProductPage + * }).subscribe((match) => { + * // match.$route - the route we matched, which is the matched entry from the arguments to route() + * // match.$args - the args passed in the link + * // match.$link - the full link data + * console.log('Successfully matched route', match); + * }, (nomatch) => { + * // nomatch.$link - the full link data + * console.error('Got a deeplink that didn\'t match', nomatch); + * }); * ``` * * See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to diff --git a/src/@ionic-native/plugins/device-accounts/index.ts b/src/@ionic-native/plugins/device-accounts/index.ts index 738606e71..17190ad80 100644 --- a/src/@ionic-native/plugins/device-accounts/index.ts +++ b/src/@ionic-native/plugins/device-accounts/index.ts @@ -1,6 +1,25 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin } from '@ionic-native/core'; +/** + * @name Device Accounts + * @description + * Gets the Google accounts associated with the Android device + * + * @usage + * ```typescript + * import { DeviceAccounts } from '@ionic-native/device-accounts'; + * + * constructor(private deviceAccounts: DeviceAccounts) { } + * + * ... + * + * this.deviceAccounts.get() + * .then(accounts => console.log(accounts)) + * .catch(error => console.error(error)); + * + * ``` + */ @Plugin({ pluginName: 'DeviceAccounts', plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git', diff --git a/src/@ionic-native/plugins/device-feedback/index.ts b/src/@ionic-native/plugins/device-feedback/index.ts index 310fb2c61..de17b6d5f 100644 --- a/src/@ionic-native/plugins/device-feedback/index.ts +++ b/src/@ionic-native/plugins/device-feedback/index.ts @@ -10,11 +10,16 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ``` * import { DeviceFeedback } from '@ionic-native/device-feedback'; * - * DeviceFeedback.acoustic(); + * constructor(private deviceFeedback: DeviceFeedback) { } * - * DeviceFeedback.haptic(0); + * ... * - * DeviceFeedback.isFeedbackEnabled() + * + * this.deviceFeedback.acoustic(); + * + * this.deviceFeedback.haptic(0); + * + * this.deviceFeedback.isFeedbackEnabled() * .then((feedback) => { * console.log(feedback); * // { diff --git a/src/@ionic-native/plugins/device/index.ts b/src/@ionic-native/plugins/device/index.ts index 62baf8755..9404c3d64 100644 --- a/src/@ionic-native/plugins/device/index.ts +++ b/src/@ionic-native/plugins/device/index.ts @@ -12,8 +12,11 @@ declare var window: any; * ```typescript * import { Device } from '@ionic-native/device'; * + * constructor(private device: Device) { } * - * console.log('Device UUID is: ' + Device.uuid); + * ... + * + * console.log('Device UUID is: ' + this.device.uuid); * ``` */ @Plugin({