mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-04 00:13:06 +08:00
Merge branch 'master' into v5
This commit is contained in:
commit
29d668ca2f
@ -1,105 +0,0 @@
|
||||
export interface PluginConfig {
|
||||
/**
|
||||
* Plugin name, this should match the class name
|
||||
*/
|
||||
pluginName: string;
|
||||
/**
|
||||
* Plugin NPM package name
|
||||
*/
|
||||
plugin: string;
|
||||
/**
|
||||
* Plugin object reference
|
||||
*/
|
||||
pluginRef?: string;
|
||||
/**
|
||||
* Github repository URL
|
||||
*/
|
||||
repo?: string;
|
||||
/**
|
||||
* Custom install command
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Available installation variables
|
||||
*/
|
||||
installVariables?: string[];
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface CordovaOptions {
|
||||
destruct?: boolean;
|
||||
/**
|
||||
* Set to true if the wrapped method is a sync function
|
||||
*/
|
||||
sync?: boolean;
|
||||
/**
|
||||
* Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method takes.
|
||||
*/
|
||||
callbackOrder?: 'reverse';
|
||||
/**
|
||||
* Callback style
|
||||
*/
|
||||
callbackStyle?: 'node' | 'object';
|
||||
/**
|
||||
* Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
|
||||
*/
|
||||
successIndex?: number;
|
||||
/**
|
||||
* Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
|
||||
*/
|
||||
errorIndex?: number;
|
||||
/**
|
||||
* Success function property name. This must be set if callbackStyle is set to object.
|
||||
*/
|
||||
successName?: string;
|
||||
/**
|
||||
* Error function property name. This must be set if callbackStyle is set to object.
|
||||
*/
|
||||
errorName?: string;
|
||||
/**
|
||||
* Set to true to return an observable
|
||||
*/
|
||||
observable?: boolean;
|
||||
/**
|
||||
* If observable is set to true, this can be set to a different function name that will cancel the observable.
|
||||
*/
|
||||
clearFunction?: string;
|
||||
/**
|
||||
* This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function.
|
||||
*/
|
||||
clearWithArgs?: boolean;
|
||||
/**
|
||||
* Creates an observable that wraps a global event. Replaces document.addEventListener
|
||||
*/
|
||||
eventObservable?: boolean;
|
||||
/**
|
||||
* Event name, this must be set if eventObservable is set to true
|
||||
*/
|
||||
event?: string;
|
||||
/**
|
||||
* Element to attach the event listener to, this is optional, defaults to `window`
|
||||
*/
|
||||
element?: any;
|
||||
/**
|
||||
* Set to true if the wrapped method returns a promise
|
||||
*/
|
||||
otherPromise?: boolean;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
export declare const Plugin: (config: PluginConfig) => ClassDecorator;
|
||||
export declare const Cordova: (config?: CordovaOptions) => MethodDecorator;
|
||||
export declare const CordovaProperty: () => PropertyDecorator;
|
||||
export declare const CordovaInstance: (config?: CordovaOptions) => MethodDecorator;
|
||||
export declare const InstanceProperty: () => PropertyDecorator;
|
||||
export declare const CordovaCheck: (config?: CordovaOptions) => MethodDecorator;
|
||||
export declare const InstanceCheck: (config?: CordovaOptions) => MethodDecorator;
|
||||
export declare const CordovaFunctionOverride: () => MethodDecorator;
|
@ -37,14 +37,14 @@ import { Observable } from 'rxjs';
|
||||
export class AppCenterPush extends IonicNativePlugin {
|
||||
/**
|
||||
* Subscribe to an event
|
||||
* @param {string} eventname Event name
|
||||
* @param {string} eventName Event name
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'removeEventListener'
|
||||
})
|
||||
addEventListener(eventname: string): Observable<any> {
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
|
@ -51,7 +51,8 @@ export interface AppUpdateOptions {
|
||||
export class AppUpdate extends IonicNativePlugin {
|
||||
/**
|
||||
* Check and update
|
||||
* @param updateUrl {string} update api url
|
||||
* @param {string} updateUrl update api url
|
||||
* @param {AppUpdateOptions} [options] options
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -1,4 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
@ -65,7 +68,6 @@ export interface IOrderItem {
|
||||
label: string;
|
||||
amount: number;
|
||||
}
|
||||
|
||||
export interface IShippingMethod {
|
||||
identifier: string;
|
||||
label: string;
|
||||
@ -214,9 +216,9 @@ export class ApplePay extends IonicNativePlugin {
|
||||
* any shipping contact selection event or else the user will not be able
|
||||
* to complete a transaction on the pay sheet. Do not call without
|
||||
* subscribing to shipping contact selection events first
|
||||
* @returns {Promise}
|
||||
*
|
||||
* @param {Object} including `items` and `shippingMethods` properties.
|
||||
* @param {IOrderItemsAndShippingMethods} list `items` and `shippingMethods` properties.
|
||||
* @returns {Promise<IUpdateItemsAndShippingStatus>}
|
||||
*
|
||||
* @usage
|
||||
* this.applePay.startListeningForShippingContactSelection().pluck('shippingAddressState').subscribe(shippingAddressState => {
|
||||
@ -254,9 +256,9 @@ export class ApplePay extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Request a payment with Apple Pay
|
||||
* @return {Promise<IPaymentResponse>} Returns a promise that resolves when something happens
|
||||
*
|
||||
* @param order {IOrder}
|
||||
* @param {IOrder} order
|
||||
* @return {Promise<IPaymentResponse>} Returns a promise that resolves when something happens
|
||||
*
|
||||
* @usage
|
||||
* try {
|
||||
@ -331,11 +333,11 @@ export class ApplePay extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Once the makePaymentRequest has been resolved successfully, the device will be waiting for a completion event.
|
||||
* This means, that the application must proceed with the token authorisation and return a success, failure,
|
||||
* This means, that the application must proceed with the token authorization and return a success, failure,
|
||||
* or other validation error. Once this has been passed back, the Apple Pay sheet will be dismissed via an animation.
|
||||
* @return {Promise<ICompleteTransaction>} Returns a promise that resolves after confirmation of payment authorization completion
|
||||
*
|
||||
* @param complete {ITransactionStatus}
|
||||
* @param {ITransactionStatus} complete
|
||||
* @return {Promise<ICompleteTransaction>} Returns a promise that resolves after confirmation of payment authorization completion
|
||||
*
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
@ -122,6 +124,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
* Override the default title, ticker and text.
|
||||
* Available only for Android platform.
|
||||
* @param {BackgroundModeConfiguration} options List of option to configure. See table below
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
@ -133,7 +136,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
/**
|
||||
* Modify the displayed information.
|
||||
* Available only for Android platform.
|
||||
* @param {BackgroundModeConfiguration} options Any options you want to update. See table below.
|
||||
* @param {BackgroundModeConfiguration} [options] Any options you want to update. See table below.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
@ -202,6 +205,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* The method works async instead of isActive() or isEnabled().
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
|
@ -124,7 +124,7 @@ export class BarcodeScanner extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Open the barcode scanner.
|
||||
* @param options {BarcodeScannerOptions} Optional options to pass to the scanner
|
||||
* @param {BarcodeScannerOptions} [options] Optional options to pass to the scanner
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
@ -137,8 +137,8 @@ export class BarcodeScanner extends IonicNativePlugin {
|
||||
/**
|
||||
* Encodes data into a barcode.
|
||||
* NOTE: not well supported on Android
|
||||
* @param type {string} Type of encoding
|
||||
* @param data {any} Data to encode
|
||||
* @param {string} type Type of encoding
|
||||
* @param {any} data Data to encode
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -74,7 +74,7 @@ export class BatteryStatus extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Watch when the battery level goes to critial
|
||||
* Watch when the battery level goes to critical
|
||||
* @returns {Observable<BatteryStatusResponse>} Returns an observable that pushes a status object
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -232,7 +232,7 @@ export class BLE extends IonicNativePlugin {
|
||||
/**
|
||||
* Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
|
||||
* @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
|
||||
* @param options {any}
|
||||
* @param {BLEScanOptions} options Options
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each peripheral discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
@ -259,7 +259,7 @@ export class BLE extends IonicNativePlugin {
|
||||
* BLE.stopScan().then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @return returns a Promise.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
stopScan(): Promise<any> {
|
||||
@ -277,8 +277,8 @@ export class BLE extends IonicNativePlugin {
|
||||
* console.log('disconnected');
|
||||
* });
|
||||
* ```
|
||||
* @param deviceId {string} UUID or MAC address of the peripheral
|
||||
* @return Returns an Observable that notifies of connect/disconnect.
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
* @return {Observable<any>} Returns an Observable that notifies of connect/disconnect.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
@ -297,8 +297,8 @@ export class BLE extends IonicNativePlugin {
|
||||
* console.log('Disconnected');
|
||||
* });
|
||||
* ```
|
||||
* @param deviceId {string} UUID or MAC address of the peripheral
|
||||
* @return Returns a Promise
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
* @return {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
disconnect(deviceId: string): Promise<any> {
|
||||
@ -311,7 +311,7 @@ export class BLE extends IonicNativePlugin {
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
* @param {string} serviceUUID UUID of the BLE service
|
||||
* @param {string} characteristicUUID UUID of the BLE characteristic
|
||||
* @return Returns a Promise
|
||||
* @return {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
read(
|
||||
@ -348,7 +348,7 @@ export class BLE extends IonicNativePlugin {
|
||||
* @param {string} serviceUUID UUID of the BLE service
|
||||
* @param {string} characteristicUUID UUID of the BLE characteristic
|
||||
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
|
||||
* @return Returns a Promise
|
||||
* @return {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
write(
|
||||
@ -367,7 +367,7 @@ export class BLE extends IonicNativePlugin {
|
||||
* @param {string} serviceUUID UUID of the BLE service
|
||||
* @param {string} characteristicUUID UUID of the BLE characteristic
|
||||
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
|
||||
* @return Returns a Promise
|
||||
* @return {Promise<any>} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
writeWithoutResponse(
|
||||
@ -392,7 +392,7 @@ export class BLE extends IonicNativePlugin {
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
* @param {string} serviceUUID UUID of the BLE service
|
||||
* @param {string} characteristicUUID UUID of the BLE characteristic
|
||||
* @return Returns an Observable that notifies of characteristic changes.
|
||||
* @return {Observable<any>} Returns an Observable that notifies of characteristic changes.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
@ -462,7 +462,7 @@ export class BLE extends IonicNativePlugin {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @return Returns an Observable that notifies when the Bluetooth is enabled or disabled on the device.
|
||||
* @return {Observable<any>} Returns an Observable that notifies when the Bluetooth is enabled or disabled on the device.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
|
@ -139,7 +139,7 @@ export interface PaymentUIResult {
|
||||
* @description
|
||||
* This plugin enables the use of the Braintree Drop-In Payments UI in your Ionic applications on Android and iOS, using the native Drop-In UI for each platform (not the Javascript SDK).
|
||||
*
|
||||
* Ionic Native utilizes [a maintaned fork](https://github.com/taracque/cordova-plugin-braintree) of the original `cordova-plugin-braintree`
|
||||
* Ionic Native utilizes [a maintained fork](https://github.com/taracque/cordova-plugin-braintree) of the original `cordova-plugin-braintree`
|
||||
*
|
||||
* For information on how to use Apple Pay with this plugin, please refer to the [plugin documentation](https://github.com/Taracque/cordova-plugin-braintree#apple-pay-ios-only)
|
||||
*
|
||||
@ -200,21 +200,21 @@ export interface PaymentUIResult {
|
||||
pluginRef: 'BraintreePlugin',
|
||||
repo: 'https://github.com/taracque/cordova-plugin-braintree',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic cordova plugin add https://github.com/taracque/cordova-plugin-braintree',
|
||||
installVariables: [],
|
||||
install:
|
||||
'ionic cordova plugin add https://github.com/taracque/cordova-plugin-braintree',
|
||||
installVariables: []
|
||||
})
|
||||
@Injectable()
|
||||
export class Braintree extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Used to initialize the Braintree client. This function must be called before other methods can be used.
|
||||
* As the initialize code is async, be sure you call all Braintree related methods after the initialize promise has resolved.
|
||||
*
|
||||
* @param token {string} The client token or tokenization key to use with the Braintree client.
|
||||
* @param {string} token The client token or tokenization key to use with the Braintree client.
|
||||
* @return {Promise<undefined | string>} Returns a promise that resolves with undefined on successful initialization, or rejects with a string message describing the failure.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
initialize(token: string): Promise<undefined | string> {
|
||||
return;
|
||||
@ -229,11 +229,11 @@ export class Braintree extends IonicNativePlugin {
|
||||
*
|
||||
* Calling this function on Android is a `noop` so you can call it without having to check which cordova platform you are on! :D
|
||||
*
|
||||
* @param options {ApplePayOptions} The options used to configure Apple Pay.
|
||||
* @param {ApplePayOptions}options The options used to configure Apple Pay.
|
||||
* @return {Promise<undefined | string>} Returns a promise that resolves with undefined on successful initialization, or rejects with a string message describing the failure.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS'],
|
||||
platforms: ['iOS']
|
||||
})
|
||||
setupApplePay(options: ApplePayOptions): Promise<undefined | string> {
|
||||
return;
|
||||
@ -247,9 +247,11 @@ export class Braintree extends IonicNativePlugin {
|
||||
* @return {Promise<PaymentUIResult | string>} Returns a promise that resolves with a PaymentUIResult object on successful payment (or the user cancels), or rejects with a string message describing the failure.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android', 'iOS'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
presentDropInPaymentUI(options?: PaymentUIOptions): Promise<PaymentUIResult | string> {
|
||||
presentDropInPaymentUI(
|
||||
options?: PaymentUIOptions
|
||||
): Promise<PaymentUIResult | string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export class Brightness extends IonicNativePlugin {
|
||||
/**
|
||||
* Sets the brightness of the display.
|
||||
*
|
||||
* @param value {number} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
|
||||
* @param {number} value Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves if setting brightness was successful.
|
||||
*/
|
||||
@Cordova()
|
||||
@ -54,6 +54,7 @@ export class Brightness extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Keeps the screen on. Prevents the device from setting the screen to sleep.
|
||||
* @param {boolean} value
|
||||
*/
|
||||
@Cordova()
|
||||
setKeepScreenOn(value: boolean): void {}
|
||||
|
@ -34,7 +34,7 @@ import { Observable } from 'rxjs';
|
||||
export class Broadcaster extends IonicNativePlugin {
|
||||
/**
|
||||
* This function listen to an event sent from the native code
|
||||
* @param eventName {string}
|
||||
* @param {string} eventName
|
||||
* @return {Observable<any>} Returns an observable to watch when an event is received
|
||||
*/
|
||||
@Cordova({
|
||||
@ -48,8 +48,8 @@ export class Broadcaster extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function sends data to the native code
|
||||
* @param eventName {string}
|
||||
* @param eventData {any}
|
||||
* @param {string} eventName
|
||||
* @param {any} eventData
|
||||
* @return {Promise<any>} Returns a promise that resolves when an event is successfully fired
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Browser Tab
|
||||
@ -13,21 +13,13 @@ import { Injectable } from '@angular/core';
|
||||
* constructor(private browserTab: BrowserTab) {
|
||||
*
|
||||
* browserTab.isAvailable()
|
||||
* .then((isAvailable: boolean) => {
|
||||
*
|
||||
* .then(isAvailable => {
|
||||
* if (isAvailable) {
|
||||
*
|
||||
* browserTab.openUrl('https://ionic.io');
|
||||
*
|
||||
* } else {
|
||||
*
|
||||
* // open URL with InAppBrowser instead or SafariViewController
|
||||
*
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
*
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
@ -41,7 +33,6 @@ import { Injectable } from '@angular/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class BrowserTab extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check if BrowserTab option is available
|
||||
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
|
||||
|
@ -93,7 +93,7 @@ export class Calendar extends IonicNativePlugin {
|
||||
* This function checks if we have permission to read/write from/to the calendar.
|
||||
* The promise will resolve with `true` when:
|
||||
* - You're running on iOS, or
|
||||
* - You're targetting API level lower than 23, or
|
||||
* - You're targeting API level lower than 23, or
|
||||
* - You're using Android < 6, or
|
||||
* - You've already granted permission
|
||||
*
|
||||
@ -184,7 +184,7 @@ export class Calendar extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns options for a custom calender with sepcific colord
|
||||
* Returns options for a custom calender with specific color
|
||||
*
|
||||
* @return {NameOrOptions} Returns an object with the default options
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ export interface CallLogObject {
|
||||
export class CallLog extends IonicNativePlugin {
|
||||
/**
|
||||
* This function return the call logs
|
||||
* @param filters {CallLogObject[]} array of object to filter the query
|
||||
* @param {CallLogObject[]} filters array of object to filter the query
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -33,8 +33,8 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
export class CallNumber extends IonicNativePlugin {
|
||||
/**
|
||||
* Calls a phone number
|
||||
* @param numberToCall {string} The phone number to call as a string
|
||||
* @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer
|
||||
* @param {string} numberToCall The phone number to call as a string
|
||||
* @param {boolean} bypassAppChooser Set to true to bypass the app chooser and go directly to dialer
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -40,7 +40,7 @@ export interface CameraPreviewOptions {
|
||||
/** Tap to set specific focus point. Note, this assumes the camera is full-screen. default false */
|
||||
tapToFocus?: boolean;
|
||||
|
||||
/** On Android disable automatic rotation of the image and stripping of Exif header. default false */
|
||||
/** On Android disable automatic rotation of the image and stripping of Exit header. default false */
|
||||
disableExifHeaderStripping?: boolean;
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Take the picture (base64)
|
||||
* @param [options] {CameraPreviewPictureOptions} size and quality of the picture to take
|
||||
* @param {CameraPreviewPictureOptions} [options] size and quality of the picture to take
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -293,7 +293,7 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set the preview Size
|
||||
* @param [dimensions] {CameraPreviewDimensions}
|
||||
* @param {CameraPreviewDimensions} [dimensions]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -315,7 +315,7 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set the focus mode
|
||||
* @param [focusMode] {string} 'fixed', 'auto', 'continuous-picture', 'continuous-video' (iOS & Android), 'edof', 'infinity', 'macro' (Android Only)
|
||||
* @param {string} [focusMode] 'fixed', 'auto', 'continuous-picture', 'continuous-video' (iOS & Android), 'edof', 'infinity', 'macro' (Android Only)
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -346,7 +346,7 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set the flash mode
|
||||
* @param [flashMode] {string} 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
|
||||
* @param {string} [flashMode] 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -395,7 +395,7 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set exposure mode
|
||||
* @param [lock] {string}
|
||||
* @param {string} [lock]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -417,7 +417,7 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set exposure compensation (Android)
|
||||
* @param [exposureCompensation] {number}
|
||||
* @param {number} [exposureCompensation]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -439,8 +439,8 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set specific focus point. Note, this assumes the camera is full-screen.
|
||||
* @param xPoint {number}
|
||||
* @param yPoint {number}
|
||||
* @param {number} xPoint
|
||||
* @param {number} yPoint
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -182,7 +182,7 @@ export class CardIO extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Scan a credit card with card.io.
|
||||
* @param {CardIOOptions} options Options for configuring the plugin
|
||||
* @param {CardIOOptions} [options] Options for configuring the plugin
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -22,7 +22,6 @@ namespace Http {
|
||||
|
||||
export interface Requester {
|
||||
request(verb: Verb, url: string, callback: Callback<Response>): void;
|
||||
|
||||
request(
|
||||
verb: Verb,
|
||||
url: string,
|
||||
@ -160,6 +159,12 @@ interface NativeUpdateNotification {
|
||||
export interface Callback<T> {
|
||||
(error: Error, parameter: T): void;
|
||||
}
|
||||
export interface SuccessCallback<T> {
|
||||
(result?: T): void;
|
||||
}
|
||||
export interface ErrorCallback {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
export interface SuccessCallback<T> {
|
||||
(result?: T): void;
|
||||
@ -184,12 +189,10 @@ declare class AcquisitionStatus {
|
||||
|
||||
declare class AcquisitionManager {
|
||||
constructor(httpRequester: Http.Requester, configuration: Configuration);
|
||||
|
||||
public queryUpdateWithCurrentPackage(
|
||||
currentPackage: IPackage,
|
||||
callback?: Callback<IRemotePackage | NativeUpdateNotification>
|
||||
): void;
|
||||
|
||||
public reportStatusDeploy(
|
||||
pkg?: IPackage,
|
||||
status?: string,
|
||||
@ -197,7 +200,6 @@ declare class AcquisitionManager {
|
||||
previousDeploymentKey?: string,
|
||||
callback?: Callback<void>
|
||||
): void;
|
||||
|
||||
public reportStatusDownload(pkg: IPackage, callback?: Callback<void>): void;
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,47 @@
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import {
|
||||
checkAvailability,
|
||||
CordovaCheck,
|
||||
CordovaInstance,
|
||||
getPromise,
|
||||
InstanceCheck,
|
||||
InstanceProperty,
|
||||
IonicNativePlugin,
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
|
||||
declare const window: any,
|
||||
navigator: any;
|
||||
declare const window: any, navigator: any;
|
||||
|
||||
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'name.familyName' | 'name.formatted' | 'name.givenName' | 'name.honorificPrefix' | 'name.honorificSuffix' | 'id' | 'ims' | 'locality' | 'name.middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
export type ContactFieldType =
|
||||
| '*'
|
||||
| 'addresses'
|
||||
| 'birthday'
|
||||
| 'categories'
|
||||
| 'country'
|
||||
| 'department'
|
||||
| 'displayName'
|
||||
| 'emails'
|
||||
| 'name.familyName'
|
||||
| 'name.formatted'
|
||||
| 'name.givenName'
|
||||
| 'name.honorificPrefix'
|
||||
| 'name.honorificSuffix'
|
||||
| 'id'
|
||||
| 'ims'
|
||||
| 'locality'
|
||||
| 'name.middleName'
|
||||
| 'name'
|
||||
| 'nickname'
|
||||
| 'note'
|
||||
| 'organizations'
|
||||
| 'phoneNumbers'
|
||||
| 'photos'
|
||||
| 'postalCode'
|
||||
| 'region'
|
||||
| 'streetAddress'
|
||||
| 'title'
|
||||
| 'urls';
|
||||
|
||||
export interface IContactProperties {
|
||||
|
||||
/** A globally unique identifier. */
|
||||
id?: string;
|
||||
|
||||
@ -48,7 +83,6 @@ export interface IContactProperties {
|
||||
|
||||
/** An array of web pages associated with the contact. */
|
||||
urls?: IContactField[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +108,9 @@ export class Contact implements IContactProperties {
|
||||
[key: string]: any;
|
||||
|
||||
constructor() {
|
||||
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
|
||||
if (
|
||||
checkAvailability('navigator.contacts', 'create', 'Contacts') === true
|
||||
) {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
}
|
||||
}
|
||||
@ -126,7 +162,7 @@ export declare const ContactError: {
|
||||
PENDING_OPERATION_ERROR: number;
|
||||
IO_ERROR: number;
|
||||
NOT_SUPPORTED_ERROR: number;
|
||||
PERMISSION_DENIED_ERROR: number
|
||||
PERMISSION_DENIED_ERROR: number;
|
||||
};
|
||||
|
||||
export interface IContactName {
|
||||
@ -148,13 +184,14 @@ export interface IContactName {
|
||||
* @hidden
|
||||
*/
|
||||
export class ContactName implements IContactName {
|
||||
constructor(public formatted?: string,
|
||||
constructor(
|
||||
public formatted?: string,
|
||||
public familyName?: string,
|
||||
public givenName?: string,
|
||||
public middleName?: string,
|
||||
public honorificPrefix?: string,
|
||||
public honorificSuffix?: string) {
|
||||
}
|
||||
public honorificSuffix?: string
|
||||
) {}
|
||||
}
|
||||
|
||||
export interface IContactField {
|
||||
@ -170,10 +207,11 @@ export interface IContactField {
|
||||
* @hidden
|
||||
*/
|
||||
export class ContactField implements IContactField {
|
||||
constructor(public type?: string,
|
||||
constructor(
|
||||
public type?: string,
|
||||
public value?: string,
|
||||
public pref?: boolean) {
|
||||
}
|
||||
public pref?: boolean
|
||||
) {}
|
||||
}
|
||||
|
||||
export interface IContactAddress {
|
||||
@ -199,15 +237,16 @@ export interface IContactAddress {
|
||||
* @hidden
|
||||
*/
|
||||
export class ContactAddress implements IContactAddress {
|
||||
constructor(public pref?: boolean,
|
||||
constructor(
|
||||
public pref?: boolean,
|
||||
public type?: string,
|
||||
public formatted?: string,
|
||||
public streetAddress?: string,
|
||||
public locality?: string,
|
||||
public region?: string,
|
||||
public postalCode?: string,
|
||||
public country?: string) {
|
||||
}
|
||||
public country?: string
|
||||
) {}
|
||||
}
|
||||
|
||||
export interface IContactOrganization {
|
||||
@ -227,12 +266,13 @@ export interface IContactOrganization {
|
||||
* @hidden
|
||||
*/
|
||||
export class ContactOrganization implements IContactOrganization {
|
||||
constructor(public type?: string,
|
||||
constructor(
|
||||
public type?: string,
|
||||
public name?: string,
|
||||
public department?: string,
|
||||
public title?: string,
|
||||
public pref?: boolean) {
|
||||
}
|
||||
public pref?: boolean
|
||||
) {}
|
||||
}
|
||||
|
||||
/** Search options to filter navigator.contacts. */
|
||||
@ -253,11 +293,12 @@ export interface IContactFindOptions {
|
||||
* @hidden
|
||||
*/
|
||||
export class ContactFindOptions implements IContactFindOptions {
|
||||
constructor(public filter?: string,
|
||||
constructor(
|
||||
public filter?: string,
|
||||
public multiple?: boolean,
|
||||
public desiredFields?: string[],
|
||||
public hasPhoneNumber?: boolean) {
|
||||
}
|
||||
public hasPhoneNumber?: boolean
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,10 +339,19 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows 8', 'Windows Phone']
|
||||
platforms: [
|
||||
'Android',
|
||||
'BlackBerry 10',
|
||||
'Browser',
|
||||
'Firefox OS',
|
||||
'iOS',
|
||||
'Ubuntu',
|
||||
'Windows',
|
||||
'Windows 8',
|
||||
'Windows Phone'
|
||||
]
|
||||
})
|
||||
export class Contacts extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Create a single contact.
|
||||
* @returns {Contact} Returns a Contact object
|
||||
@ -312,16 +362,24 @@ export class Contacts extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Search for contacts in the Contacts list.
|
||||
* @param fields {ContactFieldType[]} Contact fields to be used as a search qualifier
|
||||
* @param options {IContactFindOptions} Optional options for the query
|
||||
* @param {ContactFieldType[]} fields Contact fields to be used as a search qualifier
|
||||
* @param {IContactFindOptions} [options] Optional options for the query
|
||||
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
*/
|
||||
@CordovaCheck()
|
||||
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
find(
|
||||
fields: ContactFieldType[],
|
||||
options?: IContactFindOptions
|
||||
): Promise<Contact[]> {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
navigator.contacts.find(fields, (contacts: any[]) => {
|
||||
navigator.contacts.find(
|
||||
fields,
|
||||
(contacts: any[]) => {
|
||||
resolve(contacts.map(processContact));
|
||||
}, reject, options);
|
||||
},
|
||||
reject,
|
||||
options
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -332,10 +390,12 @@ export class Contacts extends IonicNativePlugin {
|
||||
@CordovaCheck()
|
||||
pickContact(): Promise<Contact> {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
|
||||
navigator.contacts.pickContact(
|
||||
(contact: any) => resolve(processContact(contact)),
|
||||
reject
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,8 +38,8 @@ export interface CropOptions {
|
||||
export class Crop extends IonicNativePlugin {
|
||||
/**
|
||||
* Crops an image
|
||||
* @param pathToImage
|
||||
* @param options
|
||||
* @param {string} pathToImage
|
||||
* @param {CropOptions} [options]
|
||||
* @returns {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -53,6 +53,7 @@ export class DeviceAccounts extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Get all accounts registered on Android device for requested type
|
||||
* @param {string} type
|
||||
* @returns {Promise<AndroidAccount[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -57,7 +57,7 @@ export class DeviceFeedback extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
|
||||
* @param type {number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
|
||||
* @param {number} type Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
haptic(type: number): void {}
|
||||
|
@ -101,7 +101,7 @@ export class DeviceOrientation extends IonicNativePlugin {
|
||||
* Get the device current heading at a regular interval
|
||||
*
|
||||
* Stop the watch by unsubscribing from the observable
|
||||
* @param {DeviceOrientationCompassOptions} options Options for compass. Frequency and Filter. Optional
|
||||
* @param {DeviceOrientationCompassOptions} [options] Options for compass. Frequency and Filter. Optional
|
||||
* @returns {Observable<DeviceOrientationCompassHeading>} Returns an observable that contains the compass heading
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import {
|
||||
Cordova,
|
||||
CordovaProperty,
|
||||
IonicNativePlugin,
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Diagnostic
|
||||
@ -43,7 +48,6 @@ import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-nati
|
||||
})
|
||||
@Injectable()
|
||||
export class Diagnostic extends IonicNativePlugin {
|
||||
|
||||
permission = {
|
||||
READ_CALENDAR: 'READ_CALENDAR',
|
||||
WRITE_CALENDAR: 'WRITE_CALENDAR',
|
||||
@ -92,9 +96,23 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
|
||||
LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
|
||||
MICROPHONE: ['RECORD_AUDIO'],
|
||||
PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
|
||||
PHONE: [
|
||||
'READ_PHONE_STATE',
|
||||
'CALL_PHONE',
|
||||
'ADD_VOICEMAIL',
|
||||
'USE_SIP',
|
||||
'PROCESS_OUTGOING_CALLS',
|
||||
'READ_CALL_LOG',
|
||||
'WRITE_CALL_LOG'
|
||||
],
|
||||
SENSORS: ['BODY_SENSORS'],
|
||||
SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
|
||||
SMS: [
|
||||
'SEND_SMS',
|
||||
'RECEIVE_SMS',
|
||||
'READ_SMS',
|
||||
'RECEIVE_WAP_PUSH',
|
||||
'RECEIVE_MMS'
|
||||
],
|
||||
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
|
||||
};
|
||||
|
||||
@ -181,29 +199,25 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
* Displays the device location settings to allow user to enable location services/change location mode.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10', 'iOS'] })
|
||||
switchToLocationSettings(): void {
|
||||
}
|
||||
switchToLocationSettings(): void {}
|
||||
|
||||
/**
|
||||
* Displays mobile settings to allow user to enable mobile data.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
switchToMobileDataSettings(): void {
|
||||
}
|
||||
switchToMobileDataSettings(): void {}
|
||||
|
||||
/**
|
||||
* Displays Bluetooth settings to allow user to enable Bluetooth.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
switchToBluetoothSettings(): void {
|
||||
}
|
||||
switchToBluetoothSettings(): void {}
|
||||
|
||||
/**
|
||||
* Displays WiFi settings to allow user to enable WiFi.
|
||||
*/
|
||||
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
|
||||
switchToWifiSettings(): void {
|
||||
}
|
||||
switchToWifiSettings(): void {}
|
||||
|
||||
/**
|
||||
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
|
||||
@ -217,7 +231,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
/**
|
||||
* Enables/disables WiFi on the device.
|
||||
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
|
||||
* @param state {boolean}
|
||||
* @param {boolean} state
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
|
||||
@ -228,7 +242,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
/**
|
||||
* Enables/disables Bluetooth on the device.
|
||||
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
|
||||
* @param state {boolean}
|
||||
* @param {boolean} state
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
|
||||
@ -236,7 +250,6 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// ANDROID AND IOS ONLY
|
||||
|
||||
/**
|
||||
@ -448,26 +461,23 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Bluetooth state occurs.
|
||||
* @param handler
|
||||
* @param {Function} handler
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
registerBluetoothStateChangeHandler(handler: Function): void {
|
||||
}
|
||||
registerBluetoothStateChangeHandler(handler: Function): void {}
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Location state occurs.
|
||||
* @param handler
|
||||
* @param {Function} handler
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
registerLocationStateChangeHandler(handler: Function): void {
|
||||
}
|
||||
|
||||
registerLocationStateChangeHandler(handler: Function): void {}
|
||||
|
||||
// ANDROID ONLY
|
||||
|
||||
/**
|
||||
* Checks if high-accuracy locations are available to the app from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
|
||||
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorized to use location.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
@ -489,7 +499,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
|
||||
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
|
||||
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorized to use location.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
@ -519,7 +529,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for a given permission.
|
||||
* Returns the current authorization status for a given permission.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permission
|
||||
* @returns {Promise<any>}
|
||||
@ -530,9 +540,9 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for multiple permissions.
|
||||
* Returns the current authorization status for multiple permissions.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permissions
|
||||
* @param {any[]} permissions
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
@ -541,7 +551,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for a runtime permission.
|
||||
* Requests app to be granted authorization for a runtime permission.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
||||
* @param permission
|
||||
* @returns {Promise<any>}
|
||||
@ -552,9 +562,9 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for multiple runtime permissions.
|
||||
* Requests app to be granted authorization for multiple runtime permissions.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permissions
|
||||
* @param {any[]} permissions
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
|
||||
@ -576,8 +586,8 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a runtime permission request has completed.
|
||||
* Pass in a falsey value to de-register the currently registered function.
|
||||
* @param handler {Function}
|
||||
* Pass in a falsy value to de-register the currently registered function.
|
||||
* @param {Function} handler
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
registerPermissionRequestCompleteHandler(handler: Function): void {
|
||||
@ -670,8 +680,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
switchToWirelessSettings(): void {
|
||||
}
|
||||
switchToWirelessSettings(): void {}
|
||||
|
||||
/**
|
||||
* Displays NFC settings to allow user to enable NFC.
|
||||
@ -680,8 +689,7 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
switchToNFCSettings(): void {
|
||||
}
|
||||
switchToNFCSettings(): void {}
|
||||
|
||||
/**
|
||||
* Checks if NFC hardware is present on device.
|
||||
@ -713,16 +721,15 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in NFC state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param hander {Function} callback function to be called when NFC state changes
|
||||
* Registers a function to be called when a change in NFC state occurs. Pass in a falsy value to de-register the currently registered function.
|
||||
* @param {Function} hander callback function to be called when NFC state changes
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
registerNFCStateChangeHandler(handler: Function): void {
|
||||
}
|
||||
registerNFCStateChangeHandler(handler: Function): void {}
|
||||
|
||||
/**
|
||||
* Checks if the device data roaming setting is enabled.
|
||||
@ -920,5 +927,4 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
getMotionAuthorizationStatus(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface DialogsPromptCallback {
|
||||
|
||||
/**
|
||||
* The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
|
||||
*/
|
||||
@ -13,10 +11,8 @@ export interface DialogsPromptCallback {
|
||||
* The text entered in the prompt dialog box. (String)
|
||||
*/
|
||||
input1: string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name Dialogs
|
||||
* @description
|
||||
@ -50,12 +46,11 @@ export interface DialogsPromptCallback {
|
||||
})
|
||||
@Injectable()
|
||||
export class Dialogs extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Shows a custom alert or dialog box.
|
||||
* @param {string} message Dialog message.
|
||||
* @param {string} title Dialog title. (Optional, defaults to Alert)
|
||||
* @param {string} buttonName Button name. (Optional, defaults to OK)
|
||||
* @param {string} [title] Dialog title. (Optional, defaults to Alert)
|
||||
* @param {string} [buttonName] Button name. (Optional, defaults to OK)
|
||||
* @returns {Promise<any>} Returns a blank promise once the user has dismissed the alert.
|
||||
*/
|
||||
@Cordova({
|
||||
@ -69,35 +64,43 @@ export class Dialogs extends IonicNativePlugin {
|
||||
/**
|
||||
* Displays a customizable confirmation dialog box.
|
||||
* @param {string} message Dialog message.
|
||||
* @param {string} title Dialog title. (Optional, defaults to Confirm)
|
||||
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
|
||||
* @param {string} [title] Dialog title. (Optional, defaults to Confirm)
|
||||
* @param {Array<string>} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
|
||||
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked, or 0 if the user has dismissed the dialog by clicking outside the dialog box. Note that the index use one-based indexing.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
confirm(message: string, title?: string, buttonLabels?: string[]): Promise<number> {
|
||||
confirm(
|
||||
message: string,
|
||||
title?: string,
|
||||
buttonLabels?: string[]
|
||||
): Promise<number> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
||||
* @param {string} message Dialog message.
|
||||
* @param {string} title Dialog title. (Optional, defaults to Prompt)
|
||||
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
|
||||
* @param {string} defaultText Default textbox input value. (Optional, Default: empty string)
|
||||
* @param {string} [message] Dialog message.
|
||||
* @param {string} [title] Dialog title. (Optional, defaults to Prompt)
|
||||
* @param {Array<string>} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
|
||||
* @param {string} [defaultText] Default text box input value. (Optional, Default: empty string)
|
||||
* @returns {Promise<DialogsPromptCallback>} Returns a promise that resolves an object with the button index clicked and the text entered
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 5
|
||||
})
|
||||
prompt(message?: string, title?: string, buttonLabels?: string[], defaultText?: string): Promise<DialogsPromptCallback> {
|
||||
prompt(
|
||||
message?: string,
|
||||
title?: string,
|
||||
buttonLabels?: string[],
|
||||
defaultText?: string
|
||||
): Promise<DialogsPromptCallback> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The device plays a beep sound.
|
||||
* @param {numbers} times The number of times to repeat the beep.
|
||||
@ -105,7 +108,5 @@ export class Dialogs extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
beep(times: number): void {
|
||||
}
|
||||
|
||||
beep(times: number): void {}
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name iOS DocumentPicker
|
||||
* @description
|
||||
*
|
||||
* Opens the file picker on iOS for the user to select a file, returns a file URI.
|
||||
* Allows the user to upload files from icloud
|
||||
* Allows the user to upload files from iCloud
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@ -33,13 +31,13 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class DocumentPicker extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Open a file
|
||||
* @param {string} filters files between 'image', 'pdf' or 'all'
|
||||
* @param {string} [option] files between 'image', 'pdf' or 'all'
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
getFile(options?: string): Promise<string> { return; }
|
||||
|
||||
getFile(option?: string): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
/**
|
||||
* Verifies if sending emails is supported on the device.
|
||||
*
|
||||
* @param [app] {string} App id or uri scheme.
|
||||
* @param {string} [app] App id or uri scheme.
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
@ -173,8 +173,8 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
/**
|
||||
* Adds a new mail app alias.
|
||||
*
|
||||
* @param alias {string} The alias name
|
||||
* @param packageName {string} The package name
|
||||
* @param {string} alias The alias name
|
||||
* @param {string} packageName The package name
|
||||
*/
|
||||
@Cordova()
|
||||
addAlias(alias: string, packageName: string): void {}
|
||||
@ -182,8 +182,8 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
/**
|
||||
* Displays the email composer pre-filled with data.
|
||||
*
|
||||
* @param options {EmailComposerOptions} Email
|
||||
* @param [scope] {any} Scope for the promise
|
||||
* @param {EmailComposerOptions} options Email
|
||||
* @param {any} [scope] Scope for the promise
|
||||
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
|
||||
*/
|
||||
@Cordova({
|
||||
|
@ -180,10 +180,10 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param uuid {string} UUID string the beacon should advertise (mandatory).
|
||||
* @param major {number} Major value to advertise (mandatory).
|
||||
* @param minor {number} Minor value to advertise (mandatory).
|
||||
* @param regionId {string} Identifier of the region used to advertise (mandatory).
|
||||
* @param {string} uuid UUID string the beacon should advertise (mandatory).
|
||||
* @param {number} major Major value to advertise (mandatory).
|
||||
* @param {number} minor Minor value to advertise (mandatory).
|
||||
* @param {string} regionId Identifier of the region used to advertise (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -225,7 +225,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* ```
|
||||
* EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); });
|
||||
* ```
|
||||
* @param enable {number} Boolean value to turn analytics on or off (mandatory).
|
||||
* @param {number} enable Boolean value to turn analytics on or off (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -274,8 +274,8 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* ```
|
||||
* EstimoteBeacons.setupAppIDAndAppToken('MyAppID', 'MyAppToken').then(() => { console.log('AppID and AppToken configured!'); });
|
||||
* ```
|
||||
* @param appID {string} The App ID (mandatory).
|
||||
* @param appToken {string} The App Token (mandatory).
|
||||
* @param {string} appID The App ID (mandatory).
|
||||
* @param {string} appToken The App Token (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -338,7 +338,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param {EstimoteBeaconRegion} region Dictionary with region properties (mandatory).
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each beacon discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
@ -363,7 +363,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param {EstimoteBeaconRegion} region Dictionary with region properties (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -373,7 +373,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Start ranging secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* This function has the same parameters/behavior as
|
||||
* {@link EstimoteBeacons.startRangingBeaconsInRegion}.
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
@ -392,7 +392,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Stop ranging secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* This function has the same parameters/behavior as
|
||||
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@ -411,8 +411,8 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* console.log('Region state: ' + JSON.stringify(state));
|
||||
* });
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
|
||||
* @param {EstimoteBeaconRegion} region Dictionary with region properties (mandatory).
|
||||
* @param {boolean} [notifyEntryStateOnDisplay] Set to true to detect if you
|
||||
* are inside a region when the user turns display on, see
|
||||
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
|
||||
* for further details (iOS only).
|
||||
@ -440,7 +440,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* let region: EstimoteBeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
|
||||
* ```
|
||||
* @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param {EstimoteBeaconRegion} region Dictionary with region properties (mandatory).
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -450,13 +450,13 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Start monitoring secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* This function has the same parameters/behavior as
|
||||
* EstimoteBeacons.startMonitoringForRegion.
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
* @see {@link EstimoteBeacons.startMonitoringForRegion}
|
||||
* @param region {EstimoteBeaconRegion} Region
|
||||
* @param notifyEntryStateOnDisplay {boolean}
|
||||
* @param {EstimoteBeaconRegion} region Region
|
||||
* @param {boolean} notifyEntryStateOnDisplay
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -499,7 +499,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* minor: 1
|
||||
* });
|
||||
* ```
|
||||
* @param beacon {Beacon} Beacon to connect to.
|
||||
* @param {Beacon} beacon Beacon to connect to.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -529,7 +529,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* // Example that writes constant ESTIMOTE_PROXIMITY_UUID
|
||||
* EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID);
|
||||
*
|
||||
* @param uuid {string} String to write as new UUID
|
||||
* @param {string} uuid String to write as new UUID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -545,7 +545,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* // Example that writes 1
|
||||
* EstimoteBeacons.writeConnectedMajor(1);
|
||||
*
|
||||
* @param major {number} number to write as new major
|
||||
* @param {number} major number to write as new major
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -561,7 +561,7 @@ export class EstimoteBeacons extends IonicNativePlugin {
|
||||
* // Example that writes 1
|
||||
* EstimoteBeacons.writeConnectedMinor(1);
|
||||
*
|
||||
* @param minor {number} number to write as new minor
|
||||
* @param {number} minor number to write as new minor
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface NotificationData {
|
||||
@ -63,7 +64,7 @@ export interface NotificationData {
|
||||
@Injectable()
|
||||
export class FCM extends IonicNativePlugin {
|
||||
/**
|
||||
* Get's device's current registration id
|
||||
* Gets device's current registration id
|
||||
*
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the registration id token
|
||||
*/
|
||||
@ -97,7 +98,7 @@ export class FCM extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unubscribes you from a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
|
||||
* Unsubscribes you from a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
|
||||
*
|
||||
* @param {string} topic Topic to be unsubscribed from
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name File Encryption
|
||||
@ -30,11 +30,10 @@ import { Injectable } from '@angular/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class FileEncryption extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Enrcypt a file
|
||||
* @param file {string} A string representing a local URI
|
||||
* @param key {string} A key for the crypto operations
|
||||
* Encrypt a file
|
||||
* @param {string} file A string representing a local URI
|
||||
* @param {string} key A key for the crypto operations
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
@ -44,13 +43,12 @@ export class FileEncryption extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Decrypt a file
|
||||
* @param file {string} A string representing a local URI
|
||||
* @param key {string} A key for the crypto operations
|
||||
* @param {string} file A string representing a local URI
|
||||
* @param {string} key A key for the crypto operations
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
decrypt(file: string, key: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
*
|
||||
* this.fileOpener.open('path/to/file.pdf', 'application/pdf')
|
||||
* .then(() => console.log('File is opened'))
|
||||
* .catch(e => console.log('Error openening file', e));
|
||||
* .catch(e => console.log('Error opening file', e));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@ -29,11 +29,10 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class FileOpener extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Open an file
|
||||
* @param filePath {string} File Path
|
||||
* @param fileMIMEType {string} File MIME Type
|
||||
* @param {string} filePath File Path
|
||||
* @param {string} fileMIMEType File MIME Type
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -47,7 +46,7 @@ export class FileOpener extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Uninstalls a package
|
||||
* @param packageId {string} Package ID
|
||||
* @param {string} packageId Package ID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -61,7 +60,7 @@ export class FileOpener extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check if an app is already installed
|
||||
* @param packageId {string} Package ID
|
||||
* @param {string} packageId Package ID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -72,5 +71,4 @@ export class FileOpener extends IonicNativePlugin {
|
||||
appIsInstalled(packageId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,15 +32,13 @@ declare const window: any;
|
||||
})
|
||||
@Injectable()
|
||||
export class FilePath extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Resolve native path for given content URL/path.
|
||||
* @param {String} path Content URL/path.
|
||||
* @param {string} path Content URL/path.
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
resolveNativePath(path: string): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { checkAvailability, CordovaInstance, InstanceCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import {
|
||||
checkAvailability,
|
||||
CordovaInstance,
|
||||
InstanceCheck,
|
||||
IonicNativePlugin,
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
|
||||
export interface FileUploadOptions {
|
||||
|
||||
/**
|
||||
* The name of the form element.
|
||||
* Defaults to 'file'.
|
||||
@ -30,7 +35,7 @@ export interface FileUploadOptions {
|
||||
/**
|
||||
* A set of optional key/value pairs to pass in the HTTP request.
|
||||
*/
|
||||
params?: { [s: string]: any; };
|
||||
params?: { [s: string]: any };
|
||||
|
||||
/**
|
||||
* Whether to upload the data in chunked streaming mode.
|
||||
@ -43,12 +48,10 @@ export interface FileUploadOptions {
|
||||
* than one value. On iOS, FireOS, and Android, if a header named
|
||||
* Content-Type is present, multipart form data will NOT be used.
|
||||
*/
|
||||
headers?: { [s: string]: any; };
|
||||
|
||||
headers?: { [s: string]: any };
|
||||
}
|
||||
|
||||
export interface FileUploadResult {
|
||||
|
||||
/**
|
||||
* The number of bytes sent to the server as part of the upload.
|
||||
*/
|
||||
@ -67,12 +70,10 @@ export interface FileUploadResult {
|
||||
/**
|
||||
* The HTTP response headers by the server.
|
||||
*/
|
||||
headers: { [s: string]: any; };
|
||||
|
||||
headers: { [s: string]: any };
|
||||
}
|
||||
|
||||
export interface FileTransferError {
|
||||
|
||||
/**
|
||||
* One of the predefined error codes listed below.
|
||||
*/
|
||||
@ -103,7 +104,6 @@ export interface FileTransferError {
|
||||
* Either e.getMessage or e.toString.
|
||||
*/
|
||||
exception: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,11 +179,18 @@ export interface FileTransferError {
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginRef: 'FileTransfer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-file-transfer',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
platforms: [
|
||||
'Amazon Fire OS',
|
||||
'Android',
|
||||
'Browser',
|
||||
'iOS',
|
||||
'Ubuntu',
|
||||
'Windows',
|
||||
'Windows Phone'
|
||||
]
|
||||
})
|
||||
@Injectable()
|
||||
export class FileTransfer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Error code rejected from upload with FileTransferError
|
||||
* Defined in FileTransferError.
|
||||
@ -209,7 +216,6 @@ export class FileTransfer extends IonicNativePlugin {
|
||||
create(): FileTransferObject {
|
||||
return new FileTransferObject();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,7 +229,13 @@ export class FileTransferObject {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) {
|
||||
if (
|
||||
checkAvailability(
|
||||
FileTransfer.getPluginRef(),
|
||||
null,
|
||||
FileTransfer.getPluginName()
|
||||
) === true
|
||||
) {
|
||||
this._objectInstance = new (FileTransfer.getPlugin())();
|
||||
}
|
||||
}
|
||||
@ -233,15 +245,20 @@ export class FileTransferObject {
|
||||
*
|
||||
* @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device.
|
||||
* @param {string} url URL of the server to receive the file, as encoded by encodeURI().
|
||||
* @param {FileUploadOptions} options Optional parameters.
|
||||
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @param {FileUploadOptions} [options] Optional parameters.
|
||||
* @param {boolean} [trustAllHosts] Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @returns {Promise<FileUploadResult>} Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
|
||||
upload(
|
||||
fileUrl: string,
|
||||
url: string,
|
||||
options?: FileUploadOptions,
|
||||
trustAllHosts?: boolean
|
||||
): Promise<FileUploadResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -250,21 +267,26 @@ export class FileTransferObject {
|
||||
*
|
||||
* @param {string} source URL of the server to download the file, as encoded by encodeURI().
|
||||
* @param {string} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
|
||||
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
|
||||
* @param {boolean} [trustAllHosts] Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @param {object} [Optional] parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to a FileEntry object.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise<any> {
|
||||
download(
|
||||
source: string,
|
||||
target: string,
|
||||
trustAllHosts?: boolean,
|
||||
options?: { [s: string]: any }
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener that gets called whenever a new chunk of data is transferred.
|
||||
* @param listener {function} Listener that takes a progress event.
|
||||
* @param {Function} listener Listener that takes a progress event.
|
||||
*/
|
||||
@InstanceCheck({ sync: true })
|
||||
onProgress(listener: (event: ProgressEvent) => any): void {
|
||||
|
@ -3,8 +3,7 @@ import {
|
||||
CordovaCheck,
|
||||
CordovaProperty,
|
||||
IonicNativePlugin,
|
||||
Plugin,
|
||||
getPromise
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
|
||||
export interface IFile extends Blob {
|
||||
@ -147,6 +146,28 @@ export interface Entry {
|
||||
* Entry is a directory.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Look up metadata about this entry.
|
||||
* @param successCallback A callback that is called with the time of the last modification.
|
||||
* @param errorCallback ErrorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
getMetadata(
|
||||
successCallback: MetadataCallback,
|
||||
errorCallback?: ErrorCallback
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Set the metadata of the entry.
|
||||
* @param successCallback {Function} is called with a Metadata object
|
||||
* @param errorCallback {Function} is called with a FileError
|
||||
* @param metadataObject {Metadata} keys and values to set
|
||||
*/
|
||||
setMetadata(
|
||||
successCallback: MetadataCallback,
|
||||
errorCallback: ErrorCallback,
|
||||
metadataObject: Metadata
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The name of the entry, excluding the path leading to it.
|
||||
*/
|
||||
@ -456,6 +477,27 @@ export interface RemoveResult {
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileSaver extends EventTarget {
|
||||
/**
|
||||
* When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to INIT.
|
||||
* This constructor must be visible when the script's global object is either a Window object or an object implementing the WorkerUtils interface.
|
||||
*/
|
||||
constructor(data: Blob);
|
||||
|
||||
/**
|
||||
* When the abort method is called, user agents must run the steps below:
|
||||
* <ol>
|
||||
* <li> If readyState == DONE or readyState == INIT, terminate this overall series of steps without doing anything else. </li>
|
||||
* <li> Set readyState to DONE. </li>
|
||||
* <li> If there are any tasks from the object's FileSaver task source in one of the task queues, then remove those tasks. </li>
|
||||
* <li> Terminate the write algorithm being processed. </li>
|
||||
* <li> Set the error attribute to a DOMError object of type "AbortError". </li>
|
||||
* <li> Fire a progress event called abort </li>
|
||||
* <li> Fire a progress event called write end </li>
|
||||
* <li> Terminate this algorithm. </li>
|
||||
* </ol>
|
||||
*/
|
||||
abort(): void;
|
||||
|
||||
/**
|
||||
* The blob is being written.
|
||||
* @readonly
|
||||
@ -648,7 +690,7 @@ declare const window: Window;
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesnt exist'));
|
||||
* this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesn't exist'));
|
||||
*
|
||||
* ```
|
||||
*
|
||||
@ -675,63 +717,63 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Read-only directory where the application is installed.
|
||||
*/
|
||||
@CordovaProperty() applicationDirectory: string;
|
||||
@CordovaProperty applicationDirectory: string;
|
||||
|
||||
/**
|
||||
* Read-only directory where the application is installed.
|
||||
*/
|
||||
@CordovaProperty() applicationStorageDirectory: string;
|
||||
@CordovaProperty applicationStorageDirectory: string;
|
||||
|
||||
/**
|
||||
* Where to put app-specific data files.
|
||||
*/
|
||||
@CordovaProperty() dataDirectory: string;
|
||||
@CordovaProperty dataDirectory: string;
|
||||
|
||||
/**
|
||||
* Cached files that should survive app restarts.
|
||||
* Apps should not rely on the OS to delete files in here.
|
||||
*/
|
||||
@CordovaProperty() cacheDirectory: string;
|
||||
@CordovaProperty cacheDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the application space on external storage.
|
||||
*/
|
||||
@CordovaProperty() externalApplicationStorageDirectory: string;
|
||||
@CordovaProperty externalApplicationStorageDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: Where to put app-specific data files on external storage.
|
||||
*/
|
||||
@CordovaProperty() externalDataDirectory: string;
|
||||
@CordovaProperty externalDataDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the application cache on external storage.
|
||||
*/
|
||||
@CordovaProperty() externalCacheDirectory: string;
|
||||
@CordovaProperty externalCacheDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the external storage (SD card) root.
|
||||
*/
|
||||
@CordovaProperty() externalRootDirectory: string;
|
||||
@CordovaProperty externalRootDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Temp directory that the OS can clear at will.
|
||||
*/
|
||||
@CordovaProperty() tempDirectory: string;
|
||||
@CordovaProperty tempDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Holds app-specific files that should be synced (e.g. to iCloud).
|
||||
*/
|
||||
@CordovaProperty() syncedDataDirectory: string;
|
||||
@CordovaProperty syncedDataDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
|
||||
*/
|
||||
@CordovaProperty() documentsDirectory: string;
|
||||
@CordovaProperty documentsDirectory: string;
|
||||
|
||||
/**
|
||||
* BlackBerry10: Files globally available to all apps
|
||||
*/
|
||||
@CordovaProperty() sharedDirectory: string;
|
||||
@CordovaProperty sharedDirectory: string;
|
||||
|
||||
cordovaFileError: any = {
|
||||
1: 'NOT_FOUND_ERR',
|
||||
@ -764,20 +806,20 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Check if a directory exists in a certain path, directory.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} dir Name of directory to check
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
*/
|
||||
@CordovaCheck()
|
||||
checkDir(path: string, dir: string): Promise<boolean> {
|
||||
if (/^\//.test(dir)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
const fullpath = path + dir;
|
||||
return this.resolveDirectoryUrl(fullpath).then(() => {
|
||||
const fullPath = path + dir;
|
||||
return this.resolveDirectoryUrl(fullPath).then(() => {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@ -787,7 +829,7 @@ export class File extends IonicNativePlugin {
|
||||
* The replace boolean value determines whether to replace an existing directory with the same name.
|
||||
* If an existing directory exists and the replace value is false, the promise will fail and return an error.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} dirName Name of directory to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<DirectoryEntry>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
@ -799,7 +841,7 @@ export class File extends IonicNativePlugin {
|
||||
replace: boolean
|
||||
): Promise<DirectoryEntry> {
|
||||
if (/^\//.test(dirName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -827,7 +869,7 @@ export class File extends IonicNativePlugin {
|
||||
@CordovaCheck()
|
||||
removeDir(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if (/^\//.test(dirName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -846,7 +888,7 @@ export class File extends IonicNativePlugin {
|
||||
*
|
||||
* @param {string} path The source path to the directory
|
||||
* @param {string} dirName The source directory name
|
||||
* @param {string} newPath The destionation path to the directory
|
||||
* @param {string} newPath The destination path to the directory
|
||||
* @param {string} newDirName The destination directory name
|
||||
* @returns {Promise<DirectoryEntry|Entry>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
*/
|
||||
@ -860,7 +902,7 @@ export class File extends IonicNativePlugin {
|
||||
newDirName = newDirName || dirName;
|
||||
|
||||
if (/^\//.test(newDirName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -870,8 +912,8 @@ export class File extends IonicNativePlugin {
|
||||
return this.getDirectory(fse, dirName, { create: false });
|
||||
})
|
||||
.then(srcde => {
|
||||
return this.resolveDirectoryUrl(newPath).then(deste => {
|
||||
return this.move(srcde, deste, newDirName);
|
||||
return this.resolveDirectoryUrl(newPath).then(destenation => {
|
||||
return this.move(srcde, destenation, newDirName);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -893,7 +935,7 @@ export class File extends IonicNativePlugin {
|
||||
newDirName: string
|
||||
): Promise<Entry> {
|
||||
if (/^\//.test(newDirName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -919,7 +961,7 @@ export class File extends IonicNativePlugin {
|
||||
@CordovaCheck()
|
||||
listDir(path: string, dirName: string): Promise<Entry[]> {
|
||||
if (/^\//.test(dirName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<Entry[]>(err);
|
||||
}
|
||||
@ -932,7 +974,7 @@ export class File extends IonicNativePlugin {
|
||||
});
|
||||
})
|
||||
.then(de => {
|
||||
const reader = de.createReader();
|
||||
let reader = de.createReader();
|
||||
return this.readEntries(reader);
|
||||
});
|
||||
}
|
||||
@ -940,14 +982,14 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Removes all files and the directory from a desired location.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} dirName Name of directory
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
|
||||
*/
|
||||
@CordovaCheck()
|
||||
removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if (/^\//.test(dirName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with /';
|
||||
return Promise.reject<RemoveResult>(err);
|
||||
}
|
||||
@ -964,14 +1006,14 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Check if a file exists in a certain path, directory.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} file Name of file to check
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
*/
|
||||
@CordovaCheck()
|
||||
checkFile(path: string, file: string): Promise<boolean> {
|
||||
if (/^\//.test(file)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'file cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -980,7 +1022,7 @@ export class File extends IonicNativePlugin {
|
||||
if (fse.isFile) {
|
||||
return true;
|
||||
} else {
|
||||
const err = new FileError(13);
|
||||
let err = new FileError(13);
|
||||
err.message = 'input is not a file';
|
||||
return Promise.reject<boolean>(err);
|
||||
}
|
||||
@ -992,7 +1034,7 @@ export class File extends IonicNativePlugin {
|
||||
* The replace boolean value determines whether to replace an existing file with the same name.
|
||||
* If an existing file exists and the replace value is false, the promise will fail and return an error.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} fileName Name of file to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
@ -1004,7 +1046,7 @@ export class File extends IonicNativePlugin {
|
||||
replace: boolean
|
||||
): Promise<FileEntry> {
|
||||
if (/^\//.test(fileName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -1025,14 +1067,14 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Removes a file from a desired location.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} fileName Name of file to remove
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
@CordovaCheck()
|
||||
removeFile(path: string, fileName: string): Promise<RemoveResult> {
|
||||
if (/^\//.test(fileName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -1048,7 +1090,7 @@ export class File extends IonicNativePlugin {
|
||||
|
||||
/* Write a new file to the desired location.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} fileName path relative to base path
|
||||
* @param {string | Blob | ArrayBuffer} text content, blob or ArrayBuffer to write
|
||||
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
@ -1083,7 +1125,35 @@ export class File extends IonicNativePlugin {
|
||||
|
||||
/* Write to an existing file.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @hidden
|
||||
* @param {FileEntry} fe file entry object
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
private writeFileEntry(
|
||||
fe: FileEntry,
|
||||
text: string | Blob | ArrayBuffer,
|
||||
options: IWriteOptions
|
||||
) {
|
||||
return this.createWriter(fe)
|
||||
.then(writer => {
|
||||
if (options.append) {
|
||||
writer.seek(writer.length);
|
||||
}
|
||||
|
||||
if (options.truncate) {
|
||||
writer.truncate(options.truncate);
|
||||
}
|
||||
|
||||
return this.write(writer, text);
|
||||
})
|
||||
.then(() => fe);
|
||||
}
|
||||
|
||||
/** Write to an existing file.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} fileName path relative to base path
|
||||
* @param {string | Blob} text content or blob to write
|
||||
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
|
||||
@ -1100,7 +1170,7 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Read the contents of a file as text.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
*/
|
||||
@ -1113,8 +1183,8 @@ export class File extends IonicNativePlugin {
|
||||
* Read file and return data as a base64 encoded data url.
|
||||
* A data url is of the form:
|
||||
* data: [<mediatype>][;base64],<data>
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
*/
|
||||
@ -1125,7 +1195,7 @@ export class File extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Read file and return data as a binary data.
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
*/
|
||||
@ -1136,7 +1206,7 @@ export class File extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Read file and return data as an ArrayBuffer.
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<ArrayBuffer>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
*/
|
||||
@ -1145,10 +1215,50 @@ export class File extends IonicNativePlugin {
|
||||
return this.readFile<ArrayBuffer>(path, file, 'ArrayBuffer');
|
||||
}
|
||||
|
||||
private readFile<T>(
|
||||
path: string,
|
||||
file: string,
|
||||
readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text'
|
||||
): Promise<T> {
|
||||
if (/^\//.test(file)) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, file, { create: false });
|
||||
})
|
||||
.then((fileEntry: FileEntry) => {
|
||||
const reader = new FileReader();
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
if (reader.result !== undefined || reader.result !== null) {
|
||||
resolve(<T>(<any>reader.result));
|
||||
} else if (reader.error !== undefined || reader.error !== null) {
|
||||
reject(reader.error);
|
||||
} else {
|
||||
reject({ code: null, message: 'READER_ONLOADEND_ERR' });
|
||||
}
|
||||
};
|
||||
|
||||
fileEntry.file(
|
||||
file => {
|
||||
reader[`readAs${readAs}`].call(reader, file);
|
||||
},
|
||||
error => {
|
||||
reject(error);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a file to a given path.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} fileName Name of file to move
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
|
||||
@ -1164,7 +1274,7 @@ export class File extends IonicNativePlugin {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if (/^\//.test(newFileName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -1183,7 +1293,7 @@ export class File extends IonicNativePlugin {
|
||||
/**
|
||||
* Copy a file in various methods. If file exists, will fail to copy.
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above
|
||||
* @param {string} fileName Name of file to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
|
||||
@ -1199,7 +1309,7 @@ export class File extends IonicNativePlugin {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if (/^\//.test(newFileName)) {
|
||||
const err = new FileError(5);
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
@ -1215,6 +1325,15 @@ export class File extends IonicNativePlugin {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
private fillErrorMessage(err: FileError): void {
|
||||
try {
|
||||
err.message = this.cordovaFileError[err.code];
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a local file system URL
|
||||
* @param fileUrl {string} file system url
|
||||
@ -1272,7 +1391,7 @@ export class File extends IonicNativePlugin {
|
||||
directoryName: string,
|
||||
flags: Flags
|
||||
): Promise<DirectoryEntry> {
|
||||
return getPromise<DirectoryEntry>((resolve, reject) => {
|
||||
return new Promise<DirectoryEntry>((resolve, reject) => {
|
||||
try {
|
||||
directoryEntry.getDirectory(
|
||||
directoryName,
|
||||
@ -1305,7 +1424,7 @@ export class File extends IonicNativePlugin {
|
||||
fileName: string,
|
||||
flags: Flags
|
||||
): Promise<FileEntry> {
|
||||
return getPromise<FileEntry>((resolve, reject) => {
|
||||
return new Promise<FileEntry>((resolve, reject) => {
|
||||
try {
|
||||
directoryEntry.getFile(fileName, flags, resolve, err => {
|
||||
this.fillErrorMessage(err);
|
||||
@ -1399,7 +1518,7 @@ export class File extends IonicNativePlugin {
|
||||
* @hidden
|
||||
*/
|
||||
private remove(fe: Entry): Promise<RemoveResult> {
|
||||
return getPromise<RemoveResult>((resolve, reject) => {
|
||||
return new Promise<RemoveResult>((resolve, reject) => {
|
||||
fe.remove(
|
||||
() => {
|
||||
resolve({ success: true, fileRemoved: fe });
|
||||
@ -1420,7 +1539,7 @@ export class File extends IonicNativePlugin {
|
||||
destdir: DirectoryEntry,
|
||||
newName: string
|
||||
): Promise<Entry> {
|
||||
return getPromise<Entry>((resolve, reject) => {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
srce.moveTo(
|
||||
destdir,
|
||||
newName,
|
||||
@ -1443,7 +1562,7 @@ export class File extends IonicNativePlugin {
|
||||
destdir: DirectoryEntry,
|
||||
newName: string
|
||||
): Promise<Entry> {
|
||||
return getPromise<Entry>((resolve, reject) => {
|
||||
return new Promise<Entry>((resolve, reject) => {
|
||||
srce.copyTo(
|
||||
destdir,
|
||||
newName,
|
||||
@ -1462,7 +1581,7 @@ export class File extends IonicNativePlugin {
|
||||
* @hidden
|
||||
*/
|
||||
private readEntries(dr: DirectoryReader): Promise<Entry[]> {
|
||||
return getPromise<Entry[]>((resolve, reject) => {
|
||||
return new Promise<Entry[]>((resolve, reject) => {
|
||||
dr.readEntries(
|
||||
entries => {
|
||||
resolve(entries);
|
||||
@ -1479,7 +1598,7 @@ export class File extends IonicNativePlugin {
|
||||
* @hidden
|
||||
*/
|
||||
private rimraf(de: DirectoryEntry): Promise<RemoveResult> {
|
||||
return getPromise<RemoveResult>((resolve, reject) => {
|
||||
return new Promise<RemoveResult>((resolve, reject) => {
|
||||
de.removeRecursively(
|
||||
() => {
|
||||
resolve({ success: true, fileRemoved: de });
|
||||
@ -1496,7 +1615,7 @@ export class File extends IonicNativePlugin {
|
||||
* @hidden
|
||||
*/
|
||||
private createWriter(fe: FileEntry): Promise<FileWriter> {
|
||||
return getPromise<FileWriter>((resolve, reject) => {
|
||||
return new Promise<FileWriter>((resolve, reject) => {
|
||||
fe.createWriter(
|
||||
writer => {
|
||||
resolve(writer);
|
||||
@ -1520,7 +1639,7 @@ export class File extends IonicNativePlugin {
|
||||
return this.writeFileInChunks(writer, gu);
|
||||
}
|
||||
|
||||
return getPromise<any>((resolve, reject) => {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
writer.onwriteend = evt => {
|
||||
if (writer.error) {
|
||||
reject(writer.error);
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface FingerprintOptions {
|
||||
/**
|
||||
* Key for platform keychain
|
||||
@ -66,7 +65,6 @@ export interface FingerprintOptions {
|
||||
})
|
||||
@Injectable()
|
||||
export class FingerprintAIO extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check if fingerprint authentication is available
|
||||
* @return {Promise<any>} Returns a promise with result
|
||||
@ -78,12 +76,11 @@ export class FingerprintAIO extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Show authentication dialogue
|
||||
* @param options {FingerprintOptions} options for platform specific fingerprint API
|
||||
* @return {Promise<any>} Returns a promise that resolves when authentication was successfull
|
||||
* @param {FingerprintOptions} options Options for platform specific fingerprint API
|
||||
* @return {Promise<any>} Returns a promise that resolves when authentication was successful
|
||||
*/
|
||||
@Cordova()
|
||||
show(options: FingerprintOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,51 +35,59 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseAnalytics extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Logs an app event.
|
||||
* Be aware of automatically collected events.
|
||||
* @param name {string} The name of the event
|
||||
* @param params {any} Some param to configure something
|
||||
* @param {string} name The name of the event
|
||||
* @param {any} params Some param to configure something
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
logEvent(name: string, params: any): Promise<any> { return; }
|
||||
logEvent(name: string, params: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user ID property.
|
||||
* This feature must be used in accordance with Google's Privacy Policy.
|
||||
* @param id {string} The user ID
|
||||
* @param {string} id The user ID
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setUserId(id: string): Promise<any> { return; }
|
||||
setUserId(id: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This feature must be used in accordance with Google's Privacy Policy.
|
||||
* Be aware of automatically collected user properties.
|
||||
* @param name {string} The property name
|
||||
* @param value {string} The property value
|
||||
* @param {string} name The property name
|
||||
* @param {string} value The property value
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setUserProperty(name: string, value: string): Promise<any> { return; }
|
||||
setUserProperty(name: string, value: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether analytics collection is enabled for this app on this device.
|
||||
* @param enabled {boolean}
|
||||
* @param {boolean} enabled
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setEnabled(enabled: boolean): Promise<any> { return; }
|
||||
setEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current screen name, which specifies the current visual context in your app.
|
||||
* This helps identify the areas in your app where users spend their time and how they interact with your app.
|
||||
* @param name {string} The name of the screen
|
||||
* @param {string} name The name of the screen
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setCurrentScreen(name: string): Promise<any> { return; }
|
||||
|
||||
setCurrentScreen(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set icon badge number. Set to 0 to clear the badge.
|
||||
* @param badgeNumber {number}
|
||||
* @param {number} badgeNumber
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -106,7 +106,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Subscribe to a topic
|
||||
* @param topic {string}
|
||||
* @param {string} topic
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -116,7 +116,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Unsubscribe from a topic
|
||||
* @param topic {string}
|
||||
* @param {string} topic
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -135,8 +135,8 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Log an event using Analytics
|
||||
* @param type {string}
|
||||
* @param data {Object}
|
||||
* @param {string} type
|
||||
* @param {Object} data
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -146,7 +146,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Log an Error using FirebaseCrash
|
||||
* @param message {string}
|
||||
* @param {string} message
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -156,7 +156,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set the name of the current screen in Analytics
|
||||
* @param name {string} Screen name
|
||||
* @param {string} name Screen name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -166,7 +166,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set a user id for use in Analytics
|
||||
* @param userId {string}
|
||||
* @param {string} userId
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -176,8 +176,8 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set a user property for use in Analytics
|
||||
* @param name {string}
|
||||
* @param value {string}
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@ -187,7 +187,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Fetch Remote Config parameter values for your app
|
||||
* @param cacheExpirationSeconds {number}
|
||||
* @param {number} [cacheExpirationSeconds]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -209,8 +209,8 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Retrieve a Remote Config value
|
||||
* @param key {string}
|
||||
* @param [namespace] {string}
|
||||
* @param {string} key
|
||||
* @param {string} [namespace]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -223,8 +223,8 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Retrieve a Remote Config byte array
|
||||
* @param key {string}
|
||||
* @param [namespace] {string}
|
||||
* @param {string} key
|
||||
* @param {string} [namespace]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -247,7 +247,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Change the settings for the FirebaseRemoteConfig object's operations
|
||||
* @param settings {Object}
|
||||
* @param {Object} settings
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -259,8 +259,8 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Set defaults in the Remote Config
|
||||
* @param defaults {Object}
|
||||
* @param [namespace] {string}
|
||||
* @param {Object} defaults
|
||||
* @param {string} [namespace]
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -272,7 +272,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Sends an SMS to the user with the SMS verification code and returns the Verification ID required to sign in using phone authentication
|
||||
* @param phoneNumber {string}
|
||||
* @param {string} phoneNumber
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -284,8 +284,8 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Sends an SMS to the user with the SMS verification code and returns the Verification ID required to sign in using phone authentication
|
||||
* @param phoneNumber {string} the phone number, including '+' and country code
|
||||
* @param timeoutDuration {number} the timeout in sec - no more SMS will be sent to this number until this timeout expires
|
||||
* @param {string} phoneNumber The phone number, including '+' and country code
|
||||
* @param {number} timeoutDuration The timeout in sec - no more SMS will be sent to this number until this timeout expires
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@ -302,7 +302,7 @@ export class Firebase extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Allows the user to enable/disable analytics collection
|
||||
* @param enabled {booleab} value to set collection
|
||||
* @param {boolean} enabled value to set collection
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { checkAvailability, CordovaInstance, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
checkAvailability,
|
||||
CordovaInstance,
|
||||
IonicNativePlugin,
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
|
||||
export interface FlurryAnalyticsOptions {
|
||||
/** Flurry API key is required */
|
||||
@ -76,14 +81,12 @@ export interface FlurryAnalyticsLocation {
|
||||
* @hidden
|
||||
*/
|
||||
export class FlurryAnalyticsObject {
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
}
|
||||
constructor(private _objectInstance: any) {}
|
||||
|
||||
/**
|
||||
* This function set the Event
|
||||
* @param eventName {string} Name of the event
|
||||
* @param [params] {Object} Optional params
|
||||
* @param {string} eventName Name of the event
|
||||
* @param {Object} [params] Optional params
|
||||
* @return {Promise<any>} Returns a promise that resolves when event is sent
|
||||
*/
|
||||
@CordovaInstance({
|
||||
@ -96,8 +99,8 @@ export class FlurryAnalyticsObject {
|
||||
|
||||
/**
|
||||
* Start a timed event
|
||||
* @param eventName {string} Name of the event
|
||||
* @param [params] {Object} Optional params
|
||||
* @param {string} eventName Name of the event
|
||||
* @param {Object} Optional params
|
||||
* @return {Promise<any>} Returns a promise that resolves when timed event is started tracking
|
||||
*/
|
||||
@CordovaInstance({
|
||||
@ -110,8 +113,8 @@ export class FlurryAnalyticsObject {
|
||||
|
||||
/**
|
||||
* Complete a timed event
|
||||
* @param eventName {string} Name of the event
|
||||
* @param [params] {Object} Optional params
|
||||
* @param {string} eventName Name of the event
|
||||
* @param {Object} [params] Optional params
|
||||
* @return {Promise<any>} Returns a promise that resolves when timed event is ended tracking
|
||||
*/
|
||||
@CordovaInstance({
|
||||
@ -124,8 +127,8 @@ export class FlurryAnalyticsObject {
|
||||
|
||||
/**
|
||||
* This function log an error
|
||||
* @param code
|
||||
* @param message
|
||||
* @param {Object} code
|
||||
* @param {Object} message
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
@ -145,12 +148,15 @@ export class FlurryAnalyticsObject {
|
||||
/**
|
||||
* This function set the location for the event
|
||||
* (this is will only be used for very course grained statistics like city)
|
||||
* @param location {FlurryAnalyticsLocation}
|
||||
* @param message {string}
|
||||
* @param {FlurryAnalyticsLocation} location
|
||||
* @param {string} message
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
setLocation(location: FlurryAnalyticsLocation, message: string): Promise<any> {
|
||||
setLocation(
|
||||
location: FlurryAnalyticsLocation,
|
||||
message: string
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -173,7 +179,6 @@ export class FlurryAnalyticsObject {
|
||||
endSession(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,22 +222,24 @@ export class FlurryAnalyticsObject {
|
||||
})
|
||||
@Injectable()
|
||||
export class FlurryAnalytics extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Creates a new instance of FlurryAnalyticsObject
|
||||
* @param options {FlurryAnalyticsOptions} options
|
||||
* @param {FlurryAnalyticsOptions} options Options
|
||||
* @return {FlurryAnalyticsObject}
|
||||
*/
|
||||
create(options: FlurryAnalyticsOptions): FlurryAnalyticsObject {
|
||||
|
||||
let instance: any;
|
||||
|
||||
if (checkAvailability(FlurryAnalytics.pluginRef, null, FlurryAnalytics.pluginName) === true) {
|
||||
if (
|
||||
checkAvailability(
|
||||
FlurryAnalytics.pluginRef,
|
||||
null,
|
||||
FlurryAnalytics.pluginName
|
||||
) === true
|
||||
) {
|
||||
instance = new (window as any).FlurryAnalytics(options);
|
||||
}
|
||||
|
||||
return new FlurryAnalyticsObject(instance);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,14 +32,13 @@ import { Observable } from 'rxjs';
|
||||
})
|
||||
@Injectable()
|
||||
export class FTP extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Connect to one ftp server.
|
||||
*
|
||||
* Just need to init the connection once. If success, you can do any ftp actions later.
|
||||
* @param hostname {string} The ftp server url. Like ip without protocol prefix, e.g. "192.168.1.1".
|
||||
* @param username {string} The ftp login username. If it and `password` are all blank/undefined, the default username "anonymous" is used.
|
||||
* @param password {string} The ftp login password. If it and `username` are all blank/undefined, the default password "anonymous@" is used.
|
||||
* @param {string} hostname The ftp server url. Like ip without protocol prefix, e.g. "192.168.1.1".
|
||||
* @param {string} username The ftp login username. If it and `password` are all blank/undefined, the default username "anonymous" is used.
|
||||
* @param {string} password The ftp login password. If it and `username` are all blank/undefined, the default password "anonymous@" is used.
|
||||
* @return {Promise<any>} The success callback. Notice: For iOS, if triggered, means `init` success, but NOT means the later action, e.g. `ls`... `download` will success!
|
||||
*/
|
||||
@Cordova()
|
||||
@ -58,7 +57,7 @@ export class FTP extends IonicNativePlugin {
|
||||
* - size: file size in bytes.
|
||||
* - modifiedDate: modified date of this file. date format is `yyyy-MM-dd HH:mm:ss zzz`, e.g "2015-12-01 20:45:00 GMT+8".
|
||||
*
|
||||
* @param path {string} The path on the ftp server. e.g. "/adf/123/".
|
||||
* @param {string} path The path on the ftp server. e.g. "/adf/123/".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
@ -69,7 +68,7 @@ export class FTP extends IonicNativePlugin {
|
||||
/**
|
||||
* Create one directory on the ftp server.
|
||||
*
|
||||
* @param path {string} The path on the ftp server. e.g. "/adf/123/".
|
||||
* @param {string} path The path on the ftp server. e.g. "/adf/123/".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
@ -82,7 +81,7 @@ export class FTP extends IonicNativePlugin {
|
||||
*
|
||||
* Tip: As many ftp server could not rm dir when it's not empty, so rm all files under the dir at first is recommended.
|
||||
*
|
||||
* @param path {string} The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile".
|
||||
* @param {string} path The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
@ -93,7 +92,7 @@ export class FTP extends IonicNativePlugin {
|
||||
/**
|
||||
* Delete one file on the ftp server.
|
||||
*
|
||||
* @param file {string} The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile".
|
||||
* @param {string} file The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile".
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
@ -104,8 +103,8 @@ export class FTP extends IonicNativePlugin {
|
||||
/**
|
||||
* Upload one local file to the ftp server.
|
||||
*
|
||||
* @param localFile {string} The file (with full path) you want to upload. e.g. "/local/path/to/localFile".
|
||||
* @param remoteFile {string} The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile".
|
||||
* @param {string} localFile The file (with full path) you want to upload. e.g. "/local/path/to/localFile".
|
||||
* @param {string} remoteFile The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile".
|
||||
* @return {Observable<any>} Returns an observable.
|
||||
* It will be triggered many times according the file's size.
|
||||
* The arg `0`, `0.1xx`, `0.2xx` ... `1` means the upload percent. When it reach `1`, means success.
|
||||
@ -120,8 +119,8 @@ export class FTP extends IonicNativePlugin {
|
||||
/**
|
||||
* Download one remote file on the ftp server to local path.
|
||||
*
|
||||
* @param localFile {string} The file (with full path) you want to upload. e.g. "/local/path/to/localFile".
|
||||
* @param remoteFile {string} The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile".
|
||||
* @param {string} localFile The file (with full path) you want to upload. e.g. "/local/path/to/localFile".
|
||||
* @param {string} remoteFile The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile".
|
||||
* @return {Observable<any>} Returns an observable.
|
||||
* It will be triggered many times according the file's size.
|
||||
* The arg `0`, `0.1xx`, `0.2xx` ... `1` means the upload percent. When it reach `1`, means success.
|
||||
@ -152,5 +151,4 @@ export class FTP extends IonicNativePlugin {
|
||||
disconnect(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
59
src/@ionic-native/plugins/google-nearby/index.ts
Normal file
59
src/@ionic-native/plugins/google-nearby/index.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name google-nearby
|
||||
* @description
|
||||
* This plugin adds support for the Google Nearby Messages API.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { GoogleNearby } from '@ionic-native/google-nearby';
|
||||
*
|
||||
*
|
||||
* constructor(private googleNearby: GoogleNearby) { }
|
||||
*
|
||||
* this.googleNearby.publish('Hello')
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* this.googleNearby.subscribe()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GoogleNearby',
|
||||
plugin: 'cordova-plugin-google-nearby',
|
||||
pluginRef: 'window.nearby',
|
||||
repo: 'https://github.com/hahahannes/cordova-plugin-google-nearby',
|
||||
install: 'ionic cordova plugin add cordova-plugin-google-nearby --variable API_KEY="123456789"',
|
||||
installVariables: ['API_KEY'],
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class GoogleNearby extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Publish a message
|
||||
* @param message {string} Message to publish
|
||||
* @return {Promise<any>} Returns a promise that resolves when the message got published
|
||||
*/
|
||||
@Cordova()
|
||||
publish(message: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to recieve messages
|
||||
* @return {Observable<any>} Returns an observable that emits recieved messages
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'unsubscribe'
|
||||
})
|
||||
subscribe(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user