From eb1bcdd078f3300eb167e7a3c0413857766b0dfa Mon Sep 17 00:00:00 2001 From: Hannes Date: Sat, 7 Apr 2018 14:47:33 +0200 Subject: [PATCH 01/48] feat(plugin): Add google nearby plugin --- .../plugins/google-nearby/index.ts | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/@ionic-native/plugins/google-nearby/index.ts diff --git a/src/@ionic-native/plugins/google-nearby/index.ts b/src/@ionic-native/plugins/google-nearby/index.ts new file mode 100644 index 000000000..3e3fb6a34 --- /dev/null +++ b/src/@ionic-native/plugins/google-nearby/index.ts @@ -0,0 +1,69 @@ +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/googlenearby-cordova-plugin', + 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} Returns a promise that resolves when the message got published + */ + @Cordova() + publish(message: string): Promise { + return; + } + +/** + * Subscribe to recieve messages + * @return {Observable} Returns an observable that emits recieved messages + */ + @Cordova({ + observable: true, + clearFunction: 'unsubscribe' + }) + subscribe(): Observable { + return; + } + +/** + * Unsubscribe from Messages + * @return {Promise} Returns a promise that resolves when you unsubscribed + */ + @Cordova() + unsubscribe(): Promise { + return; + } + +} From 3f82cfa527bf1ff58eb28fad39b2a5fe81c74e61 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:37:34 +0200 Subject: [PATCH 02/48] docs(code-push): fix wrong jsdocs --- src/@ionic-native/plugins/code-push/index.ts | 158 +++++++++++++------ 1 file changed, 106 insertions(+), 52 deletions(-) diff --git a/src/@ionic-native/plugins/code-push/index.ts b/src/@ionic-native/plugins/code-push/index.ts index 6db99ce70..e6b53bdf1 100644 --- a/src/@ionic-native/plugins/code-push/index.ts +++ b/src/@ionic-native/plugins/code-push/index.ts @@ -1,9 +1,18 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; + namespace Http { export const enum Verb { - GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH + GET, + HEAD, + POST, + PUT, + DELETE, + TRACE, + OPTIONS, + CONNECT, + PATCH } export interface Response { @@ -13,7 +22,12 @@ namespace Http { export interface Requester { request(verb: Verb, url: string, callback: Callback): void; - request(verb: Verb, url: string, requestBody: string, callback: Callback): void; + request( + verb: Verb, + url: string, + requestBody: string, + callback: Callback + ): void; } } @@ -46,19 +60,26 @@ export interface IRemotePackage extends IPackage { /** * Downloads the package update from the CodePush service. * - * @param downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully. - * @param downloadError Optional callback invoked in case of an error. - * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + * @param {SuccessCallback} downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully. + * @param {ErrorCallback} [downloadError] Optional callback invoked in case of an error. + * @param {SuccessCallback} [downloadProgress] Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. */ - download(downloadSuccess: SuccessCallback, downloadError?: ErrorCallback, downloadProgress?: SuccessCallback): void; + download( + downloadSuccess: SuccessCallback, + downloadError?: ErrorCallback, + downloadProgress?: SuccessCallback + ): void; /** * Aborts the current download session, previously started with download(). * - * @param abortSuccess Optional callback invoked if the abort operation succeeded. - * @param abortError Optional callback invoked in case of an error. + * @param {SuccessCallback} [abortSuccess] Optional callback invoked if the abort operation succeeded. + * @param {ErrorCallback} [abortError] Optional callback invoked in case of an error. */ - abortDownload(abortSuccess?: SuccessCallback, abortError?: ErrorCallback): void; + abortDownload( + abortSuccess?: SuccessCallback, + abortError?: ErrorCallback + ): void; } /** @@ -82,11 +103,15 @@ export interface ILocalPackage extends IPackage { * On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success. * Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run. * - * @param installSuccess Callback invoked if the install operation succeeded. - * @param installError Optional callback inovoked in case of an error. - * @param installOptions Optional parameter used for customizing the installation behavior. + * @param {SuccessCallback} installSuccess Callback invoked if the install operation succeeded. + * @param {ErrorCallback} [installError] Optional callback invoked in case of an error. + * @param {InstallOptions} [installOptions] Optional parameter used for customizing the installation behavior. */ - install(installSuccess: SuccessCallback, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void; + install( + installSuccess: SuccessCallback, + errorCallback?: ErrorCallback, + installOptions?: InstallOptions + ): void; } /** @@ -123,13 +148,19 @@ interface IPackageInfoMetadata extends ILocalPackage { } interface NativeUpdateNotification { - updateAppVersion: boolean; // Always true + updateAppVersion: boolean; // Always true appVersion: string; } -export interface Callback { (error: Error, parameter: T): void; } -export interface SuccessCallback { (result?: T): void; } -export interface ErrorCallback { (error?: Error): void; } +export interface Callback { + (error: Error, parameter: T): void; +} +export interface SuccessCallback { + (result?: T): void; +} +export interface ErrorCallback { + (error?: Error): void; +} interface Configuration { appVersion: string; @@ -146,53 +177,80 @@ declare class AcquisitionStatus { declare class AcquisitionManager { constructor(httpRequester: Http.Requester, configuration: Configuration); - public queryUpdateWithCurrentPackage(currentPackage: IPackage, callback?: Callback): void; - public reportStatusDeploy(pkg?: IPackage, status?: string, previousLabelOrAppVersion?: string, previousDeploymentKey?: string, callback?: Callback): void; + public queryUpdateWithCurrentPackage( + currentPackage: IPackage, + callback?: Callback + ): void; + public reportStatusDeploy( + pkg?: IPackage, + status?: string, + previousLabelOrAppVersion?: string, + previousDeploymentKey?: string, + callback?: Callback + ): void; public reportStatusDownload(pkg: IPackage, callback?: Callback): void; } interface CodePushCordovaPlugin { - /** * Get the current package information. * * @param packageSuccess Callback invoked with the currently deployed package information. * @param packageError Optional callback invoked in case of an error. */ - getCurrentPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void; + getCurrentPackage( + packageSuccess: SuccessCallback, + packageError?: ErrorCallback + ): void; /** * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. - * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. + * This happens only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. */ - getPendingPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void; + getPendingPackage( + packageSuccess: SuccessCallback, + packageError?: ErrorCallback + ): void; /** * Checks with the CodePush server if an update package is available for download. * - * @param querySuccess Callback invoked in case of a successful response from the server. + * @param {SuccessCallback} querySuccess Callback invoked in case of a successful response from the server. * The callback takes one RemotePackage parameter. A non-null package is a valid update. * A null package means the application is up to date for the current native application version. - * @param queryError Optional callback invoked in case of an error. - * @param deploymentKey Optional deployment key that overrides the config.xml setting. + * @param {ErrorCallback} [queryError] Optional callback invoked in case of an error. + * @param {string} [deploymentKey] Optional deployment key that overrides the config.xml setting. */ - checkForUpdate(querySuccess: SuccessCallback, queryError?: ErrorCallback, deploymentKey?: string): void; + checkForUpdate( + querySuccess: SuccessCallback, + queryError?: ErrorCallback, + deploymentKey?: string + ): void; /** * Notifies the plugin that the update operation succeeded and that the application is ready. * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop. * If using sync API, calling this function is not required since sync calls it internally. * - * @param notifySucceeded Optional callback invoked if the plugin was successfully notified. - * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin. + * @param {SuccessCallback} [notifySucceeded] Optional callback invoked if the plugin was successfully notified. + * @param {ErrorCallback} [notifyFailed] Optional callback invoked in case of an error during notifying the plugin. */ - notifyApplicationReady(notifySucceeded?: SuccessCallback, notifyFailed?: ErrorCallback): void; + notifyApplicationReady( + notifySucceeded?: SuccessCallback, + notifyFailed?: ErrorCallback + ): void; /** * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application. + * + * @param {SuccessCallback} installSuccess + * @param {ErrorCallback} [errorCallback] */ - restartApplication(installSuccess: SuccessCallback, errorCallback?: ErrorCallback): void; + restartApplication( + installSuccess: SuccessCallback, + errorCallback?: ErrorCallback + ): void; /** * Convenience method for installing updates in one method call. @@ -209,13 +267,17 @@ interface CodePushCordovaPlugin { * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE. * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR. * - * @param syncCallback Optional callback to be called with the status of the sync operation. + * @param {SuccessCallback} [syncCallback] Optional callback to be called with the status of the sync operation. * The callback will be called only once, and the possible statuses are defined by the SyncStatus enum. - * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation. - * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + * @param {SyncOptions} [syncOptions] Optional SyncOptions parameter configuring the behavior of the sync operation. + * @param {SuccessCallback} [downloadProgress] Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. * */ - sync(syncCallback?: SuccessCallback, syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): void; + sync( + syncCallback?: SuccessCallback, + syncOptions?: SyncOptions, + downloadProgress?: SuccessCallback + ): void; } /** @@ -428,12 +490,9 @@ export interface DownloadProgress { }) @Injectable() export class CodePush extends IonicNativePlugin { - /** * Get the current package information. * - * @param packageSuccess Callback invoked with the currently deployed package information. - * @param packageError Optional callback invoked in case of an error. * @returns {Promise} */ @Cordova() @@ -443,7 +502,7 @@ export class CodePush extends IonicNativePlugin { /** * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. - * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. + * This happens only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. * @returns {Promise} */ @Cordova() @@ -454,11 +513,7 @@ export class CodePush extends IonicNativePlugin { /** * Checks with the CodePush server if an update package is available for download. * - * @param querySuccess Callback invoked in case of a successful response from the server. - * The callback takes one RemotePackage parameter. A non-null package is a valid update. - * A null package means the application is up to date for the current native application version. - * @param queryError Optional callback invoked in case of an error. - * @param deploymentKey Optional deployment key that overrides the config.xml setting. + * @param {string} [deploymentKey] Optional deployment key that overrides the config.xml setting. * @returns {Promise} */ @Cordova({ @@ -473,8 +528,6 @@ export class CodePush extends IonicNativePlugin { * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop. * If using sync API, calling this function is not required since sync calls it internally. * - * @param notifySucceeded Optional callback invoked if the plugin was successfully notified. - * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin. * @returns {Promise} */ @Cordova() @@ -507,9 +560,8 @@ export class CodePush extends IonicNativePlugin { * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE. * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR. * - * @param syncCallback Optional callback to be called with the status of the sync operation. - * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation. - * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + * @param {SyncOptions} [syncOptions] Optional SyncOptions parameter configuring the behavior of the sync operation. + * @param {SuccessCallback} [downloadProgress] Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. * @returns {Observable} * */ @@ -518,8 +570,10 @@ export class CodePush extends IonicNativePlugin { successIndex: 0, errorIndex: 3 // we don't need this, so we set it to a value higher than # of args }) - sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): Observable { + sync( + syncOptions?: SyncOptions, + downloadProgress?: SuccessCallback + ): Observable { return; } - } From d8f030b67ddaee7212b32181c3a20e93e499ec54 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:39:07 +0200 Subject: [PATCH 03/48] docs(android-exoplayer): fix typo and jsdocs --- .../plugins/android-exoplayer/index.ts | 77 ++++++++++++------- 1 file changed, 51 insertions(+), 26 deletions(-) diff --git a/src/@ionic-native/plugins/android-exoplayer/index.ts b/src/@ionic-native/plugins/android-exoplayer/index.ts index 26fe48831..bdeb92441 100644 --- a/src/@ionic-native/plugins/android-exoplayer/index.ts +++ b/src/@ionic-native/plugins/android-exoplayer/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; export type AndroidExoPlayerAspectRatio = 'FILL_SCREEN' | 'FIT_SCREEN'; @@ -138,7 +138,7 @@ export interface AndroidExoPlayerControllerConfig { exo_play: string; /** - * Payse button icon. + * Pause button icon. */ exo_pause: string; @@ -184,90 +184,115 @@ export interface AndroidExoPlayerControllerConfig { export class AndroidExoplayer extends IonicNativePlugin { /** * Show the player. - * @param parameters {AndroidExoPlayerParams} Parameters + * @param {AndroidExoPlayerParams} parameters Parameters * @return {Observable} */ - @Cordova({ - observable: true, - clearFunction: 'close', - clearWithArgs: false, - successIndex: 1, - errorIndex: 2 - }) - show(parameters: AndroidExoPlayerParams): Observable { return; } + @Cordova({ + observable: true, + clearFunction: 'close', + clearWithArgs: false, + successIndex: 1, + errorIndex: 2 + }) + show(parameters: AndroidExoPlayerParams): Observable { + return; + } /** * Switch stream without disposing of the player. - * @param url {string} The url of the new stream. - * @param controller {AndroidExoPlayerControllerConfig} Configuration of the controller. + * @param {string} url The url of the new stream. + * @param {AndroidExoPlayerControllerConfig} controller Configuration of the controller. * @return {Promise} */ @Cordova() - setStream(url: string, controller: AndroidExoPlayerControllerConfig): Promise { return; } + setStream( + url: string, + controller: AndroidExoPlayerControllerConfig + ): Promise { + return; + } /** * Will pause if playing and play if paused * @return {Promise} */ @Cordova() - playPause(): Promise { return; } + playPause(): Promise { + return; + } /** * Stop playing. * @return {Promise} */ @Cordova() - stop(): Promise { return; } + stop(): Promise { + return; + } /** * Jump to a particular position. - * @param milliseconds {number} Position in stream in milliseconds + * @param {number} milliseconds Position in stream in milliseconds * @return {Promise} */ @Cordova() - seekTo(milliseconds: number): Promise { return; } + seekTo(milliseconds: number): Promise { + return; + } /** * Jump to a particular time relative to the current position. - * @param milliseconds {number} Time in milliseconds + * @param {number} milliseconds Time in milliseconds * @return {Promise} */ @Cordova() - seekBy(milliseconds: number): Promise { return; } + seekBy(milliseconds: number): Promise { + return; + } /** * Get the current player state. * @return {Promise} */ @Cordova() - getState(): Promise { return; } + getState(): Promise { + return; + } /** * Show the controller. * @return {Promise} */ @Cordova() - showController(): Promise { return; } + showController(): Promise { + return; + } /** * Hide the controller. * @return {Promise} */ @Cordova() - hideController(): Promise { return; } + hideController(): Promise { + return; + } /** * Update the controller configuration. - * @param controller {AndroidExoPlayerControllerConfig} Configuration of the controller. + * @param {AndroidExoPlayerControllerConfig} controller Configuration of the controller. * @return {Promise} */ @Cordova() - setController(controller: AndroidExoPlayerControllerConfig): Promise { return; } + setController(controller: AndroidExoPlayerControllerConfig): Promise { + return; + } /** * Close and dispose of player, call before destroy. * @return {Promise} */ @Cordova() - close(): Promise { return; } + close(): Promise { + return; + } } From dd4d35d9e091e5bccf57010780839490d3d5c093 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:46:21 +0200 Subject: [PATCH 04/48] docs(android-fingerprint-auth): add missing interfaces --- .../plugins/android-fingerprint-auth/index.ts | 84 +++++++++++-------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/src/@ionic-native/plugins/android-fingerprint-auth/index.ts b/src/@ionic-native/plugins/android-fingerprint-auth/index.ts index 2366e86bb..f29fb17f2 100644 --- a/src/@ionic-native/plugins/android-fingerprint-auth/index.ts +++ b/src/@ionic-native/plugins/android-fingerprint-auth/index.ts @@ -1,9 +1,7 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; - +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface AFAAuthOptions { - /** * Required * Used as the alias for your key in the Android Key Store. @@ -62,7 +60,6 @@ export interface AFAAuthOptions { * Set the hint displayed by the fingerprint icon on the fingerprint authentication dialog. */ dialogHint?: string; - } export interface AFADecryptOptions { @@ -96,6 +93,17 @@ export interface AFAEncryptResponse { token: string; } +export interface AFAAvailableResponse { + isAvailable: boolean; + isHardwareDetected: boolean; + hasEnrolledFingerprints: boolean; +} + +export interface AFADeleteOptions { + clientId: string; + username: string; +} + /** * @name Android Fingerprint Auth * @description @@ -139,6 +147,8 @@ export interface AFAEncryptResponse { * AFAAuthOptions * AFAEncryptResponse * AFADecryptOptions + * AFAAvailableResponse + * AFADeleteOptions */ @Plugin({ pluginName: 'AndroidFingerprintAuth', @@ -149,55 +159,63 @@ export interface AFAEncryptResponse { }) @Injectable() export class AndroidFingerprintAuth extends IonicNativePlugin { - ERRORS: { - BAD_PADDING_EXCEPTION: 'BAD_PADDING_EXCEPTION', - CERTIFICATE_EXCEPTION: 'CERTIFICATE_EXCEPTION', - FINGERPRINT_CANCELLED: 'FINGERPRINT_CANCELLED', - FINGERPRINT_DATA_NOT_DELETED: 'FINGERPRINT_DATA_NOT_DELETED', - FINGERPRINT_ERROR: 'FINGERPRINT_ERROR', - FINGERPRINT_NOT_AVAILABLE: 'FINGERPRINT_NOT_AVAILABLE', - FINGERPRINT_PERMISSION_DENIED: 'FINGERPRINT_PERMISSION_DENIED', - FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST: 'FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST', - ILLEGAL_BLOCK_SIZE_EXCEPTION: 'ILLEGAL_BLOCK_SIZE_EXCEPTION', - INIT_CIPHER_FAILED: 'INIT_CIPHER_FAILED', - INVALID_ALGORITHM_PARAMETER_EXCEPTION: 'INVALID_ALGORITHM_PARAMETER_EXCEPTION', - IO_EXCEPTION: 'IO_EXCEPTION', - JSON_EXCEPTION: 'JSON_EXCEPTION', - MINIMUM_SDK: 'MINIMUM_SDK', - MISSING_ACTION_PARAMETERS: 'MISSING_ACTION_PARAMETERS', - MISSING_PARAMETERS: 'MISSING_PARAMETERS', - NO_SUCH_ALGORITHM_EXCEPTION: 'NO_SUCH_ALGORITHM_EXCEPTION', - SECURITY_EXCEPTION: 'SECURITY_EXCEPTION' + BAD_PADDING_EXCEPTION: 'BAD_PADDING_EXCEPTION'; + CERTIFICATE_EXCEPTION: 'CERTIFICATE_EXCEPTION'; + FINGERPRINT_CANCELLED: 'FINGERPRINT_CANCELLED'; + FINGERPRINT_DATA_NOT_DELETED: 'FINGERPRINT_DATA_NOT_DELETED'; + FINGERPRINT_ERROR: 'FINGERPRINT_ERROR'; + FINGERPRINT_NOT_AVAILABLE: 'FINGERPRINT_NOT_AVAILABLE'; + FINGERPRINT_PERMISSION_DENIED: 'FINGERPRINT_PERMISSION_DENIED'; + FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST: 'FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST'; + ILLEGAL_BLOCK_SIZE_EXCEPTION: 'ILLEGAL_BLOCK_SIZE_EXCEPTION'; + INIT_CIPHER_FAILED: 'INIT_CIPHER_FAILED'; + INVALID_ALGORITHM_PARAMETER_EXCEPTION: 'INVALID_ALGORITHM_PARAMETER_EXCEPTION'; + IO_EXCEPTION: 'IO_EXCEPTION'; + JSON_EXCEPTION: 'JSON_EXCEPTION'; + MINIMUM_SDK: 'MINIMUM_SDK'; + MISSING_ACTION_PARAMETERS: 'MISSING_ACTION_PARAMETERS'; + MISSING_PARAMETERS: 'MISSING_PARAMETERS'; + NO_SUCH_ALGORITHM_EXCEPTION: 'NO_SUCH_ALGORITHM_EXCEPTION'; + SECURITY_EXCEPTION: 'SECURITY_EXCEPTION'; }; /** * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device. - * @param options {AFAAuthOptions} Options - * @returns {Promise} + * @param {AFAAuthOptions} options Options + * @returns {Promise} */ @Cordova() - encrypt(options: AFAAuthOptions): Promise { return; } + encrypt(options: AFAAuthOptions): Promise { + return; + } /** * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device. - * @param options {AFAAuthOptions} Options - * @returns {Promise} + * @param {AFAAuthOptions} options Options + * @returns {Promise} */ @Cordova() - decrypt(options: AFAAuthOptions): Promise { return; } + decrypt(options: AFAAuthOptions): Promise { + return; + } /** * Check if service is available - * @returns {Promise} Returns a Promise that resolves if fingerprint auth is available on the device + * @returns {Promise} Returns a Promise that resolves if fingerprint auth is available on the device */ @Cordova() - isAvailable(): Promise<{ isAvailable: boolean, isHardwareDetected: boolean, hasEnrolledFingerprints: boolean }> { return; } + isAvailable(): Promise { + return; + } /** * Delete the cipher used for encryption and decryption by username - * @returns {Promise} Returns a Promise that resolves if the cipher was successfully deleted + * @param {AFADeleteOptions} options Options + * @returns {Promise<{ deleted: boolean }>} Returns a Promise that resolves if the cipher was successfully deleted */ @Cordova() - delete(options: { clientId: string; username: string; }): Promise<{ deleted: boolean }> { return; } + delete(options: AFADeleteOptions): Promise<{ deleted: boolean }> { + return; + } } From 15c73e46d0253cd3656e9a81b98aecd182f1b031 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:47:50 +0200 Subject: [PATCH 05/48] docs(android-permissions): fix wrong jsdocs --- .../plugins/android-permissions/index.ts | 57 ++++++++++++------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/src/@ionic-native/plugins/android-permissions/index.ts b/src/@ionic-native/plugins/android-permissions/index.ts index 6ee438268..46060dc19 100644 --- a/src/@ionic-native/plugins/android-permissions/index.ts +++ b/src/@ionic-native/plugins/android-permissions/index.ts @@ -1,5 +1,5 @@ -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name Android Permissions @@ -37,12 +37,12 @@ import { Injectable } from '@angular/core'; }) @Injectable() export class AndroidPermissions extends IonicNativePlugin { - PERMISSION: any = { ACCESS_CHECKIN_PROPERTIES: 'android.permission.ACCESS_CHECKIN_PROPERTIES', ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION', ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION', - ACCESS_LOCATION_EXTRA_COMMANDS: 'android.permission.ACCESS_LOCATION_EXTRA_COMMANDS', + ACCESS_LOCATION_EXTRA_COMMANDS: + 'android.permission.ACCESS_LOCATION_EXTRA_COMMANDS', ACCESS_MOCK_LOCATION: 'android.permission.ACCESS_MOCK_LOCATION', ACCESS_NETWORK_STATE: 'android.permission.ACCESS_NETWORK_STATE', ACCESS_SURFACE_FLINGER: 'android.permission.ACCESS_SURFACE_FLINGER', @@ -53,12 +53,14 @@ export class AndroidPermissions extends IonicNativePlugin { BATTERY_STATS: 'android.permission.BATTERY_STATS', BIND_ACCESSIBILITY_SERVICE: 'android.permission.BIND_ACCESSIBILITY_SERVICE', BIND_APPWIDGET: 'android.permission.BIND_APPWIDGET', - BIND_CARRIER_MESSAGING_SERVICE: 'android.permission.BIND_CARRIER_MESSAGING_SERVICE', + BIND_CARRIER_MESSAGING_SERVICE: + 'android.permission.BIND_CARRIER_MESSAGING_SERVICE', BIND_DEVICE_ADMIN: 'android.permission.BIND_DEVICE_ADMIN', BIND_DREAM_SERVICE: 'android.permission.BIND_DREAM_SERVICE', BIND_INPUT_METHOD: 'android.permission.BIND_INPUT_METHOD', BIND_NFC_SERVICE: 'android.permission.BIND_NFC_SERVICE', - BIND_NOTIFICATION_LISTENER_SERVICE: 'android.permission.BIND_NOTIFICATION_LISTENER_SERVICE', + BIND_NOTIFICATION_LISTENER_SERVICE: + 'android.permission.BIND_NOTIFICATION_LISTENER_SERVICE', BIND_PRINT_SERVICE: 'android.permission.BIND_PRINT_SERVICE', BIND_REMOTEVIEWS: 'android.permission.BIND_REMOTEVIEWS', BIND_TEXT_SERVICE: 'android.permission.BIND_TEXT_SERVICE', @@ -79,12 +81,15 @@ export class AndroidPermissions extends IonicNativePlugin { CALL_PRIVILEGED: 'android.permission.CALL_PRIVILEGED', CAMERA: 'android.permission.CAMERA', CAPTURE_AUDIO_OUTPUT: 'android.permission.CAPTURE_AUDIO_OUTPUT', - CAPTURE_SECURE_VIDEO_OUTPUT: 'android.permission.CAPTURE_SECURE_VIDEO_OUTPUT', + CAPTURE_SECURE_VIDEO_OUTPUT: + 'android.permission.CAPTURE_SECURE_VIDEO_OUTPUT', CAPTURE_VIDEO_OUTPUT: 'android.permission.CAPTURE_VIDEO_OUTPUT', - CHANGE_COMPONENT_ENABLED_STATE: 'android.permission.CHANGE_COMPONENT_ENABLED_STATE', + CHANGE_COMPONENT_ENABLED_STATE: + 'android.permission.CHANGE_COMPONENT_ENABLED_STATE', CHANGE_CONFIGURATION: 'android.permission.CHANGE_CONFIGURATION', CHANGE_NETWORK_STATE: 'android.permission.CHANGE_NETWORK_STATE', - CHANGE_WIFI_MULTICAST_STATE: 'android.permission.CHANGE_WIFI_MULTICAST_STATE', + CHANGE_WIFI_MULTICAST_STATE: + 'android.permission.CHANGE_WIFI_MULTICAST_STATE', CHANGE_WIFI_STATE: 'android.permission.CHANGE_WIFI_STATE', CLEAR_APP_CACHE: 'android.permission.CLEAR_APP_CACHE', CLEAR_APP_USER_DATA: 'android.permission.CLEAR_APP_USER_DATA', @@ -130,7 +135,8 @@ export class AndroidPermissions extends IonicNativePlugin { READ_CONTACTS: 'android.permission.READ_CONTACTS', READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE', READ_FRAME_BUFFER: 'android.permission.READ_FRAME_BUFFER', - READ_HISTORY_BOOKMARKS: 'com.android.browser.permission.READ_HISTORY_BOOKMARKS', + READ_HISTORY_BOOKMARKS: + 'com.android.browser.permission.READ_HISTORY_BOOKMARKS', READ_INPUT_STATE: 'android.permission.READ_INPUT_STATE', READ_LOGS: 'android.permission.READ_LOGS', READ_PHONE_STATE: 'android.permission.READ_PHONE_STATE', @@ -164,7 +170,8 @@ export class AndroidPermissions extends IonicNativePlugin { SET_TIME_ZONE: 'android.permission.SET_TIME_ZONE', SET_WALLPAPER: 'android.permission.SET_WALLPAPER', SET_WALLPAPER_HINTS: 'android.permission.SET_WALLPAPER_HINTS', - SIGNAL_PERSISTENT_PROCESSES: 'android.permission.SIGNAL_PERSISTENT_PROCESSES', + SIGNAL_PERSISTENT_PROCESSES: + 'android.permission.SIGNAL_PERSISTENT_PROCESSES', STATUS_BAR: 'android.permission.STATUS_BAR', SUBSCRIBED_FEEDS_READ: 'android.permission.SUBSCRIBED_FEEDS_READ', SUBSCRIBED_FEEDS_WRITE: 'android.permission.SUBSCRIBED_FEEDS_WRITE', @@ -182,7 +189,8 @@ export class AndroidPermissions extends IonicNativePlugin { WRITE_CONTACTS: 'android.permission.WRITE_CONTACTS', WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE', WRITE_GSERVICES: 'android.permission.WRITE_GSERVICES', - WRITE_HISTORY_BOOKMARKS: 'com.android.browser.permission.WRITE_HISTORY_BOOKMARKS', + WRITE_HISTORY_BOOKMARKS: + 'com.android.browser.permission.WRITE_HISTORY_BOOKMARKS', WRITE_PROFILE: 'android.permission.WRITE_PROFILE', WRITE_SECURE_SETTINGS: 'android.permission.WRITE_SECURE_SETTINGS', WRITE_SETTINGS: 'android.permission.WRITE_SETTINGS', @@ -190,39 +198,46 @@ export class AndroidPermissions extends IonicNativePlugin { WRITE_SOCIAL_STREAM: 'android.permission.WRITE_SOCIAL_STREAM', WRITE_SYNC_SETTINGS: 'android.permission.WRITE_SYNC_SETTINGS', WRITE_USER_DICTIONARY: 'android.permission.WRITE_USER_DICTIONARY', - WRITE_VOICEMAIL: 'com.android.voicemail.permission.WRITE_VOICEMAIL', + WRITE_VOICEMAIL: 'com.android.voicemail.permission.WRITE_VOICEMAIL' }; /** * Check permission - * @param permission {string} The name of the permission + * @param {string} permission The name of the permission * @return {Promise} Returns a promise */ @Cordova() - checkPermission(permission: string): Promise { return; } + checkPermission(permission: string): Promise { + return; + } /** * Request permission - * @param permission {string} The name of the permission to request + * @param {string} permission The name of the permission to request * @return {Promise} */ @Cordova() - requestPermission(permission: string): Promise { return; } + requestPermission(permission: string): Promise { + return; + } /** * Request permissions - * @param permissions {Array} An array with permissions + * @param {Array} permissions An array with permissions * @return {Promise} Returns a promise */ @Cordova() - requestPermissions(permissions: string[]): Promise { return; } + requestPermissions(permissions: string[]): Promise { + return; + } /** * This function still works now, will not support in the future. - * @param permission {string} The name of the permission + * @param {string} permission The name of the permission * @return {Promise} Returns a promise */ @Cordova() - hasPermission(permission: string): Promise { return; } - + hasPermission(permission: string): Promise { + return; + } } From 4be721b8f5c6733324203167d7bddb5bf5b3ae59 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:48:55 +0200 Subject: [PATCH 06/48] refactor(core): beautify files and reorder imports --- src/@ionic-native/core/bootstrap.ts | 8 +- src/@ionic-native/core/decorators.spec.ts | 161 +++++----- src/@ionic-native/core/decorators.ts | 48 ++- .../core/ionic-native-plugin.spec.ts | 29 +- src/@ionic-native/core/ionic-native-plugin.ts | 24 +- src/@ionic-native/core/plugin.ts | 279 ++++++++++++++---- src/@ionic-native/core/util.ts | 54 +++- 7 files changed, 408 insertions(+), 195 deletions(-) diff --git a/src/@ionic-native/core/bootstrap.ts b/src/@ionic-native/core/bootstrap.ts index 09ac37f15..8f590d1cd 100644 --- a/src/@ionic-native/core/bootstrap.ts +++ b/src/@ionic-native/core/bootstrap.ts @@ -9,13 +9,17 @@ export function checkReady() { let didFireReady = false; document.addEventListener('deviceready', () => { - console.log(`Ionic Native: deviceready event fired after ${(Date.now() - before)} ms`); + console.log( + `Ionic Native: deviceready event fired after ${Date.now() - before} ms` + ); didFireReady = true; }); setTimeout(() => { if (!didFireReady && !!window.cordova) { - console.warn(`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`); + console.warn( + `Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.` + ); } }, DEVICE_READY_TIMEOUT); } diff --git a/src/@ionic-native/core/decorators.spec.ts b/src/@ionic-native/core/decorators.spec.ts index 534a135f8..b8a8e97a2 100644 --- a/src/@ionic-native/core/decorators.spec.ts +++ b/src/@ionic-native/core/decorators.spec.ts @@ -1,24 +1,34 @@ import 'core-js'; -import { Plugin, Cordova, CordovaProperty, CordovaCheck, CordovaInstance, InstanceProperty } from './decorators'; + +import { Observable } from 'rxjs/Observable'; + +import { + Cordova, + CordovaCheck, + CordovaInstance, + CordovaProperty, + InstanceProperty, + Plugin +} from './decorators'; import { IonicNativePlugin } from './ionic-native-plugin'; import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin'; -import { Observable } from 'rxjs/Observable'; declare const window: any; class TestObject { - constructor(public _objectInstance: any) {} - @InstanceProperty - name: string; + @InstanceProperty name: string; @CordovaInstance({ sync: true }) - pingSync(): string { return; } + pingSync(): string { + return; + } @CordovaInstance() - ping(): Promise { return; } - + ping(): Promise { + return; + } } @Plugin({ @@ -29,15 +39,17 @@ class TestObject { platforms: ['Android', 'iOS'] }) class TestPlugin extends IonicNativePlugin { - - @CordovaProperty - name: string; + @CordovaProperty name: string; @Cordova({ sync: true }) - pingSync(): string { return; } + pingSync(): string { + return; + } @Cordova() - ping(): Promise { return; } + ping(): Promise { + return; + } @CordovaCheck() customPing(): Promise { @@ -51,14 +63,17 @@ class TestPlugin extends IonicNativePlugin { @Cordova({ destruct: true }) - destructPromise(): Promise { return; } + destructPromise(): Promise { + return; + } @Cordova({ destruct: true, observable: true }) - destructObservable(): Observable { return; } - + destructObservable(): Observable { + return; + } } function definePlugin() { @@ -78,7 +93,6 @@ function definePlugin() { } describe('Regular Decorators', () => { - let plugin: TestPlugin; beforeEach(() => { @@ -87,7 +101,6 @@ describe('Regular Decorators', () => { }); describe('Plugin', () => { - it('should set pluginName', () => { expect(TestPlugin.getPluginName()).toEqual('TestPlugin'); }); @@ -103,17 +116,16 @@ describe('Regular Decorators', () => { it('should return supported platforms', () => { expect(TestPlugin.getSupportedPlatforms()).toEqual(['Android', 'iOS']); }); - }); describe('Cordova', () => { - it('should do a sync function', () => { expect(plugin.pingSync()).toEqual('pong'); }); it('should do an async function', (done: Function) => { - plugin.ping() + plugin + .ping() .then(res => { expect(res).toEqual('pong'); done(); @@ -125,39 +137,31 @@ describe('Regular Decorators', () => { }); it('should throw plugin_not_installed error', (done: Function) => { - delete window.testPlugin; window.cordova = true; expect(plugin.pingSync()).toEqual(ERR_PLUGIN_NOT_INSTALLED); - plugin.ping() - .catch(e => { - expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error); - delete window.cordova; - done(); - }); - + plugin.ping().catch(e => { + expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error); + delete window.cordova; + done(); + }); }); it('should throw cordova_not_available error', (done: Function) => { - delete window.testPlugin; expect(plugin.pingSync()).toEqual(ERR_CORDOVA_NOT_AVAILABLE); - plugin.ping() - .catch(e => { - expect(e).toEqual(ERR_CORDOVA_NOT_AVAILABLE.error); - done(); - }); - + plugin.ping().catch(e => { + expect(e).toEqual(ERR_CORDOVA_NOT_AVAILABLE.error); + done(); + }); }); - }); describe('CordovaProperty', () => { - it('should return property value', () => { expect(plugin.name).toEqual('John Smith'); }); @@ -166,61 +170,47 @@ describe('Regular Decorators', () => { plugin.name = 'value2'; expect(plugin.name).toEqual('value2'); }); - }); describe('CordovaCheck', () => { - - it('should run the method when plugin exists', (done) => { - plugin.customPing() - .then(res => { - expect(res).toEqual('pong'); - done(); - }); + it('should run the method when plugin exists', done => { + plugin.customPing().then(res => { + expect(res).toEqual('pong'); + done(); + }); }); - it('shouldnt run the method when plugin doesnt exist', (done) => { + it('shouldnt run the method when plugin doesnt exist', done => { delete window.testPlugin; window.cordova = true; - plugin.customPing() - .catch(e => { - expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error); - done(); - }); + plugin.customPing().catch(e => { + expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error); + done(); + }); }); - }); describe('CordovaOptions', () => { - describe('destruct', () => { - - it('should destruct values returned by a Promise', (done) => { - plugin.destructPromise() - .then((args: any[]) => { - expect(args).toEqual(['hello', 'world']); - done(); - }); + it('should destruct values returned by a Promise', done => { + plugin.destructPromise().then((args: any[]) => { + expect(args).toEqual(['hello', 'world']); + done(); + }); }); - it('should destruct values returned by an Observable', (done) => { - plugin.destructObservable() - .subscribe((args: any[]) => { - expect(args).toEqual(['hello', 'world']); - done(); - }); + it('should destruct values returned by an Observable', done => { + plugin.destructObservable().subscribe((args: any[]) => { + expect(args).toEqual(['hello', 'world']); + done(); + }); }); - }); - }); - }); describe('Instance Decorators', () => { - - let instance: TestObject, - plugin: TestPlugin; + let instance: TestObject, plugin: TestPlugin; beforeEach(() => { definePlugin(); @@ -228,20 +218,14 @@ describe('Instance Decorators', () => { instance = plugin.create(); }); - describe('Instance plugin', () => { - - - - }); + describe('Instance plugin', () => {}); describe('CordovaInstance', () => { - - it('should call instance async method', (done) => { - instance.ping() - .then(r => { - expect(r).toEqual('pong'); - done(); - }); + it('should call instance async method', done => { + instance.ping().then(r => { + expect(r).toEqual('pong'); + done(); + }); }); it('should call instance sync method', () => { @@ -249,18 +233,16 @@ describe('Instance Decorators', () => { }); it('shouldnt call instance method when _objectInstance is undefined', () => { - delete instance._objectInstance; - instance.ping() + instance + .ping() .then(r => { expect(r).toBeUndefined(); }) .catch(e => { expect(e).toBeUndefined(); }); - }); - }); describe('InstanceProperty', () => { @@ -273,5 +255,4 @@ describe('Instance Decorators', () => { expect(instance.name).toEqual('John Cena'); }); }); - }); diff --git a/src/@ionic-native/core/decorators.ts b/src/@ionic-native/core/decorators.ts index 0a99c3704..d283aa3a3 100644 --- a/src/@ionic-native/core/decorators.ts +++ b/src/@ionic-native/core/decorators.ts @@ -1,8 +1,16 @@ -import { instanceAvailability, checkAvailability, wrap, wrapInstance, overrideFunction } from './plugin'; -import { getPlugin, getPromise } from './util'; -import { Observable } from 'rxjs/Observable'; import 'rxjs/observable/throw'; +import { Observable } from 'rxjs/Observable'; + +import { + checkAvailability, + instanceAvailability, + overrideFunction, + wrap, + wrapInstance +} from './plugin'; +import { getPlugin, getPromise } from './util'; + export interface PluginConfig { /** * Plugin name, this should match the class name @@ -109,21 +117,23 @@ export interface CordovaCheckOptions { * @private */ export function InstanceCheck(opts: CordovaCheckOptions = {}) { - return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor => { + return ( + pluginObj: Object, + methodName: string, + descriptor: TypedPropertyDescriptor + ): TypedPropertyDescriptor => { return { value: function(...args: any[]): any { if (instanceAvailability(this)) { return descriptor.value.apply(this, args); } else { - if (opts.sync) { return; } else if (opts.observable) { - return new Observable(() => { }); + return new Observable(() => {}); } - return getPromise(() => { }); - + return getPromise(() => {}); } }, enumerable: true @@ -136,7 +146,11 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) { * @private */ export function CordovaCheck(opts: CordovaCheckOptions = {}) { - return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor => { + return ( + pluginObj: Object, + methodName: string, + descriptor: TypedPropertyDescriptor + ): TypedPropertyDescriptor => { return { value: function(...args: any[]): any { const check = checkAvailability(pluginObj); @@ -177,7 +191,6 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) { */ export function Plugin(config: PluginConfig): ClassDecorator { return function(cls: any) { - // Add these fields to the class for (let prop in config) { cls[prop] = config[prop]; @@ -226,7 +239,11 @@ export function Plugin(config: PluginConfig): ClassDecorator { * and the required plugin are installed. */ export function Cordova(opts: CordovaOptions = {}) { - return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor) => { + return ( + target: Object, + methodName: string, + descriptor: TypedPropertyDescriptor + ) => { return { value: function(...args: any[]) { return wrap(this, methodName, opts).apply(this, args); @@ -268,7 +285,7 @@ export function CordovaProperty(target: any, key: string) { return null; } }, - set: (value) => { + set: value => { if (checkAvailability(target, key) === true) { getPlugin(target.constructor.getPluginRef())[key] = value; } @@ -301,7 +318,11 @@ export function InstanceProperty(target: any, key: string) { * and the required plugin are installed. */ export function CordovaFunctionOverride(opts: any = {}) { - return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor) => { + return ( + target: Object, + methodName: string, + descriptor: TypedPropertyDescriptor + ) => { return { value: function(...args: any[]) { return overrideFunction(this, methodName, opts); @@ -310,4 +331,3 @@ export function CordovaFunctionOverride(opts: any = {}) { }; }; } - diff --git a/src/@ionic-native/core/ionic-native-plugin.spec.ts b/src/@ionic-native/core/ionic-native-plugin.spec.ts index 69df51ce8..9837ffb1b 100644 --- a/src/@ionic-native/core/ionic-native-plugin.spec.ts +++ b/src/@ionic-native/core/ionic-native-plugin.spec.ts @@ -1,8 +1,7 @@ // This is to verify that new (FileTransfer.getPlugin)() works - -import { Plugin, CordovaInstance } from './decorators'; -import { checkAvailability } from './plugin'; +import { CordovaInstance, Plugin } from './decorators'; import { IonicNativePlugin } from './ionic-native-plugin'; +import { checkAvailability } from './plugin'; class FT { hello(): string { @@ -21,7 +20,13 @@ class FT { export class FileTransfer extends IonicNativePlugin { create(): FileTransferObject { let instance: any; - if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) { + if ( + checkAvailability( + FileTransfer.getPluginRef(), + null, + FileTransfer.getPluginName() + ) === true + ) { instance = new (FileTransfer.getPlugin())(); } return new FileTransferObject(instance); @@ -29,20 +34,21 @@ export class FileTransfer extends IonicNativePlugin { } export class FileTransferObject { - constructor(public _objectInstance: any) { - console.info('Creating a new FileTransferObject with instance: ', _objectInstance); + console.info( + 'Creating a new FileTransferObject with instance: ', + _objectInstance + ); } @CordovaInstance({ sync: true }) - hello(): string { return; } - + hello(): string { + return; + } } describe('Mock FileTransfer Plugin', () => { - - let plugin: FileTransfer, - instance: FileTransferObject; + let plugin: FileTransfer, instance: FileTransferObject; beforeAll(() => { plugin = new FileTransfer(); @@ -65,5 +71,4 @@ describe('Mock FileTransfer Plugin', () => { console.info('instance hello is', instance.hello()); expect(instance.hello()).toEqual('world'); }); - }); diff --git a/src/@ionic-native/core/ionic-native-plugin.ts b/src/@ionic-native/core/ionic-native-plugin.ts index ed62979b3..f1660ae00 100644 --- a/src/@ionic-native/core/ionic-native-plugin.ts +++ b/src/@ionic-native/core/ionic-native-plugin.ts @@ -1,5 +1,4 @@ export class IonicNativePlugin { - static pluginName: string; static pluginRef: string; @@ -16,31 +15,40 @@ export class IonicNativePlugin { * Returns a boolean that indicates whether the plugin is installed * @return {boolean} */ - static installed(): boolean { return false; } + static installed(): boolean { + return false; + } /** * Returns the original plugin object */ - static getPlugin(): any { } + static getPlugin(): any {} /** * Returns the plugin's name */ - static getPluginName(): string { return; } + static getPluginName(): string { + return; + } /** * Returns the plugin's reference */ - static getPluginRef(): string { return; } + static getPluginRef(): string { + return; + } /** * Returns the plugin's install name */ - static getPluginInstallName(): string { return; } + static getPluginInstallName(): string { + return; + } /** * Returns the plugin's supported platforms */ - static getSupportedPlatforms(): string[] { return; } - + static getSupportedPlatforms(): string[] { + return; + } } diff --git a/src/@ionic-native/core/plugin.ts b/src/@ionic-native/core/plugin.ts index 4118e482e..a86429100 100644 --- a/src/@ionic-native/core/plugin.ts +++ b/src/@ionic-native/core/plugin.ts @@ -1,9 +1,10 @@ -import { getPlugin, getPromise, cordovaWarn, pluginWarn } from './util'; -import { checkReady } from './bootstrap'; -import { CordovaOptions } from './decorators'; +import 'rxjs/add/observable/fromEvent'; import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/observable/fromEvent'; + +import { checkReady } from './bootstrap'; +import { CordovaOptions } from './decorators'; +import { cordovaWarn, getPlugin, getPromise, pluginWarn } from './util'; checkReady(); @@ -13,16 +14,26 @@ checkReady(); export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' }; export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' }; - /** * Checks if plugin/cordova is available * @return {boolean | { error: string } } * @private */ -export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string }; -export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string }; -export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } { - +export function checkAvailability( + pluginRef: string, + methodName?: string, + pluginName?: string +): boolean | { error: string }; +export function checkAvailability( + pluginObj: any, + methodName?: string, + pluginName?: string +): boolean | { error: string }; +export function checkAvailability( + plugin: any, + methodName?: string, + pluginName?: string +): boolean | { error: string } { let pluginRef, pluginInstance, pluginPackage; if (typeof plugin === 'string') { @@ -35,7 +46,10 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?: pluginInstance = getPlugin(pluginRef); - if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) { + if ( + !pluginInstance || + (!!methodName && typeof pluginInstance[methodName] === 'undefined') + ) { if (!window.cordova) { cordovaWarn(pluginName, methodName); return ERR_CORDOVA_NOT_AVAILABLE; @@ -52,11 +66,23 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?: * Checks if _objectInstance exists and has the method/property * @private */ -export function instanceAvailability(pluginObj: any, methodName?: string): boolean { - return pluginObj._objectInstance && (!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined'); +export function instanceAvailability( + pluginObj: any, + methodName?: string +): boolean { + return ( + pluginObj._objectInstance && + (!methodName || + typeof pluginObj._objectInstance[methodName] !== 'undefined') + ); } -function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any { +function setIndex( + args: any[], + opts: any = {}, + resolve?: Function, + reject?: Function +): any { // ignore resolve and reject in case sync if (opts.sync) { return args; @@ -75,12 +101,19 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func resolve(result); } }); - } else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) { + } else if ( + opts.callbackStyle === 'object' && + opts.successName && + opts.errorName + ) { let obj: any = {}; obj[opts.successName] = resolve; obj[opts.errorName] = reject; args.push(obj); - } else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') { + } else if ( + typeof opts.successIndex !== 'undefined' || + typeof opts.errorIndex !== 'undefined' + ) { const setSuccessIndex = () => { // If we've specified a success/error index if (opts.successIndex > args.length) { @@ -106,8 +139,6 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func setSuccessIndex(); setErrorIndex(); } - - } else { // Otherwise, let's tack them on to the end of the argument list // which is 90% of cases @@ -117,7 +148,14 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func return args; } -function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) { +function callCordovaPlugin( + pluginObj: any, + methodName: string, + args: any[], + opts: any = {}, + resolve?: Function, + reject?: Function +) { // Try to figure out where the success/error callbacks need to be bound // to our promise resolve/reject handlers. args = setIndex(args, opts, resolve, reject); @@ -130,16 +168,34 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts } else { return availabilityCheck; } - } -function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) { +function wrapPromise( + pluginObj: any, + methodName: string, + args: any[], + opts: any = {} +) { let pluginResult: any, rej: Function; const p = getPromise((resolve: Function, reject: Function) => { if (opts.destruct) { - pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args)); + pluginResult = callCordovaPlugin( + pluginObj, + methodName, + args, + opts, + (...args: any[]) => resolve(args), + (...args: any[]) => reject(args) + ); } else { - pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject); + pluginResult = callCordovaPlugin( + pluginObj, + methodName, + args, + opts, + resolve, + reject + ); } rej = reject; }); @@ -147,13 +203,18 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason // to error if (pluginResult && pluginResult.error) { - p.catch(() => { }); + p.catch(() => {}); typeof rej === 'function' && rej(pluginResult.error); } return p; } -function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) { +function wrapOtherPromise( + pluginObj: any, + methodName: string, + args: any[], + opts: any = {} +) { return getPromise((resolve: Function, reject: Function) => { const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts); if (pluginResult) { @@ -168,14 +229,33 @@ function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: }); } -function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) { +function wrapObservable( + pluginObj: any, + methodName: string, + args: any[], + opts: any = {} +) { return new Observable(observer => { let pluginResult; if (opts.destruct) { - pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args)); + pluginResult = callCordovaPlugin( + pluginObj, + methodName, + args, + opts, + (...args: any[]) => observer.next(args), + (...args: any[]) => observer.error(args) + ); } else { - pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer)); + pluginResult = callCordovaPlugin( + pluginObj, + methodName, + args, + opts, + observer.next.bind(observer), + observer.error.bind(observer) + ); } if (pluginResult && pluginResult.error) { @@ -186,26 +266,45 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a try { if (opts.clearFunction) { if (opts.clearWithArgs) { - return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer)); + return callCordovaPlugin( + pluginObj, + opts.clearFunction, + args, + opts, + observer.next.bind(observer), + observer.error.bind(observer) + ); } return callCordovaPlugin(pluginObj, opts.clearFunction, []); } } catch (e) { - console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName); + console.warn( + 'Unable to clear the previous observable watch for', + pluginObj.constructor.getPluginName(), + methodName + ); console.warn(e); } }; }); } -function callInstance(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) { - +function callInstance( + pluginObj: any, + methodName: string, + args: any[], + opts: any = {}, + resolve?: Function, + reject?: Function +) { args = setIndex(args, opts, resolve, reject); if (instanceAvailability(pluginObj, methodName)) { - return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args); + return pluginObj._objectInstance[methodName].apply( + pluginObj._objectInstance, + args + ); } - } /** @@ -215,7 +314,10 @@ function callInstance(pluginObj: any, methodName: string, args: any[], opts: any * @param element The element to attach the event listener to * @returns {Observable} */ -export function wrapEventObservable(event: string, element: any = window): Observable { +export function wrapEventObservable( + event: string, + element: any = window +): Observable { return Observable.fromEvent(element, event); } @@ -227,28 +329,38 @@ export function wrapEventObservable(event: string, element: any = window): Obser * does just this. * @private */ -export function overrideFunction(pluginObj: any, methodName: string, args: any[], opts: any = {}): Observable { +export function overrideFunction( + pluginObj: any, + methodName: string, + args: any[], + opts: any = {} +): Observable { return new Observable(observer => { - - const availabilityCheck = checkAvailability(pluginObj, null, pluginObj.constructor.getPluginName()); + const availabilityCheck = checkAvailability( + pluginObj, + null, + pluginObj.constructor.getPluginName() + ); if (availabilityCheck === true) { const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef()); pluginInstance[methodName] = observer.next.bind(observer); - return () => pluginInstance[methodName] = () => { }; + return () => (pluginInstance[methodName] = () => {}); } else { observer.error(availabilityCheck); observer.complete(); } - }); } - /** * @private */ -export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) { +export const wrap = function( + pluginObj: any, + methodName: string, + opts: CordovaOptions = {} +) { return (...args: any[]) => { if (opts.sync) { // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is @@ -268,22 +380,36 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp /** * @private */ -export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) { +export function wrapInstance( + pluginObj: any, + methodName: string, + opts: any = {} +) { return (...args: any[]) => { if (opts.sync) { - return callInstance(pluginObj, methodName, args, opts); - } else if (opts.observable) { - return new Observable(observer => { - let pluginResult; if (opts.destruct) { - pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args)); + pluginResult = callInstance( + pluginObj, + methodName, + args, + opts, + (...args: any[]) => observer.next(args), + (...args: any[]) => observer.error(args) + ); } else { - pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer)); + pluginResult = callInstance( + pluginObj, + methodName, + args, + opts, + observer.next.bind(observer), + observer.error.bind(observer) + ); } if (pluginResult && pluginResult.error) { @@ -294,23 +420,47 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) return () => { try { if (opts.clearWithArgs) { - return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer)); + return callInstance( + pluginObj, + opts.clearFunction, + args, + opts, + observer.next.bind(observer), + observer.error.bind(observer) + ); } return callInstance(pluginObj, opts.clearFunction, []); } catch (e) { - console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName); + console.warn( + 'Unable to clear the previous observable watch for', + pluginObj.constructor.getPluginName(), + methodName + ); console.warn(e); } }; }); - } else if (opts.otherPromise) { return getPromise((resolve: Function, reject: Function) => { let result; if (opts.destruct) { - result = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args)); + result = callInstance( + pluginObj, + methodName, + args, + opts, + (...args: any[]) => resolve(args), + (...args: any[]) => reject(args) + ); } else { - result = callInstance(pluginObj, methodName, args, opts, resolve, reject); + result = callInstance( + pluginObj, + methodName, + args, + opts, + resolve, + reject + ); } if (result && !!result.then) { result.then(resolve, reject); @@ -318,14 +468,27 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) reject(); } }); - } else { let pluginResult: any, rej: Function; const p = getPromise((resolve: Function, reject: Function) => { if (opts.destruct) { - pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args)); + pluginResult = callInstance( + pluginObj, + methodName, + args, + opts, + (...args: any[]) => resolve(args), + (...args: any[]) => reject(args) + ); } else { - pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject); + pluginResult = callInstance( + pluginObj, + methodName, + args, + opts, + resolve, + reject + ); } rej = reject; }); @@ -333,12 +496,10 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason // to error if (pluginResult && pluginResult.error) { - p.catch(() => { }); + p.catch(() => {}); typeof rej === 'function' && rej(pluginResult.error); } return p; - - } }; } diff --git a/src/@ionic-native/core/util.ts b/src/@ionic-native/core/util.ts index eddedaaaa..bb31fad30 100644 --- a/src/@ionic-native/core/util.ts +++ b/src/@ionic-native/core/util.ts @@ -7,25 +7,27 @@ export const get = (element: Element | Window, path: string): any => { const paths: string[] = path.split('.'); let obj: any = element; for (let i: number = 0; i < paths.length; i++) { - if (!obj) { return null; } + if (!obj) { + return null; + } obj = obj[paths[i]]; } return obj; }; - /** * @private */ export const getPromise = (callback: Function): Promise => { - const tryNativePromise = () => { if (window.Promise) { return new Promise((resolve, reject) => { callback(resolve, reject); }); } else { - console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.'); + console.error( + 'No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.' + ); } }; @@ -44,14 +46,36 @@ export const getPlugin = (pluginRef: string): any => { /** * @private */ -export const pluginWarn = (pluginName: string, plugin?: string, method?: string): void => { +export const pluginWarn = ( + pluginName: string, + plugin?: string, + method?: string +): void => { if (method) { - console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.'); + console.warn( + 'Native: tried calling ' + + pluginName + + '.' + + method + + ', but the ' + + pluginName + + ' plugin is not installed.' + ); } else { - console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.'); + console.warn( + 'Native: tried accessing the ' + + pluginName + + " plugin but it's not installed." + ); } if (plugin) { - console.warn('Install the ' + pluginName + ' plugin: \'ionic cordova plugin add ' + plugin + '\''); + console.warn( + 'Install the ' + + pluginName + + " plugin: 'ionic cordova plugin add " + + plugin + + "'" + ); } }; @@ -62,8 +86,18 @@ export const pluginWarn = (pluginName: string, plugin?: string, method?: string) */ export const cordovaWarn = (pluginName: string, method?: string): void => { if (method) { - console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'); + console.warn( + 'Native: tried calling ' + + pluginName + + '.' + + method + + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator' + ); } else { - console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'); + console.warn( + 'Native: tried accessing the ' + + pluginName + + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator' + ); } }; From 3bfc95ed7877153b22441d04406879ab6487578c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:52:49 +0200 Subject: [PATCH 07/48] refactor(app-center-push): rename variable --- src/@ionic-native/plugins/app-center-push/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/app-center-push/index.ts b/src/@ionic-native/plugins/app-center-push/index.ts index 73104966c..69ee3b5f1 100644 --- a/src/@ionic-native/plugins/app-center-push/index.ts +++ b/src/@ionic-native/plugins/app-center-push/index.ts @@ -37,14 +37,14 @@ import { Observable } from 'rxjs/Observable'; export class AppCenterPush extends IonicNativePlugin { /** * Subscribe to an event - * @param {string} eventname Event name + * @param {string} eventName Event name * @returns {Observable} */ @Cordova({ observable: true, clearFunction: 'removeEventListener' }) - addEventListener(eventname: string): Observable { + addEventListener(eventName: string): Observable { return; } /** From 2e07a7c04ec32c67f189a9199bf712344ee83984 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 18:56:49 +0200 Subject: [PATCH 08/48] docs(app-update): add missing param --- src/@ionic-native/plugins/app-update/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/app-update/index.ts b/src/@ionic-native/plugins/app-update/index.ts index 0da8452f1..f78f6dce8 100644 --- a/src/@ionic-native/plugins/app-update/index.ts +++ b/src/@ionic-native/plugins/app-update/index.ts @@ -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} Returns a promise that resolves when something happens */ @Cordova({ From c26735f36649d38c1d09fd37ae4367c698d06bd6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:00:09 +0200 Subject: [PATCH 09/48] docs(apple-pay): typos --- src/@ionic-native/plugins/apple-pay/index.ts | 68 +++++++++++++------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/src/@ionic-native/plugins/apple-pay/index.ts b/src/@ionic-native/plugins/apple-pay/index.ts index 1995cb496..59e2897c9 100644 --- a/src/@ionic-native/plugins/apple-pay/index.ts +++ b/src/@ionic-native/plugins/apple-pay/index.ts @@ -1,17 +1,32 @@ -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/Observable'; +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; -export type IMakePayments = 'This device can make payments and has a supported card' | 'This device cannot make payments.' | 'This device can make payments but has no supported cards'; +export type IMakePayments = + | 'This device can make payments and has a supported card' + | 'This device cannot make payments.' + | 'This device can make payments but has no supported cards'; export type IShippingType = 'shipping' | 'delivery' | 'store' | 'service'; -export type IBillingRequirement = 'none' | 'all' | 'postcode' | 'name' | 'email' | 'phone'; -export type ITransactionStatus = 'success' | 'failure' | 'invalid-billing-address' | 'invalid-shipping-address' | 'invalid-shipping-contact' | 'require-pin' | 'incorrect-pin' | 'locked-pin'; +export type IBillingRequirement = + | 'none' + | 'all' + | 'postcode' + | 'name' + | 'email' + | 'phone'; +export type ITransactionStatus = + | 'success' + | 'failure' + | 'invalid-billing-address' + | 'invalid-shipping-address' + | 'invalid-shipping-contact' + | 'require-pin' + | 'incorrect-pin' + | 'locked-pin'; export type ICompleteTransaction = 'Payment status applied.'; -export type IUpdateItemsAndShippingStatus = 'Updated List Info' | 'Did you make a payment request?'; +export type IUpdateItemsAndShippingStatus = + | 'Updated List Info' + | 'Did you make a payment request?'; export interface IPaymentResponse { billingNameFirst?: string; @@ -50,7 +65,7 @@ export interface IOrderItem { label: string; amount: number; } -export interface IShippingMethod { +export interface IShippingMethod { identifier: string; label: string; detail: string; @@ -135,11 +150,10 @@ export interface ISelectedShippingContact { plugin: 'cordova-plugin-applepay', pluginRef: 'ApplePay', repo: 'https://github.com/samkelleher/cordova-plugin-applepay', - platforms: ['iOS'], + platforms: ['iOS'] }) @Injectable() export class ApplePay extends IonicNativePlugin { - /** * Detects if the current device supports Apple Pay and has any capable cards registered. * @return {Promise} Returns a promise @@ -174,7 +188,9 @@ export class ApplePay extends IonicNativePlugin { observable: true, clearFunction: 'stopListeningForShippingContactSelection' }) - startListeningForShippingContactSelection(): Observable { + startListeningForShippingContactSelection(): Observable< + ISelectedShippingContact + > { return; } @@ -196,9 +212,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} * * @usage * this.applePay.startListeningForShippingContactSelection().pluck('shippingAddressState').subscribe(shippingAddressState => { @@ -228,15 +244,17 @@ export class ApplePay extends IonicNativePlugin { @Cordova({ otherPromise: true }) - updateItemsAndShippingMethods(list: IOrderItemsAndShippingMethods): Promise { + updateItemsAndShippingMethods( + list: IOrderItemsAndShippingMethods + ): Promise { return; } /** * Request a payment with Apple Pay - * @return {Promise} Returns a promise that resolves when something happens * - * @param order {IOrder} + * @param {IOrder} order + * @return {Promise} Returns a promise that resolves when something happens * * @usage * try { @@ -311,17 +329,19 @@ 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} Returns a promise that resolves after confirmation of payment authorization completion * - * @param complete {ITransactionStatus} + * @param {ITransactionStatus} complete + * @return {Promise} Returns a promise that resolves after confirmation of payment authorization completion * */ @Cordova({ otherPromise: true }) - completeLastTransaction(complete: ITransactionStatus): Promise { + completeLastTransaction( + complete: ITransactionStatus + ): Promise { return; } } From 64cbb6181a67e758928e1e85dbbac1fe39c22b8c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:04:37 +0200 Subject: [PATCH 10/48] docs(background-mode): add missing return types --- .../plugins/background-mode/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/background-mode/index.ts b/src/@ionic-native/plugins/background-mode/index.ts index 6619db59f..afd8817e1 100644 --- a/src/@ionic-native/plugins/background-mode/index.ts +++ b/src/@ionic-native/plugins/background-mode/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; /** @@ -21,9 +21,9 @@ export interface BackgroundModeConfiguration { */ icon?: string; - /** - * Set the background color of the notification circle - */ + /** + * Set the background color of the notification circle + */ color?: string; /** @@ -31,9 +31,9 @@ export interface BackgroundModeConfiguration { */ resume?: boolean; - /** - * When set to false makes the notifications visible on lockscreen (Android 5.0+) - */ + /** + * When set to false makes the notifications visible on lock screen (Android 5.0+) + */ hidden?: boolean; /** Big text */ @@ -122,6 +122,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} */ @Cordova({ platforms: ['Android'] @@ -133,7 +134,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 +203,7 @@ export class BackgroundMode extends IonicNativePlugin { /** * The method works async instead of isActive() or isEnabled(). + * @returns {Promise} */ @Cordova({ platforms: ['Android'] From 7a6b8ac91710f12c8b944bec3e5bf85c604eeaa7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:05:45 +0200 Subject: [PATCH 11/48] docs(barcode-scanner): fix wrong jsdocs --- src/@ionic-native/plugins/barcode-scanner/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/barcode-scanner/index.ts b/src/@ionic-native/plugins/barcode-scanner/index.ts index 467d613cf..9a81c4c86 100644 --- a/src/@ionic-native/plugins/barcode-scanner/index.ts +++ b/src/@ionic-native/plugins/barcode-scanner/index.ts @@ -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} 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} */ @Cordova() From 376d16904c9adbfc00223f4f42ecb74fe4acd29a Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:06:48 +0200 Subject: [PATCH 12/48] docs(battery-status): typo --- src/@ionic-native/plugins/battery-status/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/battery-status/index.ts b/src/@ionic-native/plugins/battery-status/index.ts index d096bdad1..3f57933d6 100644 --- a/src/@ionic-native/plugins/battery-status/index.ts +++ b/src/@ionic-native/plugins/battery-status/index.ts @@ -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} Returns an observable that pushes a status object */ @Cordova({ From 7cbe7a628729ec86730827b91ad4073a6a89fc29 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:09:43 +0200 Subject: [PATCH 13/48] docs(ble): add missing documentations --- src/@ionic-native/plugins/ble/index.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/ble/index.ts b/src/@ionic-native/plugins/ble/index.ts index 497ddd1ec..d108e2df4 100644 --- a/src/@ionic-native/plugins/ble/index.ts +++ b/src/@ionic-native/plugins/ble/index.ts @@ -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} 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} */ @Cordova() stopScan(): Promise { @@ -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} 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} Returns a Promise */ @Cordova() disconnect(deviceId: string): Promise { @@ -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} 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} 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} 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} 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} Returns an Observable that notifies when the Bluetooth is enabled or disabled on the device. */ @Cordova({ observable: true, @@ -508,7 +508,7 @@ export class BLE extends IonicNativePlugin { * * @param {string} deviceId UUID or MAC address of the peripheral * - *@returns {Promise} + * @returns {Promise} */ @Cordova() readRSSI(deviceId: string): Promise { From 502203936c7923f0a8faeb93be528d2aeb25e81b Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:11:52 +0200 Subject: [PATCH 14/48] docs(braintree): typo --- src/@ionic-native/plugins/braintree/index.ts | 37 ++++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/@ionic-native/plugins/braintree/index.ts b/src/@ionic-native/plugins/braintree/index.ts index dd805ff9c..22fe2b048 100644 --- a/src/@ionic-native/plugins/braintree/index.ts +++ b/src/@ionic-native/plugins/braintree/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * Options for the setupApplePay method. @@ -116,8 +116,7 @@ export interface PaymentUIResult { /** * Information about the Apple Pay card used to complete a payment (if Apple Pay was used). */ - applePaycard: { - }; + applePaycard: {}; /** * Information about 3D Secure card used to complete a payment (if 3D Secure was used). @@ -140,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) * @@ -201,23 +200,25 @@ 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} 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 { return; } + initialize(token: string): Promise { + return; + } /** * Used to configure Apple Pay on iOS. @@ -228,13 +229,15 @@ 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} 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 { return; } + setupApplePay(options: ApplePayOptions): Promise { + return; + } /** * Shows Braintree's Drop-In Payments UI. @@ -244,7 +247,11 @@ export class Braintree extends IonicNativePlugin { * @return {Promise} 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 { return; } + presentDropInPaymentUI( + options?: PaymentUIOptions + ): Promise { + return; + } } From e095eecf5b88377473fb0bcedd88a9c01cda7f48 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:12:38 +0200 Subject: [PATCH 15/48] docs(brightness): add missing doc --- src/@ionic-native/plugins/brightness/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/brightness/index.ts b/src/@ionic-native/plugins/brightness/index.ts index 54120ab96..857d34676 100644 --- a/src/@ionic-native/plugins/brightness/index.ts +++ b/src/@ionic-native/plugins/brightness/index.ts @@ -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} 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 {} From 7ed6ab894bdcfbde4cfe257b5ce6a8c3d6902e4c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:17:17 +0200 Subject: [PATCH 16/48] docs(broadcaster): fix jsdocs --- src/@ionic-native/plugins/broadcaster/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/broadcaster/index.ts b/src/@ionic-native/plugins/broadcaster/index.ts index eb291aae9..cc36d0ce7 100644 --- a/src/@ionic-native/plugins/broadcaster/index.ts +++ b/src/@ionic-native/plugins/broadcaster/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; /** @@ -32,10 +32,9 @@ import { Observable } from 'rxjs/Observable'; }) @Injectable() export class Broadcaster extends IonicNativePlugin { - /** * This function listen to an event sent from the native code - * @param eventName {string} + * @param {string} eventName * @return {Observable} Returns an observable to watch when an event is received */ @Cordova({ @@ -43,15 +42,18 @@ export class Broadcaster extends IonicNativePlugin { clearFunction: 'removeEventListener', clearWithArgs: true }) - addEventListener(eventName: string): Observable { return; } + addEventListener(eventName: string): Observable { + return; + } /** * This function sends data to the native code - * @param eventName {string} - * @param eventData {any} + * @param {string} eventName + * @param {any} eventData * @return {Promise} Returns a promise that resolves when an event is successfully fired */ @Cordova() - fireNativeEvent(eventName: string, eventData: any): Promise { return; } - + fireNativeEvent(eventName: string, eventData: any): Promise { + return; + } } From 87ba4b4d32a6382c0ee56534418655f665279dd4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:18:36 +0200 Subject: [PATCH 17/48] docs(browser-tab): improve example --- .../plugins/browser-tab/index.ts | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/@ionic-native/plugins/browser-tab/index.ts b/src/@ionic-native/plugins/browser-tab/index.ts index d41848c07..f65c6c7b6 100644 --- a/src/@ionic-native/plugins/browser-tab/index.ts +++ b/src/@ionic-native/plugins/browser-tab/index.ts @@ -1,5 +1,5 @@ -import { Plugin, Cordova, IonicNativePlugin } 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,13 +33,14 @@ import { Injectable } from '@angular/core'; }) @Injectable() export class BrowserTab extends IonicNativePlugin { - /** * Check if BrowserTab option is available * @return {Promise} Returns a promise that resolves when check is successful and returns true or false */ @Cordova() - isAvailable(): Promise { return; } + isAvailable(): Promise { + return; + } /** * Opens the provided URL using a browser tab @@ -55,12 +48,16 @@ export class BrowserTab extends IonicNativePlugin { * @return {Promise} Returns a promise that resolves when check open was successful */ @Cordova() - openUrl(url: string): Promise { return; } + openUrl(url: string): Promise { + return; + } /** * Closes browser tab * @return {Promise} Returns a promise that resolves when close was finished */ @Cordova() - close(): Promise { return; } + close(): Promise { + return; + } } From 1e539f8cd9a888b4bdb5159607d7e536ce1bbcb8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:20:20 +0200 Subject: [PATCH 18/48] docs(calendar): typos --- src/@ionic-native/plugins/calendar/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/calendar/index.ts b/src/@ionic-native/plugins/calendar/index.ts index 5854ce0e1..bf7e9cf55 100644 --- a/src/@ionic-native/plugins/calendar/index.ts +++ b/src/@ionic-native/plugins/calendar/index.ts @@ -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 */ From 7f274ba9a359aba95dbc601010dac1589b2da1cc Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:27:40 +0200 Subject: [PATCH 19/48] docs(call-log): fix jsdoc --- src/@ionic-native/plugins/call-log/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/call-log/index.ts b/src/@ionic-native/plugins/call-log/index.ts index 43608abb5..67832e9d5 100644 --- a/src/@ionic-native/plugins/call-log/index.ts +++ b/src/@ionic-native/plugins/call-log/index.ts @@ -3,7 +3,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface CallLogObject { name: string; - value: string|Array; + value: string | Array; operator: '==' | '!=' | '>' | '>=' | '<' | '<=' | 'like'; } @@ -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} */ @Cordova() From 9b83615af66b1a6310938df75577c5d2968ff309 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:28:24 +0200 Subject: [PATCH 20/48] docs(call-number): fix jsdoc --- src/@ionic-native/plugins/call-number/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/call-number/index.ts b/src/@ionic-native/plugins/call-number/index.ts index 77a5ddd77..73490c38d 100644 --- a/src/@ionic-native/plugins/call-number/index.ts +++ b/src/@ionic-native/plugins/call-number/index.ts @@ -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} */ @Cordova({ From 0af33923a8804ee9c22736c65b1e7b308c4977c0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:30:04 +0200 Subject: [PATCH 21/48] BREAKING CHANGE: Removed Google Maps Plugin Use this repository instead: https://github.com/ionic-team/ionic-native-google-maps --- .../plugins/google-maps/index.ts | 3516 ----------------- 1 file changed, 3516 deletions(-) delete mode 100644 src/@ionic-native/plugins/google-maps/index.ts diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts deleted file mode 100644 index 3d875b2b5..000000000 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ /dev/null @@ -1,3516 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CordovaCheck, CordovaInstance, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/observable/fromEvent'; - - -export type MapType = 'MAP_TYPE_NORMAL' | 'MAP_TYPE_ROADMAP' | 'MAP_TYPE_SATELLITE' | 'MAP_TYPE_HYBRID' | 'MAP_TYPE_TERRAIN' | 'MAP_TYPE_NONE'; - -/** - * @hidden - */ -export class LatLng implements ILatLng { - - lat: number; - lng: number; - - constructor(lat: number, lng: number) { - this.lat = lat; - this.lng = lng; - } - - equals(other: ILatLng): boolean { - return this.lat === other.lat && this.lng === other.lng; - } - - toString(): string { - return this.lat + ',' + this.lng; - } - - toUrlValue(precision?: number): string { - precision = precision || 6; - - return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); - } -} - -export interface ILatLngBounds { - northeast: ILatLng; - southwest: ILatLng; -} - -/** - * @hidden - */ -export class LatLngBounds implements ILatLngBounds { - - private _objectInstance: any; - - @InstanceProperty northeast: ILatLng; - @InstanceProperty southwest: ILatLng; - @InstanceProperty type: string; - - constructor(points?: ILatLng[]) { - this._objectInstance = new (GoogleMaps.getPlugin()).LatLngBounds(points); - } - - /** - * Converts to string - * @return {string} - */ - @CordovaInstance({ sync: true }) - toString(): string { return; } - - /** - * Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box. - * @param precision {number} - * @return {string} - */ - @CordovaInstance({ sync: true }) - toUrlValue(precision?: number): string { return; } - - /** - * Extends this bounds to contain the given point. - * @param LatLng {ILatLng} - */ - @CordovaInstance({ sync: true }) - extend(LatLng: ILatLng): void {} - - /** - * Returns true if the given lat/lng is in this bounds. - * @param LatLng {ILatLng} - */ - @CordovaInstance({ sync: true }) - contains(LatLng: ILatLng): boolean { return; } - - /** - * Computes the center of this LatLngBounds - * @return {LatLng} - */ - @CordovaInstance({ sync: true }) - getCenter(): LatLng { return; } -} - -export interface GoogleMapControlOptions { - - /** - * Turns the compass on or off. - */ - compass?: boolean; - - /** - * Turns the myLocation button on or off. If turns on this button, the application displays a permission dialog to obtain the geolocation data. - */ - myLocationButton?: boolean; - - /** - * Turns the myLocation control(blue dot) on or off. If turns on this control, the application displays a permission dialog to obtain the geolocation data. - */ - myLocation?: boolean; - - /** - * Turns the indoor picker on or off. - */ - indoorPicker?: boolean; - - /** - * **Android** - * Turns the map toolbar on or off. - */ - mapToolbar?: boolean; - - /** - * **Android** - * Turns the zoom controller on or off. - */ - zoom?: boolean; - - /** - * Accept extra properties for future updates - */ - [key: string]: any; -} - -export interface GoogleMapGestureOptions { - - /** - * Set false to disable the scroll gesture (default: true) - */ - scroll?: boolean; - - /** - * Set false to disable the tilt gesture (default: true) - */ - tilt?: boolean; - - /** - * Set false to disable the zoom gesture (default: true) - */ - zoom?: boolean; - - /** - * Set false to disable the rotate gesture (default: true) - */ - rotate?: boolean; - - /** - * Accept extra properties for future updates - */ - [key: string]: any; -} - -export interface GoogleMapZoomOptions { - minZoom?: number; - maxZoom?: number; -} - -export interface GoogleMapPaddingOptions { - left?: number; - top?: number; - bottom?: number; - right?: number; -} - -export interface GoogleMapPreferenceOptions { - - /** - * Minimum and maximum zoom levels for zooming gestures. - */ - zoom?: GoogleMapZoomOptions; - - /** - * Paddings of controls. - */ - padding?: GoogleMapPaddingOptions; - - /** - * Turns the 3D buildings layer on or off. - */ - building?: boolean; - - /** - * Accept extra properties for future updates - */ - [key: string]: any; -} - -export interface GoogleMapOptions { - - /** - * mapType [options] - */ - mapType?: MapType; - - /** - * controls [options] - */ - controls?: GoogleMapControlOptions; - - /** - * gestures [options] - */ - gestures?: GoogleMapGestureOptions; - - /** - * Map styles [options] - * @ref https://developers.google.com/maps/documentation/javascript/style-reference - */ - styles?: any[]; - - /** - * Initial camera position [options] - */ - camera?: CameraPosition; - - /** - * preferences [options] - */ - preferences?: GoogleMapPreferenceOptions; - - /** - * Accept extra properties for future updates - */ - [key: string]: any; -} - -export interface CameraPosition { - /** - * The center location of the camera view. - * - * [usage 1] - * - * let cameraPos: CameraPosition = { - * target: {lat: ..., lng: ...}, - * zoom: 10 - * } - * - * [usage 2] The zoom property is ignored when you specify multiple position - * - * let cameraPos: CameraPosition = { - * target: [ - * {lat: ..., lng: ...}, - * {lat: ..., lng: ...}, - * {lat: ..., lng: ...} - * ] - * } - */ - target?: T; - /** - * View angle - */ - tilt?: number; - /** - * Zoom level - */ - zoom?: number; - /** - * Map orientation - */ - bearing?: number; - /** - * The duration of animation in milliseconds - */ - duration?: number; - /** - * Camera padding in pixel - */ - padding?: number; -} - -export interface CircleOptions { - /** - * Center position of circle - */ - center: ILatLng; - - /** - * Radius of circle in meter - */ - radius: number; - - /** - * Set the stroke color - * (rgb, rgba, #RRGGBB, "colorname", ...etc) - */ - strokeColor?: string; - - /** - * Set the stroke width in pixel - */ - strokeWidth?: number; - /** - * Set the inside color of polygon - * (rgb, rgba, #RRGGBB, "colorname", ...etc) - */ - fillColor?: string; - - /** - * Set to true to receive the CIRCLE_CLICK event - * (default: false) - */ - clickable?: boolean; - - /** - * Set to false to hide - */ - visible?: boolean; - - /** - * Z-index - */ - zIndex?: number; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface GeocoderRequest { - - /** - * The address property or position property is required. - * You can not specify both property at the same time. - * - * [geocoding usage1] - * let request: GeocoderRequest = { - * address: "Los Angeles, California, USA" - * }; - * - * [geocoding usage2] - * let request: GeocoderRequest = { - * address: [ - * "Los Angeles, California, USA", - * "San Francisco, California, USA", - * ] - * }; - */ - address?: string | string[]; - - /** - * - * [reverse-geocoding usage1] - * let request: GeocoderRequest = { - * position: {"lat": 37.421655, "lng": -122.085637} - * }; - * - * [reverse-geocoding usage2] - * let request: GeocoderRequest = { - * address: [ - * {"lat": 37.421655, "lng": -122.085637}, - * {"lat": 37.332, "lng": -122.030781} - * ] - * }; - */ - position?: ILatLng | ILatLng[]; -} - -export interface GeocoderResult { - adminArea?: string; - country?: string; - countryCode?: string; - extra?: { - featureName?: string; - lines?: Array; - permises?: string; - phone?: string; - url?: string - }; - locale?: string; - locality?: string; - position?: ILatLng; - postalCode?: string; - subAdminArea?: string; - subLocality?: string; - subThoroughfare?: string; - thoroughfare?: string; -} - -export interface GroundOverlayOptions { - /** - * URL of overlay - */ - url: string; - - /** - * Bounds, array of ILatLng - */ - bounds: Array; - - /** - * Set to true to receive the GROUND_OVERLAY_CLICK event - * (default: false) - */ - clickable?: boolean; - - /** - * Set to false to hide - */ - visible?: boolean; - - /** - * Opacity. From 0.0 to 1.0 . - */ - opacity?: number; - - /** - * Bearing - */ - bearing?: number; - - /** - * Z-index - */ - zIndex?: number; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface ILatLng { - lat: number; - lng: number; -} - -export interface MarkerIcon { - url?: string; - size?: { - width?: number; - height?: number; - }; -} - -export interface MarkerOptions { - /** - * The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64 - */ - icon?: any; - - /** - * The content of the infoWindow. - */ - title?: string; - - /** - * The snippet of the infoWindow. - */ - snippet?: string; - - /** - * The position of the marker. - */ - position?: ILatLng; - - /** - * Specify the anchor of the InfoWindow - */ - infoWindowAnchor?: number[]; - - /** - * Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker. - */ - draggable?: boolean; - - /** - * Set true if you want to use a flat marker. (Default: false) - */ - flat?: boolean; - - /** - * Set rotation angle. (Default: 0) - */ - rotation?: number; - - /** - * Set false if you want to hide. (Default: true) - */ - visible?: boolean; - - /** - * Specify the options for title. This property work for normal InfoWindow. - */ - styles?: any; - - /** - * Which animation to play when marker is added to a map. - */ - animation?: string; - - /** - * Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. - */ - zIndex?: number; - - /** - * Set to true to disable auto panning when the marker is clicked. - */ - disableAutoPan?: boolean; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface MarkerClusterOptions { - /** - * Maximum zoom level of clustering - * (default: 15, max: 18) - */ - maxZoomLevel?: number; - - /** - * Draw a rectangle that contains all locations of clustered when you tap on a clister marker. - * (default: true) - */ - boundsDraw?: boolean; - - /** - * Position list - * [ - * {title: "store A", position: {lat: ..., lng: ...}}, - * {title: "store B", position: {lat: ..., lng: ...}}, - * {title: "store C", position: {lat: ..., lng: ...}} - * ] - */ - markers: MarkerOptions[]; - - /** - * Conditions of clustering - * [ - * {icon: "assets/small.png", min: 2, max: 10}, - * {icon: "assets/middle.png", min: 11, max: 30}, - * {icon: "assets/large.png", min: 31}, - * ] - */ - icons: any[]; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface MyLocation { - latLng?: LatLng; - elapsedRealtimeNanos?: any; - time?: string; - accuracy?: any; - bearing?: number; - altitude?: any; - speed?: number; - provider?: any; - hashCode?: any; -} - -export interface MyLocationOptions { - /** - * Set true if you want to try to use GPS mandatory. - * (In false, the plugin try to use GPS and network) - * (default: false) - */ - enableHighAccuracy?: boolean; -} - -export interface PolygonOptions { - /** - * Pass ILatLng[] to specify the vertixes. - * You need to contain two points at least. - */ - points: Array; - - /** - * Set true if you want to draw the curve polygon based on the earth - * (default: false) - */ - geodesic?: boolean; - - /** - * Set the stroke color - * (rgb, rgba, #RRGGBB, "colorname", ...etc) - */ - strokeColor?: string; - - /** - * Set the stroke width in pixel - */ - strokeWidth?: number; - - /** - * Set the inside color of polygon - * (rgb, rgba, #RRGGBB, "colorname", ...etc) - */ - fillColor?: string; - - /** - * Set false if you want to create invisible polygon - * (Invisible polygon is not clickable, default true) - */ - visible?: boolean; - - /** - * Hierarchy z-index - */ - zIndex?: number; - - /** - * Pass ILatLng[][] to create holes in polygon - */ - addHole?: Array>; - - /** - * Set true if you want to receive the POLYGON_CLICK event - * (default: false) - */ - clickable?: boolean; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface PolylineOptions { - /** - * Pass ILatLng[] to specify the vertixes. - * You need to contain two points at least. - */ - points: Array; - - /** - * Set false if you want to create invisible polyline - * (Invisible polyline is not clickable, default true) - */ - visible?: boolean; - - /** - * Set true if you want to draw the curve polyline based on the earth - * (default: false) - */ - geodesic?: boolean; - - /** - * Set the stroke color - * (rgb, rgba, #RRGGBB, "colorname", ...etc) - */ - color?: string; - - /** - * Set the stroke width in pixel - */ - width?: number; - - /** - * Hierarchy z-index - */ - zIndex?: number; - - /** - * Set true if you want to receive the POLYLINE_CLICK event - * (default: false) - */ - clickable?: boolean; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface TileOverlayOptions { - /** - * This callback must return string of image URL. - * If no tile, you need to return null. - */ - getTile: (x: number, y: number, zoom: number) => string; - - /** - * Set false if you want to create invisible tilelayer - * (default true) - */ - visible?: boolean; - - /** - * Hierarchy z-index of tilelayer - */ - zIndex?: number; - - /** - * Default: 512px - */ - tileSize?: number; - - /** - * Default: 1.0 - */ - opacity?: number; - - /** - * Set true if you want to display the tile information over the tile images. - */ - debug?: boolean; - - /** - * Accept own properties - * You can get the property later using `get()` method. - */ - [key: string]: any; -} - -export interface ToDataUrlOptions { - /** - * True if you want get high quality map snapshot - */ - uncompress?: boolean; -} - - -/** - * Options for map.addKmlOverlay() method - */ -export interface KmlOverlayOptions { - /* - * The url or file path of KML file. KMZ format is not supported. - */ - url: string; - - /* - * Do not fire the KML_CLICK event if false. Default is true. - */ - clickable?: boolean; - - /* - * Do not display the default infoWindow if true. Default is false. - */ - suppressInfoWindows?: boolean; - - /** - * Accept own properties for future update - */ - [key: string]: any; -} - - -/** - * @hidden - */ -export class VisibleRegion implements ILatLngBounds { - private _objectInstance: any; - - /** - * The northeast of the bounds that contains the farLeft, farRight, nearLeft and nearRight. - * Since the map view is able to rotate, the farRight is not the same as the northeast. - */ - @InstanceProperty northeast: ILatLng; - - /** - * The southwest of the bounds that contains the farLeft, farRight, nearLeft and nearRight. - * Since the map view is able to rotate, the nearLeft is not the same as the southwest. - */ - @InstanceProperty southwest: ILatLng; - - /** - * The nearRight indicates the lat/lng of the top-left of the map view. - */ - @InstanceProperty farLeft: ILatLng; - - /** - * The nearRight indicates the lat/lng of the top-right of the map view. - */ - @InstanceProperty farRight: ILatLng; - - /** - * The nearRight indicates the lat/lng of the bottom-left of the map view. - */ - @InstanceProperty nearLeft: ILatLng; - - /** - * The nearRight indicates the lat/lng of the bottom-right of the map view. - */ - @InstanceProperty nearRight: ILatLng; - - /** - * constant value : `VisibleRegion` - */ - @InstanceProperty type: string; - - constructor(southwest: LatLngBounds, northeast: LatLngBounds, farLeft: ILatLng, farRight: ILatLng, nearLeft: ILatLng, nearRight: ILatLng) { - this._objectInstance = new (GoogleMaps.getPlugin()).VisibleRegion(southwest, northeast, farLeft, farRight, nearLeft, nearRight); - } - - /** - * Converts to string - * @return {string} - */ - @CordovaInstance({ sync: true }) - toString(): string { return; } - - /** - * Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box. - * @param precision {number} - * @return {string} - */ - @CordovaInstance({ sync: true }) - toUrlValue(precision?: number): string { return; } - - - /** - * Returns true if the given lat/lng is in this bounds. - * @param LatLng {ILatLng} - */ - @CordovaInstance({ sync: true }) - contains(LatLng: ILatLng): boolean { return; } - -} - -/** - * @hidden - * You can listen to these events where appropriate - */ -export const GoogleMapsEvent = { - MAP_READY: 'map_ready', - MAP_CLICK: 'map_click', - MAP_LONG_CLICK: 'map_long_click', - POI_CLICK: 'poi_click', - MY_LOCATION_CLICK: 'my_location_click', - MY_LOCATION_BUTTON_CLICK: 'my_location_button_click', - INDOOR_BUILDING_FOCUSED: 'indoor_building_focused', - INDOOR_LEVEL_ACTIVATED: 'indoor_level_activated', - CAMERA_MOVE_START: 'camera_move_start', - CAMERA_MOVE: 'camera_move', - CAMERA_MOVE_END: 'camera_move_end', - OVERLAY_CLICK: 'overlay_click', - POLYGON_CLICK: 'polygon_click', - POLYLINE_CLICK: 'polyline_click', - CIRCLE_CLICK: 'circle_click', - GROUND_OVERLAY_CLICK: 'groundoverlay_click', - INFO_CLICK: 'info_click', - INFO_LONG_CLICK: 'info_long_click', - INFO_CLOSE: 'info_close', - INFO_OPEN: 'info_open', - MARKER_CLICK: 'marker_click', - MARKER_DRAG: 'marker_drag', - MARKER_DRAG_START: 'marker_drag_start', - MARKER_DRAG_END: 'marker_drag_end', - MAP_DRAG: 'map_drag', - MAP_DRAG_START: 'map_drag_start', - MAP_DRAG_END: 'map_drag_end', - KML_CLICK: 'kml_click' -}; - -/** - * @hidden - */ -export const GoogleMapsAnimation: { [animationName: string]: string; } = { - BOUNCE: 'BOUNCE', - DROP: 'DROP' -}; - -/** - * @hidden - */ -export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { - NORMAL: 'MAP_TYPE_NORMAL', - ROADMAP: 'MAP_TYPE_ROADMAP', - SATELLITE: 'MAP_TYPE_SATELLITE', - HYBRID: 'MAP_TYPE_HYBRID', - TERRAIN: 'MAP_TYPE_TERRAIN', - NONE: 'MAP_TYPE_NONE' -}; - -/** - * @name Google Maps - * @description - * This plugin uses the native Google Maps SDK - * Note: As of Ionic native 4.0, this using the 2.0 version of the google maps plugin. Please make sure your plugin is updated - * @usage - * ```typescript - * import { - * GoogleMaps, - * GoogleMap, - * GoogleMapsEvent, - * GoogleMapOptions, - * CameraPosition, - * MarkerOptions, - * Marker - * } from '@ionic-native/google-maps'; - * import { Component } from "@angular/core/"; - * - * @Component({ - * selector: 'page-home', - * templateUrl: 'home.html' - * }) - * export class HomePage { - * map: GoogleMap; - * constructor() { } - * - * ionViewDidLoad() { - * this.loadMap(); - * } - * - * loadMap() { - * - * let mapOptions: GoogleMapOptions = { - * camera: { - * target: { - * lat: 43.0741904, - * lng: -89.3809802 - * }, - * zoom: 18, - * tilt: 30 - * } - * }; - * - * this.map = GoogleMaps.create('map_canvas', mapOptions); - * - * // Wait the MAP_READY before using any methods. - * this.map.one(GoogleMapsEvent.MAP_READY) - * .then(() => { - * console.log('Map is ready!'); - * - * // Now you can use all methods safely. - * this.map.addMarker({ - * title: 'Ionic', - * icon: 'blue', - * animation: 'DROP', - * position: { - * lat: 43.0741904, - * lng: -89.3809802 - * } - * }) - * .then(marker => { - * marker.on(GoogleMapsEvent.MARKER_CLICK) - * .subscribe(() => { - * alert('clicked'); - * }); - * }); - * - * }); - * } - * } - * - * ``` - * @classes - * GoogleMap - * Circle - * Encoding - * Environment - * Geocoder - * GroundOverlay - * HtmlInfoWindow - * Geocoder - * LatLng - * LatLngBounds - * Marker - * MarkerCluster - * Polygon - * Polyline - * Spherical - * KmlOverlay - * Poly - * TileOverlay - * BaseClass - * BaseArrayClass - * @interfaces - * GoogleMapOptions - * CameraPosition - * CircleOptions - * GeocoderRequest - * GeocoderResult - * GroundOverlayOptions - * ILatLng - * MarkerIcon - * MarkerOptions - * MarkerClusterIcon - * MarkerClusterOptions - * MyLocation - * MyLocationOptions - * PolygonOptions - * PolylineOptions - * TileOverlayOptions - * KmlOverlayOptions - * VisibleRegion - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps', - plugin: 'cordova-plugin-googlemaps', - repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', - document: 'https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/README.md', - install: 'ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"', - installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'], - platforms: ['Android', 'iOS'] -}) -@Injectable() -export class GoogleMaps extends IonicNativePlugin { - - /** - * Creates a new GoogleMap instance - * @param element {string | HTMLElement} Element ID or reference to attach the map to - * @param options {GoogleMapOptions} [options] Options - * @return {GoogleMap} - */ - static create(element: string | HTMLElement | GoogleMapOptions, options?: GoogleMapOptions): GoogleMap { - if (element instanceof HTMLElement) { - if (element.getAttribute('__pluginMapId')) { - console.error('GoogleMaps', element.tagName + '[__pluginMapId=\'' + element.getAttribute('__pluginMapId') + '\'] has already map.'); - return; - } - } else if (typeof element === 'object') { - options = element; - element = null; - } - let googleMap: GoogleMap = new GoogleMap(element, options); - googleMap.set('_overlays', {}); - return googleMap; - } - - /** - * @deprecation - * @hidden - */ - create(element: string | HTMLElement | GoogleMapOptions, options?: GoogleMapOptions): GoogleMap { - console.error('GoogleMaps', '[deprecated] Please use GoogleMaps.create()'); - return GoogleMaps.create(element, options); - } - -} - -/** - * @hidden - * https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseClass/README.md - */ -@Plugin({ - plugin: 'cordova-plugin-googlemaps', - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.BaseClass', - repo: '' -}) -export class BaseClass { - protected _objectInstance: any; - - /** - * Adds an event listener. - * @param eventName {string} event name you want to observe. - * @return {Observable} - */ - @InstanceCheck({ observable: true }) - addEventListener(eventName: string): Observable { - return new Observable((observer) => { - this._objectInstance.on(eventName, (...args: any[]) => { - if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) { - if (args[args.length - 1].type === 'Map') { - args[args.length - 1] = this; - } else if (this instanceof MarkerCluster) { - let overlay: Marker = this.get(args[args.length - 1].getId()); - if (!overlay) { - let markerJS: any = args[args.length - 1]; - let markerId: string = markerJS.getId(); - let markerCluster: MarkerCluster = this; - overlay = new Marker(markerCluster.getMap(), markerJS); - this.get('_overlays')[markerId] = overlay; - markerJS.one(markerJS.getId() + '_remove', () => { - this.get('_overlays')[markerId] = null; - }); - } - args[args.length - 1] = overlay; - } else { - args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()]; - } - } - observer.next(args); - }); - }); - } - - /** - * Adds an event listener that works once. - * @param eventName {string} event name you want to observe. - * @return {Promise} - */ - @InstanceCheck() - addListenerOnce(eventName: string): Promise { - return new Promise((resolve) => { - this._objectInstance.one(eventName, (...args: any[]) => { - if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) { - if (args[args.length - 1].type === 'Map') { - args[args.length - 1] = this; - } else if (this instanceof MarkerCluster) { - let overlay: Marker = this.get(args[args.length - 1].getId()); - if (!overlay) { - let markerJS: any = args[args.length - 1]; - let markerId: string = markerJS.getId(); - let markerCluster: MarkerCluster = this; - overlay = new Marker(markerCluster.getMap(), markerJS); - this.get('_overlays')[markerId] = overlay; - markerJS.one(markerJS.getId() + '_remove', () => { - this.get('_overlays')[markerId] = null; - }); - } - args[args.length - 1] = overlay; - } else { - args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()]; - } - } - resolve(args); - }); - }); - } - - /** - * Gets a value - * @param key {any} - */ - @CordovaInstance({ sync: true }) - get(key: string): any { return; } - - /** - * Sets a value - * @param key {string} The key name for the value. `(key)_changed` will be fired when you set value through this method. - * @param value {any} - * @param noNotify {boolean} [options] True if you want to prevent firing the `(key)_changed` event. - */ - @CordovaInstance({ sync: true }) - set(key: string, value: any, noNotify?: boolean): void { } - - /** - * Bind a key to another object - * @param key {string} The property name you want to observe. - * @param target {any} The target object you want to observe. - * @param targetKey? {string} [options] The property name you want to observe. If you omit this, the `key` argument is used. - * @param noNotify? {boolean} [options] True if you want to prevent `(key)_changed` event when you bind first time, because the internal status is changed from `undefined` to something. - */ - @CordovaInstance({ sync: true }) - bindTo(key: string, target: any, targetKey?: string, noNotify?: boolean): void { } - - /** - * Alias of `addEventListener` - * @param key {string} The property name you want to observe. - * @return {Observable} - */ - @InstanceCheck({ observable: true }) - on(eventName: string): Observable { - return new Observable((observer) => { - this._objectInstance.on(eventName, (...args: any[]) => { - if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) { - if (args[args.length - 1].type === 'Map') { - args[args.length - 1] = this; - } else if (this instanceof MarkerCluster) { - let overlay: Marker = this.get(args[args.length - 1].getId()); - if (!overlay) { - let markerJS: any = args[args.length - 1]; - let markerId: string = markerJS.getId(); - let markerCluster: MarkerCluster = this; - overlay = new Marker(markerCluster.getMap(), markerJS); - this.get('_overlays')[markerId] = overlay; - markerJS.one(markerJS.getId() + '_remove', () => { - this.get('_overlays')[markerId] = null; - }); - } - args[args.length - 1] = overlay; - } else { - args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()]; - } - } - observer.next(args); - }); - }); - } - - /** - * Alias of `addEventListenerOnce` - * @param key {string} The property name you want to observe. - * @return {Promise} - */ - @InstanceCheck() - one(eventName: string): Promise { - return new Promise((resolve) => { - this._objectInstance.one(eventName, (...args: any[]) => { - if (args[args.length - 1] instanceof GoogleMaps.getPlugin().BaseClass) { - if (args[args.length - 1].type === 'Map') { - args[args.length - 1] = this; - } else if (this instanceof MarkerCluster) { - let overlay: Marker = this.get(args[args.length - 1].getId()); - if (!overlay) { - let markerJS: any = args[args.length - 1]; - let markerId: string = markerJS.getId(); - let markerCluster: MarkerCluster = this; - overlay = new Marker(markerCluster.getMap(), markerJS); - this.get('_overlays')[markerId] = overlay; - markerJS.one(markerJS.getId() + '_remove', () => { - this.get('_overlays')[markerId] = null; - }); - } - args[args.length - 1] = overlay; - } else { - args[args.length - 1] = this._objectInstance.getMap().get('_overlays')[args[args.length - 1].getId()]; - } - } - resolve(args); - }); - }); - } - - /** - * Clears all stored values - */ - @CordovaInstance({ sync: true }) - empty(): void { } - - /** - * Dispatch event. - * @param eventName {string} Event name - * @param parameters {any} [options] The data you want to pass to event listerners. - */ - @CordovaInstance({ sync: true }) - trigger(eventName: string, ...parameters: any[]): void {} - - - /** - * Executes off() and empty() - */ - @CordovaCheck({ sync: true }) - destroy(): void { - let map: GoogleMap = this._objectInstance.getMap(); - if (map) { - delete this._objectInstance.getMap().get('_overlays')[this._objectInstance.getId()]; - } - this._objectInstance.remove(); - } - - /** - * Remove event listener(s) - * The `removeEventListener()` has three usages: - * - removeEventListener("eventName", listenerFunction); - * This removes one particular event listener - * - removeEventListener("eventName"); - * This removes the event listeners that added for the event name. - * - removeEventListener(); - * This removes all listeners. - * - * @param eventName {string} [options] Event name - * @param listener {Function} [options] Event listener - */ - @CordovaInstance({ sync: true }) - removeEventListener(eventName?: string, listener?: (...parameters: any[]) => void): void {} - - /** - * Alias of `removeEventListener` - * - * @param eventName {string} [options] Event name - * @param listener {Function} [options] Event listener - */ - @CordovaInstance({ sync: true }) - off(eventName?: string, listener?: (...parameters: any[]) => void): void {} - -} - -/** - * @hidden - * https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseArrayClass/README.md - */ -@Plugin({ - plugin: 'cordova-plugin-googlemaps', - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.BaseArrayClass', - repo: '' -}) -export class BaseArrayClass extends BaseClass { - - constructor(initialData?: T[] | any) { - super(); - if (initialData instanceof GoogleMaps.getPlugin().BaseArrayClass) { - this._objectInstance = initialData; - } else { - this._objectInstance = new (GoogleMaps.getPlugin().BaseArrayClass)(initialData); - } - } - - /** - * Removes all elements from the array. - * @param noNotify? {boolean} [options] Set true to prevent remove_at events. - */ - @CordovaInstance({ sync: true }) - empty(noNotify?: boolean): void {} - - /** - * Iterate over each element, calling the provided callback. - * @param fn {Function} - */ - @CordovaInstance({ sync: true }) - forEach(fn: (element: T, index?: number) => void): void {} - - /** - * Iterate over each element, calling the provided callback. - * @param fn {Function} - * @return {Promise} - */ - @CordovaCheck() - forEachAsync(fn: ((element: T, callback: () => void) => void)): Promise { - return new Promise((resolve) => { - this._objectInstance.forEachAsync(fn, resolve); - }); - } - - /** - * Iterate over each element, then return a new value. - * Then you can get the results of each callback. - * @param fn {Function} - * @return {Array} returns a new array with the results - */ - @CordovaInstance({ sync: true }) - map(fn: (element: T, index: number) => any): any[] { return; } - - /** - * Iterate over each element, calling the provided callback. - * Then you can get the results of each callback. - * @param fn {Function} - * @param callback {Function} - * @return {Promise} returns a new array with the results - */ - @CordovaCheck() - mapAsync(fn: ((element: T, callback: (newElement: any) => void) => void)): Promise { - return new Promise((resolve) => { - this._objectInstance.mapAsync(fn, resolve); - }); - } - - /** - * Same as `mapAsync`, but keep the execution order - * @param fn {Function} - * @param callback {Function} - * @return {Promise} returns a new array with the results - */ - @CordovaCheck() - mapSeries(fn: ((element: T, callback: (newElement: any) => void) => void)): Promise { - return new Promise((resolve) => { - this._objectInstance.mapSeries(fn, resolve); - }); - } - - /** - * The filter() method creates a new array with all elements that pass the test implemented by the provided function. - * @param fn {Function} - * @return {Array} returns a new filtered array - */ - @CordovaInstance({ sync: true }) - filter(fn: (element: T, index: number) => boolean): T[] { return; } - - /** - * The filterAsync() method creates a new array with all elements that pass the test implemented by the provided function. - * @param fn {Function} - * @param callback {Function} - * @return {Promise} returns a new filtered array - */ - @CordovaCheck() - filterAsync(fn: (element: T, callback: (result: boolean) => void) => void): Promise { - return new Promise((resolve) => { - this._objectInstance.filterAsync(fn, resolve); - }); - } - - /** - * Returns a reference to the underlying Array. - * @return {Array} - */ - @CordovaInstance({ sync: true }) - getArray(): T[] { return; } - - /** - * Returns the element at the specified index. - * @param index {number} - * @return {Object} - */ - @CordovaInstance({ sync: true }) - getAt(index: number): any {} - - /** - * Returns the number of the elements. - * @return {number} - */ - @CordovaInstance({ sync: true }) - getLength(): number { return; } - - /** - * The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present. - * @param element {Object} - * @return {number} - */ - @CordovaInstance({ sync: true }) - indexOf(element: T): number { return; } - - /** - * The reverse() method reverses an array in place. - */ - @CordovaInstance({ sync: true }) - reverse(): void {} - - /** - * The sort() method sorts the elements of an array in place and returns the array. - */ - @CordovaInstance({ sync: true }) - sort(): void {} - - /** - * Inserts an element at the specified index. - * @param index {number} - * @param element {Object} - * @param noNotify? {boolean} [options] Set true to prevent insert_at events. - * @return {Object} - */ - @CordovaInstance({ sync: true }) - insertAt(index: number, element: T, noNotify?: boolean) {} - - /** - * Removes the last element of the array and returns that element. - * @param noNotify? {boolean} [options] Set true to prevent remove_at events. - * @return {Object} - */ - @CordovaInstance({ sync: true }) - pop(noNotify?: boolean): T { return; } - - /** - * Adds one element to the end of the array and returns the new length of the array. - * @param element {object} - * @param noNotify? {boolean} Set true to prevent insert_at events. - */ - @CordovaInstance({ sync: true }) - push(element: T, noNotify?: boolean): void {} - - /** - * Removes an element from the specified index. - * @param index {number} - * @param noNotify? {boolean} [options] Set true to prevent remove_at events. - */ - @CordovaInstance({ sync: true }) - removeAt(index: number, noNotify?: boolean): void {} - - /** - * Sets an element at the specified index. - * @param index {number} - * @param element {object} - * @param noNotify? {boolean} [options] Set true to prevent set_at events. - */ - @CordovaInstance({ sync: true }) - setAt(index: number, element: T, noNotify?: boolean): void {} -} - -/** - * @hidden - * https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Circle/README.md - */ -export class Circle extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Change the center position. - * @param latLng {ILatLng} - */ - @CordovaInstance({ sync: true }) - setCenter(latLng: ILatLng): void {} - - /** - * Return the current center position - * @return {ILatLng} - */ - @CordovaInstance({ sync: true }) - getCenter(): ILatLng { return; } - - /** - * Return the current circle radius. - * @return {number} - */ - @CordovaInstance({ sync: true }) - getRadius(): number { return; } - - /** - * Change the circle radius. - * @param radius {number} - */ - @CordovaInstance({ sync: true }) - setRadius(radius: number): void {} - - /** - * Change the filling color (inner color). - * @param color {string} - */ - @CordovaInstance({ sync: true }) - setFillColor(color: string): void {} - - /** - * Return the current circle filling color (inner color). - * @return {string} - */ - @CordovaInstance({ sync: true }) - getFillColor(): string { return; } - - /** - * Change the stroke width. - * @param strokeWidth {number} - */ - @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void {} - - /** - * Return the current circle stroke width (unit: pixel). - * @return {number} - */ - @CordovaInstance({ sync: true }) - getStrokeWidth(): number { return; } - - /** - * Change the stroke color (outter color). - * @param strokeColor {string} - */ - @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void {} - - /** - * Return the current circle stroke color (outer color). - * @return {string} - */ - @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } - - /** - * Change clickablity of the circle. - * @param clickable {boolean} - */ - @CordovaInstance({ sync: true }) - setClickable(clickable: boolean): void {} - - /** - * Return true if the circle is clickable. - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getClickable(): boolean { return; } - - /** - * Change the circle zIndex order. - * @param zIndex {number} - */ - @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void {} - - /** - * Return the current circle zIndex. - * @return {number} - */ - @CordovaInstance({ sync: true }) - getZIndex(): number { return; } - - /** - * Remove the circle. - */ - @CordovaInstance({ sync: true }) - remove(): void {} - - /** - * Return the latLngBounds (rectangle) that contains the circle. - * @return {LatLngBounds} - */ - @CordovaInstance({ sync: true }) - getBounds(): LatLngBounds { return; } - - /** - * Set circle visibility - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Returns a boolean that indicates whether the circle is visible - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } -} - -/** - * @hidden - */ -@Plugin({ - plugin: 'cordova-plugin-googlemaps', - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.environment', - repo: '' -}) -export class Environment { - - /** - * Get the open source software license information for Google Maps SDK for iOS. - * @return {Promise} - */ - static getLicenseInfo(): Promise { - return new Promise((resolve) => { - GoogleMaps.getPlugin().environment.getLicenseInfo((text: string) => resolve(text)); - }); - } - - /** - * @deprecation - * @hidden - */ - getLicenseInfo(): Promise { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Environment.getLicenseInfo()'); - return Environment.getLicenseInfo(); - } - - /** - * Specifies the background color of the app. - * @param color - */ - static setBackgroundColor(color: string): void { - GoogleMaps.getPlugin().environment.setBackgroundColor(color); - } - - /** - * @deprecation - * @hidden - */ - setBackgroundColor(color: string): void { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Environment.setBackgroundColor()'); - Environment.setBackgroundColor(color); - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.Geocoder', - plugin: 'cordova-plugin-googlemaps', - repo: '' -}) -export class Geocoder { - - /** - * @deprecation - * @hidden - */ - geocode(request: GeocoderRequest): Promise> { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Geocoder.geocode()'); - return Geocoder.geocode(request); - } - - /** - * Converts position to address and vice versa - * @param {GeocoderRequest} request Request object with either an address or a position - * @return {Promise>} - */ - static geocode(request: GeocoderRequest): Promise> { - - if (request.address instanceof Array || Array.isArray(request.address) || - request.position instanceof Array || Array.isArray(request.position)) { - // ------------------------- - // Geocoder.geocode({ - // address: [ - // "Kyoto, Japan", - // "Tokyo, Japan" - // ] - // }) - // ------------------------- - return new Promise>((resolve, reject) => { - GoogleMaps.getPlugin().Geocoder.geocode(request, (mvcArray: any) => { - if (mvcArray) { - resolve(new BaseArrayClass(mvcArray)); - } else { - reject(); - } - }); - }); - } else { - // ------------------------- - // Geocoder.geocode({ - // address: "Kyoto, Japan" - // }) - // ------------------------- - return new Promise((resolve, reject) => { - GoogleMaps.getPlugin().Geocoder.geocode(request, (results: GeocoderResult[]) => { - if (results) { - resolve(results); - } else { - reject(); - } - }); - }); - } - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.LocationService', - plugin: 'cordova-plugin-googlemaps', - repo: '' -}) -export class LocationService { - - /** - * Get the current device location without map - * @return {Promise} - */ - static getMyLocation(options?: MyLocationOptions): Promise { - return new Promise((resolve, reject) => { - GoogleMaps.getPlugin().LocationService.getMyLocation(options, resolve); - }); - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.geometry.encoding', - plugin: 'cordova-plugin-googlemaps', - repo: '' -}) -export class Encoding { - - /** - * @deprecation - * @hidden - */ - decodePath(encoded: string, precision?: number): Array { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Encoding.decodePath()'); - return Encoding.decodePath(encoded, precision); - } - - /** - * @deprecation - * @hidden - */ - encodePath(path: Array | BaseArrayClass): string { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Encoding.encodePath()'); - return Encoding.encodePath(path); - } - - /** - * Decodes an encoded path string into a sequence of LatLngs. - * @param encoded {string} an encoded path string - * @param precision? {number} default: 5 - * @return {ILatLng[]} - */ - static decodePath(encoded: string, precision?: number): Array { - return GoogleMaps.getPlugin().geometry.encoding.decodePath(encoded, precision); - } - - /** - * Encodes a sequence of LatLngs into an encoded path string. - * @param path {Array | BaseArrayClass} a sequence of LatLngs - * @return {string} - */ - static encodePath(path: Array | BaseArrayClass): string { - return GoogleMaps.getPlugin().geometry.encoding.encodePath(path); - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.geometry.poly', - plugin: 'cordova-plugin-googlemaps', - repo: '' -}) -export class Poly { - - /** - * Returns true if the speicified location is in the polygon path - * @param location {ILatLng} - * @param path {ILatLng[]} - * @return {boolean} - */ - static containsLocation(location: ILatLng, path: ILatLng[]): boolean { - return GoogleMaps.getPlugin().geometry.poly.containsLocation(location, path); - } - - /** - * Returns true if the speicified location is on the polyline path - * @param location {ILatLng} - * @param path {ILatLng[]} - * @return {boolean} - */ - static isLocationOnEdge(location: ILatLng, path: ILatLng[]): boolean { - return GoogleMaps.getPlugin().geometry.poly.isLocationOnEdge(location, path); - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.geometry.spherical', - plugin: 'cordova-plugin-googlemaps', - repo: '' -}) -export class Spherical { - - /** - * @deprecation - * @hidden - */ - computeDistanceBetween(from: ILatLng, to: ILatLng): number { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeDistanceBetween()'); - return Spherical.computeDistanceBetween(from, to); - } - - /** - * @deprecation - * @hidden - */ - computeOffset(from: ILatLng, distance: number, heading: number): LatLng { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeOffset()'); - return Spherical.computeOffset(from, distance, heading); - } - - /** - * @deprecation - * @hidden - */ - computeOffsetOrigin(to: ILatLng, distance: number, heading: number): LatLng { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeOffsetOrigin()'); - return Spherical.computeOffsetOrigin(to, distance, heading); - } - - /** - * @deprecation - * @hidden - */ - computeLength(path: Array | BaseArrayClass): number { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeLength()'); - return Spherical.computeLength(path); - } - - /** - * @deprecation - * @hidden - */ - computeArea(path: Array | BaseArrayClass): number { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeArea()'); - return Spherical.computeArea(path); - } - - /** - * @deprecation - * @hidden - */ - computeSignedArea(path: Array | BaseArrayClass): number { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeSignedArea()'); - return Spherical.computeSignedArea(path); - } - - /** - * @deprecation - * @hidden - */ - computeHeading(from: ILatLng, to: ILatLng): number { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.computeHeading()'); - return Spherical.computeHeading(from, to); - } - - /** - * @deprecation - * @hidden - */ - interpolate(from: ILatLng, to: ILatLng, fraction: number): LatLng { - console.error('GoogleMaps', '[deprecated] This method is static. Please use Spherical.interpolate()'); - return Spherical.interpolate(from, to, fraction); - } - - - - - - - - /** - * Returns the distance, in meters, between two LatLngs. - * @param locationA {ILatLng} - * @param locationB {ILatLng} - * @return {number} - */ - static computeDistanceBetween(from: ILatLng, to: ILatLng): number { - return GoogleMaps.getPlugin().geometry.spherical.computeDistanceBetween(from, to); - } - - /** - * Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north) - * @param from {ILatLng} - * @param distance {number} - * @param heading {number} - * @return {LatLng} - */ - static computeOffset(from: ILatLng, distance: number, heading: number): LatLng { - return GoogleMaps.getPlugin().geometry.spherical.computeOffset(from, distance, heading); - } - - /** - * Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available. - * @param to {ILatLng} The destination LatLng. - * @param distance {number} The distance travelled, in meters. - * @param heading {number} The heading in degrees clockwise from north. - * @return {LatLng} - */ - static computeOffsetOrigin(to: ILatLng, distance: number, heading: number): LatLng { - return GoogleMaps.getPlugin().geometry.spherical.computeOffsetOrigin(to, distance, heading); - } - - /** - * Returns the length of the given path. - * @param path {Array | BaseArrayClass} - * @return {number} - */ - static computeLength(path: Array | BaseArrayClass): number { - return GoogleMaps.getPlugin().geometry.spherical.computeLength(path); - } - - /** - * Returns the area of a closed path. The computed area uses the same units as the radius. - * @param path {Array | BaseArrayClass}. - * @return {number} - */ - static computeArea(path: Array | BaseArrayClass): number { - return GoogleMaps.getPlugin().geometry.spherical.computeArea(path); - } - - /** - * Returns the signed area of a closed path. The signed area may be used to determine the orientation of the path. - * @param path {Array | BaseArrayClass}. - * @return {number} - */ - static computeSignedArea(path: Array | BaseArrayClass): number { - return GoogleMaps.getPlugin().geometry.spherical.computeSignedArea(path); - } - - /** - * Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range (-180,180). - * @param from {ILatLng} - * @param to {ILatLng} - * @return {number} - */ - static computeHeading(from: ILatLng, to: ILatLng): number { - return GoogleMaps.getPlugin().geometry.spherical.computeHeading(from, to); - } - - /** - * Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng. - * @param from {ILatLng} The LatLng from which to start. - * @param to {ILatLng} The LatLng toward which to travel. - * @param fraction {number} A fraction of the distance to travel from 0.0 to 1.0 . - * @return {LatLng} - */ - static interpolate(from: ILatLng, to: ILatLng, fraction: number): LatLng { - return GoogleMaps.getPlugin().geometry.spherical.interpolate(from, to, fraction); - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - plugin: 'cordova-plugin-googlemaps' -}) -export class GoogleMap extends BaseClass { - constructor(element: string | HTMLElement, options?: GoogleMapOptions) { - super(); - if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { - if (element instanceof HTMLElement) { - this._objectInstance = GoogleMaps.getPlugin().Map.getMap(element, options); - } else if (typeof element === 'string') { - let dummyObj: any = new (GoogleMaps.getPlugin().BaseClass)(); - this._objectInstance = dummyObj; - let onListeners: any[] = []; - let oneListeners: any[] = []; - let _origAddEventListener: any = this._objectInstance.addEventListener; - let _origAddEventListenerOnce: any = this._objectInstance.addEventListenerOnce; - this._objectInstance.addEventListener = (eventName: string, fn: () => void) => { - if (eventName === GoogleMapsEvent.MAP_READY) { - _origAddEventListener.call(dummyObj, eventName, fn); - } else { - onListeners.push([dummyObj, fn]); - } - }; - this._objectInstance.on = this._objectInstance.addEventListener; - - this._objectInstance.addEventListenerOnce = (eventName: string, fn: () => void) => { - if (eventName === GoogleMapsEvent.MAP_READY) { - _origAddEventListenerOnce.call(dummyObj, eventName, fn); - } else { - oneListeners.push([dummyObj, fn]); - } - }; - this._objectInstance.one = this._objectInstance.addEventListenerOnce; - (new Promise((resolve, reject) => { - let count: number = 0; - let timer: any = setInterval(() => { - let target = document.querySelector('.show-page #' + element); - if (target) { - clearInterval(timer); - resolve(target); - } else { - if (count++ < 20) { - return; - } - clearInterval(timer); - this._objectInstance.remove(); - console.error('Can not find the element [#' + element + ']'); - reject(); - } - }, 100); - })) - .then((target: any) => { - this._objectInstance = GoogleMaps.getPlugin().Map.getMap(target, options); - this._objectInstance.one(GoogleMapsEvent.MAP_READY, () => { - this.set('_overlays', {}); - onListeners.forEach((args) => { - this.on.apply(this, args); - }); - oneListeners.forEach((args) => { - this.one.apply(this, args); - }); - dummyObj.trigger(GoogleMapsEvent.MAP_READY); - }); - }) - .catch(() => { - this._objectInstance = null; - }); - } else if (element === null && options) { - this._objectInstance = GoogleMaps.getPlugin().Map.getMap(null, options); - } - } - } - - /** - * Changes the map div - * @param domNode {HTMLElement | string} [options] If you want to display the map in an html element, you need to specify an element or id. If omit this argument, the map is detached from webview. - */ - @InstanceCheck() - setDiv(domNode?: HTMLElement | string): void { - if (typeof domNode === 'string') { - this._objectInstance.setDiv(document.querySelector('.show-page #' + domNode)); - } else { - this._objectInstance.setDiv(domNode); - } - } - - /** - * Returns the map HTML element - * @return {HTMLElement} - */ - @CordovaInstance({ sync: true }) - getDiv(): HTMLElement { return; } - - /** - * Changes the map type id - * @param mapTypeId {string} - */ - @CordovaInstance({ sync: true }) - setMapTypeId(mapTypeId: MapType): void { } - - /** - * Moves the camera with animation - * @return {Promise} - */ - @CordovaInstance() - animateCamera(cameraPosition: CameraPosition): Promise { return; } - - /** - * Zooming in the camera with animation - * @return {Promise} - */ - @CordovaInstance() - animateCameraZoomIn(): Promise { return; } - - /** - * Zooming out the camera with animation - * @return {Promise} - */ - @CordovaInstance() - animateCameraZoomOut(): Promise { return; } - - /** - * Moves the camera without animation - * @return {Promise} - */ - @CordovaInstance() - moveCamera(cameraPosition: CameraPosition): Promise { return; } - - /** - * Zooming in the camera without animation - * @return {Promise} - */ - @CordovaInstance() - moveCameraZoomIn(): Promise { return; } - - /** - * Zooming out the camera without animation - * @return {Promise} - */ - @CordovaInstance() - moveCameraZoomOut(): Promise { return; } - - /** - * Get the position of the camera. - * @return {CameraPosition} - */ - @CordovaInstance({ sync: true }) - getCameraPosition(): CameraPosition { return; } - - /** - * Get the current camera target position - * @return {Promise} - */ - @CordovaInstance({ sync: true }) - getCameraTarget(): ILatLng { return; } - - /** - * Get the current camera zoom level - * @return {number} - */ - @CordovaInstance({ sync: true }) - getCameraZoom(): number { return; } - - /** - * Get the current camera bearing - * @return {number} - */ - @CordovaInstance({ sync: true }) - getCameraBearing(): number { return; } - - /** - * Get the current camera tilt (view angle) - * @return {number} - */ - @CordovaInstance({ sync: true }) - getCameraTilt(): number { return; } - - /** - * Set the center position of the camera view - * @param latLng {ILatLng | Array} - */ - @CordovaInstance({ sync: true }) - setCameraTarget(latLng: ILatLng | Array): void { } - - /** - * Set zoom level of the camera - * @param zoomLevel {number} Zoom level - */ - @CordovaInstance({ sync: true }) - setCameraZoom(zoomLevel: number): void {} - - /** - * Set the camera view angle - * @param tiltLevel {number} Tilt level - */ - @CordovaInstance({ sync: true }) - setCameraTilt(tiltLevel: number): void {} - - /** - * Set camera bearing - * @param bearing {any} - */ - @CordovaInstance({ sync: true }) - setCameraBearing(bearing: any): void {} - - /** - * Change the center of the map by the given distance in pixels - * @param x {any} - * @param y {any} - */ - @CordovaInstance({ sync: true }) - panBy(x: string | number, y: string | number): void { } - - /** - * Get the current visible region (southWest and northEast) - * @return {VisibleRegion} - */ - @CordovaInstance({ sync: true }) - getVisibleRegion(): VisibleRegion { return; } - - /** - * Get the current device location - * @return {Promise} - */ - @CordovaInstance() - getMyLocation(options?: MyLocationOptions): Promise { return; } - - /** - * Set false to ignore all clicks on the map - * @param isClickable {boolean} - */ - @CordovaInstance({ sync: true }) - setClickable(isClickable: boolean): void {} - - /** - * Destroy a map completely - * @return {Promise} - */ - @CordovaInstance() - remove(): Promise { - if (this.get('_overlays')) { - Object.keys(this.get('_overlays')).forEach((overlayId: string) => { - this.get('_overlays')[overlayId] = null; - delete this.get('_overlays')[overlayId]; - }); - } - return new Promise((resolve) => { - this._objectInstance.remove(() => resolve()); - }); - } - - /** - * Remove all overlays, such as marker - * @return {Promise} - */ - @InstanceCheck() - clear(): Promise { - if (this.get('_overlays')) { - Object.keys(this.get('_overlays')).forEach((overlayId: string) => { - this.get('_overlays')[overlayId] = null; - delete this.get('_overlays')[overlayId]; - }); - } - return new Promise((resolve) => { - this._objectInstance.clear(() => resolve()); - }); - } - - /** - * Convert the unit from LatLng to the pixels from the left/top of the map div - * @return {Promise} - */ - @CordovaInstance() - fromLatLngToPoint(latLng: ILatLng): Promise { return; } - - /** - * Convert the unit from the pixels from the left/top to the LatLng - * @return {Promise} - */ - @CordovaInstance() - fromPointToLatLng(point: any): Promise { return; } - - /** - * Set true if you want to show the MyLocation control (blue dot) - * @param enabled {boolean} - */ - @CordovaInstance({ sync: true }) - setMyLocationEnabled(enabled: boolean): void {} - - /** - * Set true if you want to show the MyLocation button - * @param enabled {boolean} - */ - @CordovaInstance({ sync: true }) - setMyLocationButtonEnabled(enabled: boolean): void {} - - /** - * Get the currently focused building - * @return {Promise} - */ - @CordovaInstance() - getFocusedBuilding(): Promise { return; } - - /** - * Set true if you want to show the indoor map - * @param enabled {boolean} - */ - @CordovaInstance({ sync: true }) - setIndoorEnabled(enabled: boolean): void {} - - /** - * Set true if you want to show the traffic layer - * @param enabled {boolean} - */ - @CordovaInstance({ sync: true }) - setTrafficEnabled(enabled: boolean): void {} - - /** - * Set true if you want to show the compass button - * @param enabled {boolean} - */ - @CordovaInstance({ sync: true }) - setCompassEnabled(enabled: boolean): void {} - - /** - * Sets the preference for whether all gestures should be enabled or disabled - * @param enabled {boolean} - */ - @CordovaInstance({ sync: true }) - setAllGesturesEnabled(enabled: boolean): void {} - - /** - * Set visibility of the map - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Adjust the map padding (same as CSS padding rule) - * @param top {number} - * @param right {number} - * @param left {number} - * @param bottom {number} - */ - @CordovaInstance({ sync: true }) - setPadding(top?: number, right?: number, bottom?: number, left?: number): void { } - - /** - * Set options - * @param options - */ - @CordovaInstance({ sync: true }) - setOptions(options: GoogleMapOptions): void {} - - /** - * Adds a marker - * @param options {MarkerOptions} options - * @return {Promise} - */ - @InstanceCheck() - addMarker(options: MarkerOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addMarker(options, (marker: any) => { - if (marker) { - let overlayId: string = marker.getId(); - const overlay: Marker = new Marker(this, marker); - this.get('_overlays')[overlayId] = overlay; - marker.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a marker cluster - * @param options {MarkerClusterOptions} options - * @return {Promise} - */ - @InstanceCheck() - addMarkerCluster(options: MarkerClusterOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addMarkerCluster(options, (markerCluster: any) => { - if (markerCluster) { - let overlayId = markerCluster.getId(); - const overlay = new MarkerCluster(this, markerCluster); - this.get('_overlays')[overlayId] = overlay; - markerCluster.one('remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - markerCluster.set('_overlays', new BaseArrayClass()); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a circle - * @param options {CircleOptions} options - * @return {Promise} - */ - @InstanceCheck() - addCircle(options: CircleOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addCircle(options, (circle: any) => { - if (circle) { - let overlayId: string = circle.getId(); - const overlay = new Circle(this, circle); - this.get('_overlays')[overlayId] = overlay; - circle.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a polygon - * @param options {PolygonOptions} options - * @return {Promise} - */ - @InstanceCheck() - addPolygon(options: PolygonOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addPolygon(options, (polygon: any) => { - if (polygon) { - let overlayId: string = polygon.getId(); - const overlay = new Polygon(this, polygon); - this.get('_overlays')[overlayId] = overlay; - polygon.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a polyline - * @param options {PolylineOptions} options - * @return {Promise} - */ - @InstanceCheck() - addPolyline(options: PolylineOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addPolyline(options, (polyline: any) => { - if (polyline) { - let overlayId: string = polyline.getId(); - const overlay = new Polyline(this, polyline); - this.get('_overlays')[overlayId] = overlay; - polyline.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a tile overlay - * @param options {TileOverlayOptions} options - * @return {Promise} - */ - @InstanceCheck() - addTileOverlay(options: TileOverlayOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addTileOverlay(options, (tileOverlay: any) => { - if (tileOverlay) { - let overlayId: string = tileOverlay.getId(); - const overlay = new TileOverlay(this, tileOverlay); - this.get('_overlays')[overlayId] = overlay; - tileOverlay.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a ground overlay - * @param options {GroundOverlayOptions} options - * @return {Promise} - */ - @InstanceCheck() - addGroundOverlay(options: GroundOverlayOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => { - if (groundOverlay) { - let overlayId: string = groundOverlay.getId(); - const overlay = new GroundOverlay(this, groundOverlay); - this.get('_overlays')[overlayId] = overlay; - groundOverlay.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Adds a kml overlay - * @param options {KmlOverlayOptions} options - * @return {Promise} - */ - @InstanceCheck() - addKmlOverlay(options: KmlOverlayOptions): Promise { - return new Promise((resolve, reject) => { - this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => { - if (kmlOverlay) { - let overlayId: string = kmlOverlay.getId(); - const overlay = new KmlOverlay(this, kmlOverlay); - this.get('_overlays')[overlayId] = overlay; - kmlOverlay.one(overlayId + '_remove', () => { - if (this.get('_overlays')) { - this.get('_overlays')[overlayId] = null; - overlay.destroy(); - } - }); - resolve(overlay); - } else { - reject(); - } - }); - }); - } - - /** - * Returns the base64 encoded screen capture of the map. - * @param options {ToDataUrlOptions} [options] options - * @return {Promise} - */ - @CordovaInstance() - toDataURL(params?: ToDataUrlOptions): Promise { return; } - -} - -/** - * @hidden - */ -export class GroundOverlay extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Change the bounds of the GroundOverlay - * @param bounds { ILatLng[]} - */ - @CordovaInstance({ sync: true }) - setBounds(bounds: ILatLng[]): void {} - - /** - * Change the bearing of the ground overlay - * @param bearing {number} - */ - @CordovaInstance({ sync: true }) - setBearing(bearing: number): void { } - - /** - * Return the current bearing value - */ - @CordovaInstance({ sync: true }) - getBearing(): number { return; } - - /** - * Change the image of the ground overlay - * @param image {string} URL of image - */ - @CordovaInstance({ sync: true }) - setImage(image: string): void {}; - - /** - * Change the opacity of the ground overlay from 0.0 to 1.0 - * @param opacity {number} - */ - @CordovaInstance({ sync: true }) - setOpacity(opacity: number): void { } - - /** - * Return the current opacity - * @return {number} - */ - @CordovaInstance({ sync: true }) - getOpacity(): number { return; } - - /** - * Change clickablity of the ground overlay - * @param clickable {boolean} - */ - @CordovaInstance({ sync: true }) - setClickable(clickable: boolean): void {} - - /** - * Return true if the ground overlay is clickable - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getClickable(): boolean { return; } - - /** - * Change visibility of the ground overlay - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } - - /** - * Return true if the ground overlay is visible - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - /** - * Change the ground overlay zIndex order - * @param index {number} - */ - @CordovaInstance({ sync: true }) - setZIndex(index: number): void {} - - /** - * Return the current ground overlay zIndex - * @return {number} - */ - @CordovaInstance({ sync: true }) - getZIndex(): number { return; } - - /** - * Remove the ground overlay - */ - @CordovaCheck() - remove(): void { - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } -} - -/** - * @hidden - */ -@Plugin({ - plugin: 'cordova-plugin-googlemaps', - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.HtmlInfoWindow', - repo: '' -}) -export class HtmlInfoWindow extends BaseClass { - - constructor() { - super(); - this._objectInstance = new (GoogleMaps.getPlugin().HtmlInfoWindow)(); - } - - /** - * Change the backgroundColor - * @param color {string} - */ - @CordovaInstance() - setBackgroundColor(color: string): void {} - - /** - * Set your HTML contents. - * @param content {any} String containing text or HTML element - * @param cssOptions? {any} CSS styles for the container element of HTMLInfoWindow - */ - @CordovaInstance() - setContent(content: string | Element, cssOptions?: any): void {} - - /** - * Open the htmlInfoWindow - * @param marker {Marker} - */ - @CordovaInstance() - open(marker: any): any {} - - /** - * Close the htmlInfoWindow - */ - @CordovaInstance() - close(): void {} - -} - -/** - * @hidden - */ -export class Marker extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Set the marker position. - * @param latLng {ILatLng} - */ - @CordovaInstance({ sync: true }) - setPosition(latLng: ILatLng): void { return; } - - /** - * Return the marker position. - * @return {ILatLng} - */ - @CordovaInstance({ sync: true }) - getPosition(): ILatLng { return; } - - /** - * Show the normal infoWindow of the marker. - */ - @CordovaInstance({ sync: true }) - showInfoWindow(): void {} - - /** - * Hide the normal infoWindow of the marker. - */ - @CordovaInstance({ sync: true }) - hideInfoWindow(): void {} - - /** - * Specify the animation either `DROP` or `BOUNCE` - * @param animation {string} - */ - @CordovaInstance({ sync: true }) - setAnimation(animation: string): void {} - - /** - * Set true if you **do not want** to move the map when you click on the marker. - * @param disableAutoPan {boolean} - */ - @CordovaInstance({ sync: true }) - setDisableAutoPan(disableAutoPan: boolean): void {} - - /** - * Set false if you want to hide the marker. - * @param visible - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Return true if the marker is visible - */ - @CordovaInstance({ sync: true }) - isVisible(): boolean { return; } - - /** - * Change title of the normal infoWindow. - * @param title {string} - */ - @CordovaInstance({ sync: true }) - setTitle(title: string): void {} - - /** - * Return the title strings. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getTitle(): string { return; } - - /** - * Change snippet of the normal infoWindow. - * @param snippet {string} - */ - @CordovaInstance({ sync: true }) - setSnippet(snippet: string): void {} - - /** - * Return the snippet strings. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getSnippet(): string { return; } - - /** - * Change the marker opacity from 0.0 to 1.0. - * @param alpha {number} Opacity - */ - @CordovaInstance({ sync: true }) - setOpacity(alpha: number): void {} - - /** - * Return the marker opacity. - * @return {number} Opacity - */ - @CordovaInstance({ sync: true }) - getOpacity(): number { return; } - - /** - * Remove the marker. - */ - @CordovaCheck() - remove(): void { - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } - - /** - * Change the info window anchor. This defaults to 50% from the left of the image and at the bottom of the image. - * @param x {number} Distance from left of the icon image in pixels. - * @param y {number} Distance from top of the icon image in pixels. - */ - @CordovaInstance({ sync: true }) - setIconAnchor(x: number, y: number): void {} - - /** - * Change the info window anchor. This defaults to 50% from the left of the image and at the top of the image. - * @param x {number} Distance from left of the icon image in pixels. - * @param y {number} Distance from top of the icon image in pixels. - */ - @CordovaInstance({ sync: true }) - setInfoWindowAnchor(x: number, y: number): void {} - - /** - * Return true if the infoWindow is shown on the marker - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - isInfoWindowShown(): boolean { return; } - - /** - * Return the marker hash code. - * @return {string} Marker hash code - */ - @CordovaInstance({ sync: true }) - getHashCode(): string { return; } - - /** - * Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. - * @param y {number} z-index - */ - @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void {} - - /** - * Get z-index - * @return {number} - */ - @CordovaInstance({ sync: true }) - getZIndex(): number { return; } - - /** - * Set true if you allow all users to drag the marker. - * @param draggable {boolean} - */ - @CordovaInstance({ sync: true }) - setDraggable(draggable: boolean): void { } - - /** - * Return true if the marker drag is enabled. - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - isDraggable(): boolean { return; } - - /** - * Set true if you want to be flat marker. - * @param flat {boolean} - */ - @CordovaInstance({ sync: true }) - setFlat(flat: boolean): void { return; } - - /** - * Change icon url and/or size - * @param icon - */ - @CordovaInstance({ sync: true }) - setIcon(icon: MarkerIcon): void { return; } - - /** - * Set the marker rotation angle. - * @param rotation {number} - */ - @CordovaInstance({ sync: true }) - setRotation(rotation: number): void { } - - /** - * Return the marker rotation angle. - * @return {number} - */ - @CordovaInstance({ sync: true }) - getRotation(): number { return; } - -} - -/** - * @hidden - */ -export class MarkerCluster extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Add one marker location - * @param marker {MarkerOptions} one location - * @param skipRedraw? {boolean} marker cluster does not redraw the marker cluster if true. - */ - @CordovaInstance({ sync: true }) - addMarker(marker: MarkerOptions, skipRedraw?: boolean): void {} - - /** - * Add marker locations - * @param markers {MarkerOptions[]} multiple locations - */ - @CordovaInstance({ sync: true }) - addMarkers(markers: MarkerOptions[]): void {} - - /** - * Remove the marker cluster - */ - @InstanceCheck() - remove(): void { - this._objectInstance.set('_overlays', undefined); - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - -} - -/** - * @hidden - */ -export class Polygon extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Change the polygon points. - * @param points {ILatLng[]} - */ - @CordovaInstance({ sync: true }) - setPoints(points: ILatLng[]): void {} - - /** - * Return an instance of the BaseArrayClass. - * You can modify the points. - * @return {BaseArrayClass} - */ - @CordovaCheck() - getPoints(): BaseArrayClass { - return new BaseArrayClass(this._objectInstance.getPoints()); - } - - /** - * Change the polygon holes. - * @param holes {ILatLng[][]} - */ - @CordovaInstance({ sync: true }) - setHoles(holes: ILatLng[][]): void {} - - /** - * Return an instance of the BaseArrayClass. - * You can modify the holes. - * @return {BaseArrayClass} - */ - @CordovaCheck() - getHoles(): BaseArrayClass { - let holes: ILatLng[][] = this._objectInstance.getPoints(); - let results: BaseArrayClass = new BaseArrayClass(); - holes.forEach((hole: ILatLng[]) => { - results.push(hole); - }); - return results; - } - - /** - * Change the filling color (inner color) - * @param fillColor {string} - */ - @CordovaInstance({ sync: true }) - setFillColor(fillColor: string): void {} - - /** - * Return the current polygon filling color (inner color). - * @return {string} - */ - @CordovaInstance({ sync: true }) - getFillColor(): string { return; } - - /** - * Change the stroke color (outer color) - * @param strokeColor {string} - */ - @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void {} - - /** - * Return the current polygon stroke color (outer color) - * @return {string} - */ - @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } - - /** - * Change clickablity of the polygon - * @param clickable {boolean} - */ - @CordovaInstance({ sync: true }) - setClickable(clickable: boolean): void {} - - /** - * Return true if the polygon is clickable - */ - @CordovaInstance({ sync: true }) - getClickable(): boolean { return; } - - /** - * Change visibility of the polygon - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Return true if the polygon is visible - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - /** - * Change the polygon zIndex order. - * @param zIndex {number} - */ - @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void {} - - /** - * Return the current polygon zIndex - * @return {number} - */ - @CordovaInstance({ sync: true }) - getZIndex(): number { return; } - - /** - * Remove the polygon. - */ - @InstanceCheck() - remove(): void { - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } - - /** - * Change the polygon stroke width - */ - @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void {} - - /** - * Return the polygon stroke width - */ - @CordovaInstance({ sync: true }) - getStrokeWidth(): number { return; } - - /** - * When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. - * @param geodesic {boolean} - */ - @CordovaInstance({ sync: true }) - setGeodesic(geodesic: boolean): void {} - - /** - * Return true if the polygon is geodesic. - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getGeodesic(): boolean { return; } - -} - -/** - * @hidden - */ -export class Polyline extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Change the polyline points. - * @param points {ILatLng[]} - */ - @CordovaInstance({ sync: true }) - setPoints(points: ILatLng[]): void {} - - /** - * Return an instance of the BaseArrayClass - * You can modify the points. - * @return {BaseArrayClass} - */ - @CordovaCheck() - getPoints(): BaseArrayClass { - return new BaseArrayClass(this._objectInstance.getPoints()); - } - - /** - * When true, edges of the polyline are interpreted as geodesic and will follow the curvature of the Earth. - * @param geoDesic {boolean} - */ - @CordovaInstance({ sync: true }) - setGeoDesic(geoDesic: boolean): void {} - - /** - * Return true if the polyline is geodesic - */ - @CordovaInstance({ sync: true }) - getGeodesic(): boolean { return; } - - /** - * Change visibility of the polyline - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Return true if the polyline is visible - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - /** - * Change clickablity of the polyline - * @param clickable {boolean} - */ - @CordovaInstance({ sync: true }) - setClickable(clickable: boolean): void {} - - /** - * Return true if the polyline is clickable - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getClickable(): boolean { return; } - - /** - * Change the polyline color - * @param strokeColor {string} - */ - @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void {} - - /** - * Return the current polyline color - * @return {string} - */ - @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } - - /** - * Change the polyline stroke width - * @param strokeWidth {number} - */ - @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void {} - - /** - * Return the current stroke width (unit: pixel). - * @return {number} - */ - @CordovaInstance({ sync: true }) - getStrokeWidth(): number { return; } - - /** - * Change the polyline zIndex order. - * @param index {number} - */ - @CordovaInstance({ sync: true }) - setZIndex(index: number): void {} - - /** - * Return the current polyline zIndex - * @return {number} - */ - @CordovaInstance({ sync: true }) - getZIndex(): number { return; } - - /** - * Remove the polyline - */ - @InstanceCheck() - remove(): void { - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } -} - -/** - * @hidden - */ -export class TileOverlay extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Set whether the tiles should fade in. - * @param fadeIn {boolean} - */ - @CordovaInstance({ sync: true }) - setFadeIn(fadeIn: boolean): void {} - - /** - * Get whether the tiles should fade in - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getFadeIn(): boolean { return; } - - /** - * Set the zIndex of the tile overlay - * @param zIndex {number} - */ - @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void {} - - /** - * Return the zIndex of the tile overlay - * @return {number} - */ - @CordovaInstance({ sync: true }) - getZIndex(): number { return; } - - /** - * Set the opacity of the tile overlay - * @param opacity {number} - */ - @CordovaInstance({ sync: true }) - setOpacity(opacity: number): void {} - - /** - * Return the opacity of the tile overlay - * @return {number} - */ - @CordovaInstance({ sync: true }) - getOpacity(): number { return; } - - /** - * Set false if you want to hide - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Return true if the tile overlay is visible - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - /** - * Get tile size - */ - @CordovaInstance({ sync: true }) - getTileSize(): any { return; } - - /** - * Remove the tile overlay - */ - @CordovaCheck() - remove(): void { - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } -} - -/** - * @hidden - */ -export class KmlOverlay extends BaseClass { - - private _map: GoogleMap; - - constructor(_map: GoogleMap, _objectInstance: any) { - super(); - this._map = _map; - this._objectInstance = _objectInstance; - - Object.defineProperty(self, 'camera', { - value: this._objectInstance.camera, - writable: false - }); - Object.defineProperty(self, 'kmlData', { - value: this._objectInstance.kmlData, - writable: false - }); - } - - /** - * Returns the viewport to contains all overlays - */ - @CordovaInstance({ sync: true }) - getDefaultViewport(): CameraPosition { return; } - - /** - * Return the ID of instance. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getId(): string { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - getMap(): GoogleMap { return this._map; } - - /** - * Change visibility of the polyline - * @param visible {boolean} - */ - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} - - /** - * Return true if the polyline is visible - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - /** - * Change clickablity of the KmlOverlay - * @param clickable {boolean} - */ - @CordovaInstance({ sync: true }) - setClickable(clickable: boolean): void {} - - /** - * Return true if the KmlOverlay is clickable - * @return {boolean} - */ - @CordovaInstance({ sync: true }) - getClickable(): boolean { return; } - - /** - * Remove the KmlOverlay - */ - @InstanceCheck() - remove(): void { - delete this._objectInstance.getMap().get('_overlays')[this.getId()]; - this._objectInstance.remove(); - this.destroy(); - } -} From 7520a96cc6a5d5cc89606d790e5702c471cca7cc Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 19:32:19 +0200 Subject: [PATCH 22/48] docs(camera-preview): fix typos --- .../plugins/camera-preview/index.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/camera-preview/index.ts b/src/@ionic-native/plugins/camera-preview/index.ts index 8923ed42a..8fcaa5a51 100644 --- a/src/@ionic-native/plugins/camera-preview/index.ts +++ b/src/@ionic-native/plugins/camera-preview/index.ts @@ -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} */ @Cordova({ @@ -293,7 +293,7 @@ export class CameraPreview extends IonicNativePlugin { /** * Set the preview Size - * @param [dimensions] {CameraPreviewDimensions} + * @param {CameraPreviewDimensions} [dimensions] * @return {Promise} */ @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} */ @Cordova({ @@ -345,8 +345,8 @@ export class CameraPreview extends IonicNativePlugin { } /** - * Set the flashmode - * @param [flashMode] {string} 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android) + * Set the flash mode + * @param {string} [flashMode] 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android) * @return {Promise} */ @Cordova({ @@ -395,7 +395,7 @@ export class CameraPreview extends IonicNativePlugin { /** * Set exposure mode - * @param [lock] {string} + * @param {string} [lock] * @return {Promise} */ @Cordova({ @@ -417,7 +417,7 @@ export class CameraPreview extends IonicNativePlugin { /** * Set exposure compensation (Android) - * @param [exposureCompensation] {number} + * @param {number} [exposureCompensation] * @return {Promise} */ @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} */ @Cordova() @@ -450,7 +450,7 @@ export class CameraPreview extends IonicNativePlugin { /** * Add a listener for the back event for the preview - * @return {Promise} if backbutton pressed + * @return {Promise} if back button pressed */ @Cordova() onBackButton(): Promise { From 1e8626c4358a7953ca68d580dc1836e7f2da2f55 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Sun, 8 Apr 2018 19:52:33 +0200 Subject: [PATCH 23/48] chore(travis): fix lint --- src/@ionic-native/core/util.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/core/util.ts b/src/@ionic-native/core/util.ts index bb31fad30..835771d7f 100644 --- a/src/@ionic-native/core/util.ts +++ b/src/@ionic-native/core/util.ts @@ -63,18 +63,12 @@ export const pluginWarn = ( ); } else { console.warn( - 'Native: tried accessing the ' + - pluginName + - " plugin but it's not installed." + `'Native: tried accessing the ${pluginName} plugin but it's not installed.` ); } if (plugin) { console.warn( - 'Install the ' + - pluginName + - " plugin: 'ionic cordova plugin add " + - plugin + - "'" + `Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'` ); } }; From 62241105c83948eae83a8c54c77460fdab1b5fd0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 20:44:06 +0200 Subject: [PATCH 24/48] docs(card-io): fix jsdoc --- src/@ionic-native/plugins/card-io/index.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/card-io/index.ts b/src/@ionic-native/plugins/card-io/index.ts index 4313dd509..281411c3c 100644 --- a/src/@ionic-native/plugins/card-io/index.ts +++ b/src/@ionic-native/plugins/card-io/index.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface CardIOOptions { - /** * Set to true to require expiry date */ @@ -82,11 +81,9 @@ export interface CardIOOptions { * Once a card image has been captured but before it has been processed, this value will determine whether to continue processing as usual. */ supressScan?: boolean; - } export interface CardIOResponse { - /** * Card type */ @@ -126,7 +123,6 @@ export interface CardIOResponse { * Cardholder name */ cardholderName: string; - } /** @@ -173,7 +169,6 @@ export interface CardIOResponse { }) @Injectable() export class CardIO extends IonicNativePlugin { - /** * Check whether card scanning is currently available. (May vary by * device, OS version, network connectivity, etc.) @@ -181,21 +176,26 @@ export class CardIO extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - canScan(): Promise { return; } + canScan(): Promise { + return; + } /** * 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} */ @Cordova() - scan(options?: CardIOOptions): Promise { return; } + scan(options?: CardIOOptions): Promise { + return; + } /** * Retrieve the version of the card.io library. Useful when contacting support. * @returns {Promise} */ @Cordova() - version(): Promise { return; } - + version(): Promise { + return; + } } From 7f24f89fc4e2229b1ce83f7f5e8d0ba9e013e56d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 20:47:18 +0200 Subject: [PATCH 25/48] docs(contacts): fix jsdoc --- src/@ionic-native/plugins/contacts/index.ts | 121 +++++++++++++++----- 1 file changed, 93 insertions(+), 28 deletions(-) diff --git a/src/@ionic-native/plugins/contacts/index.ts b/src/@ionic-native/plugins/contacts/index.ts index 495703233..e3b884848 100644 --- a/src/@ionic-native/plugins/contacts/index.ts +++ b/src/@ionic-native/plugins/contacts/index.ts @@ -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(); } } @@ -90,7 +126,9 @@ export class Contact implements IContactProperties { } @CordovaInstance() - remove(): Promise { return; } + remove(): Promise { + return; + } @InstanceCheck() save(): Promise { @@ -124,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 { @@ -146,12 +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 { @@ -167,9 +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 { @@ -195,14 +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 { @@ -228,7 +272,7 @@ export class ContactOrganization implements IContactOrganization { public department?: string, public title?: string, public pref?: boolean - ) { } + ) {} } /** Search options to filter navigator.contacts. */ @@ -249,10 +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 + ) {} } /** @@ -293,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 @@ -307,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} Returns a Promise that resolves with the search results (an array of Contact objects) */ @CordovaCheck() - find(fields: ContactFieldType[], options?: IContactFindOptions): Promise { + find( + fields: ContactFieldType[], + options?: IContactFindOptions + ): Promise { return getPromise((resolve: Function, reject: Function) => { - navigator.contacts.find(fields, (contacts: any[]) => { - resolve(contacts.map(processContact)); - }, reject, options); + navigator.contacts.find( + fields, + (contacts: any[]) => { + resolve(contacts.map(processContact)); + }, + reject, + options + ); }); } @@ -327,10 +390,12 @@ export class Contacts extends IonicNativePlugin { @CordovaCheck() pickContact(): Promise { return getPromise((resolve: Function, reject: Function) => { - navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject); + navigator.contacts.pickContact( + (contact: any) => resolve(processContact(contact)), + reject + ); }); } - } /** From bca7f38bbf70a65e48d451743fd89f64b39c94b8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 20:48:14 +0200 Subject: [PATCH 26/48] docs(crop): add missing docs --- src/@ionic-native/plugins/crop/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/crop/index.ts b/src/@ionic-native/plugins/crop/index.ts index 928675009..ff6ce1ac3 100644 --- a/src/@ionic-native/plugins/crop/index.ts +++ b/src/@ionic-native/plugins/crop/index.ts @@ -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} Returns a promise that resolves with the new image path, or rejects if failed to crop. */ @Cordova({ From 18da591f03935f0326987f21663c41354e62645a Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 20:49:46 +0200 Subject: [PATCH 27/48] docs(device-accounts): add missing docs --- src/@ionic-native/plugins/device-accounts/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/@ionic-native/plugins/device-accounts/index.ts b/src/@ionic-native/plugins/device-accounts/index.ts index 903ddc380..65333ee0b 100644 --- a/src/@ionic-native/plugins/device-accounts/index.ts +++ b/src/@ionic-native/plugins/device-accounts/index.ts @@ -53,6 +53,7 @@ export class DeviceAccounts extends IonicNativePlugin { /** * Get all accounts registered on Android device for requested type + * @param {string} type * @returns {Promise} */ @Cordova() From 48ccc4c24e0fa08c428ffd283b263c77d6645944 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 20:50:25 +0200 Subject: [PATCH 28/48] docs(device-feedback): fix jsdoc --- src/@ionic-native/plugins/device-feedback/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/device-feedback/index.ts b/src/@ionic-native/plugins/device-feedback/index.ts index 132c523f8..ec8c60858 100644 --- a/src/@ionic-native/plugins/device-feedback/index.ts +++ b/src/@ionic-native/plugins/device-feedback/index.ts @@ -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 {} From a235b2493fb2de48febbf48dc5b16b51c830efe8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 20:51:53 +0200 Subject: [PATCH 29/48] docs(device-orientation): fix jsodc --- .../plugins/device-orientation/index.ts | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/device-orientation/index.ts b/src/@ionic-native/plugins/device-orientation/index.ts index ffd4e52aa..a45a3a167 100644 --- a/src/@ionic-native/plugins/device-orientation/index.ts +++ b/src/@ionic-native/plugins/device-orientation/index.ts @@ -1,9 +1,8 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; export interface DeviceOrientationCompassHeading { - /** * The heading in degrees from 0-359.99 at a single moment in time. (Number) */ @@ -23,11 +22,9 @@ export interface DeviceOrientationCompassHeading { * The time at which this heading was determined. (DOMTimeStamp) */ timestamp: number; - } export interface DeviceOrientationCompassOptions { - /** * How often to retrieve the compass heading in milliseconds. (Number) (Default: 100) */ @@ -37,7 +34,6 @@ export interface DeviceOrientationCompassOptions { * The change in degrees required to initiate a watchHeading success callback. When this value is set, frequency is ignored. (Number) */ filter?: number; - } /** @@ -77,23 +73,35 @@ export interface DeviceOrientationCompassOptions { plugin: 'cordova-plugin-device-orientation', pluginRef: 'navigator.compass', repo: 'https://github.com/apache/cordova-plugin-device-orientation', - platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone'] + platforms: [ + 'Amazon Fire OS', + 'Android', + 'BlackBerry 10', + 'Browser', + 'Firefox OS', + 'iOS', + 'Tizen', + 'Ubuntu', + 'Windows', + 'Windows Phone' + ] }) @Injectable() export class DeviceOrientation extends IonicNativePlugin { - /** * Get the current compass heading. * @returns {Promise} */ @Cordova() - getCurrentHeading(): Promise { return; } + getCurrentHeading(): Promise { + return; + } /** * 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} Returns an observable that contains the compass heading */ @Cordova({ @@ -101,6 +109,9 @@ export class DeviceOrientation extends IonicNativePlugin { observable: true, clearFunction: 'clearWatch' }) - watchHeading(options?: DeviceOrientationCompassOptions): Observable { return; } - + watchHeading( + options?: DeviceOrientationCompassOptions + ): Observable { + return; + } } From 9e744e7c29a8a6c07cf848933cccdb1fa208aed2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:00:17 +0200 Subject: [PATCH 30/48] docs(diagnostic): typo --- src/@ionic-native/plugins/diagnostic/index.ts | 353 +++++++++++++----- 1 file changed, 252 insertions(+), 101 deletions(-) diff --git a/src/@ionic-native/plugins/diagnostic/index.ts b/src/@ionic-native/plugins/diagnostic/index.ts index e4a447664..5625c589a 100644 --- a/src/@ionic-native/plugins/diagnostic/index.ts +++ b/src/@ionic-native/plugins/diagnostic/index.ts @@ -1,5 +1,10 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, CordovaProperty, IonicNativePlugin } from '@ionic-native/core'; +import { + Cordova, + CordovaProperty, + IonicNativePlugin, + Plugin +} from '@ionic-native/core'; /** * @name Diagnostic @@ -43,7 +48,6 @@ import { Cordova, Plugin, CordovaProperty, IonicNativePlugin } 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'] }; @@ -141,7 +159,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isLocationAvailable(): Promise { return; } + isLocationAvailable(): Promise { + return; + } /** * Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled. @@ -149,17 +169,21 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isWifiAvailable(): Promise { return; } + isWifiAvailable(): Promise { + return; + } /** * Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the * application is authorized to use it. * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission. - * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true. + * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true. * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' }) - isCameraAvailable( externalStorage?: boolean ): Promise { return; } + isCameraAvailable(externalStorage?: boolean): Promise { + return; + } /** * Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile) @@ -167,57 +191,64 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isBluetoothAvailable(): Promise { return; } + isBluetoothAvailable(): Promise { + return; + } /** * 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()` * @returns {Promise} */ @Cordova({ platforms: ['Android', 'Windows 10'] }) - isWifiEnabled(): Promise { return; } + isWifiEnabled(): Promise { + return; + } /** * 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} */ @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) - setWifiState(state: boolean): Promise { return; } + setWifiState(state: boolean): Promise { + return; + } /** * Enables/disables Bluetooth on the device. * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android - * @param state {boolean} + * @param {boolean} state * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) - setBluetoothState(state: boolean): Promise { return; } - + setBluetoothState(state: boolean): Promise { + return; + } // ANDROID AND IOS ONLY @@ -226,7 +257,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - isLocationEnabled(): Promise { return; } + isLocationEnabled(): Promise { + return; + } /** * Checks if the application is authorized to use location. @@ -234,14 +267,18 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isLocationAuthorized(): Promise { return; } + isLocationAuthorized(): Promise { + return; + } /** * Returns the location authorization status for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - getLocationAuthorizationStatus(): Promise { return; } + getLocationAuthorizationStatus(): Promise { + return; + } /** * Returns the location authorization status for the application. @@ -251,14 +288,18 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - requestLocationAuthorization(mode?: string): Promise { return; } + requestLocationAuthorization(mode?: string): Promise { + return; + } /** * Checks if camera hardware is present on device. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - isCameraPresent(): Promise { return; } + isCameraPresent(): Promise { + return; + } /** * Checks if the application is authorized to use the camera. @@ -268,7 +309,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - isCameraAuthorized( externalStorage?: boolean ): Promise { return; } + isCameraAuthorized(externalStorage?: boolean): Promise { + return; + } /** * Returns the camera authorization status for the application. @@ -277,7 +320,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - getCameraAuthorizationStatus( externalStorage?: boolean ): Promise { return; } + getCameraAuthorizationStatus(externalStorage?: boolean): Promise { + return; + } /** * Requests camera authorization for the application. @@ -286,49 +331,63 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - requestCameraAuthorization( externalStorage?: boolean ): Promise { return; } + requestCameraAuthorization(externalStorage?: boolean): Promise { + return; + } /** * Checks if the application is authorized to use the microphone. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - isMicrophoneAuthorized(): Promise { return; } + isMicrophoneAuthorized(): Promise { + return; + } /** * Returns the microphone authorization status for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - getMicrophoneAuthorizationStatus(): Promise { return; } + getMicrophoneAuthorizationStatus(): Promise { + return; + } /** * Requests microphone authorization for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - requestMicrophoneAuthorization(): Promise { return; } + requestMicrophoneAuthorization(): Promise { + return; + } /** * Checks if the application is authorized to use contacts (address book). * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - isContactsAuthorized(): Promise { return; } + isContactsAuthorized(): Promise { + return; + } /** * Returns the contacts authorization status for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - getContactsAuthorizationStatus(): Promise { return; } + getContactsAuthorizationStatus(): Promise { + return; + } /** * Requests contacts authorization for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - requestContactsAuthorization(): Promise { return; } + requestContactsAuthorization(): Promise { + return; + } /** * Checks if the application is authorized to use the calendar. @@ -341,7 +400,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - isCalendarAuthorized(): Promise { return; } + isCalendarAuthorized(): Promise { + return; + } /** * Returns the calendar authorization status for the application. @@ -355,7 +416,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - getCalendarAuthorizationStatus(): Promise { return; } + getCalendarAuthorizationStatus(): Promise { + return; + } /** * Requests calendar authorization for the application. @@ -372,7 +435,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - requestCalendarAuthorization(): Promise { return; } + requestCalendarAuthorization(): Promise { + return; + } /** * Opens settings page for this app. @@ -381,39 +446,44 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - switchToSettings(): Promise { return; } + switchToSettings(): Promise { + return; + } /** * Returns the state of Bluetooth on the device. * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - getBluetoothState(): Promise { return; } + getBluetoothState(): Promise { + return; + } /** * 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} */ @Cordova({ platforms: ['Android'] }) - isGpsLocationAvailable(): Promise { return; } + isGpsLocationAvailable(): Promise { + return; + } /** * Checks if location mode is set to return high-accuracy locations from GPS hardware. @@ -423,15 +493,19 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isGpsLocationEnabled(): Promise { return; } + isGpsLocationEnabled(): Promise { + return; + } /** * 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} */ @Cordova({ platforms: ['Android'] }) - isNetworkLocationAvailable(): Promise { return; } + isNetworkLocationAvailable(): Promise { + return; + } /** * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points. @@ -441,50 +515,62 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isNetworkLocationEnabled(): Promise { return; } + isNetworkLocationEnabled(): Promise { + return; + } /** * Returns the current location mode setting for the device. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - getLocationMode(): Promise { return; } + getLocationMode(): Promise { + return; + } /** - * 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} */ @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - getPermissionAuthorizationStatus(permission: any): Promise { return; } + getPermissionAuthorizationStatus(permission: any): Promise { + return; + } /** - * 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} */ @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - getPermissionsAuthorizationStatus(permissions: any[]): Promise { return; } + getPermissionsAuthorizationStatus(permissions: any[]): Promise { + return; + } /** - * 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} */ @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - requestRuntimePermission(permission: any): Promise { return; } + requestRuntimePermission(permission: any): Promise { + return; + } /** - * 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} */ @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - requestRuntimePermissions(permissions: any[]): Promise { return; } + requestRuntimePermissions(permissions: any[]): Promise { + return; + } /** * Indicates if the plugin is currently requesting a runtime permission via the native API. @@ -494,15 +580,19 @@ export class Diagnostic extends IonicNativePlugin { * @returns {boolean} */ @Cordova({ sync: true }) - isRequestingPermission(): boolean { return; } + isRequestingPermission(): boolean { + return; + } /** * 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 { return; } + registerPermissionRequestCompleteHandler(handler: Function): void { + return; + } /** * Checks if the device setting for Bluetooth is switched on. @@ -510,49 +600,63 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isBluetoothEnabled(): Promise { return; } + isBluetoothEnabled(): Promise { + return; + } /** * Checks if the device has Bluetooth capabilities. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - hasBluetoothSupport(): Promise { return; } + hasBluetoothSupport(): Promise { + return; + } /** * Checks if the device has Bluetooth Low Energy (LE) capabilities. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - hasBluetoothLESupport(): Promise { return; } + hasBluetoothLESupport(): Promise { + return; + } /** * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - hasBluetoothLEPeripheralSupport(): Promise { return; } + hasBluetoothLEPeripheralSupport(): Promise { + return; + } /** * Checks if the application is authorized to use external storage. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isExternalStorageAuthorized(): Promise { return; } + isExternalStorageAuthorized(): Promise { + return; + } /** * CReturns the external storage authorization status for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - getExternalStorageAuthorizationStatus(): Promise { return; } + getExternalStorageAuthorizationStatus(): Promise { + return; + } /** * Requests external storage authorization for the application. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - requestExternalStorageAuthorization(): Promise { return; } + requestExternalStorageAuthorization(): Promise { + return; + } /** * Returns details of external SD card(s): absolute path, is writable, free space. @@ -565,7 +669,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - getExternalSdCardDetails(): Promise { return; } + getExternalSdCardDetails(): Promise { + return; + } /** * Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks. @@ -574,7 +680,7 @@ export class Diagnostic extends IonicNativePlugin { platforms: ['Android'], sync: true }) - switchToWirelessSettings(): void { } + switchToWirelessSettings(): void {} /** * Displays NFC settings to allow user to enable NFC. @@ -583,14 +689,16 @@ export class Diagnostic extends IonicNativePlugin { platforms: ['Android'], sync: true }) - switchToNFCSettings(): void { } + switchToNFCSettings(): void {} /** * Checks if NFC hardware is present on device. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isNFCPresent(): Promise { return; } + isNFCPresent(): Promise { + return; + } /** * Checks if the device setting for NFC is switched on. @@ -598,7 +706,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isNFCEnabled(): Promise { return; } + isNFCEnabled(): Promise { + return; + } /** * Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on. @@ -606,39 +716,47 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isNFCAvailable(): Promise { return; } + isNFCAvailable(): Promise { + return; + } /** - * 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} */ @Cordova({ platforms: ['Android'], sync: true }) - registerNFCStateChangeHandler(handler: Function): void { } + registerNFCStateChangeHandler(handler: Function): void {} /** * Checks if the device data roaming setting is enabled. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isDataRoamingEnabled(): Promise { return; } + isDataRoamingEnabled(): Promise { + return; + } /** * Checks if the device setting for ADB(debug) is switched on. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isADBModeEnabled(): Promise { return; } + isADBModeEnabled(): Promise { + return; + } /** * Checks if the device is rooted. * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) - isDeviceRooted(): Promise { return; } + isDeviceRooted(): Promise { + return; + } // IOS ONLY @@ -647,14 +765,18 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - isCameraRollAuthorized(): Promise { return; } + isCameraRollAuthorized(): Promise { + return; + } /** * Returns the authorization status for the application to use the Camera Roll in Photos app. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - getCameraRollAuthorizationStatus(): Promise { return; } + getCameraRollAuthorizationStatus(): Promise { + return; + } /** * Requests camera roll authorization for the application. @@ -663,21 +785,27 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - requestCameraRollAuthorization(): Promise { return; } + requestCameraRollAuthorization(): Promise { + return; + } /** * Checks if remote (push) notifications are enabled. * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] }) - isRemoteNotificationsEnabled(): Promise { return; } + isRemoteNotificationsEnabled(): Promise { + return; + } /** * Indicates if the app is registered for remote (push) notifications on the device. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - isRegisteredForRemoteNotifications(): Promise { return; } + isRegisteredForRemoteNotifications(): Promise { + return; + } /** * Returns the authorization status for the application to use Remote Notifications. @@ -685,7 +813,9 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - getRemoteNotificationsAuthorizationStatus(): Promise { return; } + getRemoteNotificationsAuthorizationStatus(): Promise { + return; + } /** * Indicates the current setting of notification types for the app in the Settings app. @@ -693,42 +823,54 @@ export class Diagnostic extends IonicNativePlugin { * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - getRemoteNotificationTypes(): Promise { return; } + getRemoteNotificationTypes(): Promise { + return; + } /** * Checks if the application is authorized to use reminders. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - isRemindersAuthorized(): Promise { return; } + isRemindersAuthorized(): Promise { + return; + } /** * Returns the reminders authorization status for the application. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - getRemindersAuthorizationStatus(): Promise { return; } + getRemindersAuthorizationStatus(): Promise { + return; + } /** * Requests reminders authorization for the application. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - requestRemindersAuthorization(): Promise { return; } + requestRemindersAuthorization(): Promise { + return; + } /** * Checks if the application is authorized for background refresh. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - isBackgroundRefreshAuthorized(): Promise { return; } + isBackgroundRefreshAuthorized(): Promise { + return; + } /** * Returns the background refresh authorization status for the application. * @returns {Promise} */ @Cordova({ platforms: ['iOS'] }) - getBackgroundRefreshStatus(): Promise { return; } + getBackgroundRefreshStatus(): Promise { + return; + } /** * Requests Bluetooth authorization for the application. @@ -737,14 +879,18 @@ export class Diagnostic extends IonicNativePlugin { * @return {Promise} */ @Cordova({ platforms: ['iOS'] }) - requestBluetoothAuthorization(): Promise { return; } + requestBluetoothAuthorization(): Promise { + return; + } /** * Checks if motion tracking is available on the current device. * @return {Promise} */ @Cordova({ platforms: ['iOS'] }) - isMotionAvailable(): Promise { return; } + isMotionAvailable(): Promise { + return; + } /** * Checks if it's possible to determine the outcome of a motion authorization request on the current device. @@ -754,7 +900,9 @@ export class Diagnostic extends IonicNativePlugin { * @return {Promise} */ @Cordova({ platforms: ['iOS'] }) - isMotionRequestOutcomeAvailable(): Promise { return; } + isMotionRequestOutcomeAvailable(): Promise { + return; + } /** * Requests motion tracking authorization for the application. @@ -764,7 +912,9 @@ export class Diagnostic extends IonicNativePlugin { * @return {Promise} */ @Cordova({ platforms: ['iOS'] }) - requestMotionAuthorization(): Promise { return; } + requestMotionAuthorization(): Promise { + return; + } /** * Checks motion authorization status for the application. @@ -774,6 +924,7 @@ export class Diagnostic extends IonicNativePlugin { * @return {Promise} */ @Cordova({ platforms: ['iOS'] }) - getMotionAuthorizationStatus(): Promise { return; } - + getMotionAuthorizationStatus(): Promise { + return; + } } From fc9add88dcd614f42a3de4657c8946f05a9d7db9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:05:44 +0200 Subject: [PATCH 31/48] docs(dialogs): fix jsdoc --- src/@ionic-native/plugins/dialogs/index.ts | 46 +++++++++++++--------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/@ionic-native/plugins/dialogs/index.ts b/src/@ionic-native/plugins/dialogs/index.ts index 65710e890..e9eb64333 100644 --- a/src/@ionic-native/plugins/dialogs/index.ts +++ b/src/@ionic-native/plugins/dialogs/index.ts @@ -1,9 +1,7 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } 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,47 +46,60 @@ 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} Returns a blank promise once the user has dismissed the alert. */ @Cordova({ successIndex: 1, errorIndex: 4 }) - alert(message: string, title?: string, buttonName?: string): Promise { return; } + alert(message: string, title?: string, buttonName?: string): Promise { + return; + } /** * Displays a customizable confirmation dialog box. * @param {string} message Dialog message. - * @param {string} title Dialog title. (Optional, defaults to Confirm) - * @param {Array} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel]) + * @param {string} [title] Dialog title. (Optional, defaults to Confirm) + * @param {Array} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to [OK,Cancel]) * @returns {Promise} 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 { return; } + confirm( + message: string, + title?: string, + buttonLabels?: string[] + ): Promise { + 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} 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} [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} 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 { return; } - + prompt( + message?: string, + title?: string, + buttonLabels?: string[], + defaultText?: string + ): Promise { + return; + } /** * The device plays a beep sound. @@ -99,6 +108,5 @@ export class Dialogs extends IonicNativePlugin { @Cordova({ sync: true }) - beep(times: number): void { } - + beep(times: number): void {} } From 4ab4aaf17860993ca8d1441cc9955a596a763a2a Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:20:35 +0200 Subject: [PATCH 32/48] docs(document-picker): fix docs --- src/@ionic-native/plugins/document-picker/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/@ionic-native/plugins/document-picker/index.ts b/src/@ionic-native/plugins/document-picker/index.ts index f9f636f6d..bb1f6252a 100644 --- a/src/@ionic-native/plugins/document-picker/index.ts +++ b/src/@ionic-native/plugins/document-picker/index.ts @@ -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} */ @Cordova() - getFile(options?: string): Promise { return; } - + getFile(option?: string): Promise { + return; + } } From 38e7e65557b06da9ca9bcdebe776c0c7f28a4c5c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:21:37 +0200 Subject: [PATCH 33/48] docs(email-composer): fix jsdoc --- src/@ionic-native/plugins/email-composer/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/email-composer/index.ts b/src/@ionic-native/plugins/email-composer/index.ts index 4f8c28c43..700bafff7 100644 --- a/src/@ionic-native/plugins/email-composer/index.ts +++ b/src/@ionic-native/plugins/email-composer/index.ts @@ -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} 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} Resolves promise when the EmailComposer has been opened */ @Cordova({ From 095a6c5cf748e813677012ef2ff93a2061b917ce Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:24:30 +0200 Subject: [PATCH 34/48] docs(estimote-beacons): typos --- .../plugins/estimote-beacons/index.ts | 187 ++++++++++++------ 1 file changed, 122 insertions(+), 65 deletions(-) diff --git a/src/@ionic-native/plugins/estimote-beacons/index.ts b/src/@ionic-native/plugins/estimote-beacons/index.ts index 5a6fde940..f877ca010 100644 --- a/src/@ionic-native/plugins/estimote-beacons/index.ts +++ b/src/@ionic-native/plugins/estimote-beacons/index.ts @@ -1,9 +1,8 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; export interface EstimoteBeaconRegion { - state?: string; major: number; @@ -13,7 +12,6 @@ export interface EstimoteBeaconRegion { identifier?: string; uuid: string; - } /** @@ -48,7 +46,6 @@ export interface EstimoteBeaconRegion { }) @Injectable() export class EstimoteBeacons extends IonicNativePlugin { - /** Proximity value */ ProximityUnknown = 0; @@ -124,7 +121,9 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - requestWhenInUseAuthorization(): Promise { return; } + requestWhenInUseAuthorization(): Promise { + return; + } /** * Ask the user for permission to use location services @@ -145,7 +144,9 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - requestAlwaysAuthorization(): Promise { return; } + requestAlwaysAuthorization(): Promise { + return; + } /** * Get the current location authorization status. @@ -164,7 +165,9 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - authorizationStatus(): Promise { return; } + authorizationStatus(): Promise { + return; + } /** * Start advertising as a beacon. @@ -177,16 +180,23 @@ 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} */ @Cordova({ clearFunction: 'stopAdvertisingAsBeacon' }) - startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise { return; } + startAdvertisingAsBeacon( + uuid: string, + major: number, + minor: number, + regionId: string + ): Promise { + return; + } /** * Stop advertising as a beacon. @@ -202,7 +212,9 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - stopAdvertisingAsBeacon(): Promise { return; } + stopAdvertisingAsBeacon(): Promise { + return; + } /** * Enable analytics. @@ -213,16 +225,18 @@ 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} */ @Cordova() - enableAnalytics(enable: boolean): Promise { return; } + enableAnalytics(enable: boolean): Promise { + return; + } /** - * Test if analytics is enabled. - * - * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} + * Test if analytics is enabled. + * + * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} * * @usage * ``` @@ -231,12 +245,14 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isAnalyticsEnabled(): Promise { return; } + isAnalyticsEnabled(): Promise { + return; + } /** - * Test if App ID and App Token is set. - * - * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} + * Test if App ID and App Token is set. + * + * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} * * @usage * ``` @@ -245,23 +261,27 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isAuthorized(): Promise { return; } + isAuthorized(): Promise { + return; + } /** - * Set App ID and App Token. - * - * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} + * Set App ID and App Token. + * + * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} * * @usage * ``` * 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} */ @Cordova() - setupAppIDAndAppToken(appID: string, appToken: string): Promise { return; } + setupAppIDAndAppToken(appID: string, appToken: string): Promise { + return; + } /** * Start scanning for all nearby beacons using CoreBluetooth (no region object is used). @@ -282,7 +302,9 @@ export class EstimoteBeacons extends IonicNativePlugin { observable: true, clearFunction: 'stopEstimoteBeaconDiscovery' }) - startEstimoteBeaconDiscovery(): Observable { return; } + startEstimoteBeaconDiscovery(): Observable { + return; + } /** * Stop CoreBluetooth scan. Available on iOS. @@ -299,7 +321,9 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - stopEstimoteBeaconDiscovery(): Promise { return; } + stopEstimoteBeaconDiscovery(): Promise { + return; + } /** * Start ranging beacons. Available on iOS and Android. @@ -314,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} Returns an Observable that notifies of each beacon discovered. */ @Cordova({ @@ -322,7 +346,9 @@ export class EstimoteBeacons extends IonicNativePlugin { clearFunction: 'stopRangingBeaconsInRegion', clearWithArgs: true }) - startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable { return; } + startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable { + return; + } /** * Stop ranging beacons. Available on iOS and Android. @@ -337,15 +363,17 @@ 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} */ @Cordova() - stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise { return; } + stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise { + return; + } /** * 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}. @@ -356,16 +384,22 @@ export class EstimoteBeacons extends IonicNativePlugin { clearFunction: 'stopRangingSecureBeaconsInRegion', clearWithArgs: true }) - startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable { return; } + startRangingSecureBeaconsInRegion( + region: EstimoteBeaconRegion + ): Observable { + return; + } /** * 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} */ @Cordova() - stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise { return; } + stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise { + return; + } /** * Start monitoring beacons. Available on iOS and Android. @@ -377,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). @@ -391,7 +425,12 @@ export class EstimoteBeacons extends IonicNativePlugin { successIndex: 1, errorIndex: 2 }) - startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } + startMonitoringForRegion( + region: EstimoteBeaconRegion, + notifyEntryStateOnDisplay: boolean + ): Observable { + return; + } /** * Stop monitoring beacons. Available on iOS and Android. @@ -401,21 +440,23 @@ 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} */ @Cordova() - stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise { return; } + stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise { + return; + } /** * 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} */ @Cordova({ @@ -425,17 +466,24 @@ export class EstimoteBeacons extends IonicNativePlugin { successIndex: 1, errorIndex: 2 }) - startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } + startSecureMonitoringForRegion( + region: EstimoteBeaconRegion, + notifyEntryStateOnDisplay: boolean + ): Observable { + return; + } /** - * Stop monitoring secure beacons. Available on iOS. - * This function has the same parameters/behaviour as - * {@link EstimoteBeacons.stopMonitoringForRegion}. - * @param region {EstimoteBeaconRegion} Region - * @returns {Promise} - */ + * Stop monitoring secure beacons. Available on iOS. + * This function has the same parameters/behavior as + * {@link EstimoteBeacons.stopMonitoringForRegion}. + * @param {EstimoteBeaconRegion} region Region + * @returns {Promise} + */ @Cordova() - stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise { return; } + stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise { + return; + } /** * Connect to Estimote Beacon. Available on Android. @@ -451,11 +499,13 @@ export class EstimoteBeacons extends IonicNativePlugin { * minor: 1 * }); * ``` - * @param beacon {Beacon} Beacon to connect to. + * @param {Beacon} beacon Beacon to connect to. * @returns {Promise} */ @Cordova() - connectToBeacon(beacon: any): Promise { return; } + connectToBeacon(beacon: any): Promise { + return; + } /** * Disconnect from connected Estimote Beacon. Available on Android. @@ -467,7 +517,9 @@ export class EstimoteBeacons extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - disconnectConnectedBeacon(): Promise { return; } + disconnectConnectedBeacon(): Promise { + return; + } /** * Write proximity UUID to connected Estimote Beacon. Available on Android. @@ -477,11 +529,13 @@ 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} */ @Cordova() - writeConnectedProximityUUID(uuid: any): Promise { return; } + writeConnectedProximityUUID(uuid: any): Promise { + return; + } /** * Write major to connected Estimote Beacon. Available on Android. @@ -491,11 +545,13 @@ 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} */ @Cordova() - writeConnectedMajor(major: number): Promise { return; } + writeConnectedMajor(major: number): Promise { + return; + } /** * Write minor to connected Estimote Beacon. Available on Android. @@ -505,10 +561,11 @@ 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} */ @Cordova() - writeConnectedMinor(minor: number): Promise { return; } - + writeConnectedMinor(minor: number): Promise { + return; + } } From e70885ca2fd58fa0fb136a3333147c9b83face48 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:26:14 +0200 Subject: [PATCH 35/48] docs(fcm): typo --- src/@ionic-native/plugins/fcm/index.ts | 30 +++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/fcm/index.ts b/src/@ionic-native/plugins/fcm/index.ts index 269937abb..cbbbe006e 100644 --- a/src/@ionic-native/plugins/fcm/index.ts +++ b/src/@ionic-native/plugins/fcm/index.ts @@ -1,9 +1,8 @@ -import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core'; import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; export interface NotificationData { - /** * Determines whether the notification was pressed or not */ @@ -15,7 +14,6 @@ export interface NotificationData { */ [name: string]: any; - } /** @@ -64,14 +62,15 @@ export interface NotificationData { }) @Injectable() export class FCM extends IonicNativePlugin { - /** - * Get's device's current registration id + * Gets device's current registration id * * @returns {Promise} Returns a Promise that resolves with the registration id token */ @Cordova() - getToken(): Promise { return; } + getToken(): Promise { + return; + } /** * Event firing on the token refresh @@ -81,7 +80,9 @@ export class FCM extends IonicNativePlugin { @Cordova({ observable: true }) - onTokenRefresh(): Observable { return; } + onTokenRefresh(): Observable { + return; + } /** * Subscribes you to a [topic](https://firebase.google.com/docs/notifications/android/console-topics) @@ -91,17 +92,21 @@ export class FCM extends IonicNativePlugin { * @returns {Promise} Returns a promise resolving in result of subscribing to a topic */ @Cordova() - subscribeToTopic(topic: string): Promise { return; } + subscribeToTopic(topic: string): Promise { + return; + } /** - * 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 * * @returns {Promise} Returns a promise resolving in result of unsubscribing from a topic */ @Cordova() - unsubscribeFromTopic(topic: string): Promise { return; } + unsubscribeFromTopic(topic: string): Promise { + return; + } /** * Watch for incoming notifications @@ -113,6 +118,7 @@ export class FCM extends IonicNativePlugin { successIndex: 0, errorIndex: 2 }) - onNotification(): Observable { return; } - + onNotification(): Observable { + return; + } } From 624f94f9f6d1c8ec9028e05a341a8dda6b66e0f3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:29:39 +0200 Subject: [PATCH 36/48] docs(file): typo --- src/@ionic-native/plugins/file/index.ts | 602 ++++++++++++++---------- 1 file changed, 366 insertions(+), 236 deletions(-) diff --git a/src/@ionic-native/plugins/file/index.ts b/src/@ionic-native/plugins/file/index.ts index 8b4bfd9dd..5b0808950 100644 --- a/src/@ionic-native/plugins/file/index.ts +++ b/src/@ionic-native/plugins/file/index.ts @@ -1,5 +1,10 @@ import { Injectable } from '@angular/core'; -import { CordovaProperty, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; +import { + CordovaCheck, + CordovaProperty, + IonicNativePlugin, + Plugin +} from '@ionic-native/core'; export interface IFile extends Blob { /** @@ -36,7 +41,6 @@ export interface IFile extends Blob { } export interface LocalFileSystem { - /** * Used for storage with no guarantee of persistence. */ @@ -54,7 +58,12 @@ export interface LocalFileSystem { * @param successCallback The callback that is called when the user agent provides a filesystem. * @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied. */ - requestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void; + requestFileSystem( + type: number, + size: number, + successCallback: FileSystemCallback, + errorCallback?: ErrorCallback + ): void; /** * Allows the user to look up the Entry for a file or directory referred to by a local URL. @@ -62,12 +71,21 @@ export interface LocalFileSystem { * @param successCallback A callback that is called to report the Entry to which the supplied URL refers. * @param errorCallback A callback that is called when errors happen, or when the request to obtain the Entry is denied. */ - resolveLocalFileSystemURL(url: string, successCallback: EntryCallback, errorCallback?: ErrorCallback): void; + resolveLocalFileSystemURL( + url: string, + successCallback: EntryCallback, + errorCallback?: ErrorCallback + ): void; /** * see requestFileSystem. */ - webkitRequestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void; + webkitRequestFileSystem( + type: number, + size: number, + successCallback: FileSystemCallback, + errorCallback?: ErrorCallback + ): void; } export interface Metadata { @@ -115,11 +133,9 @@ export interface FileSystem { toJSON(): string; encodeURIPath(path: string): string; - } export interface Entry { - /** * Entry is a file. */ @@ -135,7 +151,10 @@ export interface 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; + getMetadata( + successCallback: MetadataCallback, + errorCallback?: ErrorCallback + ): void; /** * Set the metadata of the entry. @@ -143,7 +162,11 @@ export interface Entry { * @param errorCallback {Function} is called with a FileError * @param metadataObject {Metadata} keys and values to set */ - setMetadata(successCallback: MetadataCallback, errorCallback: ErrorCallback, metadataObject: Metadata): void; + setMetadata( + successCallback: MetadataCallback, + errorCallback: ErrorCallback, + metadataObject: Metadata + ): void; /** * The name of the entry, excluding the path leading to it. @@ -179,7 +202,12 @@ export interface Entry { * A move of a file on top of an existing file must attempt to delete and replace that file. * A move of a directory on top of an existing empty directory must attempt to delete and replace that directory. */ - moveTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void; + moveTo( + parent: DirectoryEntry, + newName?: string, + successCallback?: EntryCallback, + errorCallback?: ErrorCallback + ): void; /** * Copy an entry to a different location on the file system. It is an error to try to: @@ -196,7 +224,12 @@ export interface Entry { * * Directory copies are always recursive--that is, they copy all contents of the directory. */ - copyTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void; + copyTo( + parent: DirectoryEntry, + newName?: string, + successCallback?: EntryCallback, + errorCallback?: ErrorCallback + ): void; /** * Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists. @@ -221,7 +254,10 @@ export interface Entry { * @param successCallback A callback that is called to return the parent Entry. * @param errorCallback A callback that is called when errors happen. */ - getParent(successCallback: DirectoryEntryCallback, errorCallback?: ErrorCallback): void; + getParent( + successCallback: DirectoryEntryCallback, + errorCallback?: ErrorCallback + ): void; } /** @@ -247,7 +283,12 @@ export interface DirectoryEntry extends Entry { * @param successCallback A callback that is called to return the File selected or created. * @param errorCallback A callback that is called when errors happen. */ - getFile(path: string, options?: Flags, successCallback?: FileEntryCallback, errorCallback?: ErrorCallback): void; + getFile( + path: string, + options?: Flags, + successCallback?: FileEntryCallback, + errorCallback?: ErrorCallback + ): void; /** * Creates or looks up a directory. @@ -264,14 +305,22 @@ export interface DirectoryEntry extends Entry { * @param errorCallback A callback that is called when errors happen. * */ - getDirectory(path: string, options?: Flags, successCallback?: DirectoryEntryCallback, errorCallback?: ErrorCallback): void; + getDirectory( + path: string, + options?: Flags, + successCallback?: DirectoryEntryCallback, + errorCallback?: ErrorCallback + ): void; /** * Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem. * @param successCallback A callback that is called on success. * @param errorCallback A callback that is called when errors happen. */ - removeRecursively(successCallback: VoidCallback, errorCallback?: ErrorCallback): void; + removeRecursively( + successCallback: VoidCallback, + errorCallback?: ErrorCallback + ): void; } /** @@ -291,7 +340,10 @@ export interface DirectoryReader { * @param successCallback Called once per successful call to readEntries to deliver the next previously-unreported set of Entries in the associated Directory. If all Entries have already been returned from previous invocations of readEntries, successCallback must be called with a zero-length array as an argument. * @param errorCallback A callback indicating that there was an error reading from the Directory. */ - readEntries(successCallback: EntriesCallback, errorCallback?: ErrorCallback): void; + readEntries( + successCallback: EntriesCallback, + errorCallback?: ErrorCallback + ): void; } /** @@ -303,7 +355,10 @@ export interface FileEntry extends Entry { * @param successCallback A callback that is called with the new FileWriter. * @param errorCallback A callback that is called when errors happen. */ - createWriter(successCallback: FileWriterCallback, errorCallback?: ErrorCallback): void; + createWriter( + successCallback: FileWriterCallback, + errorCallback?: ErrorCallback + ): void; /** * Returns a File that represents the current state of the file that this FileEntry represents. @@ -417,7 +472,7 @@ export declare class FileSaver extends EventTarget { *
  • Terminate the write algorithm being processed.
  • *
  • Set the error attribute to a DOMError object of type "AbortError".
  • *
  • Fire a progress event called abort
  • - *
  • Fire a progress event called writeend
  • + *
  • Fire a progress event called write end
  • *
  • Terminate this algorithm.
  • * */ @@ -459,7 +514,7 @@ export declare class FileSaver extends EventTarget { error: Error; /** - * Handler for writestart events + * Handler for write start events */ onwritestart: (event: ProgressEvent) => void; @@ -484,7 +539,7 @@ export declare class FileSaver extends EventTarget { onerror: (event: ProgressEvent) => void; /** - * Handler for writeend events. + * Handler for write end events. */ onwriteend: (event: ProgressEvent) => void; } @@ -578,7 +633,6 @@ export declare class FileReader { * @hidden */ [key: string]: any; - } interface Window extends LocalFileSystem {} @@ -600,7 +654,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')); * * ``` * @@ -624,79 +678,66 @@ declare const window: Window; }) @Injectable() export class File extends IonicNativePlugin { + /** + * Read-only directory where the application is installed. + */ + @CordovaProperty applicationDirectory: string; /** * Read-only directory where the application is installed. */ - @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', @@ -712,7 +753,7 @@ export class File extends IonicNativePlugin { 11: 'TYPE_MISMATCH_ERR', 12: 'PATH_EXISTS_ERR', 13: 'WRONG_ENTRY_TYPE', - 14: 'DIR_READ_ERR', + 14: 'DIR_READ_ERR' }; /** @@ -729,23 +770,22 @@ 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} Returns a Promise that resolves to true if the directory exists or rejects with an error. */ @CordovaCheck() checkDir(path: string, dir: string): Promise { - if ((/^\//.test(dir))) { + if (/^\//.test(dir)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } - let fullpath = path + dir; - return this.resolveDirectoryUrl(fullpath) - .then(() => { - return true; - }); + const fullPath = path + dir; + return this.resolveDirectoryUrl(fullPath).then(() => { + return true; + }); } /** @@ -753,16 +793,20 @@ 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} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. */ @CordovaCheck() - createDir(path: string, dirName: string, replace: boolean): Promise { - if ((/^\//.test(dirName))) { + createDir( + path: string, + dirName: string, + replace: boolean + ): Promise { + if (/^\//.test(dirName)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } @@ -774,10 +818,9 @@ export class File extends IonicNativePlugin { options.exclusive = true; } - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, options); - }); + return this.resolveDirectoryUrl(path).then(fse => { + return this.getDirectory(fse, dirName, options); + }); } /** @@ -789,17 +832,17 @@ export class File extends IonicNativePlugin { */ @CordovaCheck() removeDir(path: string, dirName: string): Promise { - if ((/^\//.test(dirName))) { + if (/^\//.test(dirName)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getDirectory(fse, dirName, { create: false }); }) - .then((de) => { + .then(de => { return this.remove(de); }); } @@ -809,29 +852,33 @@ 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} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. */ @CordovaCheck() - moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { + moveDir( + path: string, + dirName: string, + newPath: string, + newDirName: string + ): Promise { newDirName = newDirName || dirName; - if ((/^\//.test(newDirName))) { + if (/^\//.test(newDirName)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getDirectory(fse, dirName, { create: false }); }) - .then((srcde) => { - return this.resolveDirectoryUrl(newPath) - .then((deste) => { - return this.move(srcde, deste, newDirName); - }); + .then(srcde => { + return this.resolveDirectoryUrl(newPath).then(destenation => { + return this.move(srcde, destenation, newDirName); + }); }); } @@ -845,22 +892,26 @@ export class File extends IonicNativePlugin { * @returns {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. */ @CordovaCheck() - copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { - if ((/^\//.test(newDirName))) { + copyDir( + path: string, + dirName: string, + newPath: string, + newDirName: string + ): Promise { + if (/^\//.test(newDirName)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getDirectory(fse, dirName, { create: false }); }) - .then((srcde) => { - return this.resolveDirectoryUrl(newPath) - .then((deste) => { - return this.copy(srcde, deste, newDirName); - }); + .then(srcde => { + return this.resolveDirectoryUrl(newPath).then(deste => { + return this.copy(srcde, deste, newDirName); + }); }); } @@ -873,17 +924,20 @@ export class File extends IonicNativePlugin { */ @CordovaCheck() listDir(path: string, dirName: string): Promise { - if ((/^\//.test(dirName))) { + if (/^\//.test(dirName)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, { create: false, exclusive: false }); + .then(fse => { + return this.getDirectory(fse, dirName, { + create: false, + exclusive: false + }); }) - .then((de) => { + .then(de => { let reader = de.createReader(); return this.readEntries(reader); }); @@ -892,23 +946,23 @@ 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} Returns a Promise that resolves with a RemoveResult or rejects with an error. */ @CordovaCheck() removeRecursively(path: string, dirName: string): Promise { - if ((/^\//.test(dirName))) { + if (/^\//.test(dirName)) { let err = new FileError(5); - err.message = 'directory cannot start with \/'; + err.message = 'directory cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getDirectory(fse, dirName, { create: false }); }) - .then((de) => { + .then(de => { return this.rimraf(de); }); } @@ -916,28 +970,27 @@ 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} Returns a Promise that resolves with a boolean or rejects with an error. */ @CordovaCheck() checkFile(path: string, file: string): Promise { - if ((/^\//.test(file))) { + if (/^\//.test(file)) { let err = new FileError(5); - err.message = 'file cannot start with \/'; + err.message = 'file cannot start with /'; return Promise.reject(err); } - return this.resolveLocalFilesystemUrl(path + file) - .then((fse) => { - if (fse.isFile) { - return true; - } else { - let err = new FileError(13); - err.message = 'input is not a file'; - return Promise.reject(err); - } - }); + return this.resolveLocalFilesystemUrl(path + file).then(fse => { + if (fse.isFile) { + return true; + } else { + let err = new FileError(13); + err.message = 'input is not a file'; + return Promise.reject(err); + } + }); } /** @@ -945,16 +998,20 @@ 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} Returns a Promise that resolves to a FileEntry or rejects with an error. */ @CordovaCheck() - createFile(path: string, fileName: string, replace: boolean): Promise { - if ((/^\//.test(fileName))) { + createFile( + path: string, + fileName: string, + replace: boolean + ): Promise { + if (/^\//.test(fileName)) { let err = new FileError(5); - err.message = 'file-name cannot start with \/'; + err.message = 'file-name cannot start with /'; return Promise.reject(err); } @@ -966,50 +1023,53 @@ export class File extends IonicNativePlugin { options.exclusive = true; } - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getFile(fse, fileName, options); - }); + return this.resolveDirectoryUrl(path).then(fse => { + return this.getFile(fse, fileName, options); + }); } /** * 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} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ @CordovaCheck() removeFile(path: string, fileName: string): Promise { - if ((/^\//.test(fileName))) { + if (/^\//.test(fileName)) { let err = new FileError(5); - err.message = 'file-name cannot start with \/'; + err.message = 'file-name cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getFile(fse, fileName, { create: false }); }) - .then((fe) => { + .then(fe => { return this.remove(fe); }); } /** 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. * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. */ @CordovaCheck() - writeFile(path: string, fileName: string, - text: string | Blob | ArrayBuffer, options: IWriteOptions = {}): Promise { - if ((/^\//.test(fileName))) { + writeFile( + path: string, + fileName: string, + text: string | Blob | ArrayBuffer, + options: IWriteOptions = {} + ): Promise { + if (/^\//.test(fileName)) { const err = new FileError(5); - err.message = 'file-name cannot start with \/'; + err.message = 'file-name cannot start with /'; return Promise.reject(err); } @@ -1035,9 +1095,13 @@ export class File extends IonicNativePlugin { * @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information. * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. */ - private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions) { + private writeFileEntry( + fe: FileEntry, + text: string | Blob | ArrayBuffer, + options: IWriteOptions + ) { return this.createWriter(fe) - .then((writer) => { + .then(writer => { if (options.append) { writer.seek(writer.length); } @@ -1051,23 +1115,26 @@ export class File extends IonicNativePlugin { .then(() => fe); } - /** Write to an existing file. * - * @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} text content or blob to write * @returns {Promise} Returns a Promise that resolves or rejects with an error. */ @CordovaCheck() - writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { + writeExistingFile( + path: string, + fileName: string, + text: string | Blob + ): Promise { return this.writeFile(path, fileName, text, { replace: true }); } /** * 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} Returns a Promise that resolves with the contents of the file as string or rejects with an error. */ @@ -1081,7 +1148,7 @@ export class File extends IonicNativePlugin { * A data url is of the form: * data: [][;base64], - * @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} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error. */ @@ -1092,7 +1159,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} Returns a Promise that resolves with the contents of the file as string rejects with an error. */ @@ -1103,7 +1170,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} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error. */ @@ -1112,10 +1179,14 @@ export class File extends IonicNativePlugin { return this.readFile(path, file, 'ArrayBuffer'); } - private readFile(path: string, file: string, readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text'): Promise { - if ((/^\//.test(file))) { + private readFile( + path: string, + file: string, + readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text' + ): Promise { + if (/^\//.test(file)) { let err = new FileError(5); - err.message = 'file-name cannot start with \/'; + err.message = 'file-name cannot start with /'; return Promise.reject(err); } @@ -1128,7 +1199,7 @@ export class File extends IonicNativePlugin { return new Promise((resolve, reject) => { reader.onloadend = () => { if (reader.result !== undefined || reader.result !== null) { - resolve(reader.result); + resolve((reader.result)); } else if (reader.error !== undefined || reader.error !== null) { reject(reader.error); } else { @@ -1136,12 +1207,14 @@ export class File extends IonicNativePlugin { } }; - fileEntry.file(file => { - reader[`readAs${readAs}`].call(reader, file); - }, error => { - reject(error); - }); - + fileEntry.file( + file => { + reader[`readAs${readAs}`].call(reader, file); + }, + error => { + reject(error); + } + ); }); }); } @@ -1149,62 +1222,70 @@ export class File extends IonicNativePlugin { /** * 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) * @returns {Promise} Returns a Promise that resolves to the new Entry or rejects with an error. */ @CordovaCheck() - moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { + moveFile( + path: string, + fileName: string, + newPath: string, + newFileName: string + ): Promise { newFileName = newFileName || fileName; - if ((/^\//.test(newFileName))) { + if (/^\//.test(newFileName)) { let err = new FileError(5); - err.message = 'file name cannot start with \/'; + err.message = 'file name cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getFile(fse, fileName, { create: false }); }) - .then((srcfe) => { - return this.resolveDirectoryUrl(newPath) - .then((deste) => { - return this.move(srcfe, deste, newFileName); - }); + .then(srcfe => { + return this.resolveDirectoryUrl(newPath).then(deste => { + return this.move(srcfe, deste, newFileName); + }); }); } /** * 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) * @returns {Promise} Returns a Promise that resolves to an Entry or rejects with an error. */ @CordovaCheck() - copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { + copyFile( + path: string, + fileName: string, + newPath: string, + newFileName: string + ): Promise { newFileName = newFileName || fileName; - if ((/^\//.test(newFileName))) { + if (/^\//.test(newFileName)) { let err = new FileError(5); - err.message = 'file name cannot start with \/'; + err.message = 'file name cannot start with /'; return Promise.reject(err); } return this.resolveDirectoryUrl(path) - .then((fse) => { + .then(fse => { return this.getFile(fse, fileName, { create: false }); }) - .then((srcfe) => { - return this.resolveDirectoryUrl(newPath) - .then((deste) => { - return this.copy(srcfe, deste, newFileName); - }); + .then(srcfe => { + return this.resolveDirectoryUrl(newPath).then(deste => { + return this.copy(srcfe, deste, newFileName); + }); }); } @@ -1214,7 +1295,7 @@ export class File extends IonicNativePlugin { private fillErrorMessage(err: FileError): void { try { err.message = this.cordovaFileError[err.code]; - } catch (e) { } + } catch (e) {} } /** @@ -1226,12 +1307,16 @@ export class File extends IonicNativePlugin { resolveLocalFilesystemUrl(fileUrl: string): Promise { return new Promise((resolve, reject) => { try { - window.resolveLocalFileSystemURL(fileUrl, (entry: Entry) => { - resolve(entry); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + window.resolveLocalFileSystemURL( + fileUrl, + (entry: Entry) => { + resolve(entry); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); } catch (xc) { this.fillErrorMessage(xc); reject(xc); @@ -1246,16 +1331,15 @@ export class File extends IonicNativePlugin { */ @CordovaCheck() resolveDirectoryUrl(directoryUrl: string): Promise { - return this.resolveLocalFilesystemUrl(directoryUrl) - .then((de) => { - if (de.isDirectory) { - return de; - } else { - const err = new FileError(13); - err.message = 'input is not a directory'; - return Promise.reject(err); - } - }); + return this.resolveLocalFilesystemUrl(directoryUrl).then(de => { + if (de.isDirectory) { + return de; + } else { + const err = new FileError(13); + err.message = 'input is not a directory'; + return Promise.reject(err); + } + }); } /** @@ -1266,15 +1350,24 @@ export class File extends IonicNativePlugin { * @returns {Promise} */ @CordovaCheck() - getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise { + getDirectory( + directoryEntry: DirectoryEntry, + directoryName: string, + flags: Flags + ): Promise { return new Promise((resolve, reject) => { try { - directoryEntry.getDirectory(directoryName, flags, (de) => { - resolve(de); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + directoryEntry.getDirectory( + directoryName, + flags, + de => { + resolve(de); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); } catch (xc) { this.fillErrorMessage(xc); reject(xc); @@ -1290,10 +1383,14 @@ export class File extends IonicNativePlugin { * @returns {Promise} */ @CordovaCheck() - getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise { + getFile( + directoryEntry: DirectoryEntry, + fileName: string, + flags: Flags + ): Promise { return new Promise((resolve, reject) => { try { - directoryEntry.getFile(fileName, flags, resolve, (err) => { + directoryEntry.getFile(fileName, flags, resolve, err => { this.fillErrorMessage(err); reject(err); }); @@ -1309,40 +1406,61 @@ export class File extends IonicNativePlugin { */ private remove(fe: Entry): Promise { return new Promise((resolve, reject) => { - fe.remove(() => { - resolve({ success: true, fileRemoved: fe }); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + fe.remove( + () => { + resolve({ success: true, fileRemoved: fe }); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); }); } /** * @hidden */ - private move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { + private move( + srce: Entry, + destdir: DirectoryEntry, + newName: string + ): Promise { return new Promise((resolve, reject) => { - srce.moveTo(destdir, newName, (deste) => { - resolve(deste); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + srce.moveTo( + destdir, + newName, + deste => { + resolve(deste); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); }); } /** * @hidden */ - private copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { + private copy( + srce: Entry, + destdir: DirectoryEntry, + newName: string + ): Promise { return new Promise((resolve, reject) => { - srce.copyTo(destdir, newName, (deste) => { - resolve(deste); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + srce.copyTo( + destdir, + newName, + deste => { + resolve(deste); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); }); } @@ -1351,12 +1469,15 @@ export class File extends IonicNativePlugin { */ private readEntries(dr: DirectoryReader): Promise { return new Promise((resolve, reject) => { - dr.readEntries((entries) => { - resolve(entries); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + dr.readEntries( + entries => { + resolve(entries); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); }); } @@ -1365,12 +1486,15 @@ export class File extends IonicNativePlugin { */ private rimraf(de: DirectoryEntry): Promise { return new Promise((resolve, reject) => { - de.removeRecursively(() => { - resolve({ success: true, fileRemoved: de }); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + de.removeRecursively( + () => { + resolve({ success: true, fileRemoved: de }); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); }); } @@ -1379,25 +1503,31 @@ export class File extends IonicNativePlugin { */ private createWriter(fe: FileEntry): Promise { return new Promise((resolve, reject) => { - fe.createWriter((writer) => { - resolve(writer); - }, (err) => { - this.fillErrorMessage(err); - reject(err); - }); + fe.createWriter( + writer => { + resolve(writer); + }, + err => { + this.fillErrorMessage(err); + reject(err); + } + ); }); } /** * @hidden */ - private write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise { + private write( + writer: FileWriter, + gu: string | Blob | ArrayBuffer + ): Promise { if (gu instanceof Blob) { return this.writeFileInChunks(writer, gu); } return new Promise((resolve, reject) => { - writer.onwriteend = (evt) => { + writer.onwriteend = evt => { if (writer.error) { reject(writer.error); } else { From d598bf34169c92e2de7382c492a4c1f3999c9d4e Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:30:20 +0200 Subject: [PATCH 37/48] docs(file-encryption): typo --- .../plugins/file-encryption/index.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/file-encryption/index.ts b/src/@ionic-native/plugins/file-encryption/index.ts index 345cdb2e3..606d04045 100644 --- a/src/@ionic-native/plugins/file-encryption/index.ts +++ b/src/@ionic-native/plugins/file-encryption/index.ts @@ -1,5 +1,5 @@ -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name File Encryption @@ -30,23 +30,25 @@ 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} Returns a promise that resolves when something happens */ @Cordova() - encrypt(file: string, key: string): Promise { return; } + encrypt(file: string, key: string): Promise { + return; + } /** * 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} Returns a promise that resolves when something happens */ @Cordova() - decrypt(file: string, key: string): Promise { return; } - + decrypt(file: string, key: string): Promise { + return; + } } From 06094c2b533c08297854e895c1029344481ca22d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:31:06 +0200 Subject: [PATCH 38/48] docs(file-opener): typo --- .../plugins/file-opener/index.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/file-opener/index.ts b/src/@ionic-native/plugins/file-opener/index.ts index 1250e1c7d..9d691fcbc 100644 --- a/src/@ionic-native/plugins/file-opener/index.ts +++ b/src/@ionic-native/plugins/file-opener/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name File Opener @@ -16,7 +16,7 @@ import { Plugin, Cordova, IonicNativePlugin } 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 { Plugin, Cordova, IonicNativePlugin } 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} */ @Cordova({ @@ -41,11 +40,13 @@ export class FileOpener extends IonicNativePlugin { successName: 'success', errorName: 'error' }) - open(filePath: string, fileMIMEType: string): Promise { return; } + open(filePath: string, fileMIMEType: string): Promise { + return; + } /** * Uninstalls a package - * @param packageId {string} Package ID + * @param {string} packageId Package ID * @returns {Promise} */ @Cordova({ @@ -53,11 +54,13 @@ export class FileOpener extends IonicNativePlugin { successName: 'success', errorName: 'error' }) - uninstall(packageId: string): Promise { return; } + uninstall(packageId: string): Promise { + return; + } /** * Check if an app is already installed - * @param packageId {string} Package ID + * @param {string} packageId Package ID * @returns {Promise} */ @Cordova({ @@ -65,6 +68,7 @@ export class FileOpener extends IonicNativePlugin { successName: 'success', errorName: 'error' }) - appIsInstalled(packageId: string): Promise { return; } - + appIsInstalled(packageId: string): Promise { + return; + } } From 3e9e578781e63db15cb16effeb5b8015ecafdf75 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:32:20 +0200 Subject: [PATCH 39/48] docs(file-path): fix jsdoc --- src/@ionic-native/plugins/file-path/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/file-path/index.ts b/src/@ionic-native/plugins/file-path/index.ts index 29dc9b719..3e5896a23 100644 --- a/src/@ionic-native/plugins/file-path/index.ts +++ b/src/@ionic-native/plugins/file-path/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; declare const window: any; @@ -32,13 +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} */ @Cordova() - resolveNativePath(path: string): Promise { return; } - + resolveNativePath(path: string): Promise { + return; + } } From 7e0b9a488d6291069d0eb83916294ea4063804d2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:33:19 +0200 Subject: [PATCH 40/48] docs(file-transfer): fix jsdoc --- .../plugins/file-transfer/index.ts | 68 +++++++++++++------ 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/src/@ionic-native/plugins/file-transfer/index.ts b/src/@ionic-native/plugins/file-transfer/index.ts index 0530d56d5..e48b41b46 100644 --- a/src/@ionic-native/plugins/file-transfer/index.ts +++ b/src/@ionic-native/plugins/file-transfer/index.ts @@ -1,8 +1,13 @@ import { Injectable } from '@angular/core'; -import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } 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,34 +245,48 @@ 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} 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 { return; } + upload( + fileUrl: string, + url: string, + options?: FileUploadOptions, + trustAllHosts?: boolean + ): Promise { + return; + } /** * Downloads a file from server. * * @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} 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 { return; } + download( + source: string, + target: string, + trustAllHosts?: boolean, + options?: { [s: string]: any } + ): Promise { + 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 { From 87f8505d93c69c0bb9a07854baeec09a2d321211 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:39:33 +0200 Subject: [PATCH 41/48] docs(fingerprint-aio): typo --- .../plugins/fingerprint-aio/index.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/fingerprint-aio/index.ts b/src/@ionic-native/plugins/fingerprint-aio/index.ts index 8d414ccb2..85ed812d2 100644 --- a/src/@ionic-native/plugins/fingerprint-aio/index.ts +++ b/src/@ionic-native/plugins/fingerprint-aio/index.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; - +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface FingerprintOptions { /** @@ -66,20 +65,22 @@ export interface FingerprintOptions { }) @Injectable() export class FingerprintAIO extends IonicNativePlugin { - /** * Check if fingerprint authentication is available * @return {Promise} Returns a promise with result */ @Cordova() - isAvailable(): Promise { return; } + isAvailable(): Promise { + return; + } /** * Show authentication dialogue - * @param options {FingerprintOptions} options for platform specific fingerprint API - * @return {Promise} Returns a promise that resolves when authentication was successfull + * @param {FingerprintOptions} options Options for platform specific fingerprint API + * @return {Promise} Returns a promise that resolves when authentication was successful */ @Cordova() - show(options: FingerprintOptions): Promise { return; } - + show(options: FingerprintOptions): Promise { + return; + } } From 1cc7243ef9c227467af8f50a3269c46599fbfa77 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:44:57 +0200 Subject: [PATCH 42/48] docs(firebase): fix docs --- src/@ionic-native/plugins/firebase/index.ts | 53 +++++++++++---------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/@ionic-native/plugins/firebase/index.ts b/src/@ionic-native/plugins/firebase/index.ts index d1d1abde4..f2ebbcfde 100644 --- a/src/@ionic-native/plugins/firebase/index.ts +++ b/src/@ionic-native/plugins/firebase/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; /** @@ -30,7 +30,7 @@ import { Observable } from 'rxjs/Observable'; plugin: 'cordova-plugin-firebase', pluginRef: 'FirebasePlugin', repo: 'https://github.com/arnesson/cordova-plugin-firebase', - platforms: ['Android', 'iOS'], + platforms: ['Android', 'iOS'] }) @Injectable() export class Firebase extends IonicNativePlugin { @@ -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} */ @Cordova() @@ -106,7 +106,7 @@ export class Firebase extends IonicNativePlugin { /** * Subscribe to a topic - * @param topic {string} + * @param {string} topic * @return {Promise} */ @Cordova() @@ -116,7 +116,7 @@ export class Firebase extends IonicNativePlugin { /** * Unsubscribe from a topic - * @param topic {string} + * @param {string} topic * @return {Promise} */ @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} */ @Cordova() @@ -146,7 +146,7 @@ export class Firebase extends IonicNativePlugin { /** * Log an Error using FirebaseCrash - * @param message {string} + * @param {string} message * @return {Promise} */ @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} */ @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} */ @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} */ @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} */ @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} */ @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} */ @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} */ @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} */ @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} */ @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} */ @Cordova({ @@ -293,13 +293,16 @@ export class Firebase extends IonicNativePlugin { successIndex: 2, errorIndex: 3 }) - verifyPhoneNumber(phoneNumber: string, timeoutDuration: number): Promise { + verifyPhoneNumber( + phoneNumber: string, + timeoutDuration: number + ): Promise { return; } /** * Allows the user to enable/disable analytics collection - * @param enabled {booleab} value to set collection + * @param {boolean} enabled value to set collection * @returns {Promise} */ @Cordova() From bee3d639cbabc4b917a6f00bcd30cc12fd50de9b Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:45:48 +0200 Subject: [PATCH 43/48] docs(firebase-analytics): fix jsdoc --- .../plugins/firebase-analytics/index.ts | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/@ionic-native/plugins/firebase-analytics/index.ts b/src/@ionic-native/plugins/firebase-analytics/index.ts index 5cdac8fd4..e47c8c181 100644 --- a/src/@ionic-native/plugins/firebase-analytics/index.ts +++ b/src/@ionic-native/plugins/firebase-analytics/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @beta @@ -35,51 +35,59 @@ import { Plugin, Cordova, IonicNativePlugin } 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} Returns a promise */ @Cordova({ sync: true }) - logEvent(name: string, params: any): Promise { return; } + logEvent(name: string, params: any): Promise { + 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} Returns a promise */ @Cordova({ sync: true }) - setUserId(id: string): Promise { return; } + setUserId(id: string): Promise { + 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} Returns a promise */ @Cordova({ sync: true }) - setUserProperty(name: string, value: string): Promise { return; } + setUserProperty(name: string, value: string): Promise { + return; + } /** * Sets whether analytics collection is enabled for this app on this device. - * @param enabled {boolean} + * @param {boolean} enabled * @return {Promise} Returns a promise */ @Cordova({ sync: true }) - setEnabled(enabled: boolean): Promise { return; } + setEnabled(enabled: boolean): Promise { + 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} Returns a promise */ @Cordova({ sync: true }) - setCurrentScreen(name: string): Promise { return; } - + setCurrentScreen(name: string): Promise { + return; + } } From 237ea0d90deec792c5aca1929e9e6a1b103028c6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:47:25 +0200 Subject: [PATCH 44/48] docs(flurry-analytics): fix jsdoc --- .../plugins/flurry-analytics/index.ts | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/@ionic-native/plugins/flurry-analytics/index.ts b/src/@ionic-native/plugins/flurry-analytics/index.ts index 6116dd195..ae5a44c69 100644 --- a/src/@ionic-native/plugins/flurry-analytics/index.ts +++ b/src/@ionic-native/plugins/flurry-analytics/index.ts @@ -1,5 +1,10 @@ -import { Plugin, CordovaInstance, checkAvailability, IonicNativePlugin } 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 */ @@ -73,16 +78,15 @@ export interface FlurryAnalyticsLocation { } /** -* @hidden -*/ + * @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} Returns a promise that resolves when event is sent */ @CordovaInstance({ @@ -95,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} Returns a promise that resolves when timed event is started tracking */ @CordovaInstance({ @@ -109,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} Returns a promise that resolves when timed event is ended tracking */ @CordovaInstance({ @@ -123,8 +127,8 @@ export class FlurryAnalyticsObject { /** * This function log an error - * @param code - * @param message + * @param {Object} code + * @param {Object} message * @return {Promise} */ @CordovaInstance() @@ -144,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} */ @CordovaInstance() - setLocation(location: FlurryAnalyticsLocation, message: string): Promise { + setLocation( + location: FlurryAnalyticsLocation, + message: string + ): Promise { return; } @@ -172,7 +179,6 @@ export class FlurryAnalyticsObject { endSession(): Promise { return; } - } /** @@ -216,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); - } - } From 5d1c8c225bb8b0b0ea8cad4983fec3bf6d0ab039 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Apr 2018 21:48:34 +0200 Subject: [PATCH 45/48] docs(ftp): fix jsdoc --- src/@ionic-native/plugins/ftp/index.ts | 72 ++++++++++++++++---------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/src/@ionic-native/plugins/ftp/index.ts b/src/@ionic-native/plugins/ftp/index.ts index c2c3be5ae..6f7bd762f 100644 --- a/src/@ionic-native/plugins/ftp/index.ts +++ b/src/@ionic-native/plugins/ftp/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; /** @@ -32,18 +32,19 @@ 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. - * @return {Promise} The success callback. Notice: For iOS, if triggered, means `init` success, but NOT means the later action, e.g. `ls`... `download` will success! - */ + * Connect to one ftp server. + * + * Just need to init the connection once. If success, you can do any ftp actions later. + * @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} The success callback. Notice: For iOS, if triggered, means `init` success, but NOT means the later action, e.g. `ls`... `download` will success! + */ @Cordova() - connect(hostname: string, username: string, password: string): Promise { return; } + connect(hostname: string, username: string, password: string): Promise { + return; + } /** * List files (with info of `name`, `type`, `link`, `size`, `modifiedDate`) under one directory on the ftp server. @@ -56,46 +57,54 @@ 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} Returns a promise */ @Cordova() - ls(path: string): Promise { return; } + ls(path: string): Promise { + return; + } /** * 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} Returns a promise */ @Cordova() - mkdir(path: string): Promise { return; } + mkdir(path: string): Promise { + return; + } /** * Delete one directory on the ftp server. * * 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} Returns a promise */ @Cordova() - rmdir(path: string): Promise { return; } + rmdir(path: string): Promise { + return; + } /** * 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} Returns a promise */ @Cordova() - rm(file: string): Promise { return; } + rm(file: string): Promise { + return; + } /** * 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} 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. @@ -103,13 +112,15 @@ export class FTP extends IonicNativePlugin { @Cordova({ observable: true }) - upload(localFile: string, remoteFile: string): Observable { return; } + upload(localFile: string, remoteFile: string): Observable { + return; + } /** * 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} 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. @@ -117,7 +128,9 @@ export class FTP extends IonicNativePlugin { @Cordova({ observable: true }) - download(localFile: string, remoteFile: string): Observable { return; } + download(localFile: string, remoteFile: string): Observable { + return; + } /** * Cancel all requests. Always success. @@ -125,7 +138,9 @@ export class FTP extends IonicNativePlugin { * @return {Promise} Returns a promise */ @Cordova() - cancel(): Promise { return; } + cancel(): Promise { + return; + } /** * Disconnect from ftp server. @@ -133,6 +148,7 @@ export class FTP extends IonicNativePlugin { * @return {Promise} Returns a promise */ @Cordova() - disconnect(): Promise { return; } - + disconnect(): Promise { + return; + } } From 8f1854c180d21bb47716d37a6f0abe66f19b5fb3 Mon Sep 17 00:00:00 2001 From: Hannes Date: Sun, 8 Apr 2018 22:21:18 +0200 Subject: [PATCH 46/48] refactor(GoogleNearby): add requested changes --- src/@ionic-native/plugins/google-nearby/index.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/google-nearby/index.ts b/src/@ionic-native/plugins/google-nearby/index.ts index 3e3fb6a34..3ef6e97b0 100644 --- a/src/@ionic-native/plugins/google-nearby/index.ts +++ b/src/@ionic-native/plugins/google-nearby/index.ts @@ -27,7 +27,7 @@ import { Observable } from 'rxjs/Observable'; pluginName: 'GoogleNearby', plugin: 'cordova-plugin-google-nearby', pluginRef: 'window.nearby', - repo: 'https://github.com/hahahannes/googlenearby-cordova-plugin', + 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'] @@ -56,14 +56,4 @@ export class GoogleNearby extends IonicNativePlugin { subscribe(): Observable { return; } - -/** - * Unsubscribe from Messages - * @return {Promise} Returns a promise that resolves when you unsubscribed - */ - @Cordova() - unsubscribe(): Promise { - return; - } - } From 1be1d5b577543a4a2434ca60d851dc3e67bb53a9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 9 Apr 2018 07:44:51 -0400 Subject: [PATCH 47/48] 4.7.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 211c997c4..a2361b229 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "4.6.0", + "version": "4.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d4cc528f7..bdc0ceda6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "4.6.0", + "version": "4.7.0", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "homepage": "https://ionicframework.com/", "author": "Ionic Team (https://ionic.io)", From a3c46216f6bf14a60704a4f847dca62615951f84 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 9 Apr 2018 07:44:58 -0400 Subject: [PATCH 48/48] chore(): update changelog --- CHANGELOG.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99cddb639..3f0f9c170 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ - -# [4.6.0](https://github.com/ionic-team/ionic-native/compare/v5.0.0-beta.3...v4.6.0) (2018-03-19) + +# [4.7.0](https://github.com/ionic-team/ionic-native/compare/v4.6.0...v4.7.0) (2018-04-09) ### Bug Fixes @@ -8,19 +8,25 @@ * **call-log:** comments erratum ([4b9cf17](https://github.com/ionic-team/ionic-native/commit/4b9cf17)) * **call-log:** update getCallLog signature ([61c0ecf](https://github.com/ionic-team/ionic-native/commit/61c0ecf)) * **contacts:** refactor wrong ContactFieldTypes ([f607a03](https://github.com/ionic-team/ionic-native/commit/f607a03)) +* **email-composer:** add missing options ([4399600](https://github.com/ionic-team/ionic-native/commit/4399600)) * **facebook:** remove browserInit function ([f718432](https://github.com/ionic-team/ionic-native/commit/f718432)) * **firebase-analytics:** add `sync` option for all methods ([42fd1f2](https://github.com/ionic-team/ionic-native/commit/42fd1f2)) * **google-maps:** wrong decorators ([e5b9d53](https://github.com/ionic-team/ionic-native/commit/e5b9d53)) * **health-kit:** add missing properties to HealthKitOptions ([f8e79ce](https://github.com/ionic-team/ionic-native/commit/f8e79ce)) +* **image-resizer:** add missing option ([859cbfc](https://github.com/ionic-team/ionic-native/commit/859cbfc)) * **index-app-content:** remove onItemPressed function ([270678f](https://github.com/ionic-team/ionic-native/commit/270678f)) +* **local-notifications:** fixed linting errors ([8a26377](https://github.com/ionic-team/ionic-native/commit/8a26377)) * **printer:** add correct npm repository ([4bf55d3](https://github.com/ionic-team/ionic-native/commit/4bf55d3)) * **pro:** proper callback type and guard for plugin instantiate. [#2136](https://github.com/ionic-team/ionic-native/issues/2136) [#2127](https://github.com/ionic-team/ionic-native/issues/2127) ([61293c3](https://github.com/ionic-team/ionic-native/commit/61293c3)) * **pro:** Tweak to pro plugin. [#2136](https://github.com/ionic-team/ionic-native/issues/2136) [#2127](https://github.com/ionic-team/ionic-native/issues/2127) ([c8ecee0](https://github.com/ionic-team/ionic-native/commit/c8ecee0)) * **Pro:** CordovaCheck should sync. [#2136](https://github.com/ionic-team/ionic-native/issues/2136) [#2127](https://github.com/ionic-team/ionic-native/issues/2127) ([f419db5](https://github.com/ionic-team/ionic-native/commit/f419db5)) * **push:** Android senderID as optional ([1b237aa](https://github.com/ionic-team/ionic-native/commit/1b237aa)) * **Radmob-pro:** add offsetTopBar option ([4948640](https://github.com/ionic-team/ionic-native/commit/4948640)) +* **speech-recognition:** add missing options ([9aff5ea](https://github.com/ionic-team/ionic-native/commit/9aff5ea)) * **sqlite:** remove trailing whitespaces ([7547a94](https://github.com/ionic-team/ionic-native/commit/7547a94)) +* **uuid:** add correct plugin source ([a81a4d3](https://github.com/ionic-team/ionic-native/commit/a81a4d3)) * **web-intent:** allow extras ([8dc5ad2](https://github.com/ionic-team/ionic-native/commit/8dc5ad2)) +* **web-intent:** rename `onNewIntent` to `onIntent` ([dbcb103](https://github.com/ionic-team/ionic-native/commit/dbcb103)) ### Features @@ -31,20 +37,35 @@ * **base64-to-gallery:** add options interface ([11d516f](https://github.com/ionic-team/ionic-native/commit/11d516f)) * **ble:** add scan options interface ([e345fed](https://github.com/ionic-team/ionic-native/commit/e345fed)) * **calendar:** add getCreateCalendarOptions function ([13765d2](https://github.com/ionic-team/ionic-native/commit/13765d2)) +* **call-log:** add operator 'like' and array of values ([84cecf7](https://github.com/ionic-team/ionic-native/commit/84cecf7)) * **call-log:** add plugin ([76a644d](https://github.com/ionic-team/ionic-native/commit/76a644d)) * **camera-preview:** add onBackButton function ([a345e2c](https://github.com/ionic-team/ionic-native/commit/a345e2c)) +* **camera-preview:** disable exif stripping conf ([e231bf8](https://github.com/ionic-team/ionic-native/commit/e231bf8)) * **device-accounts:** add android account interface ([d2261b6](https://github.com/ionic-team/ionic-native/commit/d2261b6)) * **device-feedback:** add feedback interface ([7cafebd](https://github.com/ionic-team/ionic-native/commit/7cafebd)) * **google-analytics:** add missing functions ([ff0008e](https://github.com/ionic-team/ionic-native/commit/ff0008e)) * **google-maps:** update to match latest plugin version ([#2320](https://github.com/ionic-team/ionic-native/issues/2320)) ([f11be24](https://github.com/ionic-team/ionic-native/commit/f11be24)) * **hot code push:** add cordova-hot-code-push ([e7968da](https://github.com/ionic-team/ionic-native/commit/e7968da)) * **hot code push:** add update events ([04bdade](https://github.com/ionic-team/ionic-native/commit/04bdade)) +* **http:** add support for new methods ([#2249](https://github.com/ionic-team/ionic-native/issues/2249)) ([4497e00](https://github.com/ionic-team/ionic-native/commit/4497e00)) +* **http:** add support for new properties ([#2135](https://github.com/ionic-team/ionic-native/issues/2135)) ([c2a62cd](https://github.com/ionic-team/ionic-native/commit/c2a62cd)) * **jins-meme:** enable background mode data collection ([1932f2d](https://github.com/ionic-team/ionic-native/commit/1932f2d)) * **local-notifications:** added a new param to specify if the notification will be silent ([6e58192](https://github.com/ionic-team/ionic-native/commit/6e58192)) +* **local-notifications:** Support version 0.9.0-beta.3 of cordova-plugin-local-notifications ([e5034bf](https://github.com/ionic-team/ionic-native/commit/e5034bf)) * **one-signal:** add clearOneSignalNotifications function ([fc0338a](https://github.com/ionic-team/ionic-native/commit/fc0338a)) +* **plugin:** Add google nearby plugin ([eb1bcdd](https://github.com/ionic-team/ionic-native/commit/eb1bcdd)) * **plugin:** add iOS File Picker ([571df3a](https://github.com/ionic-team/ionic-native/commit/571df3a)) +* **plugin:** add Microdoft App Center Analytics plugin ([7a5bee9](https://github.com/ionic-team/ionic-native/commit/7a5bee9)) +* **plugin:** add Microdoft App Center Analytics plugin ([84c9bfb](https://github.com/ionic-team/ionic-native/commit/84c9bfb)) +* **plugin:** add Microdoft App Center Analytics plugin ([b65946b](https://github.com/ionic-team/ionic-native/commit/b65946b)) +* **plugin:** add Microsoft App Center Crashes plugin ([44e0e24](https://github.com/ionic-team/ionic-native/commit/44e0e24)) +* **plugin:** add Microsoft App Center Push plugin ([cdabebd](https://github.com/ionic-team/ionic-native/commit/cdabebd)) +* **plugin:** add OpenALPR plugin ([e27fbf4](https://github.com/ionic-team/ionic-native/commit/e27fbf4)) +* **plugin:** add Uptime plugin ([6be3832](https://github.com/ionic-team/ionic-native/commit/6be3832)) +* **social-sharing:** add missing function ([4cb28c4](https://github.com/ionic-team/ionic-native/commit/4cb28c4)) * **speechkit:** plugin implementation ([41e5a0f](https://github.com/ionic-team/ionic-native/commit/41e5a0f)) * **sqlite:** add selfTest function ([241f073](https://github.com/ionic-team/ionic-native/commit/241f073)) +* **uptime:** add iOS support ([e6f6158](https://github.com/ionic-team/ionic-native/commit/e6f6158)) * **web-intent:** add startService function ([15bb350](https://github.com/ionic-team/ionic-native/commit/15bb350))