From 347c8a0715679049b82e456bd105d18788207946 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:29:03 +0200 Subject: [PATCH 001/231] refactor(3dtouch): --- src/plugins/3dtouch.ts | 137 +++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 67 deletions(-) diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 9f83f75d..61e81c4d 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -1,6 +1,9 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + + declare var window: any; + /** * @name 3DTouch * @description @@ -62,81 +65,81 @@ declare var window: any; * ``` */ @Plugin({ - plugin: 'cordova-plugin-3dtouch', - pluginRef: 'ThreeDeeTouch', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch', - platforms: ['iOS'] + plugin: 'cordova-plugin-3dtouch', + pluginRef: 'ThreeDeeTouch', + repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch', + platforms: ['iOS'] }) export class ThreeDeeTouch { - /** - * You need an iPhone 6S or some future tech to use the features of this plugin, so you can check at runtime if the user's device is supported. - * @returns {Promise} returns a promise that resolves with a boolean that indicates whether the plugin is available or not - */ - @Cordova() - static isAvailable(): Promise {return; } + /** + * You need an iPhone 6S or some future tech to use the features of this plugin, so you can check at runtime if the user's device is supported. + * @returns {Promise} returns a promise that resolves with a boolean that indicates whether the plugin is available or not + */ + @Cordova() + static isAvailable(): Promise { return; } - /** - * You can get a notification when the user force touches the webview. The plugin defines a Force Touch when at least 75% of the maximum force is applied to the screen. Your app will receive the x and y coordinates, so you have to figure out which UI element was touched. - * @returns {Observable} Returns an observable that sends a `ThreeDeeTouchForceTouch` object - */ - @Cordova({ - observable: true - }) - static watchForceTouches(): Observable {return; } + /** + * You can get a notification when the user force touches the webview. The plugin defines a Force Touch when at least 75% of the maximum force is applied to the screen. Your app will receive the x and y coordinates, so you have to figure out which UI element was touched. + * @returns {Observable} Returns an observable that sends a `ThreeDeeTouchForceTouch` object + */ + @Cordova({ + observable: true + }) + static watchForceTouches(): Observable { return; } - /** - * setup the 3D-touch actions, takes an array of objects with the following - * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback - * @param {string} title Title for your action - * @param {string} subtitle (optional) A short description for your action - * @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update - */ - @Cordova({ - sync: true - }) - static configureQuickActions(quickActions: Array): void {} + /** + * setup the 3D-touch actions, takes an array of objects with the following + * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback + * @param {string} title Title for your action + * @param {string} subtitle (optional) A short description for your action + * @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update + */ + @Cordova({ + sync: true + }) + static configureQuickActions(quickActions: Array): void { } - /** - * When a home icon is pressed, your app launches and this JS callback is invoked. - * @returns {Observable} returns an observable that notifies you when he user presses on the home screen icon - */ - static onHomeIconPressed(): Observable { - return new Observable(observer => { - if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer); - else { - observer.error('3dTouch plugin is not available.'); - observer.complete(); - } - }); - } + /** + * When a home icon is pressed, your app launches and this JS callback is invoked. + * @returns {Observable} returns an observable that notifies you when he user presses on the home screen icon + */ + static onHomeIconPressed(): Observable { + return new Observable(observer => { + if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer); + else { + observer.error('3dTouch plugin is not available.'); + observer.complete(); + } + }); + } - /** - * Enable Link Preview. - * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9. - */ - @Cordova({ - sync: true - }) - static enableLinkPreview(): void {} + /** + * Enable Link Preview. + * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9. + */ + @Cordova({ + sync: true + }) + static enableLinkPreview(): void { } - /** - * Disabled the link preview feature, if enabled. - */ - @Cordova({ - sync: true - }) - static disableLinkPreview(): void {} + /** + * Disabled the link preview feature, if enabled. + */ + @Cordova({ + sync: true + }) + static disableLinkPreview(): void { } } export interface ThreeDeeTouchQuickAction { - type?: string; - title: string; - subtitle?: string; - iconType?: string; + type?: string; + title: string; + subtitle?: string; + iconType?: string; } export interface ThreeDeeTouchForceTouch { - force: number; - timestamp: number; - x: number; - y: number; + force: number; + timestamp: number; + x: number; + y: number; } From ef977b7d9e9f70f4f4a9a4d4082bb0941b19aad4 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:31:06 +0200 Subject: [PATCH 002/231] refactor(actionsheet): --- src/plugins/actionsheet.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 9019e194..5c7738a9 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Action Sheet From de3f7c23352a653c17f606fd863587a2cdf4a37d Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:31:47 +0200 Subject: [PATCH 003/231] refactor(admob): --- src/plugins/admob.ts | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index 1830e61e..1c825b30 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name AdMob @@ -22,7 +22,7 @@ export class AdMob { * @param adIdOrOptions */ @Cordova() - static createBanner(adIdOrOptions: any): Promise {return; } + static createBanner(adIdOrOptions: any): Promise { return; } /** * @@ -30,7 +30,7 @@ export class AdMob { @Cordova({ sync: true }) - static removeBanner(): void {} + static removeBanner(): void { } /** * @@ -39,7 +39,7 @@ export class AdMob { @Cordova({ sync: true }) - static showBanner(position: any): void {} + static showBanner(position: any): void { } /** * @@ -49,7 +49,7 @@ export class AdMob { @Cordova({ sync: true }) - static showBannerAtXY(x: number, y: number): void {} + static showBannerAtXY(x: number, y: number): void { } /** * @@ -57,14 +57,14 @@ export class AdMob { @Cordova({ sync: true }) - static hideBanner(): void {} + static hideBanner(): void { } /** * * @param adIdOrOptions */ @Cordova() - static prepareInterstitial(adIdOrOptions: any): Promise {return; } + static prepareInterstitial(adIdOrOptions: any): Promise { return; } /** * Show interstitial @@ -72,20 +72,20 @@ export class AdMob { @Cordova({ sync: true }) - static showInterstitial(): void {} + static showInterstitial(): void { } /** * */ @Cordova() - static isInterstitialReady (): Promise {return; } + static isInterstitialReady(): Promise { return; } /** * Prepare a reward video ad * @param adIdOrOptions */ @Cordova() - static prepareRewardVideoAd(adIdOrOptions: any): Promise {return; } + static prepareRewardVideoAd(adIdOrOptions: any): Promise { return; } /** * Show a reward video ad @@ -100,14 +100,14 @@ export class AdMob { * @param options Returns a promise that resolves if the options are set successfully */ @Cordova() - static setOptions(options: any): Promise {return; } + static setOptions(options: any): Promise { return; } /** * Get user ad settings * @returns {Promise} Returns a promise that resolves with the ad settings */ @Cordova() - static getAdSettings(): Promise {return; } + static getAdSettings(): Promise { return; } // Events @@ -115,65 +115,65 @@ export class AdMob { eventObservable: true, event: 'onBannerFailedToReceive' }) - static onBannerFailedToReceive (): Observable {return; } + static onBannerFailedToReceive(): Observable { return; } @Cordova({ eventObservable: true, event: 'onBannerReceive' }) - static onBannerReceive (): Observable {return; } + static onBannerReceive(): Observable { return; } @Cordova({ eventObservable: true, event: 'onBannerPresent' }) - static onBannerPresent (): Observable {return; } + static onBannerPresent(): Observable { return; } @Cordova({ eventObservable: true, event: 'onBannerLeaveApp' }) - static onBannerLeaveApp (): Observable {return; } + static onBannerLeaveApp(): Observable { return; } @Cordova({ eventObservable: true, event: 'onBannerDismiss' }) - static onBannerDismiss (): Observable {return; } + static onBannerDismiss(): Observable { return; } @Cordova({ eventObservable: true, event: 'onInterstitialFailedToReceive' }) - static onInterstitialFailedToReceive (): Observable {return; } + static onInterstitialFailedToReceive(): Observable { return; } @Cordova({ eventObservable: true, event: 'onInterstitialReceive' }) - static onInterstitialReceive (): Observable {return; } + static onInterstitialReceive(): Observable { return; } @Cordova({ eventObservable: true, event: 'onInterstitialPresent' }) - static onInterstitialPresent (): Observable {return; } + static onInterstitialPresent(): Observable { return; } @Cordova({ eventObservable: true, event: 'onInterstitialLeaveApp' }) - static onInterstitialLeaveApp (): Observable {return; } + static onInterstitialLeaveApp(): Observable { return; } @Cordova({ eventObservable: true, event: 'onInterstitialDismiss' }) - static onInterstitialDismiss (): Observable {return; } + static onInterstitialDismiss(): Observable { return; } } From 71c3b19a71c0c1b5faa5781a5e568735fc2967bc Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:32:33 +0200 Subject: [PATCH 004/231] refactor(appAvailability): --- src/plugins/appavailability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 11283d90..cf0ffd41 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name App Availability From 5b2a7b8618a716297fc41b750ad1dd2008cf5b74 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:33:07 +0200 Subject: [PATCH 005/231] refactor(AppRate): --- src/plugins/apprate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index fcdbfb08..876d3535 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova, CordovaProperty} from './plugin'; +import { Cordova, CordovaProperty, Plugin } from './plugin'; + declare var window; @@ -62,6 +63,6 @@ export class AppRate { * @param {boolean} immediately Show the rating prompt immediately. */ @Cordova() - static promptForRating(immediately: boolean): void {}; + static promptForRating(immediately: boolean): void { }; } From c36c210e66b5176b27fb5ee65686864adf02bf95 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:33:53 +0200 Subject: [PATCH 006/231] refactor(getAppVersion): --- src/plugins/appversion.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 385280d3..9932af27 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name App Version From b8afd70a42814bd4e9f0279f5ab5544fed2ef177 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:34:43 +0200 Subject: [PATCH 007/231] refactor(backgroundGeoLocation): --- src/plugins/background-geolocation.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index f4951530..18b4261a 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + declare var window; @@ -177,7 +178,7 @@ export interface Config { * debug: true, // enable this hear sounds for background-geolocation life-cycle. * stopOnTerminate: false, // enable this to clear background location settings when the app terminates * }; - * + * * BackgroundGeolocation.configure(config) * .then((location) => { * console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude); From 92a4608a5bb3a05a31ec68f537979687ed930dd8 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:35:11 +0200 Subject: [PATCH 008/231] refactor(backgroundMode): --- src/plugins/backgroundmode.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 59afd65a..47d2caca 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Background Mode @@ -39,28 +39,28 @@ export class BackgroundMode { @Cordova({ sync: true }) - static enable(): void {} + static enable(): void { } - /** - * Disable the background mode. - * Once the background mode has been disabled, the app will be paused when in background. - */ + /** + * Disable the background mode. + * Once the background mode has been disabled, the app will be paused when in background. + */ @Cordova() - static disable(): void {} + static disable(): void { } /** * Checks if background mode is enabled or not. * @returns {boolean} returns a true of false if the background mode is enabled. */ @Cordova() - static isEnabled(): Promise {return; } + static isEnabled(): Promise { return; } /** * Can be used to get the information if the background mode is active. * @returns {boolean} returns tru or flase if the background mode is active. */ @Cordova() - static isActive(): Promise {return; } + static isActive(): Promise { return; } /** * Override the default title, ticker and text. @@ -70,7 +70,7 @@ export class BackgroundMode { @Cordova({ platforms: ['Android'] }) - static setDefaults(options?: Configure): void {} + static setDefaults(options?: Configure): void { } /** * Modify the displayed information. @@ -80,7 +80,7 @@ export class BackgroundMode { @Cordova({ platforms: ['Android'] }) - static update(options?: Configure): void {} + static update(options?: Configure): void { } /** * Sets a callback for a specific event @@ -90,7 +90,7 @@ export class BackgroundMode { @Cordova({ sync: true }) - static on(eventName: string, callback: any): void {} + static on(eventName: string, callback: any): void { } } /** From a1fe6d7965ece2de24c186bcc7bd3a88b1c35a3c Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:35:43 +0200 Subject: [PATCH 009/231] refactor(badge): --- src/plugins/badge.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index ed79016a..f29ee2bc 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Badge From 85349696c2e816a4e0901dc75a7b3a9303615d81 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:36:10 +0200 Subject: [PATCH 010/231] refactor(barcodeScanner): --- src/plugins/barcodescanner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 584ffb07..c00aad09 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Barcode Scanner @@ -52,6 +52,6 @@ export class BarcodeScanner { * @param data */ @Cordova() - static encode(type: string, data: any): Promise {return; } + static encode(type: string, data: any): Promise { return; } } From f362215dd3ba31657212ceeda686af2e5d87c66d Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:37:05 +0200 Subject: [PATCH 011/231] refactor(base64togallery): --- src/plugins/base64togallery.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index c786f007..7ae62da9 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Base64 To Gallery * @description This plugin allows you to save base64 data as a png image into the device @@ -28,7 +28,7 @@ export class Base64ToGallery { * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova() - static base64ToGallery(data: string , prefix?: string ): Promise { + static base64ToGallery(data: string, prefix?: string): Promise { return; } From 0412387d02f6811e91726704f615a439ef227009 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:37:22 +0200 Subject: [PATCH 012/231] docs(base64togallery): Fix typo --- src/plugins/base64togallery.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index 7ae62da9..a5cc2d2a 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -24,7 +24,7 @@ export class Base64ToGallery { /** * Converts a base64 string to an image file in the device gallery * @param {string} data The actual base64 string that you want to save - * @param {sstring} prefix Prefix the file with a string. Default is 'img_'. Optional. + * @param {string} prefix Prefix the file with a string. Default is 'img_'. Optional. * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova() From b811fad3a65ac78ea2661c2d357128ef9092eebd Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:38:00 +0200 Subject: [PATCH 013/231] refactor(batterystatus): --- src/plugins/batterystatus.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 4758ad72..cf19c658 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name Battery Status @@ -39,7 +39,7 @@ export class BatteryStatus { eventObservable: true, event: 'batterystatus' }) - static onChange (): Observable {return; } + static onChange(): Observable { return; } /** * Watch when the battery level goes low @@ -49,7 +49,7 @@ export class BatteryStatus { eventObservable: true, event: 'batterylow' }) - static onLow (): Observable {return; } + static onLow(): Observable { return; } /** * Watch when the battery level goes to critial @@ -59,7 +59,7 @@ export class BatteryStatus { eventObservable: true, event: 'batterycritical' }) - static onCritical (): Observable {return; } + static onCritical(): Observable { return; } } From ca845d6b980946f8b77b386435d0e1a394cae262 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:38:35 +0200 Subject: [PATCH 014/231] refactor(ble): --- src/plugins/ble.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index c4bf4e7c..5a7657f2 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name BLE @@ -272,7 +272,7 @@ export class BLE { deviceId: string, serviceUUID: string, characteristicUUID: string - ): Promise { return; }; + ): Promise { return; }; /** * Write the value of a characteristic. @@ -308,7 +308,7 @@ export class BLE { serviceUUID: string, characteristicUUID: string, value: ArrayBuffer - ): Promise { return; } + ): Promise { return; } /** * Write the value of a characteristic without waiting for confirmation from the peripheral. @@ -325,7 +325,7 @@ export class BLE { serviceUUID: string, characteristicUUID: string, value: ArrayBuffer - ): Promise { return; } + ): Promise { return; } /** * Register to be notified when the value of a characteristic changes. @@ -351,7 +351,7 @@ export class BLE { deviceId: string, serviceUUID: string, characteristicUUID: string - ): Observable { return; } + ): Observable { return; } /** * Stop being notified when the value of a characteristic changes. @@ -366,7 +366,7 @@ export class BLE { deviceId: string, serviceUUID: string, characteristicUUID: string - ): Promise { return; } + ): Promise { return; } /** * Report the connection status. From a0529ef0edf625865deb49ee365b874bf2d0fb47 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:39:05 +0200 Subject: [PATCH 015/231] refactor(bluetoothSerial): --- src/plugins/bluetoothserial.ts | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index 20726b98..bfef832e 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name Bluetooth Serial @@ -42,7 +42,7 @@ export class BluetoothSerial { observable: true, clearFunction: 'disconnect' }) - static connect (macAddress_or_uuid: string): Observable {return; } + static connect(macAddress_or_uuid: string): Observable { return; } /** * Connect insecurely to a Bluetooth device @@ -54,7 +54,7 @@ export class BluetoothSerial { observable: true, clearFunction: 'disconnect' }) - static connectInsecure (macAddress: string): Observable {return; } + static connectInsecure(macAddress: string): Observable { return; } /** * Writes data to the serial port @@ -64,7 +64,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static write (data: any): Promise {return; } + static write(data: any): Promise { return; } /** * Gets the number of bytes of data available @@ -72,7 +72,7 @@ export class BluetoothSerial { */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] - }) static available (): Promise {return; } + }) static available(): Promise { return; } /** * Reads data from the buffer @@ -81,7 +81,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static read (): Promise {return; } + static read(): Promise { return; } /** * Reads data from the buffer until it reaches a delimiter @@ -91,7 +91,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static readUntil (delimiter: string): Promise {return; } + static readUntil(delimiter: string): Promise { return; } /** * Subscribe to be notified when data is received @@ -103,7 +103,7 @@ export class BluetoothSerial { observable: true, clearFunction: 'unsubscribe' }) - static subscribe (delimiter: string): Observable {return; } + static subscribe(delimiter: string): Observable { return; } /** * Subscribe to be notified when data is received @@ -114,7 +114,7 @@ export class BluetoothSerial { observable: true, clearFunction: 'unsubscribeRawData' }) - static subscribeRawData (): Observable {return; } + static subscribeRawData(): Observable { return; } /** * Clears data in buffer @@ -123,7 +123,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static clear (): Promise {return; } + static clear(): Promise { return; } /** * Lists bonded devices @@ -132,7 +132,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static list (): Promise {return; } + static list(): Promise { return; } /** * Reports if bluetooth is enabled @@ -141,7 +141,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static isEnabled (): Promise {return; } + static isEnabled(): Promise { return; } /** * Reports the connection status @@ -150,7 +150,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static isConnected (): Promise {return; } + static isConnected(): Promise { return; } /** * Reads the RSSI from the connected peripheral @@ -159,7 +159,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static readRSSI (): Promise {return; } + static readRSSI(): Promise { return; } /** * Show the Bluetooth settings on the device @@ -168,7 +168,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static showBluetoothSettings (): Promise {return; } + static showBluetoothSettings(): Promise { return; } /** * Enable Bluetooth on the device @@ -177,7 +177,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static enable (): Promise {return; } + static enable(): Promise { return; } /** * Discover unpaired devices @@ -186,7 +186,7 @@ export class BluetoothSerial { @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] }) - static discoverUnpaired (): Promise {return; } + static discoverUnpaired(): Promise { return; } /** * Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function. @@ -197,7 +197,7 @@ export class BluetoothSerial { observable: true, clearFunction: 'clearDeviceDiscoveredListener' }) - static setDeviceDiscoveredListener (): Observable {return; } + static setDeviceDiscoveredListener(): Observable { return; } /** * Sets the human readable device name that is broadcasted to other devices @@ -207,7 +207,7 @@ export class BluetoothSerial { platforms: ['Android'], sync: true }) - static setName (newName: string): void {} + static setName(newName: string): void { } /** * Makes the device discoverable by other devices @@ -217,5 +217,5 @@ export class BluetoothSerial { platforms: ['Android'], sync: true }) - static setDiscoverable (discoverableDuration: number): void {} + static setDiscoverable(discoverableDuration: number): void { } } From 35d083ed5225fce4b040445fe72451c49458be83 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:40:07 +0200 Subject: [PATCH 016/231] refactor(brightness): --- src/plugins/brightness.ts | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts index 2fc29d99..bf50fbbe 100644 --- a/src/plugins/brightness.ts +++ b/src/plugins/brightness.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Brightness @@ -17,34 +17,34 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - plugin: 'cordova-plugin-brightness', - pluginRef: 'plugins.brightness', - repo: 'https://github.com/mgcrea/cordova-plugin-brightness', - platforms: ['Android', 'iOS'] + plugin: 'cordova-plugin-brightness', + pluginRef: 'plugins.brightness', + repo: 'https://github.com/mgcrea/cordova-plugin-brightness', + platforms: ['Android', 'iOS'] }) export class Brightness { - /** - * Sets the brightness of the display. - * - * @param {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() - static setBrightness(value: number): Promise { return; } + /** + * Sets the brightness of the display. + * + * @param {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() + static setBrightness(value: number): Promise { return; } - /** - * Reads the current brightness of the device display. - * - * @returns {Promise} Returns a Promise that resolves with the - * brightness value of the device display (floating number between 0 and 1). - */ - @Cordova() - static getBrightness(): Promise { return; } + /** + * Reads the current brightness of the device display. + * + * @returns {Promise} Returns a Promise that resolves with the + * brightness value of the device display (floating number between 0 and 1). + */ + @Cordova() + static getBrightness(): Promise { return; } - /** - * Keeps the screen on. Prevents the device from setting the screen to sleep. - */ - @Cordova() - static setKeepScreenOn(value: boolean): void { } + /** + * Keeps the screen on. Prevents the device from setting the screen to sleep. + */ + @Cordova() + static setKeepScreenOn(value: boolean): void { } } From c122171dd55e463ecac7548ea55009ec8aff4f71 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:40:35 +0200 Subject: [PATCH 017/231] refactor(calendar): --- src/plugins/calendar.ts | 139 ++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 216b4c7f..82f144d6 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + export interface CalendarOptions { firstReminderMinutes?: number; @@ -24,7 +25,7 @@ export interface Calendar { * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). * * @usage - * + * */ @Plugin({ plugin: 'cordova-plugin-calendar', @@ -48,40 +49,40 @@ export class Calendar { @Cordova() static hasReadWritePermission(): Promise { return; } - /** - * Check if we have read permission - * @returns {Promise} - */ - @Cordova() - static hasReadPermission(): Promise {return; } + /** + * Check if we have read permission + * @returns {Promise} + */ + @Cordova() + static hasReadPermission(): Promise { return; } - /** - * Check if we have write permission - * @returns {Promise} - */ - @Cordova() - static hasWritePermission(): Promise {return; } + /** + * Check if we have write permission + * @returns {Promise} + */ + @Cordova() + static hasWritePermission(): Promise { return; } - /** - * Request write permission - * @returns {Promise} - */ - @Cordova() - static requestWritePermission(): Promise {return; } + /** + * Request write permission + * @returns {Promise} + */ + @Cordova() + static requestWritePermission(): Promise { return; } - /** - * Request read permission - * @returns {Promise} - */ - @Cordova() - static requestReadPermission(): Promise {return; } + /** + * Request read permission + * @returns {Promise} + */ + @Cordova() + static requestReadPermission(): Promise { return; } /** * Requests read/write permissions * @returns {Promise} */ @Cordova() - static requestReadWritePermission(): Promise {return; } + static requestReadWritePermission(): Promise { return; } /** * Create a calendar. (iOS only) @@ -107,7 +108,7 @@ export class Calendar { @Cordova() static createCalendar( nameOrOptions: string | { calendarName: string, calendarColor: string } - ): Promise { return; } + ): Promise { return; } /** * Delete a calendar. (iOS only) @@ -172,7 +173,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { return; } /** * Silently create an event with additional options. @@ -193,7 +194,7 @@ export class Calendar { startDate?: Date, endDate?: Date, options?: CalendarOptions - ): Promise { return; } + ): Promise { return; } /** * Interactively create an event. @@ -212,7 +213,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { return; } /** * Interactively create an event with additional options. @@ -233,7 +234,7 @@ export class Calendar { startDate?: Date, endDate?: Date, options?: CalendarOptions - ): Promise { return; } + ): Promise { return; } // deprecated // @Cordova() @@ -263,7 +264,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { return; } /** * Find an event with additional options. @@ -284,7 +285,7 @@ export class Calendar { startDate?: Date, endDate?: Date, options?: CalendarOptions - ): Promise { return; } + ): Promise { return; } /** * Find a list of events within the specified date range. (Android only) @@ -337,7 +338,7 @@ export class Calendar { newNotes?: string, newStartDate?: Date, newEndDate?: Date - ): Promise { return; } + ): Promise { return; } /** * Modify an event with additional options. (iOS only) @@ -355,31 +356,31 @@ export class Calendar { * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` * @return Returns a Promise */ - @Cordova() - static modifyEventWithOptions( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - newTitle?: string, - newLocation?: string, - newNotes?: string, - newStartDate?: Date, - newEndDate?: Date, - options?: CalendarOptions - ) { return; } + @Cordova() + static modifyEventWithOptions( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + newTitle?: string, + newLocation?: string, + newNotes?: string, + newStartDate?: Date, + newEndDate?: Date, + options?: CalendarOptions + ) { return; } - /** - * Delete an event. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @return Returns a Promise - */ + /** + * Delete an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ @Cordova() static deleteEvent( title?: string, @@ -387,7 +388,7 @@ export class Calendar { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { return; } /** * Delete an event from the specified Calendar. (iOS only) @@ -400,15 +401,15 @@ export class Calendar { * @param {string} calendarName * @return Returns a Promise */ - @Cordova() - static deleteEventFromNamedCalendar( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - calendarName?: string - ): Promise { return; } + @Cordova() + static deleteEventFromNamedCalendar( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + calendarName?: string + ): Promise { return; } /** * Open the calendar at the specified date. From 8e91f2128fe6a5007225a5837ea578862aadd97e Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:42:47 +0200 Subject: [PATCH 018/231] refactor(camera): --- src/plugins/camera.ts | 170 +++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index aef94980..6fa19601 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -1,67 +1,67 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; export interface CameraOptions { - /** Picture quality in range 0-100. Default is 50 */ - quality?: number; - /** - * Choose the format of the return value. - * Defined in navigator.camera.DestinationType. Default is FILE_URI. - * DATA_URL : 0, Return image as base64-encoded string - * FILE_URI : 1, Return image file URI - * NATIVE_URI : 2 Return image native URI - * (e.g., assets-library:// on iOS or content:// on Android) - */ - destinationType?: number; - /** - * Set the source of the picture. - * Defined in navigator.camera.PictureSourceType. Default is CAMERA. - * PHOTOLIBRARY : 0, - * CAMERA : 1, - * SAVEDPHOTOALBUM : 2 - */ - sourceType?: number; - /** Allow simple editing of image before selection. */ - allowEdit?: boolean; - /** - * Choose the returned image file's encoding. - * Defined in navigator.camera.EncodingType. Default is JPEG - * JPEG : 0 Return JPEG encoded image - * PNG : 1 Return PNG encoded image - */ - encodingType?: number; - /** - * Width in pixels to scale image. Must be used with targetHeight. - * Aspect ratio remains constant. - */ - targetWidth?: number; - /** - * Height in pixels to scale image. Must be used with targetWidth. - * Aspect ratio remains constant. - */ - targetHeight?: number; - /** - * Set the type of media to select from. Only works when PictureSourceType - * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType - * PICTURE: 0 allow selection of still pictures only. DEFAULT. - * Will return format specified via DestinationType - * VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI - * ALLMEDIA : 2 allow selection from all media types - */ - mediaType?: number; - /** Rotate the image to correct for the orientation of the device during capture. */ - correctOrientation?: boolean; - /** Save the image to the photo album on the device after capture. */ - saveToPhotoAlbum?: boolean; - /** - * Choose the camera to use (front- or back-facing). - * Defined in navigator.camera.Direction. Default is BACK. - * FRONT: 0 - * BACK: 1 - */ - cameraDirection?: number; - /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */ - popoverOptions?: CameraPopoverOptions; + /** Picture quality in range 0-100. Default is 50 */ + quality?: number; + /** + * Choose the format of the return value. + * Defined in navigator.camera.DestinationType. Default is FILE_URI. + * DATA_URL : 0, Return image as base64-encoded string + * FILE_URI : 1, Return image file URI + * NATIVE_URI : 2 Return image native URI + * (e.g., assets-library:// on iOS or content:// on Android) + */ + destinationType?: number; + /** + * Set the source of the picture. + * Defined in navigator.camera.PictureSourceType. Default is CAMERA. + * PHOTOLIBRARY : 0, + * CAMERA : 1, + * SAVEDPHOTOALBUM : 2 + */ + sourceType?: number; + /** Allow simple editing of image before selection. */ + allowEdit?: boolean; + /** + * Choose the returned image file's encoding. + * Defined in navigator.camera.EncodingType. Default is JPEG + * JPEG : 0 Return JPEG encoded image + * PNG : 1 Return PNG encoded image + */ + encodingType?: number; + /** + * Width in pixels to scale image. Must be used with targetHeight. + * Aspect ratio remains constant. + */ + targetWidth?: number; + /** + * Height in pixels to scale image. Must be used with targetWidth. + * Aspect ratio remains constant. + */ + targetHeight?: number; + /** + * Set the type of media to select from. Only works when PictureSourceType + * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType + * PICTURE: 0 allow selection of still pictures only. DEFAULT. + * Will return format specified via DestinationType + * VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI + * ALLMEDIA : 2 allow selection from all media types + */ + mediaType?: number; + /** Rotate the image to correct for the orientation of the device during capture. */ + correctOrientation?: boolean; + /** Save the image to the photo album on the device after capture. */ + saveToPhotoAlbum?: boolean; + /** + * Choose the camera to use (front- or back-facing). + * Defined in navigator.camera.Direction. Default is BACK. + * FRONT: 0 + * BACK: 1 + */ + cameraDirection?: number; + /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */ + popoverOptions?: CameraPopoverOptions; } /** @@ -69,20 +69,20 @@ export interface CameraOptions { * of the popover when selecting images from an iPad's library or album. */ export interface CameraPopoverOptions { - x: number; - y: number; - width: number; - height: number; - /** - * Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection - * Matches iOS UIPopoverArrowDirection constants. - * ARROW_UP : 1, - * ARROW_DOWN : 2, - * ARROW_LEFT : 4, - * ARROW_RIGHT : 8, - * ARROW_ANY : 15 - */ - arrowDir: number; + x: number; + y: number; + width: number; + height: number; + /** + * Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection + * Matches iOS UIPopoverArrowDirection constants. + * ARROW_UP : 1, + * ARROW_DOWN : 2, + * ARROW_LEFT : 4, + * ARROW_RIGHT : 8, + * ARROW_ANY : 15 + */ + arrowDir: number; } /** @@ -95,7 +95,7 @@ export interface CameraPopoverOptions { * @usage * ```js * import {Camera} from 'ionic-native'; - * + * * Camera.getPicture(options).then((imageData) => { * // imageData is either a base64 encoded string or a file URI * // If it's base64: @@ -161,7 +161,7 @@ export class Camera { /** Allow selection of video only, ONLY RETURNS URL */ VIDEO: 1, /** Allow selection from all media types */ - ALLMEDIA : 2 + ALLMEDIA: 2 }; /** @@ -169,11 +169,11 @@ export class Camera { */ static PictureSourceType = { /** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */ - PHOTOLIBRARY : 0, + PHOTOLIBRARY: 0, /** Take picture from camera */ - CAMERA : 1, + CAMERA: 1, /** Choose image from picture library (same as PHOTOLIBRARY for Android) */ - SAVEDPHOTOALBUM : 2 + SAVEDPHOTOALBUM: 2 }; /** @@ -181,11 +181,11 @@ export class Camera { * @enum {number} */ static PopoverArrowDirection = { - ARROW_UP : 1, - ARROW_DOWN : 2, - ARROW_LEFT : 4, - ARROW_RIGHT : 8, - ARROW_ANY : 15 + ARROW_UP: 1, + ARROW_DOWN: 2, + ARROW_LEFT: 4, + ARROW_RIGHT: 8, + ARROW_ANY: 15 }; /** From ff9b500938ae58c792fa3dfbba7dcc0e723c61b9 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:43:33 +0200 Subject: [PATCH 019/231] refactor(CardIO): --- src/plugins/card-io.ts | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index d5045e8c..5de7aaec 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name CardIO @@ -25,49 +25,49 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - plugin: 'https://github.com/card-io/card.io-Cordova-Plugin', - pluginRef: 'CardIO', - repo: 'https://github.com/card-io/card.io-Cordova-Plugin', - platforms: ['iOS', 'Android'] + plugin: 'https://github.com/card-io/card.io-Cordova-Plugin', + pluginRef: 'CardIO', + repo: 'https://github.com/card-io/card.io-Cordova-Plugin', + platforms: ['iOS', 'Android'] }) export class CardIO { - /** - * Check whether card scanning is currently available. (May vary by - * device, OS version, network connectivity, etc.) - * - */ - @Cordova() - static canScan(): Promise {return; } + /** + * Check whether card scanning is currently available. (May vary by + * device, OS version, network connectivity, etc.) + * + */ + @Cordova() + static canScan(): Promise { return; } - /** - * Scan a credit card with card.io. - * @param options - */ - @Cordova() - static scan(options?: CardIOOptions): Promise {return; } + /** + * Scan a credit card with card.io. + * @param options + */ + @Cordova() + static scan(options?: CardIOOptions): Promise { return; } - /** - * Retrieve the version of the card.io library. Useful when contacting support. - */ - @Cordova() - static version(): Promise {return; } + /** + * Retrieve the version of the card.io library. Useful when contacting support. + */ + @Cordova() + static version(): Promise { return; } } export interface CardIOOptions { - requireExpiry?: boolean; - requireCCV?: boolean; - requirePostalCode?: boolean; - supressManual?: boolean; - restrictPostalCodeToNumericOnly?: boolean; - keepApplicationTheme?: boolean; - requireCardholderName?: boolean; - scanInstructions?: string; - noCamera?: boolean; - scanExpiry?: boolean; - languageOrLocale?: string; - guideColor?: string; - supressConfirmation?: boolean; - hideCardIOLogo?: boolean; - useCardIOLogo?: boolean; - supressScan?: boolean; -} \ No newline at end of file + requireExpiry?: boolean; + requireCCV?: boolean; + requirePostalCode?: boolean; + supressManual?: boolean; + restrictPostalCodeToNumericOnly?: boolean; + keepApplicationTheme?: boolean; + requireCardholderName?: boolean; + scanInstructions?: string; + noCamera?: boolean; + scanExpiry?: boolean; + languageOrLocale?: string; + guideColor?: string; + supressConfirmation?: boolean; + hideCardIOLogo?: boolean; + useCardIOLogo?: boolean; + supressScan?: boolean; +} From b995d7bc3157b4297c5daa0fb9879b0ddeba08e4 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:46:46 +0200 Subject: [PATCH 020/231] refactor(clipboard): --- src/plugins/clipboard.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index ab35b6f7..8ae65b69 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Clipboard From e52fb1cacc0373aa61b4fd7ec4e7be2596f336cd Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:49:27 +0200 Subject: [PATCH 021/231] refactor(contacts): --- src/plugins/contacts.ts | 379 +++++++++++++++++++++------------------- 1 file changed, 199 insertions(+), 180 deletions(-) diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 7cee7187..47c4e58e 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -1,235 +1,252 @@ -import {Plugin, Cordova, InstanceProperty, CordovaInstance} from './plugin'; -declare var window: any, - navigator: any; -export interface IContactProperties { - /** A globally unique identifier. */ - id?: string; - /** The name of this Contact, suitable for display to end users. */ - displayName?: string; - /** An object containing all components of a persons name. */ - name?: ContactName; - /** A casual name by which to address the contact. */ - nickname?: string; - /** An array of all the contact's phone numbers. */ - phoneNumbers?: IContactField[]; - /** An array of all the contact's email addresses. */ - emails?: IContactField[]; - /** An array of all the contact's addresses. */ - addresses?: ContactAddress[]; - /** An array of all the contact's IM addresses. */ - ims?: IContactField[]; - /** An array of all the contact's organizations. */ - organizations?: ContactOrganization[]; - /** The birthday of the contact. */ - birthday?: Date; - /** A note about the contact. */ - note?: string; - /** An array of the contact's photos. */ - photos?: IContactField[]; - /** An array of all the user-defined categories associated with the contact. */ - categories?: IContactField[]; - /** An array of web pages associated with the contact. */ - urls?: IContactField[]; -} +import { Cordova, CordovaInstance, Plugin, InstanceProperty } from './plugin'; +declare var window: any, + navigator: any; + +export interface IContactProperties { + /** A globally unique identifier. */ + id?: string; + /** The name of this Contact, suitable for display to end users. */ + displayName?: string; + /** An object containing all components of a persons name. */ + name?: ContactName; + /** A casual name by which to address the contact. */ + nickname?: string; + /** An array of all the contact's phone numbers. */ + phoneNumbers?: IContactField[]; + /** An array of all the contact's email addresses. */ + emails?: IContactField[]; + /** An array of all the contact's addresses. */ + addresses?: ContactAddress[]; + /** An array of all the contact's IM addresses. */ + ims?: IContactField[]; + /** An array of all the contact's organizations. */ + organizations?: ContactOrganization[]; + /** The birthday of the contact. */ + birthday?: Date; + /** A note about the contact. */ + note?: string; + /** An array of the contact's photos. */ + photos?: IContactField[]; + /** An array of all the user-defined categories associated with the contact. */ + categories?: IContactField[]; + /** An array of web pages associated with the contact. */ + urls?: IContactField[]; +} + /** * @private */ export class Contact { - private _objectInstance: any; - @InstanceProperty get id(): string {return; } - @InstanceProperty get displayName(): string {return; } - @InstanceProperty get nickname(): ContactName {return; } - @InstanceProperty get phoneNumbers(): string {return; } - @InstanceProperty get emails(): IContactField[] {return; } - @InstanceProperty get addresses(): ContactAddress[] {return; } - @InstanceProperty get ims(): IContactField[] {return; } - @InstanceProperty get organizations(): ContactOrganization[] {return; } - @InstanceProperty get birthday(): Date {return; } - @InstanceProperty get note(): string {return; } - @InstanceProperty get photos(): IContactField[] {return; } - @InstanceProperty get categories(): IContactField[] {return; } - @InstanceProperty get urls(): IContactField[] {return; } - constructor () { - this._objectInstance = navigator.contacts.create(); + private _objectInstance: any; + @InstanceProperty get id(): string { return; } + @InstanceProperty get displayName(): string { return; } + @InstanceProperty get nickname(): ContactName { return; } + @InstanceProperty get phoneNumbers(): string { return; } + @InstanceProperty get emails(): IContactField[] { return; } + @InstanceProperty get addresses(): ContactAddress[] { return; } + @InstanceProperty get ims(): IContactField[] { return; } + @InstanceProperty get organizations(): ContactOrganization[] { return; } + @InstanceProperty get birthday(): Date { return; } + @InstanceProperty get note(): string { return; } + @InstanceProperty get photos(): IContactField[] { return; } + @InstanceProperty get categories(): IContactField[] { return; } + @InstanceProperty get urls(): IContactField[] { return; } + + constructor() { + this._objectInstance = navigator.contacts.create(); + } + + clone(): Contact { + let newContact = new Contact(); + for (let prop in this) { + if (prop === 'id') return; + newContact[prop] = this[prop]; } - clone(): Contact { - let newContact = new Contact(); - for (let prop in this) { - if (prop === 'id') return; - newContact[prop] = this[prop]; - } - return newContact; - } - @CordovaInstance() - remove(): Promise {return; } - @CordovaInstance() - save(): Promise {return; } + return newContact; + } + + @CordovaInstance() + remove(): Promise { return; } + + @CordovaInstance() + save(): Promise { return; } } + interface IContactError { - /** Error code */ - code: number; - /** Error message */ - message: string; + /** Error code */ + code: number; + /** Error message */ + message: string; } + declare var ContactError: { - new(code: number): IContactError; - UNKNOWN_ERROR: number; - INVALID_ARGUMENT_ERROR: number; - TIMEOUT_ERROR: number; - PENDING_OPERATION_ERROR: number; - IO_ERROR: number; - NOT_SUPPORTED_ERROR: number; - PERMISSION_DENIED_ERROR: number + new (code: number): IContactError; + UNKNOWN_ERROR: number; + INVALID_ARGUMENT_ERROR: number; + TIMEOUT_ERROR: number; + PENDING_OPERATION_ERROR: number; + IO_ERROR: number; + NOT_SUPPORTED_ERROR: number; + PERMISSION_DENIED_ERROR: number }; + export interface IContactName { - /** The complete name of the contact. */ - formatted?: string; - /** The contact's family name. */ - familyName?: string; - /** The contact's given name. */ - givenName?: string; - /** The contact's middle name. */ - middleName?: string; - /** The contact's prefix (example Mr. or Dr.) */ - honorificPrefix?: string; - /** The contact's suffix (example Esq.). */ - honorificSuffix?: string; + /** The complete name of the contact. */ + formatted?: string; + /** The contact's family name. */ + familyName?: string; + /** The contact's given name. */ + givenName?: string; + /** The contact's middle name. */ + middleName?: string; + /** The contact's prefix (example Mr. or Dr.) */ + honorificPrefix?: string; + /** The contact's suffix (example Esq.). */ + honorificSuffix?: string; } /** * @private */ export class ContactName implements IContactName { - private _objectInstance: any; - constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) { - this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix); - } - @InstanceProperty get formatted(): string {return; } - @InstanceProperty get familyName(): string {return; } - @InstanceProperty get givenName(): string {return; } - @InstanceProperty get middleName(): string {return; } - @InstanceProperty get honorificPrefix(): string {return; } - @InstanceProperty get honorificSuffix(): string {return; } + private _objectInstance: any; + + constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) { + this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix); + } + + @InstanceProperty get formatted(): string { return; } + @InstanceProperty get familyName(): string { return; } + @InstanceProperty get givenName(): string { return; } + @InstanceProperty get middleName(): string { return; } + @InstanceProperty get honorificPrefix(): string { return; } + @InstanceProperty get honorificSuffix(): string { return; } } export interface IContactField { - /** A string that indicates what type of field this is, home for example. */ - type: string; - /** The value of the field, such as a phone number or email address. */ - value: string; - /** Set to true if this ContactField contains the user's preferred value. */ - pref: boolean; + /** A string that indicates what type of field this is, home for example. */ + type: string; + /** The value of the field, such as a phone number or email address. */ + value: string; + /** Set to true if this ContactField contains the user's preferred value. */ + pref: boolean; } /** * @private */ export class ContactField implements IContactField { - private _objectInstance: any; - constructor(type?: string, value?: string, pref?: boolean) { - this._objectInstance = new window.ContactField(type, value, pref); - } - @InstanceProperty get type(): string {return; } - @InstanceProperty get value(): string {return; } - @InstanceProperty get pref(): boolean {return; } + private _objectInstance: any; + + constructor(type?: string, value?: string, pref?: boolean) { + this._objectInstance = new window.ContactField(type, value, pref); + } + + @InstanceProperty get type(): string { return; } + @InstanceProperty get value(): string { return; } + @InstanceProperty get pref(): boolean { return; } } export interface IContactAddress { - /** Set to true if this ContactAddress contains the user's preferred value. */ - pref?: boolean; - /** A string indicating what type of field this is, home for example. */ - type?: string; - /** The full address formatted for display. */ - formatted?: string; - /** The full street address. */ - streetAddress?: string; - /** The city or locality. */ - locality?: string; - /** The state or region. */ - region?: string; - /** The zip code or postal code. */ - postalCode?: string; - /** The country name. */ - country?: string; + /** Set to true if this ContactAddress contains the user's preferred value. */ + pref?: boolean; + /** A string indicating what type of field this is, home for example. */ + type?: string; + /** The full address formatted for display. */ + formatted?: string; + /** The full street address. */ + streetAddress?: string; + /** The city or locality. */ + locality?: string; + /** The state or region. */ + region?: string; + /** The zip code or postal code. */ + postalCode?: string; + /** The country name. */ + country?: string; } /** * @private */ export class ContactAddress implements IContactAddress { - private _objectInstance: any; - constructor (pref?: boolean, - type?: string, - formatted?: string, - streetAddress?: string, - locality?: string, - region?: string, - postalCode?: string, - country?: string) { - this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country); - } - @InstanceProperty get pref(): boolean {return; } - @InstanceProperty get type(): string {return; } - @InstanceProperty get formatted(): string {return; } - @InstanceProperty get streetAddress(): string {return; } - @InstanceProperty get locality(): string {return; } - @InstanceProperty get region(): string {return; } - @InstanceProperty get postalCode(): string {return; } - @InstanceProperty get country(): string {return; } + private _objectInstance: any; + + constructor(pref?: boolean, + type?: string, + formatted?: string, + streetAddress?: string, + locality?: string, + region?: string, + postalCode?: string, + country?: string) { + this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country); + } + + @InstanceProperty get pref(): boolean { return; } + @InstanceProperty get type(): string { return; } + @InstanceProperty get formatted(): string { return; } + @InstanceProperty get streetAddress(): string { return; } + @InstanceProperty get locality(): string { return; } + @InstanceProperty get region(): string { return; } + @InstanceProperty get postalCode(): string { return; } + @InstanceProperty get country(): string { return; } } export interface IContactOrganization { - /** Set to true if this ContactOrganization contains the user's preferred value. */ - pref?: boolean; - /** A string that indicates what type of field this is, home for example. */ - type?: string; - /** The name of the organization. */ - name?: string; - /** The department the contract works for. */ - department?: string; - /** The contact's title at the organization. */ - title?: string; + /** Set to true if this ContactOrganization contains the user's preferred value. */ + pref?: boolean; + /** A string that indicates what type of field this is, home for example. */ + type?: string; + /** The name of the organization. */ + name?: string; + /** The department the contract works for. */ + department?: string; + /** The contact's title at the organization. */ + title?: string; } /** * @private */ export class ContactOrganization implements IContactOrganization { - private _objectInstance: any; - constructor () { - this._objectInstance = new window.ContactOrganization(); - } - @InstanceProperty get pref(): boolean {return; } - @InstanceProperty get type(): string {return; } - @InstanceProperty get name(): string {return; } - @InstanceProperty get department(): string {return; } - @InstanceProperty get title(): string {return; } + private _objectInstance: any; + constructor() { + this._objectInstance = new window.ContactOrganization(); + } + @InstanceProperty get pref(): boolean { return; } + @InstanceProperty get type(): string { return; } + @InstanceProperty get name(): string { return; } + @InstanceProperty get department(): string { return; } + @InstanceProperty get title(): string { return; } } /** Search options to filter navigator.contacts. */ export interface IContactFindOptions { - /** The search string used to find navigator.contacts. */ - filter?: string; - /** Determines if the find operation returns multiple navigator.contacts. */ - multiple?: boolean; - /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */ - desiredFields?: string[]; + /** The search string used to find navigator.contacts. */ + filter?: string; + /** Determines if the find operation returns multiple navigator.contacts. */ + multiple?: boolean; + /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */ + desiredFields?: string[]; } /** * @private */ export class ContactFindOptions implements IContactFindOptions { - private _objectInstance: any; - constructor () { - this._objectInstance = new window.ContactFindOptions(); - } - @InstanceProperty get filter(): string {return; } - @InstanceProperty get multiple(): boolean {return; } - @InstanceProperty get desiredFields(): any {return; } - @InstanceProperty get hasPhoneNumber(): boolean {return; } + private _objectInstance: any; + + constructor() { + this._objectInstance = new window.ContactFindOptions(); + } + + @InstanceProperty get filter(): string { return; } + @InstanceProperty get multiple(): boolean { return; } + @InstanceProperty get desiredFields(): any { return; } + @InstanceProperty get hasPhoneNumber(): boolean { return; } } /** @@ -260,9 +277,10 @@ export class ContactFindOptions implements IContactFindOptions { repo: 'https://github.com/apache/cordova-plugin-contacts' }) export class Contacts { - static create(): Contact { - return new Contact(); - } + static create(): Contact { + return new Contact(); + } + /** * Search for contacts in the Contacts list. * @@ -285,10 +303,11 @@ export class Contacts { errorIndex: 2 }) static find(fields: string[], options?: any): Promise { return; } + /** * Select a single Contact. * @return Returns a Promise that resolves with the selected Contact */ @Cordova() - static pickContact(): Promise {return; } + static pickContact(): Promise { return; } } From 8030f3d4be95f89147331a897c381520e8b406c9 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:50:03 +0200 Subject: [PATCH 022/231] refactor(datePicker): --- src/plugins/datepicker.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 8e70adcb..9f495a7f 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; export interface DatePickerOptions { /** @@ -102,5 +102,4 @@ export class DatePicker { */ @Cordova() static show(options: DatePickerOptions): Promise { return; } - -} \ No newline at end of file +} From 6d87f6ecb0bb9a6164d0609be544075c0a2d836b Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:50:46 +0200 Subject: [PATCH 023/231] refactor(DBMeter): --- src/plugins/dbmeter.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index 3ef16c48..05471fff 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -1,5 +1,7 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + + /** * @name DB Meter * @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone. @@ -45,27 +47,27 @@ export class DBMeter { observable: true, clearFunction: 'stop' }) - static start (): Observable {return; } + static start(): Observable { return; } /** * Stops listening * @private */ @Cordova() - static stop (): Promise {return; } + static stop(): Promise { return; } /** * Check if the DB Meter is listening * @return {Promise} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening */ @Cordova() - static isListening(): Promise {return; } + static isListening(): Promise { return; } /** * Delete the DB Meter instance * @return {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur. */ @Cordova() - static delete(): Promise {return; } + static delete(): Promise { return; } } From 7c39e91b686ea79f6ba79080a2a6f4a5a75b329b Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:51:17 +0200 Subject: [PATCH 024/231] refactor(IonicDeeplink): --- src/plugins/deeplinks.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 05ab2fd2..ab6172c2 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + export interface DeeplinkMatch { /** @@ -17,7 +18,7 @@ export interface DeeplinkMatch { * any internal native data available as "extras" at the time * the route was matched (for example, Facebook sometimes adds extra data) */ - $link: any; + $link: any; } /** @@ -52,7 +53,7 @@ export class Deeplinks { @Cordova({ observable: true }) - static route(paths): Observable {return; } + static route(paths): Observable { return; } /** * @@ -75,5 +76,5 @@ export class Deeplinks { @Cordova({ observable: true }) - static routeWithNavController(navController, paths): Observable {return; } + static routeWithNavController(navController, paths): Observable { return; } } From c40fec7ae3df3618115245c84f29707c41e8c008 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:51:45 +0200 Subject: [PATCH 025/231] refactor(device): --- src/plugins/device.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/device.ts b/src/plugins/device.ts index e0c78d45..453e3ad1 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -1,4 +1,5 @@ -import {Plugin, CordovaProperty} from './plugin'; +import { CordovaProperty, Plugin } from './plugin'; + declare var window: { device: Device From 6e8248a0b8197a6559799e54a6abf2e4e4898581 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:52:13 +0200 Subject: [PATCH 026/231] refactor(DeviceAccounts): --- src/plugins/deviceaccounts.ts | 68 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts index bc17415c..7497671b 100644 --- a/src/plugins/deviceaccounts.ts +++ b/src/plugins/deviceaccounts.ts @@ -1,33 +1,35 @@ -import {Cordova, Plugin} from './plugin'; -@Plugin({ - plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git', - pluginRef: 'plugins.DeviceAccounts', - repo: 'https://github.com/loicknuchel/cordova-device-accounts', - platforms: ['Android'] -}) -export class DeviceAccounts { - - /** - * Gets all accounts registered on the Android Device - */ - @Cordova() - static get(): Promise {return; } - - /** - * Get all accounts registered on Android device for requested type - */ - @Cordova() - static getByType(type: string): Promise {return; } - - /** - * Get all emails registered on Android device (accounts with 'com.google' type) - */ - @Cordova() - static getEmails(): Promise {return; } - - /** - * Get the first email registered on Android device - */ - @Cordova() - static getEmail(): Promise {return; } -} \ No newline at end of file +import { Cordova, Plugin } from './plugin'; + + +@Plugin({ + plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git', + pluginRef: 'plugins.DeviceAccounts', + repo: 'https://github.com/loicknuchel/cordova-device-accounts', + platforms: ['Android'] +}) +export class DeviceAccounts { + + /** + * Gets all accounts registered on the Android Device + */ + @Cordova() + static get(): Promise { return; } + + /** + * Get all accounts registered on Android device for requested type + */ + @Cordova() + static getByType(type: string): Promise { return; } + + /** + * Get all emails registered on Android device (accounts with 'com.google' type) + */ + @Cordova() + static getEmails(): Promise { return; } + + /** + * Get the first email registered on Android device + */ + @Cordova() + static getEmail(): Promise { return; } +} From b7fb2483bff827cd561eec180e9ab62783ddc8c0 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:53:01 +0200 Subject: [PATCH 027/231] refactor(accelerometer): --- src/plugins/devicemotion.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 200d4990..42246f97 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + export interface AccelerationData { @@ -73,9 +74,7 @@ export class DeviceMotion { * @returns {Promise} Returns object with x, y, z, and timestamp properties */ @Cordova() - static getCurrentAcceleration(): Promise { - return; - } + static getCurrentAcceleration(): Promise { return; } /** * Watch the device acceleration. Clear the watch by unsubscribing from the observable. @@ -87,7 +86,5 @@ export class DeviceMotion { observable: true, clearFunction: 'clearWatch' }) - static watchAcceleration(options?: AccelerometerOptions): Observable { - return; - } + static watchAcceleration(options?: AccelerometerOptions): Observable { return; } } From f8330daa8b8b8c2f53a7de349952d666a05e757f Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:53:35 +0200 Subject: [PATCH 028/231] refactor(DeviceOrientation): --- src/plugins/deviceorientation.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index a923d68b..c493e553 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + export interface CompassHeading { From 17214ffba717bb7f2db44a27dac2ef6ad789766f Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:54:06 +0200 Subject: [PATCH 029/231] refactor(diagnostic): --- src/plugins/diagnostic.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index d1c31cd6..4037fa98 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + @Plugin({ plugin: 'cordova.plugins.diagnostic', @@ -10,28 +11,28 @@ export class Diagnostic { * Checks if app is able to access device location. */ @Cordova() - static isLocationEnabled(): Promise {return; } + static isLocationEnabled(): 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. * On Android this requires permission. `` */ @Cordova() - static isWifiEnabled(): Promise {return; } + static isWifiEnabled(): 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. */ @Cordova() - static isCameraEnabled(): Promise {return; } + static isCameraEnabled(): 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) * On Android this requires permission */ @Cordova() - static isBluetoothEnabled(): Promise {return; } + static isBluetoothEnabled(): Promise { return; } /** * Returns the location authorization status for the application. @@ -40,27 +41,27 @@ export class Diagnostic { * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". */ @Cordova() - static requestLocationAuthorization(mode?: string): Promise {return; } + static requestLocationAuthorization(mode?: string): Promise { return; } /** * Checks if the application is authorized to use location. * Note for Android: 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. */ @Cordova() - static isLocationAuthorized(): Promise {return; } + static isLocationAuthorized(): Promise { return; } /** * Checks if camera hardware is present on device. */ @Cordova() - static isCameraPresent(): Promise {return; } + static isCameraPresent(): Promise { return; } /** * Checks if the application is authorized to use the camera. * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time. */ @Cordova() - static isCameraAuthorized(): Promise {return; } + static isCameraAuthorized(): Promise { return; } /** * Checks if location mode is set to return high-accuracy locations from GPS hardware. * Returns true if Location mode is enabled and is set to either: @@ -68,7 +69,7 @@ export class Diagnostic { * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) */ @Cordova() - static isGpsLocationEnabled(): Promise {return; } + static isGpsLocationEnabled(): Promise { return; } /** * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points. @@ -77,7 +78,7 @@ export class Diagnostic { * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) */ @Cordova() - static isNetworkLocationEnabled(): Promise {return; } + static isNetworkLocationEnabled(): Promise { return; } /** * Checks if remote (push) notifications are enabled. @@ -85,7 +86,7 @@ export class Diagnostic { * On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications(). */ @Cordova() - static isRemoteNotificationsEnabled(): Promise {return; } + static isRemoteNotificationsEnabled(): Promise { return; } /** * Indicates if the app is registered for remote (push) notifications on the device. @@ -93,5 +94,5 @@ export class Diagnostic { * On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled(). */ @Cordova() - static isRegisteredForRemoteNotifications(): Promise {return; } + static isRegisteredForRemoteNotifications(): Promise { return; } } From bc3f10cbc1e9c7e1be9bd70b1232fa0cc3a429d6 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:54:38 +0200 Subject: [PATCH 030/231] refactor(dialogs): --- src/plugins/dialogs.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index 835d8803..cbd8607b 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + export interface PromptCallback { @@ -11,7 +12,6 @@ export interface PromptCallback { * The text entered in the prompt dialog box. (String) */ input1: string; - } @@ -53,7 +53,7 @@ export class Dialogs { message, title: string = 'Alert', buttonName: string = 'OK' - ): Promise {return; } + ): Promise { return; } /** * Displays a customizable confirmation dialog box. @@ -70,7 +70,7 @@ export class Dialogs { message, title: string = 'Confirm', buttonLabels: Array = ['OK', 'Cancel'] - ): Promise { return; } + ): Promise { return; } /** * Displays a native dialog box that is more customizable than the browser's prompt function. @@ -89,7 +89,7 @@ export class Dialogs { title: string = 'Prompt', buttonLabels: Array = ['OK', 'Cancel'], defaultText: string = '' - ): Promise { return; } + ): Promise { return; } /** @@ -99,6 +99,6 @@ export class Dialogs { @Cordova({ sync: true }) - static beep(times: number): void {} + static beep(times: number): void { } -} \ No newline at end of file +} From dcd7ad430fe822ba63d01729466938e9e0039690 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:58:21 +0200 Subject: [PATCH 031/231] refactor(email): --- src/plugins/emailcomposer.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index a2e0f821..532f9fe6 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -1,5 +1,8 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + + declare var cordova: any; + /** * @name Email Composer * @description @@ -53,7 +56,7 @@ export class EmailComposer { * @param app {string?} An optional app id or uri scheme. * @returns {Promise} Resolves if available, rejects if not available */ - static isAvailable (app?: string): Promise { + static isAvailable(app?: string): Promise { return new Promise((resolve, reject) => { if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); }); else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); }); @@ -67,7 +70,7 @@ export class EmailComposer { * @param packageName {string} The package name */ @Cordova() - static addAlias(alias: string, packageName: string): void {} + static addAlias(alias: string, packageName: string): void { } /** * Displays the email composer pre-filled with data. @@ -80,9 +83,10 @@ export class EmailComposer { successIndex: 1, errorIndex: 3 }) - static open(email: Email, scope?: any): Promise {return; } + static open(email: Email, scope?: any): Promise { return; } } + export interface Email { app?: string; to?: string | Array; @@ -92,4 +96,4 @@ export interface Email { subject?: string; body?: string; isHtml?: boolean; -} \ No newline at end of file +} From 63a1a34f9777f1c3e4ee44ad9457b282efcb5c2c Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:59:05 +0200 Subject: [PATCH 032/231] refactor(facebook4): --- src/plugins/facebook.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 4ceaf43a..5cda15b4 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Facebook @@ -85,15 +85,15 @@ import {Plugin, Cordova} from './plugin'; }) export class Facebook { - /** - * Browser wrapper - * @param appId - * @param version - */ - @Cordova() - static browserInit(appId: number, version?: string): Promise { - return; - } + /** + * Browser wrapper + * @param appId + * @param version + */ + @Cordova() + static browserInit(appId: number, version?: string): Promise { + return; + } /** * Login to Facebook to authenticate this app. @@ -213,7 +213,7 @@ export class Facebook { name: string, params?: Object, valueToSum?: number - ): Promise { return; } + ): Promise { return; } /** * Log a purchase. For more information see the Events section above. From 27c02ecb8221db5cdd781b91c8672332b5d130ea Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 00:59:54 +0200 Subject: [PATCH 033/231] refactor(file): --- src/plugins/file.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index cd4e901f..cb043703 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + declare var window; From 6fcc109b6b425818bfe00f4230497342e2b4a50b Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:00:17 +0200 Subject: [PATCH 034/231] refactor(FileTransfer): --- src/plugins/filetransfer.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 65f75c58..85d7844c 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -1,4 +1,5 @@ -import {Plugin, CordovaInstance} from './plugin'; +import { CordovaInstance, Plugin } from './plugin'; + declare var FileTransfer; @@ -189,6 +190,6 @@ export class Transfer { @CordovaInstance({ sync: true }) - abort(): void {} + abort(): void { } } From c94ba61a6601cc8602cf568a7dcfca1bf52b9c64 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:00:45 +0200 Subject: [PATCH 035/231] refactor(flashlight): --- src/plugins/flashlight.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 80aa7ee3..034114b2 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Flashlight @@ -21,7 +22,6 @@ import {Plugin, Cordova} from './plugin'; }) export class Flashlight { - /** * Checks if the flashlight is available * @returns {Promise} Returns a promise that resolves with a boolean stating if the flashlight is available. From 31ec6431269f52441efc8b558def62854123f9b3 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:01:36 +0200 Subject: [PATCH 036/231] refactor(geolocation): --- src/plugins/geolocation.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 8c059f99..a9644adc 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + declare var navigator: any; From be3c579c49c38e884f88549645e7ae994e610834 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:06:34 +0200 Subject: [PATCH 037/231] refactor(Globalization): --- src/plugins/globalization.ts | 50 +++++++++++++++++------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index bd43c954..2b5f412f 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Globalization @@ -23,14 +23,14 @@ export class Globalization { * @return {Promise<{value: string}>} */ @Cordova() - static getPreferredLanguage(): Promise<{value: string}> {return; } + static getPreferredLanguage(): Promise<{value: string}> { return; } /** * Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter. * @return {Promise<{value: string}>} */ @Cordova() - static getLocaleName(): Promise<{value: string}> {return; } + static getLocaleName(): Promise<{value: string}> { return; } /** * Converts date to string @@ -39,10 +39,10 @@ export class Globalization { * @return {Promise<{value: string}>} */ @Cordova({ - successIndex: 1, - errorIndex: 2 + successIndex: 1, + errorIndex 2 }) - static dateToString(date: Date, options: {formatLength: string, selector: string}): Promise<{value: string}> {return; } + static dateToString(date: Date, options: {formatLength: string, selector: string}): Promise<{value: string}> { return; } /** * @@ -50,53 +50,51 @@ export class Globalization { * @param options */ @Cordova({ - successIndex: 1, - errorIndex: 2 + successIndex: 1, + errorIndex: 2 }) - static stringToDate(dateString: string, options: {formatLength: string, selector: string}): Promise<{year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number}> {return; } - + static stringToDate(dateString: string, options: {formatLength: string, selector: string}): Promise<{year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number}> { return; } /** * * @param options */ @Cordova({ - callbackOrder: 'reverse' + callbackOrder: 'reverse' }) - static getDatePattern(options: {formatLength: string, selector: string}): Promise<{pattern: string}> {return; } - + static getDatePattern(options: {formatLength: string, selector: string}): Promise<{pattern: string}> { return; } /** * * @param options */ @Cordova({ - callbackOrder: 'reverse' + callbackOrder: 'reverse' }) - static getDateNames(options: {type: string, item: string}): Promise<{value: Array}> {return; } + static getDateNames(options: {type: string, item: string}): Promise<{value: Array}> { return; } /** * Check if day light saving is active * @param date */ @Cordova() - static isDayLightSavingsTime(date: Date): Promise<{dst: string}> {return; } + static isDayLightSavingsTime(date: Date): Promise<{dst: string}> { return; } /** * Get first day of week */ @Cordova() - static getFirstDayOfWeek(): Promise<{value: string}> {return; } + static getFirstDayOfWeek(): Promise<{value: string}> { return; } /** * * @param options */ @Cordova({ - successIndex: 1, - errorIndex: 2 + successIndex: 1, + errorIndex: 2 }) - static numberToString(options: {type: string}): Promise<{value: string}> {return; } + static numberToString(options: {type: string}): Promise<{value: string}> { return; } /** * @@ -104,25 +102,25 @@ export class Globalization { * @param options */ @Cordova({ - successIndex: 1, - errorIndex: 2 + successIndex: 1, + errorIndex: 2 }) - static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value: number|string}> {return; } + static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value: number|string}> { return; } /** * * @param options */ @Cordova({ - callbackOrder: 'reverse' + callbackOrder: 'reverse' }) - static getNumberPattern(options: {type: string}): Promise<{pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string}> {return; } + static getNumberPattern(options: {type: string}): Promise<{pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string}> { return; } /** * * @param currencyCode */ @Cordova() - static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; } + static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> { return; } } From 3e0b2c5b327e02b8823c64e277608434db90db4f Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:08:59 +0200 Subject: [PATCH 038/231] refactor(googleplus): --- src/plugins/google-plus.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/google-plus.ts b/src/plugins/google-plus.ts index f766e6e0..09b2550c 100644 --- a/src/plugins/google-plus.ts +++ b/src/plugins/google-plus.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Google Plus @@ -22,25 +23,25 @@ export class GooglePlus { * @param options */ @Cordova() - static login(options?: any): Promise {return; } + static login(options?: any): Promise { return; } /** * You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are. * @param options */ @Cordova() - static trySilentLogin(options?: any): Promise {return; } + static trySilentLogin(options?: any): Promise { return; } /** * This will clear the OAuth2 token. */ @Cordova() - static logout(): Promise {return; } + static logout(): Promise { return; } /** * This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect. */ @Cordova() - static disconnect(): Promise {return; } + static disconnect(): Promise { return; } -} \ No newline at end of file +} From 7bc847a7f880dd5824d5df4438ab3999812b2782 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:09:34 +0200 Subject: [PATCH 039/231] refactor(analytics): --- src/plugins/googleanalytics.ts | 195 +++++++++++++++++---------------- 1 file changed, 98 insertions(+), 97 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index dc6bcf15..a50d6c74 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + declare var window; @@ -12,112 +13,112 @@ declare var window; * - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html) */ @Plugin({ - plugin: 'cordova-plugin-google-analytics', - pluginRef: 'analytics', - repo: 'https://github.com/danwilson/google-analytics-plugin', - platforms: ['Android', 'iOS'] + plugin: 'cordova-plugin-google-analytics', + pluginRef: 'analytics', + repo: 'https://github.com/danwilson/google-analytics-plugin', + platforms: ['Android', 'iOS'] }) export class GoogleAnalytics { - /** - * In your 'deviceready' handler, set up your Analytics tracker. - * https://developers.google.com/analytics/devguides/collection/analyticsjs/ - * @param {string} id Your Google Analytics Mobile App property - */ - @Cordova() - static startTrackerWithId(id: string): Promise { return; } + /** + * In your 'deviceready' handler, set up your Analytics tracker. + * https://developers.google.com/analytics/devguides/collection/analyticsjs/ + * @param {string} id Your Google Analytics Mobile App property + */ + @Cordova() + static startTrackerWithId(id: string): Promise { return; } - /** - * Track a screen - * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens - * - * @param {string} title Screen title - */ - @Cordova() - static trackView(title: string): Promise { return; } + /** + * Track a screen + * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens + * + * @param {string} title Screen title + */ + @Cordova() + static trackView(title: string): Promise { return; } - /** - * Track an event - * https://developers.google.com/analytics/devguides/collection/analyticsjs/events - * @param {string} category - * @param {string} action - * @param {string} label - * @param {number} value - */ - @Cordova() - static trackEvent(category: string, action: string, label?: string, value?: number): Promise { return; } + /** + * Track an event + * https://developers.google.com/analytics/devguides/collection/analyticsjs/events + * @param {string} category + * @param {string} action + * @param {string} label + * @param {number} value + */ + @Cordova() + static trackEvent(category: string, action: string, label?: string, value?: number): Promise { return; } - /** - * Track an exception - * @param {string} description - * @param {boolean} fatal - */ - @Cordova() - static trackException(description: string, fatal: boolean): Promise { return; } + /** + * Track an exception + * @param {string} description + * @param {boolean} fatal + */ + @Cordova() + static trackException(description: string, fatal: boolean): Promise { return; } - /** - * Track User Timing (App Speed) - * @param {string} category - * @param {number} intervalInMilliseconds - * @param {string} variable - * @param {string} label - */ - @Cordova() - static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { return; } + /** + * Track User Timing (App Speed) + * @param {string} category + * @param {number} intervalInMilliseconds + * @param {string} variable + * @param {string} label + */ + @Cordova() + static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { return; } - /** - * Add a Transaction (Ecommerce) - * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans - * @param {string} id - * @param {string} affiliation - * @param {number} revenue - * @param {number} tax - * @param {number} shipping - * @param {string} currencyCode - */ - @Cordova() - static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise { return; } + /** + * Add a Transaction (Ecommerce) + * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans + * @param {string} id + * @param {string} affiliation + * @param {number} revenue + * @param {number} tax + * @param {number} shipping + * @param {string} currencyCode + */ + @Cordova() + static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise { return; } - /** - * Add a Transaction Item (Ecommerce) - * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem - * @param {string} id - * @param {string} name - * @param {string} sku - * @param {string} category - * @param {number} price - * @param {number} quantity - * @param {string} currencyCode - */ - @Cordova() - static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise { return; } + /** + * Add a Transaction Item (Ecommerce) + * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem + * @param {string} id + * @param {string} name + * @param {string} sku + * @param {string} category + * @param {number} price + * @param {number} quantity + * @param {string} currencyCode + */ + @Cordova() + static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise { return; } - /** - * Add a Custom Dimension - * https://developers.google.com/analytics/devguides/platform/customdimsmets - * @param {string} key - * @param {string} value - */ - @Cordova() - static addCustomDimension(key: number, value: string): Promise { return; } + /** + * Add a Custom Dimension + * https://developers.google.com/analytics/devguides/platform/customdimsmets + * @param {string} key + * @param {string} value + */ + @Cordova() + static addCustomDimension(key: number, value: string): Promise { return; } - /** - * Set a UserId - * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id - * @param {string} id - */ - @Cordova() - static setUserId(id: string): Promise { return; } + /** + * Set a UserId + * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id + * @param {string} id + */ + @Cordova() + static setUserId(id: string): Promise { return; } - /** - * Enable verbose logging - */ - @Cordova() - static debugMode(): Promise { return; } + /** + * Enable verbose logging + */ + @Cordova() + static debugMode(): Promise { return; } - /** - * Enable/disable automatic reporting of uncaught exceptions - * @param {boolean} shouldEnable - */ - @Cordova() - static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { return; } + /** + * Enable/disable automatic reporting of uncaught exceptions + * @param {boolean} shouldEnable + */ + @Cordova() + static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { return; } } From 08412feae07dc261e8b1e9ab48be8a79e2f5205e Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 8 Jul 2016 01:10:28 +0200 Subject: [PATCH 040/231] refactor(googlemaps): --- src/plugins/googlemaps.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index dd8bbcfe..029c6696 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1,10 +1,13 @@ import { Cordova, CordovaInstance, Plugin } from './plugin'; import { Observable } from 'rxjs/Observable'; + + /** * @private * Created by Ibrahim on 3/29/2016. */ declare var plugin: any; + /** * @private * You can listen to these events where appropriate From b5a2ffc6a53b6623e4e8aed11171e40140500598 Mon Sep 17 00:00:00 2001 From: Markus Wagner Date: Sat, 16 Jul 2016 05:28:05 +0200 Subject: [PATCH 041/231] fix(ibeacon): minor fixes * Order of major/minor parameters for BeaconRegion creater fixed * Property PluginResult.error added * comment for BeaconRegion.minor fixed --- src/plugins/ibeacon.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index 2e89648b..89176da3 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -65,7 +65,7 @@ export interface BeaconRegion { major?: number; /** - * The beacon's major identifier number. Optional, of nothing is supplied + * The beacon's minor identifier number. Optional, of nothing is supplied * the plugin will treat it as a wildcard. */ minor?: number; @@ -125,6 +125,11 @@ export interface PluginResult { * The state of the phone in relation to the region. Inside/outside for example. */ state: 'CLRegionStateInside' | 'CLRegionStateOutside'; + + /** + * Error message, used only with monitoringDidFailForRegionWithError delegate. + */ + error: string; } export interface Delegate { /** @@ -372,8 +377,8 @@ export class IBeacon { * * @return Returns the BeaconRegion that was created */ - static BeaconRegion(identifer: string, uuid: string, minor?: number, major?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { - return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, minor, major, notifyEntryStateOnDisplay); + static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { + return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay); } /** From 2996da65c337deb135f99058a8b6b90e0798f9e3 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 17 Jul 2016 02:07:46 -0400 Subject: [PATCH 042/231] feat(googlemaps): add Geocoder class (#292) closes #280 --- src/plugins/googlemaps.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index dd8bbcfe..fbbb92ac 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1005,3 +1005,38 @@ export class GoogleMapsLatLng { return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); } } +/** + * @private + */ +export interface GeocoderRequest { + address?: string; + position?: {lat: number; lng: number}; +} +/** + * @private + */ +export interface GeocoderResult { + position?: {lat: number; lng: number}; + subThoroughfare?: string; + thoroughfare?: string; + locality?: string; + adminArea?: string; + postalCode?: string; + country?: string; +} +/** + * @private + */ +export class Geocoder { + /** + * Converts position to address and vice versa + * @param {GeocoderRequest} request Request object with either an address or a position + * @returns {Promise} + */ + static geocode(request: GeocoderRequest): Promise { + return new Promise((resolve, reject) => { + if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) reject({error: 'plugin_not_installed'}); + else plugin.google.maps.Geocoder.geocode(request, resolve); + }); + } +} From daa6d4cbb9220a5924ccb0b479bc319e9b98a17e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 17 Jul 2016 02:07:59 -0400 Subject: [PATCH 043/231] feat(media-capture): add media capture plugin (#293) closes #272 --- src/index.ts | 3 + src/plugins/media-capture.ts | 218 +++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 src/plugins/media-capture.ts diff --git a/src/index.ts b/src/index.ts index 3e186783..8ded70ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,6 +51,7 @@ import {Insomnia} from './plugins/insomnia'; import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; +import {MediaCapture} from './plugins/media-capture'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; @@ -91,6 +92,7 @@ export * from './plugins/inappbrowser'; export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; export * from './plugins/media'; +export * from './plugins/media-capture'; export * from './plugins/printer'; export * from './plugins/push'; export * from './plugins/safari-view-controller'; @@ -190,6 +192,7 @@ window['IonicNative'] = { Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, + MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, Network: Network, Printer: Printer, diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts new file mode 100644 index 00000000..a3f354f8 --- /dev/null +++ b/src/plugins/media-capture.ts @@ -0,0 +1,218 @@ +import {Plugin, Cordova, CordovaProperty} from './plugin'; +import {Observable} from 'rxjs/Rx'; +/** + * @name Media Capture + * @description + * @usage + * ```typescript + * import {MediaCapture} from 'ionic-native'; + * + * ... + * + * let options: CaptureImageOptions = { limit: 3 }; + * MediaCapture.captureImage(options) + * .then( + * (data: MediaFile[]) => console.log(data), + * (err: CaptureError) => console.error(err) + * ); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-media-capture', + pluginRef: 'navigator.device.capture', + repo: 'https://github.com/apache/cordova-plugin-media-capture' +}) +export class MediaCapture { + /** + * The audio recording formats supported by the device. + * @returns {ConfigurationData[]} + */ + @CordovaProperty + static get supportedImageModes(): ConfigurationData[] { + return navigator.device.capture.supportedImageModes; + } + + /** + * The recording image sizes and formats supported by the device. + * @returns {ConfigurationData[]} + */ + @CordovaProperty + static get supportedAudioModes(): ConfigurationData[] { + return navigator.device.capture.supportedAudioModes; + } + + /** + * The recording video resolutions and formats supported by the device. + * @returns {ConfigurationData[]} + */ + @CordovaProperty + static get supportedVideoModes(): ConfigurationData[] { + return navigator.device.capture.supportedVideoModes; + } + + /** + * Start the audio recorder application and return information about captured audio clip files. + * @param options + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static captureAudio(options?: CaptureAudioOptions): Promise {return; } + + /** + * Start the camera application and return information about captured image files. + * @param options + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static captureImage(options?: CaptureImageOptions): Promise {return; } + + /** + * Start the video recorder application and return information about captured video clip files. + * @param options + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static captureVideo(options?: CaptureVideoOptions): Promise {return; } + + /** + * is fired if the capture call is successful + */ + @Cordova({ + eventObservable: true, + event: 'pendingcaptureresult' + }) + static onPendingCaptureResult(): Observable {return; } + + /** + * is fired if the capture call is unsuccessful + */ + @Cordova({ + eventObservable: true, + event: 'pendingcaptureerror' + }) + static onPendingCaptureError(): Observable {return; } + +} +/** + * Encapsulates properties of a media capture file. + */ +export interface MediaFile { + /** + * The name of the file, without path information. + */ + name: string; + /** + * The full path of the file, including the name. + */ + fullPath: string; + /** + * The file's mime type + */ + type: string; + /** + * The date and time when the file was last modified. + */ + lastModifiedDate: Date; + /** + * The size of the file, in bytes. + */ + size: number; + /** + * Retrieves the format information of the media file. + * @param {Function} successCallback + * @param {Function} errorCallback + */ + getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any); +} +/** + * Encapsulates format information about a media file. + */ +export interface MediaFileData { + /** + * The actual format of the audio and video content. + */ + codecs: string; + /** + * The average bitrate of the content. The value is zero for images. + */ + bitrate: number; + /** + * The height of the image or video in pixels. The value is zero for audio clips. + */ + height: number; + /** + * The width of the image or video in pixels. The value is zero for audio clips. + */ + width: number; + /** + * The length of the video or sound clip in seconds. The value is zero for images. + */ + duration: number; +} +/** + * Encapsulates the error code resulting from a failed media capture operation. + */ +export interface CaptureError { + code: string; +} +/** + * Encapsulates audio capture configuration options. + */ +export interface CaptureAudioOptions { + /** + * Maximum number of audio clips. Defaults to 1. + * On iOS you can only record one file. + */ + limit?: number; + /** + * Maximum duration of an audio sound clip, in seconds. This does not work on Android devices. + */ + duration?: number; +} +/** + * Encapsulates image capture configuration options. + */ +export interface CaptureImageOptions { + /** + * Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation. + */ + limit?: number; +} +/** + * Encapsulates video capture configuration options. + */ +export interface CaptureVideoOptions { + /** + * Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation. + */ + limit?: number; + /** + * Maximum duration per video clip. This will be ignored on BlackBerry. + */ + duration?: number; + /** + * Quality of the video. This parameter can only be used with Android. + */ + quality?: number; +} +/** + * Encapsulates a set of media capture parameters that a device supports. + */ +export interface ConfigurationData { + /** + * The ASCII-encoded lowercase string representing the media type. + */ + type: string; + /** + * The height of the image or video in pixels. The value is zero for sound clips. + */ + height: number; + /** + * The width of the image or video in pixels. The value is zero for sound clips. + */ + width: number; +} From 453374d4e788127a3a89aba03a478a3f804494ee Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:11:52 -0400 Subject: [PATCH 044/231] docs(sqlite): fix usage typo --- src/plugins/sqlite.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 5a90ac1a..8d37a967 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -53,7 +53,7 @@ export class SQLite { * import { SQLite } from 'ionic-native'; * * let db = new SQLite(); - * db.openDatabse({ + * db.openDatabase({ * name: 'data.db', * location: 'default' // the location field is required * }).then(() => { From af5d4ad87f678fbae3fb2157e2c210f86eb01cab Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:32:19 -0400 Subject: [PATCH 045/231] feat(nativestorage): add NativeStorage plugin wrapper --- src/index.ts | 3 +++ src/plugins/nativestorage.ts | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/plugins/nativestorage.ts diff --git a/src/index.ts b/src/index.ts index 8ded70ce..ab277db3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,6 +52,7 @@ import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; import {MediaCapture} from './plugins/media-capture'; +import {NativeStorage} from './plugins/nativestorage'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; @@ -129,6 +130,7 @@ export { Hotspot, Insomnia, Keyboard, + NativeStorage, Network, OneSignal, PinDialog, @@ -194,6 +196,7 @@ window['IonicNative'] = { LocalNotifications: LocalNotifications, MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, + NativeStorage: NativeStorage, Network: Network, Printer: Printer, Push: Push, diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts new file mode 100644 index 00000000..46d513b7 --- /dev/null +++ b/src/plugins/nativestorage.ts @@ -0,0 +1,38 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name Native Storage + */ +@Plugin({ + plugin: 'cordova-plugin-nativestorage', + pluginRef: 'NativeStorage', + repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage' +}) +export class NativeStorage { + /** + * Stores a value + * @param reference + * @param value + */ + @Cordova() + static setItem(reference: string, value: any): Promise {return; } + + /** + * Gets a stored item + * @param reference + */ + @Cordova() + static getItem(reference: string): Promise {return; } + + /** + * Removes a single stored item + * @param reference + */ + @Cordova() + static remove(reference: string): Promise {return; } + + /** + * Removes all stored values. + */ + @Cordova() + static clear(): Promise {return; } +} From d03ff962e36f4411e245c50adf6bd4c37b3e5636 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:35:31 -0400 Subject: [PATCH 046/231] docs(nativestorage): add usage --- src/plugins/nativestorage.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 46d513b7..3a19ef6f 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -1,6 +1,24 @@ import {Plugin, Cordova} from './plugin'; /** * @name Native Storage + * @description + * + * @usage + * ```typescript + * import {NativeStorage} from 'ionic-native'; + * + * NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) + * .then( + * () => console.log('Stored item!'), + * error => console.error('Error storing item', error) + * ); + * + * NativeStorage.getItem('myitem') + * .then( + * data => console.log(data), + * error => console.error(error) + * ); + * ``` */ @Plugin({ plugin: 'cordova-plugin-nativestorage', From b4b3ec0d2a359effd51ffac8a5a427d5e6222db5 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:39:29 -0400 Subject: [PATCH 047/231] fix(safari-view-controller): fix wrappers --- src/plugins/safari-view-controller.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 397748f6..e6c80e9e 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -41,7 +41,7 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-safariviewcontroller', pluginRef: 'SafariViewController', - platforms: ['iOS'], + platforms: ['iOS', 'Android'], repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller' }) export class SafariViewController { @@ -56,17 +56,13 @@ export class SafariViewController { * Shows Safari View Controller * @param options */ - @Cordova({ - callbackOrder: 'reverse' - }) + @Cordova() static show(options?: SafariViewControllerOptions): Promise {return; } /** * Hides Safari View Controller */ - @Cordova({ - sync: true - }) + @Cordova() static hide(): void {} /** From 40590350506f2aa16516b44dcf72d1ea3cab2ee6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:40:58 -0400 Subject: [PATCH 048/231] 1.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31f195e0..f1d985c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.4", + "version": "1.3.5", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 1dbfd70724b40db0d74c89f276cc4a38f42e8afa Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:43:05 -0400 Subject: [PATCH 049/231] chore(): update changelog --- CHANGELOG.md | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1227f004..516850df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ + +## [1.3.5](https://github.com/driftyco/ionic-native/compare/v1.3.4...v1.3.5) (2016-07-17) + + +### Bug Fixes + +* **ibeacon:** minor fixes ([b5a2ffc](https://github.com/driftyco/ionic-native/commit/b5a2ffc)) +* **safari-view-controller:** fix wrappers ([b4b3ec0](https://github.com/driftyco/ionic-native/commit/b4b3ec0)) + + +### Features + +* **googlemaps:** add Geocoder class ([#292](https://github.com/driftyco/ionic-native/issues/292)) ([2996da6](https://github.com/driftyco/ionic-native/commit/2996da6)), closes [#280](https://github.com/driftyco/ionic-native/issues/280) +* **media-capture:** add media capture plugin ([#293](https://github.com/driftyco/ionic-native/issues/293)) ([daa6d4c](https://github.com/driftyco/ionic-native/commit/daa6d4c)), closes [#272](https://github.com/driftyco/ionic-native/issues/272) +* **nativestorage:** add NativeStorage plugin wrapper ([af5d4ad](https://github.com/driftyco/ionic-native/commit/af5d4ad)) +* **pin-dialog:** add pin dialog plugin ([#291](https://github.com/driftyco/ionic-native/issues/291)) ([2fe37c4](https://github.com/driftyco/ionic-native/commit/2fe37c4)) + + + ## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14) @@ -46,28 +65,12 @@ -## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.1) (2016-06-26) +## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26) ### Bug Fixes * **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232) -* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) - - -### Features - -* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) -* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) - - - - -# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.3.0) (2016-06-13) - - -### Bug Fixes - * **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180) * **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212) * **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6)) @@ -76,6 +79,7 @@ * **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e)) * **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164) * **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f)) +* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) ### Features @@ -83,6 +87,13 @@ * **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde)) * **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115) * **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed)) +* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) +* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) + + + + +## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01) From e55c0c3e15e813e91f3fdfa325b9f2fd97a30c3c Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:44:10 -0400 Subject: [PATCH 050/231] declare navigator to get rid of errors --- src/plugins/media-capture.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index a3f354f8..4366dc51 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -1,5 +1,6 @@ import {Plugin, Cordova, CordovaProperty} from './plugin'; import {Observable} from 'rxjs/Rx'; +declare var navigator: any; /** * @name Media Capture * @description @@ -8,7 +9,7 @@ import {Observable} from 'rxjs/Rx'; * import {MediaCapture} from 'ionic-native'; * * ... - * + * * let options: CaptureImageOptions = { limit: 3 }; * MediaCapture.captureImage(options) * .then( From de14b0ea150572d1ade768bfb3c99a0ec1071bee Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:49:44 -0400 Subject: [PATCH 051/231] fix(googlemaps): able to pass array of LatLng to GoogleMapsLatLngBounds constructor closes #298 --- src/plugins/googlemaps.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index fbbb92ac..5f80a699 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -951,8 +951,9 @@ export class GoogleMapsKmlOverlay { export class GoogleMapsLatLngBounds { private _objectInstance: any; - constructor(public southwest: GoogleMapsLatLng, public northeast: GoogleMapsLatLng) { - this._objectInstance = new plugin.google.maps.LatLngBounds([southwest, northeast]); + constructor(public southwestOrArrayOfLatLng: GoogleMapsLatLng|GoogleMapsLatLng[], public northeast?: GoogleMapsLatLng) { + let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng; + this._objectInstance = new plugin.google.maps.LatLngBounds(args); } @CordovaInstance({ sync: true }) From 6f625f92227512ef30e8f49066b8f376bce4e2a6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:07:51 -0400 Subject: [PATCH 052/231] fix(launch-navigator): fix the navigate function wrapper to match latest plugin API --- src/plugins/launchnavigator.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index b28ead09..d1c4a13c 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -44,6 +44,11 @@ export interface LaunchNavigatorOptions { */ navigationMode?: string; + /** + * Start point of the navigation + */ + start?: string|number[]; + } /** @@ -73,18 +78,16 @@ export class LaunchNavigator { /** * Launches navigator app - * @param destination Location name or coordinates - * @param start Location name or coordinates - * @param options + * @param destination {string|number[]} Location name or coordinates + * @param options {LaunchNavigatorOptions} * @returns {Promise} */ @Cordova({ - successIndex: 2, - errorIndex: 3 + successIndex: 1, + errorIndex: 2 }) static navigate( - destination: any, - start: any = null, + destination: string|number[], options?: LaunchNavigatorOptions ): Promise { return; } From 29de6b394e34aa9e9d87bb8bcce6b8cbc98bb4c8 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:43:12 -0400 Subject: [PATCH 053/231] feat(launch-navigator): add new methods and constants to match latest plugin API --- src/plugins/launchnavigator.ts | 179 +++++++++++++++++++++++++-------- 1 file changed, 139 insertions(+), 40 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index d1c4a13c..5cec5a09 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -3,52 +3,54 @@ import {Plugin, Cordova} from './plugin'; export interface LaunchNavigatorOptions { /** - * iOS, Android, Windows - * If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false. + * name of the navigation app to use for directions. Specify using launchnavigator.APP constants. If not specified, defaults to User Selection. */ - disableAutoGeolocation?: boolean; + app?: string; /** - * iOS, Android, Windows - * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. + * nickname to display in app for destination. e.g. "Bob's House". */ - transportMode?: string; - - /** - * iOS - * If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps. - */ - preferGoogleMaps?: boolean; - - /** - * iOS - * If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app. - */ - urlScheme?: string; - - /** - * iOS - * If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified. - */ - backButtonText?: string; - - /** - * iOS - * If true, debug log output will be generated by the plugin. Defaults to false. - */ - enableDebug?: boolean; - - /** - * Android - * Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. - */ - navigationMode?: string; + destinationName?: string; /** * Start point of the navigation */ start?: string|number[]; + /** + * nickname to display in app for start . e.g. "My House". + */ + startName?: string; + + /** + * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. + */ + transportMode?: string; + + /** + * If true, debug log output will be generated by the plugin. Defaults to false. + */ + enableDebug?: boolean; + + /** + * a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}` + */ + extras?: any; + + /** + * (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants. + */ + launchMode?: string; + + /** + * text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified. + */ + appSelectionDialogHeader?: string; + + /** + * text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified. + */ + appSelectionCancelButton?: string; } /** @@ -57,12 +59,17 @@ export interface LaunchNavigatorOptions { * Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator). * * @usage + * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper. + * * ```js - * import {LaunchNavigator} from 'ionic-native'; + * import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native'; * + * let options: LaunchNavigatorOptions = { + * start: 'London, ON', + * app: LaunchNavigator.APPS.UBER + * }; * - * - * LaunchNavigator.navigate("Toronto, ON", "London, ON") + * LaunchNavigator.navigate("Toronto, ON", options) * .then( * success => console.log("Launched navigator"), * error => console.log("Error launching navigator", error) @@ -78,7 +85,7 @@ export class LaunchNavigator { /** * Launches navigator app - * @param destination {string|number[]} Location name or coordinates + * @param destination {string|number[]} Location name or coordinates (as string or array) * @param options {LaunchNavigatorOptions} * @returns {Promise} */ @@ -91,4 +98,96 @@ export class LaunchNavigator { options?: LaunchNavigatorOptions ): Promise { return; } + /** + * Determines if the given app is installed and available on the current device. + * @param app {string} + */ + @Cordova() + static isAppAvailable(app: string): Promise {return; } + + /** + * Returns a list indicating which apps are installed and available on the current device. + */ + @Cordova() + static availableApps(): Promise {return; } + + /** + * Returns the display name of the specified app. + * @param app {string} + */ + @Cordova({sync: true}) + static getAppDisplayName(app: string): string {return; } + + /** + * Returns list of supported apps on a given platform. + * @param platform {string} + */ + @Cordova({sync: true}) + static getAppsForPlatform(platform: string): string[] {return; } + + /** + * Indicates if an app on a given platform supports specification of transport mode. + * @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS` + * @param platform {string} + */ + @Cordova({sync: true}) + static supportsTransportMode(app: string, platform: string): boolean {return; } + + /** + * Returns the list of transport modes supported by an app on a given platform. + * @param app {string} + * @param platform {string} + */ + @Cordova({sync: true}) + static getTransportModes(app: string, platform: string): string[] {return; } + + /** + * Indicates if an app on a given platform supports specification of launch mode. + * Note that currently only Google Maps on Android does. + * @param app {string} + * @param platform {string} + */ + @Cordova({sync: true}) + static supportsLaunchMode(app: string, platform: string): boolean {return; } + + /** + * Indicates if an app on a given platform supports specification of start location. + * @param app {string} + * @param platform {string} + */ + @Cordova({sync: true}) + static supportsStart(app: string, platform: string): boolean {return; } + + @Cordova({sync: true}) + static supportsStartName(app: string, platform: string): boolean {return; } + + @Cordova({sync: true}) + static supportsDestName(app: string, platform: string): boolean {return; } + + @Cordova({sync: true}) + static userSelect(destination: string|number[], options: LaunchNavigatorOptions): void { } + + static APP: any = { + USER_SELECT: 'user_select', + APPLE_MAPS: 'apple_maps', + GOOGLE_MAPS: 'google_maps', + WAZE: 'waze', + CITYMAPPER: 'citymapper', + NAVIGON: 'navigon', + TRANSIT_APP: 'transit_app', + YANDEX: 'yandex', + UBER: 'uber', + TOMTOM: 'tomtom', + BING_MAPS: 'bing_maps', + SYGIC: 'sygic', + HERE_MAPS: 'here_maps', + MOOVIT: 'moovit' + }; + + static TRANSPORT_MODE: any = { + DRIVING: 'driving', + WALKING: 'walking', + BICYCLING: 'bicycling', + TRANSIT: 'transit' + }; } From 3a1a3ceabc8997b1299b3b4623831d9eadac0fac Mon Sep 17 00:00:00 2001 From: Rodrigue BOULEAU Date: Sun, 17 Jul 2016 10:50:18 +0200 Subject: [PATCH 054/231] feat(camera-preview): add wrapper for camera-preview (#301) * feat(camera-preview): add camera-preview * feat(camera-preview): add camera-preview --- src/index.ts | 3 + src/plugins/camera-preview.ts | 129 ++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 src/plugins/camera-preview.ts diff --git a/src/index.ts b/src/index.ts index ab277db3..cbc91cfd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ import {BLE} from './plugins/ble'; import {BluetoothSerial} from './plugins/bluetoothserial'; import {Calendar} from './plugins/calendar'; import {Camera} from './plugins/camera'; +import {CameraPreview} from './plugins/camera-preview'; import {CardIO} from './plugins/card-io'; import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; @@ -113,6 +114,7 @@ export { Brightness, BLE, BluetoothSerial, + CameraPreview, Clipboard, DBMeter, Deeplinks, @@ -165,6 +167,7 @@ window['IonicNative'] = { BluetoothSerial: BluetoothSerial, Calendar: Calendar, Camera: Camera, + CameraPreview: CameraPreview, CardIO: CardIO, Clipboard: Clipboard, Contacts: Contacts, diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts new file mode 100644 index 00000000..72cf1b2d --- /dev/null +++ b/src/plugins/camera-preview.ts @@ -0,0 +1,129 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from 'rxjs/Observable'; + +export interface CameraPreviewOptions { + x: number; + y: number; + width: number; + height: number; + /** + * Choose the camera to use (front- or back-facing). + * 'front' for front camera + * 'rear' for rear camera + */ + camera: string; + /** Take photo on tap */ + tapPhoto: boolean; + /** */ + previewDrag: boolean; + /** */ + toBack: boolean; + /** Alpha use when toBack is set to true */ + alpha: number; +} + +export interface CameraPreviewSize { + maxWidth: number; + maxHeight: number; +} + +/** + * @name CameraPreview + * @description + * Showing camera preview in HTML + * + * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview). + * + */ +@Plugin({ + plugin: 'cordova-plugin-camera-preview', + pluginRef: 'cordova.plugins.camerapreview', + repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', + platforms: ['Android', 'iOS'] +}) +export class CameraPreview { + + /** + * Starts the camera preview instance. + * @param {CameraPreviewOptions} options for the preview + */ + @Cordova({ + sync: true + }) + static startCamera(options: CameraPreviewOptions): void {}; + + /** + * Stops the camera preview instance. + */ + @Cordova({ + sync: true + }) + static stopCamera(): void {}; + + /** + * Take the picture, the parameter size is optional + */ + @Cordova({ + sync: true + }) + static takePicture(size: CameraPreviewSize): void {}; + + /** + * Register a callback function that receives the original picture and the image captured from the preview box. + */ + @Cordova({ + observable: true + }) + static setOnPictureTakenHandler(): Observable { return; }; + + /** + * Switch from the rear camera and front camera, if available. + */ + @Cordova({ + sync: true + }) + static switchCamera(): void {}; + + /** + * Show the camera preview box. + */ + @Cordova({ + sync: true + }) + static show(): void {}; + + /** + * Hide the camera preview box. + */ + @Cordova({ + sync: true + }) + static hide(): void {}; + + /** + * Set the default mode for the Flash. + */ + @Cordova({ + sync: true + }) + static setFlashMode(mode: number): void {}; + + /** + * Set camera color effect. + */ + @Cordova({ + sync: true + }) + static setColorEffect(effect: string): void {}; + + /** + * @private + * @enum {number} + */ + static FlashMode = { + OFF: 0, + ON: 1, + AUTO: 2 + }; + +} From 6ee645a976b6e7d5d2dbfa81d4bf72ed904e17ae Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:53:50 -0400 Subject: [PATCH 055/231] refactor(launchnavigator): add successCallback and errorCallback to options interface these are currently needed to use the userSelect function --- src/plugins/launchnavigator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 5cec5a09..ae931918 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -51,6 +51,10 @@ export interface LaunchNavigatorOptions { * text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified. */ appSelectionCancelButton?: string; + + successCallback?: Function; + + errorCallback?: Function; } /** @@ -60,7 +64,7 @@ export interface LaunchNavigatorOptions { * * @usage * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper. - * + * * ```js * import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native'; * From 46e3a0ecb33748c7981275be9d37d4b0d527023f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:54:33 -0400 Subject: [PATCH 056/231] 1.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1d985c8..4b349181 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.5", + "version": "1.3.6", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 8bd906c1a7290a0225e5c99d4f29e3aa00725aab Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:55:20 -0400 Subject: [PATCH 057/231] chore(changelog): update changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 516850df..80112298 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [1.3.6](https://github.com/driftyco/ionic-native/compare/v1.3.5...v1.3.6) (2016-07-17) + + +### Bug Fixes + +* **googlemaps:** able to pass array of LatLng to GoogleMapsLatLngBounds constructor ([de14b0e](https://github.com/driftyco/ionic-native/commit/de14b0e)), closes [#298](https://github.com/driftyco/ionic-native/issues/298) +* **launch-navigator:** fix the navigate function wrapper to match latest plugin API ([6f625f9](https://github.com/driftyco/ionic-native/commit/6f625f9)) + + +### Features + +* **camera-preview:** add wrapper for camera-preview ([#301](https://github.com/driftyco/ionic-native/issues/301)) ([3a1a3ce](https://github.com/driftyco/ionic-native/commit/3a1a3ce)) +* **launch-navigator:** add new methods and constants to match latest plugin API ([29de6b3](https://github.com/driftyco/ionic-native/commit/29de6b3)) + + + ## [1.3.5](https://github.com/driftyco/ionic-native/compare/v1.3.4...v1.3.5) (2016-07-17) From 4f85110f7521e0e97c3824da8d29e41bdbc510a0 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Sun, 17 Jul 2016 12:56:41 +0200 Subject: [PATCH 058/231] feat(sim): Add sim plugin (#317) * Add sim plugin * Fix pluginRef --- src/index.ts | 3 +++ src/plugins/sim.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/plugins/sim.ts diff --git a/src/index.ts b/src/index.ts index cbc91cfd..45a511cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; import {SafariViewController} from './plugins/safari-view-controller'; import {Screenshot} from './plugins/screenshot'; +import {Sim} from './plugins/sim'; import {SMS} from './plugins/sms'; import {SocialSharing} from './plugins/socialsharing'; import {SpinnerDialog} from './plugins/spinnerdialog'; @@ -138,6 +139,7 @@ export { PinDialog, Screenshot, SocialSharing, + Sim, Splashscreen, SQLite, StatusBar, @@ -207,6 +209,7 @@ window['IonicNative'] = { PinDialog: PinDialog, SafariViewController: SafariViewController, Screenshot: Screenshot, + Sim: Sim, SMS: SMS, SocialSharing: SocialSharing, SpinnerDialog: SpinnerDialog, diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts new file mode 100644 index 00000000..7155cb7a --- /dev/null +++ b/src/plugins/sim.ts @@ -0,0 +1,35 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * @name Sim + * @description + * Gets info from the Sim card like the carrier name, mcc, mnc and country code and other system dependent info. + * + * Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim). + * + * @usage + * ```js + * import {Sim} from 'ionic-native'; + * + * + * Sim.getSimInfo().then( + * (info) => console.log('Sim info:', info), + * (err) => console.log('Unable to get sim info:', err) + * ); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-sim', + pluginRef: 'plugins.sim', + repo: 'https://github.com/pbakondy/cordova-plugin-sim', + platforms: ['Android', 'iOS', 'Windows Phone'] +}) +export class Sim { + /** + * Returns info from the SIM card. + * @returns {Promise} + */ + @Cordova() + static getSimInfo(): Promise { return; } + +} From 965d742bb6b693d1c0e9d3517f35c7963a5c4b9a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 08:35:20 -0400 Subject: [PATCH 059/231] refactor(google-maps): use observer.next.bind instead of manual way --- src/plugins/googlemaps.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 5f80a699..4952c54e 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -77,8 +77,7 @@ export class GoogleMap { on(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.on(event, cb); + this._objectInstance.on(event, observer.next.bind); return () => this._objectInstance.off(event); } ); @@ -389,10 +388,7 @@ export class GoogleMapsMarker { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = (data: any) => { - observer.next(data); - }; - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); @@ -537,8 +533,7 @@ export class GoogleMapsCircle { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); @@ -629,8 +624,7 @@ export class GoogleMapsPolyline { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); @@ -721,8 +715,7 @@ export class GoogleMapsPolygon { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); From 0c0456ada6d502ceded22fab7e901205c67f529a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 08:37:00 -0400 Subject: [PATCH 060/231] refactor(google-maps): fix mistake in previous commit --- src/plugins/googlemaps.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 4952c54e..65d7433f 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -389,7 +389,7 @@ export class GoogleMapsMarker { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } @@ -534,7 +534,7 @@ export class GoogleMapsCircle { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } @@ -625,7 +625,7 @@ export class GoogleMapsPolyline { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } @@ -716,7 +716,7 @@ export class GoogleMapsPolygon { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } From 4841f31a92be5ef9e265046b4d6ccb066f777071 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 08:54:39 -0400 Subject: [PATCH 061/231] refactor(project): fix and optimize observables --- src/plugins/geolocation.ts | 3 +-- src/plugins/googlemaps.ts | 18 +++++++++--------- src/plugins/plugin.ts | 5 ++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 8c059f99..60d28a7e 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -154,8 +154,7 @@ export class Geolocation { static watchPosition(options?: GeolocationOptions): Observable { return new Observable( (observer: any) => { - let cb = (data: Geoposition) => observer.next(data); - let watchId = navigator.geolocation.watchPosition(cb, options); + let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), options); return () => navigator.geolocation.clearWatch(watchId); } ); diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 65d7433f..c0378efe 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -77,7 +77,7 @@ export class GoogleMap { on(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.on(event, observer.next.bind); + this._objectInstance.on(event, observer.next.bind(observer)); return () => this._objectInstance.off(event); } ); @@ -388,8 +388,8 @@ export class GoogleMapsMarker { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } @@ -533,8 +533,8 @@ export class GoogleMapsCircle { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } @@ -624,8 +624,8 @@ export class GoogleMapsPolyline { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } @@ -715,8 +715,8 @@ export class GoogleMapsPolygon { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 7a97b8bf..99b99c0e 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -174,9 +174,8 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) { */ function wrapEventObservable (event: string): Observable { return new Observable(observer => { - let callback = (status: any) => observer.next(status); - window.addEventListener(event, callback, false); - return () => window.removeEventListener(event, callback, false); + window.addEventListener(event, observer.next.bind(observer), false); + return () => window.removeEventListener(event, observer.next.bind(observer), false); }); } From 28ee511437fd439b53feb1259bc5e54ce2e8ab1d Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:51:30 +0200 Subject: [PATCH 062/231] refactor(hotspot): --- src/plugins/hotspot.ts | 88 +++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index 9932a0f7..0c927e6c 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Hotspot @@ -24,10 +24,10 @@ import {Plugin, Cordova} from './plugin'; export class Hotspot { @Cordova() - static isAvailable(): Promise {return; } + static isAvailable(): Promise { return; } @Cordova() - static toggleWifi(): Promise {return; } + static toggleWifi(): Promise { return; } /** * Configures and starts hotspot with SSID and Password @@ -39,7 +39,7 @@ export class Hotspot { * @return {Promise} - Promise to call once hotspot is started, or reject upon failure */ @Cordova() - static createHotspot(ssid: string, mode: string, password: string): Promise {return; } + static createHotspot(ssid: string, mode: string, password: string): Promise { return; } /** * Turns on Access Point @@ -47,7 +47,7 @@ export class Hotspot { * @return {Promise} - true if AP is started */ @Cordova() - static startHotspot(): Promise {return; } + static startHotspot(): Promise { return; } /** * Configures hotspot with SSID and Password @@ -59,7 +59,7 @@ export class Hotspot { * @return {Promise} - Promise to call when hotspot is configured, or reject upon failure */ @Cordova() - static configureHotspot(ssid: string, mode: string, password: string): Promise {return; } + static configureHotspot(ssid: string, mode: string, password: string): Promise { return; } /** * Turns off Access Point @@ -67,7 +67,7 @@ export class Hotspot { * @return {Promise} - Promise to turn off the hotspot, true on success, false on failure */ @Cordova() - static stopHotspot(): Promise {return; } + static stopHotspot(): Promise { return; } /** * Checks if hotspot is enabled @@ -75,10 +75,10 @@ export class Hotspot { * @return {Promise} - Promise that hotspot is enabled, rejected if it is not enabled */ @Cordova() - static isHotspotEnabled(): Promise {return; } + static isHotspotEnabled(): Promise { return; } @Cordova() - static getAllHotspotDevices(): Promise> {return; } + static getAllHotspotDevices(): Promise> { return; } /** * Connect to a WiFi network @@ -92,25 +92,25 @@ export class Hotspot { * Promise that connection to the WiFi network was successfull, rejected if unsuccessful */ @Cordova() - static connectToWifi(ssid: string, password: string): Promise {return; } + static connectToWifi(ssid: string, password: string): Promise { return; } - /** - * Connect to a WiFi network - * - * @param {string} ssid - * SSID to connect - * @param {string} password - * Password to use - * @param {string} authentication - * Authentication modes to use (LEAP, SHARED, OPEN) - * @param {string[]} encryption - * Encryption modes to use (CCMP, TKIP, WEP104, WEP40) - * - * @return {Promise} - * Promise that connection to the WiFi network was successfull, rejected if unsuccessful - */ + /** + * Connect to a WiFi network + * + * @param {string} ssid + * SSID to connect + * @param {string} password + * Password to use + * @param {string} authentication + * Authentication modes to use (LEAP, SHARED, OPEN) + * @param {string[]} encryption + * Encryption modes to use (CCMP, TKIP, WEP104, WEP40) + * + * @return {Promise} + * Promise that connection to the WiFi network was successfull, rejected if unsuccessful + */ @Cordova() - static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array): Promise {return; } + static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array): Promise { return; } /** * Add a WiFi network @@ -126,7 +126,7 @@ export class Hotspot { * Promise that adding the WiFi network was successfull, rejected if unsuccessful */ @Cordova() - static addWifiNetwork(ssid: string, mode: string, password: string): Promise {return; } + static addWifiNetwork(ssid: string, mode: string, password: string): Promise { return; } /** * Remove a WiFi network @@ -138,43 +138,43 @@ export class Hotspot { * Promise that removing the WiFi network was successfull, rejected if unsuccessful */ @Cordova() - static removeWifiNetwork(ssid: string): Promise {return; } + static removeWifiNetwork(ssid: string): Promise { return; } @Cordova() - static isConnectedToInternet(): Promise {return; } + static isConnectedToInternet(): Promise { return; } @Cordova() - static isConnectedToInternetViaWifi(): Promise {return; } + static isConnectedToInternetViaWifi(): Promise { return; } @Cordova() - static isWifiOn(): Promise {return; } + static isWifiOn(): Promise { return; } @Cordova() - static isWifiSupported(): Promise {return; } + static isWifiSupported(): Promise { return; } @Cordova() - static isWifiDirectSupported(): Promise {return; } + static isWifiDirectSupported(): Promise { return; } @Cordova() - static scanWifi(): Promise> {return; } + static scanWifi(): Promise> { return; } @Cordova() - static scanWifiByLevel(): Promise> {return; } + static scanWifiByLevel(): Promise> { return; } @Cordova() - static startWifiPeriodicallyScan(interval: number, duration: number): Promise {return; } + static startWifiPeriodicallyScan(interval: number, duration: number): Promise { return; } @Cordova() - static stopWifiPeriodicallyScan(): Promise {return; } + static stopWifiPeriodicallyScan(): Promise { return; } @Cordova() - static getNetConfig(): Promise {return; } + static getNetConfig(): Promise { return; } @Cordova() - static getConnectionInfo(): Promise {return; } + static getConnectionInfo(): Promise { return; } @Cordova() - static pingHost(ip: string): Promise {return; } + static pingHost(ip: string): Promise { return; } /** * Gets MAC Address associated with IP Address from ARP File @@ -184,7 +184,7 @@ export class Hotspot { * @return {Promise} - A Promise for the MAC Address */ @Cordova() - static getMacAddressOfHost(ip: string): Promise {return; } + static getMacAddressOfHost(ip: string): Promise { return; } /** * Checks if IP is live using DNS @@ -194,7 +194,7 @@ export class Hotspot { * @return {Promise} - A Promise for whether the IP Address is reachable */ @Cordova() - static isDnsLive(ip: string): Promise {return; } + static isDnsLive(ip: string): Promise { return; } /** * Checks if IP is live using socket And PORT @@ -204,7 +204,7 @@ export class Hotspot { * @return {Promise} - A Promise for whether the IP Address is reachable */ @Cordova() - static isPortLive(ip: string): Promise {return; } + static isPortLive(ip: string): Promise { return; } /** * Checks if device is rooted @@ -212,7 +212,7 @@ export class Hotspot { * @return {Promise} - A Promise for whether the device is rooted */ @Cordova() - static isRooted(): Promise {return; } + static isRooted(): Promise { return; } } From 1eed1a1cb34f8a26c62a6f5336d57cc284168b56 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:53:58 +0200 Subject: [PATCH 063/231] refactor(Httpd): --- src/plugins/httpd.ts | 92 +++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index c948d02f..3aa5fed2 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -1,5 +1,7 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + + /** * @name Httpd * @description @@ -7,55 +9,57 @@ import {Observable} from 'rxjs/Observable'; * @usage */ @Plugin({ - plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', - pluginRef: 'cordova.plugins.CorHttpd', - repo: 'https://github.com/floatinghotpot/cordova-httpd', - platforms: ['iOS', 'Android'] + plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', + pluginRef: 'cordova.plugins.CorHttpd', + repo: 'https://github.com/floatinghotpot/cordova-httpd', + platforms: ['iOS', 'Android'] }) export class Httpd { - /** - * Starts a web server. - * @returns {Observable} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server. - * @param options {HttpdOptions} - */ - @Cordova({ - observable: true, - clearFunction: 'stopServer' - }) - static startServer(options: any): Observable {return; } + /** + * Starts a web server. + * @returns {Observable} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server. + * @param options {HttpdOptions} + */ + @Cordova({ + observable: true, + clearFunction: 'stopServer' + }) + static startServer(options: any): Observable { return; } - /** - * Gets the URL of the running server - * @returns {Promise} Returns a promise that resolves with the URL of the web server. - */ - @Cordova() - static getUrl(): Promise {return; } + /** + * Gets the URL of the running server + * @returns {Promise} Returns a promise that resolves with the URL of the web server. + */ + @Cordova() + static getUrl(): Promise { return; } + + /** + * Get the local path of the running webserver + * @returns {Promise} Returns a promise that resolves with the local path of the web server. + */ + @Cordova() + static getLocalPath(): Promise { return; } - /** - * Get the local path of the running webserver - * @returns {Promise} Returns a promise that resolves with the local path of the web server. - */ - @Cordova() - static getLocalPath(): Promise {return; } } + /** * These options are used for the Httpd.startServer() function. */ export interface HttpdOptions { - /** - * The public root directory for your web server. This path is relative to your app's www directory. - * Default is current directory. - */ - www_root?: string; - /** - * The port number to use. - * Default is 8888 - */ - port?: number; - /** - * Setting this option to false will allow remote access to your web server (over any IP). - * Default is false. - */ - localhost_only?: boolean; -} \ No newline at end of file + /** + * The public root directory for your web server. This path is relative to your app's www directory. + * Default is current directory. + */ + www_root?: string; + /** + * The port number to use. + * Default is 8888 + */ + port?: number; + /** + * Setting this option to false will allow remote access to your web server (over any IP). + * Default is false. + */ + localhost_only?: boolean; +} From f21c49e29309467db129fc7c774cf129a762603a Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:55:18 +0200 Subject: [PATCH 064/231] refactor(ibeacon): --- src/plugins/ibeacon.ts | 110 +++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index 89176da3..cb9d2fdf 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + declare var cordova: any; @@ -21,7 +22,7 @@ export interface Beacon { /** * The proximity of the beacon relative to the phone. - * + * * Possible options are: * ProximityImmediate * ProximityNear @@ -47,6 +48,7 @@ export interface Beacon { accuracy: number; } + export interface BeaconRegion { /** * A unique identifier for this region. @@ -76,6 +78,7 @@ export interface BeaconRegion { */ notifyEntryStateOnDisplay?: boolean; } + export interface CircularRegion { /** * A unique identifier for this region. @@ -97,6 +100,7 @@ export interface CircularRegion { */ radius: number; } + export type Region = BeaconRegion | CircularRegion; export interface PluginResult { @@ -131,10 +135,11 @@ export interface PluginResult { */ error: string; } + export interface Delegate { /** * An observable that publishes information about the location permission authorization status. - * + * * @return Returns a string. */ didChangeAuthorizationStatus(): Observable; @@ -142,10 +147,10 @@ export interface Delegate { /** * An Observable that publishes event data to it's subscribers * when the native layer is able to determine the device's state. - * + * * This event is called when the phone begins starts monitoring, * when requestStateForRegion is called, etc. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ didDetermineStateForRegion(): Observable; @@ -153,32 +158,32 @@ export interface Delegate { /** * An Observable that publishes event data to it's subscribers * when the phone enters a region that it was asked to monitor. - * + * * If the user has given the app Always-Location permission, this function * will be called even when the app is not running on iOS. * The app will run silently in the background for a small amount of time. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ didEnterRegion(): Observable; /** - * An Observable that publishes event data to it's subscribers + * An Observable that publishes event data to it's subscribers * when the phone exits a region that it was asked to monitor. - * + * * If the user has given the app Always-Location permission, this function * will be called even when the app is not running on iOS. * The app will run silently in the background for a small amount of time. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ didExitRegion(): Observable; /** * An Observable that publishes event data to it's subscribers - * each time that the device ranges beacons. Modern Android and iOS devices range + * each time that the device ranges beacons. Modern Android and iOS devices range * aproximately once per second. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ didRangeBeaconsInRegion(): Observable; @@ -186,7 +191,7 @@ export interface Delegate { /** * An Observable that publishes event data to it's subscribers * when the device begins monitoring a region. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ didStartMonitoringForRegion(): Observable; @@ -194,7 +199,7 @@ export interface Delegate { /** * An Observable that publishes event data to it's subscribers * when the device fails to monitor a region. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ monitoringDidFailForRegionWithError(): Observable; @@ -202,16 +207,16 @@ export interface Delegate { /** * An Observable that publishes event data to it's subscribers * when the device begins advertising as an iBeacon. - * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ peripheralManagerDidStartAdvertising(): Observable; /** - * An Observable that publishes event data to it's subscribers + * An Observable that publishes event data to it's subscribers * when the state of the peripheral manager's state updates. - * - * + * + * * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). */ peripheralManagerDidUpdateState(): Observable; @@ -234,7 +239,7 @@ export interface Delegate { * IBeacon.requestAlwaysAuthorization(); * // create a new delegate and register it with the native layer * let delegate = IBeacon.Delegate(); - * + * * // Subscribe to some of the delegate's event handlers * delegate.didRangeBeaconsInRegion() * .subscribe( @@ -252,9 +257,9 @@ export interface Delegate { * console.log('didEnterRegion: ', data); * } * ); - * + * * let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E'); - * + * * IBeacon.startMonitoringForRegion(beaconRegion) * .then( * () => console.log('Native layer recieved the request to monitoring'), @@ -263,18 +268,17 @@ export interface Delegate { * ``` */ @Plugin({ - plugin: 'cordova-plugin-ibeacon', - pluginRef: 'cordova.plugins.locationManager', - repo: 'https://github.com/petermetz/cordova-plugin-ibeacon', - platforms: ['Android', 'iOS'] + plugin: 'cordova-plugin-ibeacon', + pluginRef: 'cordova.plugins.locationManager', + repo: 'https://github.com/petermetz/cordova-plugin-ibeacon', + platforms: ['Android', 'iOS'] }) export class IBeacon { - /** * Instances of this class are delegates between the {@link LocationManager} and * the code that consumes the messages generated on in the native layer. - * + * * @returns {Delegate} An instance of the type {@type Delegate}. */ static Delegate(): Delegate { @@ -367,14 +371,14 @@ export class IBeacon { /** * Creates a new BeaconRegion - * + * * @param {String} identifier @see {CLRegion} - * @param {String} uuid The proximity ID of the beacon being targeted. + * @param {String} uuid The proximity ID of the beacon being targeted. * This value must not be blank nor invalid as a UUID. * @param {Number} major The major value that you use to identify one or more beacons. * @param {Number} minor The minor value that you use to identify a specific beacon. * @param {BOOL} notifyEntryStateOnDisplay - * + * * @return Returns the BeaconRegion that was created */ static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { @@ -389,7 +393,7 @@ export class IBeacon { /** * @param {Delegate} delegate An instance of a delegate to register with the native layer. - * + * * @return Returns the Delegate */ @Cordova() @@ -399,15 +403,15 @@ export class IBeacon { * Signals the native layer that the client side is ready to consume messages. * Readiness here means that it has a {Delegate} set by the consumer javascript * code. - * + * * The {LocationManager.setDelegate()} will implicitly call this method as well, * therefore the only case when you have to call this manually is if you don't * wish to specify a {Delegate} of yours. - * + * * The purpose of this signaling mechanism is to make the events work when the * app is being woken up by the Operating System to give it a chance to handle * region monitoring events for example. - * + * * If you don't set a {Delegate} and don't call this method manually, an error * message get emitted in the native runtime and the DOM as well after a certain * period of time. @@ -447,9 +451,9 @@ export class IBeacon { /** * Start monitoring the specified region. * - * If a region of the same type with the same identifier is already being + * If a region of the same type with the same identifier is already being * monitored for this application, - * it will be removed from monitoring. For circular regions, the region + * it will be removed from monitoring. For circular regions, the region * monitoring service will prioritize * regions by their size, favoring smaller regions over larger regions. * @@ -457,7 +461,7 @@ export class IBeacon { * * @param {Region} region An instance of {Region} which will be monitored * by the operating system. - * + * * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the monitoring request. */ @@ -465,16 +469,16 @@ export class IBeacon { static startMonitoringForRegion(region: BeaconRegion): Promise { return; } /** - * Stop monitoring the specified region. It is valid to call - * stopMonitoringForRegion: for a region that was registered for monitoring - * with a different location manager object, during this or previous + * Stop monitoring the specified region. It is valid to call + * stopMonitoringForRegion: for a region that was registered for monitoring + * with a different location manager object, during this or previous * launches of your application. * * This is done asynchronously and may not be immediately reflected in monitoredRegions. * * @param {Region} region An instance of {Region} which will be monitored * by the operating system. - * + * * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ @@ -483,14 +487,14 @@ export class IBeacon { /** * Request state the for specified region. When result is ready - * didDetermineStateForRegion is triggered. This can be any region, - * also those which is not currently monitored. + * didDetermineStateForRegion is triggered. This can be any region, + * also those which is not currently monitored. * * This is done asynchronously and may not be immediately reflected in monitoredRegions. * * @param {Region} region An instance of {Region} which will be monitored * by the operating system. - * + * * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ @@ -534,8 +538,8 @@ export class IBeacon { /** * Queries the native layer to determine the current authorization in effect. - * - * @returns Returns a promise which is resolved with the + * + * @returns Returns a promise which is resolved with the * requested authorization status. */ @Cordova({sync: true}) @@ -563,16 +567,16 @@ export class IBeacon { @Cordova({sync: true}) static requestAlwaysAuthorization(): Promise { return; } - /** - * + /** + * * @returns Returns a promise which is resolved with an {Array} * of {Region} instances that are being monitored by the native layer. */ @Cordova({sync: true}) static getMonitoredRegions(): Promise { return; } - /** - * + /** + * * @returns Returns a promise which is resolved with an {Array} * of {Region} instances that are being ranged by the native layer. */ @@ -649,7 +653,7 @@ export class IBeacon { /** * Disables debug logging in the native layer. Use this method if you want * to prevent this plugin from writing to the device logs. - * + * * @returns Returns a promise which is resolved as soon as the * native layer has set the logging level accordingly. */ @@ -700,4 +704,4 @@ export class IBeacon { @Cordova({sync: true}) static appendToDeviceLog(message: string): Promise { return; } -} \ No newline at end of file +} From c6749404870cdfce6395801a93c09f4686682422 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:56:02 +0200 Subject: [PATCH 065/231] refactor(imagePicker): --- src/plugins/imagepicker.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index f4b1d7af..45bacc98 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -1,20 +1,21 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + export interface ImagePickerOptions { - // max images to be selected, defaults to 15. If this is set to 1, upon - // selection of a single image, the plugin will return it. - maximumImagesCount?: number; + // max images to be selected, defaults to 15. If this is set to 1, upon + // selection of a single image, the plugin will return it. + maximumImagesCount?: number; - // max width and height to allow the images to be. Will keep aspect - // ratio no matter what. So if both are 800, the returned image - // will be at most 800 pixels wide and 800 pixels tall. If the width is - // 800 and height 0 the image will be 800 pixels wide if the source - // is at least that wide. - width?: number; - height?: number; + // max width and height to allow the images to be. Will keep aspect + // ratio no matter what. So if both are 800, the returned image + // will be at most 800 pixels wide and 800 pixels tall. If the width is + // 800 and height 0 the image will be 800 pixels wide if the source + // is at least that wide. + width?: number; + height?: number; - // quality of resized image, defaults to 100 - quality?: number; + // quality of resized image, defaults to 100 + quality?: number; } /** @@ -55,4 +56,5 @@ export class ImagePicker { callbackOrder: 'reverse' }) static getPictures(options: ImagePickerOptions): Promise { return; } + } From 3f276580c65ec5f2f2232b7f403a4d3b6a6491c5 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:56:52 +0200 Subject: [PATCH 066/231] refactor(InAppBrowser): --- src/plugins/inappbrowser.ts | 172 ++++++++++++++++++------------------ 1 file changed, 87 insertions(+), 85 deletions(-) diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index 5ebb6153..75bf7722 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -1,85 +1,87 @@ -import {Plugin, Cordova} from './plugin'; - -export interface InAppBrowserEvent extends Event { - /** the eventname, either loadstart, loadstop, loaderror, or exit. */ - type: string; - /** the URL that was loaded. */ - url: string; - /** the error code, only in the case of loaderror. */ - code: number; - /** the error message, only in the case of loaderror. */ - message: string; -} - -export interface InAppBrowserRef { - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: string, callback: (event: InAppBrowserEvent) => void); - - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void); - - /** Closes the InAppBrowser window. */ - close(); - - /** - * Displays an InAppBrowser window that was opened hidden. Calling this has no effect - * if the InAppBrowser was already visible. - */ - show(); - - /** - * Injects JavaScript code into the InAppBrowser window. - * @param script Details of the script to run, specifying either a file or code key. - * @param callback The function that executes after the JavaScript code is injected. - * If the injected script is of type code, the callback executes with - * a single parameter, which is the return value of the script, wrapped in an Array. - * For multi-line scripts, this is the return value of the last statement, - * or the last expression evaluated. - */ - executeScript(script: {file?: string, code?: string}, callback?: (result?: any) => void); - - /** - * Injects CSS into the InAppBrowser window. - * @param css Details of the script to run, specifying either a file or code key. - * @param callback The function that executes after the CSS is injected. - */ - insertCSS(css: {file?: string, code?: string}, callback?: () => void); -} - -@Plugin({ - plugin: 'cordova-plugin-inappbrowser', - pluginRef: 'cordova.InAppBrowser' -}) -export class InAppBrowser { - - /** - * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. - * @param url The URL to load. - * @param target The target in which to load the URL, an optional parameter that defaults to _self. - * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes. - * The options string must not contain any blank space, and each feature's - * name/value pairs must be separated by a comma. Feature names are case insensitive. - */ - @Cordova({ - sync: true - }) - static open(url: string, target?: string, options?: string): InAppBrowserRef { return; } -} \ No newline at end of file +import { Cordova, Plugin } from './plugin'; + + +export interface InAppBrowserEvent extends Event { + /** the eventname, either loadstart, loadstop, loaderror, or exit. */ + type: string; + /** the URL that was loaded. */ + url: string; + /** the error code, only in the case of loaderror. */ + code: number; + /** the error message, only in the case of loaderror. */ + message: string; +} + +export interface InAppBrowserRef { + /** + * Adds a listener for an event from the InAppBrowser. + * @param type the event to listen for + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: string, callback: (event: InAppBrowserEvent) => void); + + /** + * Removes a listener for an event from the InAppBrowser. + * @param type The event to stop listening for. + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void); + + /** Closes the InAppBrowser window. */ + close(); + + /** + * Displays an InAppBrowser window that was opened hidden. Calling this has no effect + * if the InAppBrowser was already visible. + */ + show(); + + /** + * Injects JavaScript code into the InAppBrowser window. + * @param script Details of the script to run, specifying either a file or code key. + * @param callback The function that executes after the JavaScript code is injected. + * If the injected script is of type code, the callback executes with + * a single parameter, which is the return value of the script, wrapped in an Array. + * For multi-line scripts, this is the return value of the last statement, + * or the last expression evaluated. + */ + executeScript(script: { file?: string, code?: string }, callback?: (result?: any) => void); + + /** + * Injects CSS into the InAppBrowser window. + * @param css Details of the script to run, specifying either a file or code key. + * @param callback The function that executes after the CSS is injected. + */ + insertCSS(css: { file?: string, code?: string }, callback?: () => void); +} + +@Plugin({ + plugin: 'cordova-plugin-inappbrowser', + pluginRef: 'cordova.InAppBrowser' +}) +export class InAppBrowser { + + /** + * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. + * @param url The URL to load. + * @param target The target in which to load the URL, an optional parameter that defaults to _self. + * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes. + * The options string must not contain any blank space, and each feature's + * name/value pairs must be separated by a comma. Feature names are case insensitive. + */ + @Cordova({ + sync: true + }) + static open(url: string, target?: string, options?: string): InAppBrowserRef { return; } + +} From 77447975b26f0f72365e3de1f39e32c0dcc3a7dc Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:57:22 +0200 Subject: [PATCH 067/231] refactor(insomnia): --- src/plugins/insomnia.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/insomnia.ts b/src/plugins/insomnia.ts index 95238a66..95fb7238 100644 --- a/src/plugins/insomnia.ts +++ b/src/plugins/insomnia.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Insomnia @@ -44,4 +45,5 @@ export class Insomnia { */ @Cordova() static allowSleepAgain(): Promise { return; } + } From 24910aacee7c401bfa467fc6ad47db9ab815e335 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:58:05 +0200 Subject: [PATCH 068/231] refactor(keyboard): --- src/plugins/keyboard.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index 7c01269c..bda2758a 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -1,5 +1,6 @@ -import {Cordova, Plugin} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + /** * @name Keyboard @@ -34,7 +35,7 @@ export class Keyboard { sync: true, platforms: ['Android', 'BlackBerry 10', 'Windows'] }) - static show(): void {} + static show(): void { } /** * Close the keyboard if open. @@ -43,7 +44,7 @@ export class Keyboard { sync: true, platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] }) - static close(): void {} + static close(): void { } /** * Prevents the native UIScrollView from moving when an input is focused. @@ -53,7 +54,7 @@ export class Keyboard { sync: true, platforms: ['iOS', 'Windows'] }) - static disableScroll(disable: boolean): void {} + static disableScroll(disable: boolean): void { } /** * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch. @@ -63,7 +64,7 @@ export class Keyboard { event: 'native.keyboardshow', platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] }) - static onKeyboardShow(): Observable {return; } + static onKeyboardShow(): Observable { return; } /** * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch. @@ -73,6 +74,6 @@ export class Keyboard { event: 'native.keyboardhide', platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] }) - static onKeyboardHide(): Observable {return; } + static onKeyboardHide(): Observable { return; } } From 0231220c6f9e7b33702025c0149f9ef7e5e994b9 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:58:46 +0200 Subject: [PATCH 069/231] refactor(launchnavigator): --- src/plugins/launchnavigator.ts | 49 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index ae931918..a01326f3 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + export interface LaunchNavigatorOptions { @@ -15,7 +16,7 @@ export interface LaunchNavigatorOptions { /** * Start point of the navigation */ - start?: string|number[]; + start?: string | number[]; /** * nickname to display in app for start . e.g. "My House". @@ -98,52 +99,52 @@ export class LaunchNavigator { errorIndex: 2 }) static navigate( - destination: string|number[], + destination: string | number[], options?: LaunchNavigatorOptions - ): Promise { return; } + ): Promise { return; } /** * Determines if the given app is installed and available on the current device. * @param app {string} */ @Cordova() - static isAppAvailable(app: string): Promise {return; } + static isAppAvailable(app: string): Promise { return; } /** * Returns a list indicating which apps are installed and available on the current device. */ @Cordova() - static availableApps(): Promise {return; } + static availableApps(): Promise { return; } /** * Returns the display name of the specified app. * @param app {string} */ - @Cordova({sync: true}) - static getAppDisplayName(app: string): string {return; } + @Cordova({ sync: true }) + static getAppDisplayName(app: string): string { return; } /** * Returns list of supported apps on a given platform. * @param platform {string} */ - @Cordova({sync: true}) - static getAppsForPlatform(platform: string): string[] {return; } + @Cordova({ sync: true }) + static getAppsForPlatform(platform: string): string[] { return; } /** * Indicates if an app on a given platform supports specification of transport mode. * @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS` * @param platform {string} */ - @Cordova({sync: true}) - static supportsTransportMode(app: string, platform: string): boolean {return; } + @Cordova({ sync: true }) + static supportsTransportMode(app: string, platform: string): boolean { return; } /** * Returns the list of transport modes supported by an app on a given platform. * @param app {string} * @param platform {string} */ - @Cordova({sync: true}) - static getTransportModes(app: string, platform: string): string[] {return; } + @Cordova({ sync: true }) + static getTransportModes(app: string, platform: string): string[] { return; } /** * Indicates if an app on a given platform supports specification of launch mode. @@ -151,25 +152,25 @@ export class LaunchNavigator { * @param app {string} * @param platform {string} */ - @Cordova({sync: true}) - static supportsLaunchMode(app: string, platform: string): boolean {return; } + @Cordova({ sync: true }) + static supportsLaunchMode(app: string, platform: string): boolean { return; } /** * Indicates if an app on a given platform supports specification of start location. * @param app {string} * @param platform {string} */ - @Cordova({sync: true}) - static supportsStart(app: string, platform: string): boolean {return; } + @Cordova({ sync: true }) + static supportsStart(app: string, platform: string): boolean { return; } - @Cordova({sync: true}) - static supportsStartName(app: string, platform: string): boolean {return; } + @Cordova({ sync: true }) + static supportsStartName(app: string, platform: string): boolean { return; } - @Cordova({sync: true}) - static supportsDestName(app: string, platform: string): boolean {return; } + @Cordova({ sync: true }) + static supportsDestName(app: string, platform: string): boolean { return; } - @Cordova({sync: true}) - static userSelect(destination: string|number[], options: LaunchNavigatorOptions): void { } + @Cordova({ sync: true }) + static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { } static APP: any = { USER_SELECT: 'user_select', From 34e038d3ca06f0a224f643c46305576518121250 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:59:26 +0200 Subject: [PATCH 070/231] refactor(local-notification): --- src/plugins/localnotifications.ts | 42 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 585d1c8f..fd03199f 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -1,4 +1,6 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + + /** * @name Local Notifications * @description @@ -57,7 +59,7 @@ export class LocalNotifications { @Cordova({ sync: true }) - static schedule(options?: Notification|Array): void {} + static schedule(options?: Notification | Array): void { } /** * Updates a previously scheduled notification. Must include the id in the options parameter. @@ -66,14 +68,14 @@ export class LocalNotifications { @Cordova({ sync: true }) - static update(options?: Notification): void {} + static update(options?: Notification): void { } /** * Clears single or multiple notifications * @param notificationId A single notification id, or an array of notification ids. */ @Cordova() - static clear(notificationId: any): Promise {return; } + static clear(notificationId: any): Promise { return; } /** * Clears all notifications @@ -82,14 +84,14 @@ export class LocalNotifications { successIndex: 0, errorIndex: 2 }) - static clearAll(): Promise {return; } + static clearAll(): Promise { return; } /** * Cancels single or multiple notifications * @param notificationId A single notification id, or an array of notification ids. */ @Cordova() - static cancel(notificationId: any): Promise {return; } + static cancel(notificationId: any): Promise { return; } /** * Cancels all notifications @@ -98,85 +100,85 @@ export class LocalNotifications { successIndex: 0, errorIndex: 2 }) - static cancelAll(): Promise {return; } + static cancelAll(): Promise { return; } /** * Checks presence of a notification * @param notificationId */ @Cordova() - static isPresent (notificationId: number): Promise {return; } + static isPresent(notificationId: number): Promise { return; } /** * Checks is a notification is scheduled * @param notificationId */ @Cordova() - static isScheduled (notificationId: number): Promise {return; } + static isScheduled(notificationId: number): Promise { return; } /** * Checks if a notification is triggered * @param notificationId */ @Cordova() - static isTriggered (notificationId: number): Promise {return; } + static isTriggered(notificationId: number): Promise { return; } /** * Get all the notification ids */ @Cordova() - static getAllIds (): Promise> {return; } + static getAllIds(): Promise> { return; } /** * Get the ids of triggered notifications */ @Cordova() - static getTriggeredIds (): Promise> {return; } + static getTriggeredIds(): Promise> { return; } /** * Get the ids of scheduled notifications */ @Cordova() - static getScheduledIds (): Promise> {return; } + static getScheduledIds(): Promise> { return; } /** * Get a notification object * @param notificationId The id of the notification to get */ @Cordova() - static get (notificationId: any): Promise {return; } + static get(notificationId: any): Promise { return; } /** * Get a scheduled notification object * @param notificationId The id of the notification to get */ @Cordova() - static getScheduled (notificationId: any): Promise {return; } + static getScheduled(notificationId: any): Promise { return; } /** * Get a triggered notification object * @param notificationId The id of the notification to get */ @Cordova() - static getTriggered (notificationId: any): Promise {return; } + static getTriggered(notificationId: any): Promise { return; } /** * Get all notification objects */ @Cordova() - static getAll(): Promise> {return; } + static getAll(): Promise> { return; } /** * Get all scheduled notification objects */ @Cordova() - static getAllScheduled(): Promise> {return; } + static getAllScheduled(): Promise> { return; } /** * Get all triggered notification objects */ @Cordova() - static getAllTriggered(): Promise> {return; } + static getAllTriggered(): Promise> { return; } /** @@ -187,7 +189,7 @@ export class LocalNotifications { @Cordova({ sync: true }) - static on(eventName: string, callback: any): void {} + static on(eventName: string, callback: any): void { } } From 67917548742d74c94e46285162c337dbed5f10ea Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:00:11 +0200 Subject: [PATCH 071/231] refactor(media-capture): --- src/plugins/media-capture.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 4366dc51..668dc5c2 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -1,6 +1,9 @@ -import {Plugin, Cordova, CordovaProperty} from './plugin'; -import {Observable} from 'rxjs/Rx'; +import { Cordova, CordovaProperty, Plugin } from './plugin'; +import { Observable } from 'rxjs/Rx'; + + declare var navigator: any; + /** * @name Media Capture * @description @@ -59,7 +62,7 @@ export class MediaCapture { @Cordova({ callbackOrder: 'reverse' }) - static captureAudio(options?: CaptureAudioOptions): Promise {return; } + static captureAudio(options?: CaptureAudioOptions): Promise { return; } /** * Start the camera application and return information about captured image files. @@ -68,7 +71,7 @@ export class MediaCapture { @Cordova({ callbackOrder: 'reverse' }) - static captureImage(options?: CaptureImageOptions): Promise {return; } + static captureImage(options?: CaptureImageOptions): Promise { return; } /** * Start the video recorder application and return information about captured video clip files. @@ -77,7 +80,7 @@ export class MediaCapture { @Cordova({ callbackOrder: 'reverse' }) - static captureVideo(options?: CaptureVideoOptions): Promise {return; } + static captureVideo(options?: CaptureVideoOptions): Promise { return; } /** * is fired if the capture call is successful @@ -86,7 +89,7 @@ export class MediaCapture { eventObservable: true, event: 'pendingcaptureresult' }) - static onPendingCaptureResult(): Observable {return; } + static onPendingCaptureResult(): Observable { return; } /** * is fired if the capture call is unsuccessful @@ -95,7 +98,7 @@ export class MediaCapture { eventObservable: true, event: 'pendingcaptureerror' }) - static onPendingCaptureError(): Observable {return; } + static onPendingCaptureError(): Observable { return; } } /** From df1d42fa99f16397ea0f403772ce557265e4d771 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:00:56 +0200 Subject: [PATCH 072/231] refactor(media): --- src/plugins/media.ts | 49 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index 20898718..425e0ec7 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -1,6 +1,9 @@ -import {CordovaInstance, Plugin} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { CordovaInstance, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + + declare var Media: any; + /** * @name MediaPlugin * @description @@ -85,11 +88,11 @@ export class MediaPlugin { * Open a media file * @param src {string} A URI containing the audio content. */ - constructor (src: string) { + constructor(src: string) { let res, rej, next; - this.init = new Promise((resolve, reject) => {res = resolve; rej = reject; }); + this.init = new Promise((resolve, reject) => { res = resolve; rej = reject; }); this.status = new Observable((observer) => { - next = data => observer.next(data); + next = data => observer.next(data); }); this._objectInstance = new Media(src, res, rej, next); } @@ -98,13 +101,13 @@ export class MediaPlugin { * Returns the current amplitude of the current recording. */ @CordovaInstance() - getCurrentAmplitude (): Promise {return; } + getCurrentAmplitude(): Promise { return; } /** * Returns the current position within an audio file. Also updates the Media object's position parameter. */ @CordovaInstance() - getCurrentPosition (): Promise {return; } + getCurrentPosition(): Promise { return; } /** * Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. @@ -112,7 +115,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - getDuration (): number {return; } + getDuration(): number { return; } /** * Starts or resumes playing an audio file. @@ -120,10 +123,10 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - play (iosOptions?: { + play(iosOptions?: { numberOfLoops?: number, playAudioWhenScreenIsLocked?: boolean - }): void {} + }): void { } /** * Pauses playing an audio file. @@ -131,7 +134,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - pause (): void {} + pause(): void { } /** * Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed. @@ -139,7 +142,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - release (): void {} + release(): void { } /** * Sets the current position within an audio file. @@ -148,7 +151,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - seekTo (milliseconds: number): void {} + seekTo(milliseconds: number): void { } /** * Set the volume for an audio file. @@ -157,7 +160,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - setVolume (volume: number): void {} + setVolume(volume: number): void { } /** * Starts recording an audio file. @@ -165,7 +168,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - startRecord (): void {} + startRecord(): void { } /** @@ -174,7 +177,7 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - stopRecord (): void {} + stopRecord(): void { } /** @@ -183,17 +186,15 @@ export class MediaPlugin { @CordovaInstance({ sync: true }) - stop (): void {} - - + stop(): void { } } export class MediaError { - static get MEDIA_ERR_ABORTED () {return 1; } - static get MEDIA_ERR_NETWORK () {return 2; } - static get MEDIA_ERR_DECODE () {return 3; } - static get MEDIA_ERR_NONE_SUPPORTED () {return 4; } + static get MEDIA_ERR_ABORTED() { return 1; } + static get MEDIA_ERR_NETWORK() { return 2; } + static get MEDIA_ERR_DECODE() { return 3; } + static get MEDIA_ERR_NONE_SUPPORTED() { return 4; } code: number; message: string; -} \ No newline at end of file +} From 1e6937164894d07b018df66c01b0e806d7a51051 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:01:31 +0200 Subject: [PATCH 073/231] refactor(nativestorage): --- src/plugins/nativestorage.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 3a19ef6f..00399a1e 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -1,8 +1,10 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + + /** * @name Native Storage * @description - * + * * @usage * ```typescript * import {NativeStorage} from 'ionic-native'; @@ -53,4 +55,5 @@ export class NativeStorage { */ @Cordova() static clear(): Promise {return; } + } From 494d80e9de7ec8b335585e8b96b38d9ed7347a2a Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:02:13 +0200 Subject: [PATCH 074/231] refactor(network): --- src/plugins/network.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/network.ts b/src/plugins/network.ts index 43bbba3d..b1f3da4e 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova, CordovaProperty} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, CordovaProperty, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + declare var navigator: any; From 88e05d663a2d0e2085ccaa2be4973afac40f4939 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:03:03 +0200 Subject: [PATCH 075/231] refactor(OneSignal): --- src/plugins/onesignal.ts | 440 ++++++++++++++++++++------------------- 1 file changed, 221 insertions(+), 219 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index bf61be4c..d7041197 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name OneSignal @@ -18,236 +19,237 @@ import {Plugin, Cordova} from './plugin'; * OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba", * {googleProjectNumber: "703322744261"}, * notificationOpenedCallback); - * + * * OneSignal.enableInAppAlertNotification(true); * ``` * */ @Plugin({ - plugin: 'onesignal-cordova-plugin', - pluginRef: 'plugins.OneSignal', - repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK', - platforms: ['Android', 'iOS', 'Windows Phone 8'] + plugin: 'onesignal-cordova-plugin', + pluginRef: 'plugins.OneSignal', + repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK', + platforms: ['Android', 'iOS', 'Windows Phone 8'] }) export class OneSignal { - /** - * Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event. - * - * @param {appId} Your AppId from your OneSignal app - * @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option. - * @returns {Promise} Returns a Promise that resolves when remote notification was recieved. - */ - @Cordova() - static init(appId: string, - options: { - googleProjectNumber: string, - autoRegister: boolean - }): Promise { return; } - - - /** - * Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt. - * Only use if you passed false to autoRegister when calling init. - */ - @Cordova({ sync: true }) - static registerForPushNotifications(): void { } - - - /** - * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. - * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. - * - * @param {key} Key of your choosing to create or update. - * @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag. - */ - @Cordova({ sync: true }) - static sendTag(key: string, value: string): void { } - - /** - * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. - * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. - * - * @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"} - */ - @Cordova({ sync: true }) - static sendTags(json: any): void { } - - /** - * Retrieve a list of tags that have been set on the user from the OneSignal server. - * - * @returns {Promise} Returns a Promise that resolves when tags are recieved. - */ - @Cordova() - static getTags(): Promise { return; } - - /** - * Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one. - * - * @param {key} Key to remove. - */ - @Cordova({ sync: true }) - static deleteTag(key: string): void { } - - /** - * Deletes tags that were previously set on a user with `sendTag` or `sendTags`. - * - * @param {keys} Keys to remove. - */ - @Cordova({ sync: true }) - static deleteTags(keys: string[]): void { } - - /** - * Lets you retrieve the OneSignal user id and device token. - * Your handler is called after the device is successfully registered with OneSignal. - * - * @returns {Promise} Returns a Promise that reolves if the device was successfully registered. - * It returns a JSON with `userId`and `pushToken`. - */ - @Cordova() - static getIds(): Promise { return; } - - /** - * Warning: - * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications. - * - * By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode. - * Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode. - * - * @param {enable} false to disable vibrate, true to re-enable it. - */ - @Cordova({ sync: true }) - static enableVibrate(enable: boolean): void { } - - /** - * Warning: - * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications. - * - * By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on. - * Passing false means that the device will only vibrate unless the device is set to a total silent mode. - * - * @param {enable} false to disable sound, true to re-enable it. - */ - @Cordova({ sync: true }) - static enableSound(enable: boolean): void { } - - /** - * Warning: - * Only applies to Android and Amazon devices. - * - * By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired. - * If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification. - * - * @param {enable} enable - */ - @Cordova({ sync: true }) - static enableNotificationsWhenActive(enable: boolean): void { } - - /** - * By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired. - * If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app. - * The notificationOpenedCallback is then fired after the alert box is closed. - * - * @param {enable} enable - */ - @Cordova({ sync: true }) - static enableInAppAlertNotification(enable: boolean): void { } - - /** - * You can call this method with false to opt users out of receiving all notifications through OneSignal. - * You can pass true later to opt users back into notifications. - * - * @param {enable} enable - */ - @Cordova({ sync: true }) - static setSubscription(enable: boolean): void { } - - /** + /** + * Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event. * - * @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification) - * @returns {Promise} Returns a Promise that resolves if the notification was send successfully. + * @param {appId} Your AppId from your OneSignal app + * @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option. + * @returns {Promise} Returns a Promise that resolves when remote notification was recieved. */ - @Cordova() - static postNotification(notificationObj: { - app_id: string, - contents: any, - headings?: any, - isIos?: boolean, - isAndroid?: boolean, - isWP?: boolean, - isWP_WNS?: boolean, - isAdm?: boolean, - isChrome?: boolean, - isChromeWeb?: boolean, - isSafari?: boolean, - isAnyWeb?: boolean, - included_segments?: string[], - excluded_segments?: string[], - include_player_ids?: string[], - include_ios_tokens?: string[], - include_android_reg_ids?: string[], - include_wp_uris?: string[], - include_wp_wns_uris?: string[], - include_amazon_reg_ids?: string[], - include_chrome_reg_ids?: string[], - include_chrome_web_reg_ids?: string[], - app_ids?: string[]; - tags?: any[], - ios_badgeType?: string, - ios_badgeCount?: number, - ios_sound?: string, - android_sound?: string, - adm_sound?: string, - wp_sound?: string, - wp_wns_sound?: string, - data?: any, - buttons?: any, - small_icon?: string, - large_icon?: string, - big_picture?: string, - adm_small_icon?: string, - adm_large_icon?: string, - adm_big_picture?: string, - chrome_icon?: string, - chrome_big_picture?: string, - chrome_web_icon?: string, - firefox_icon?: string, - url?: string, - send_after?: string, - delayed_option?: string, - delivery_time_of_day?: string, - android_led_color?: string, - android_accent_color?: string, - android_visibility?: number, - content_available?: boolean, - amazon_background_data?: boolean, - template_id?: string, - android_group?: string, - android_group_message?: any, - adm_group?: string, - adm_group_message?: any, - ttl?: number, - priority?: number, - ios_category?: string + @Cordova() + static init(appId: string, + options: { + googleProjectNumber: string, + autoRegister: boolean }): Promise { return; } - /** - * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard. - */ - @Cordova({ sync: true }) - static promptLocation(): void { } - /** - * Enable logging to help debug if you run into an issue setting up OneSignal. - * The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose + /** + * Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt. + * Only use if you passed false to autoRegister when calling init. + */ + @Cordova({ sync: true }) + static registerForPushNotifications(): void { } + + + /** + * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. + * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. + * + * @param {key} Key of your choosing to create or update. + * @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag. + */ + @Cordova({ sync: true }) + static sendTag(key: string, value: string): void { } + + /** + * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. + * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. + * + * @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"} + */ + @Cordova({ sync: true }) + static sendTags(json: any): void { } + + /** + * Retrieve a list of tags that have been set on the user from the OneSignal server. + * + * @returns {Promise} Returns a Promise that resolves when tags are recieved. + */ + @Cordova() + static getTags(): Promise { return; } + + /** + * Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one. + * + * @param {key} Key to remove. + */ + @Cordova({ sync: true }) + static deleteTag(key: string): void { } + + /** + * Deletes tags that were previously set on a user with `sendTag` or `sendTags`. + * + * @param {keys} Keys to remove. + */ + @Cordova({ sync: true }) + static deleteTags(keys: string[]): void { } + + /** + * Lets you retrieve the OneSignal user id and device token. + * Your handler is called after the device is successfully registered with OneSignal. + * + * @returns {Promise} Returns a Promise that reolves if the device was successfully registered. + * It returns a JSON with `userId`and `pushToken`. + */ + @Cordova() + static getIds(): Promise { return; } + + /** + * Warning: + * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications. + * + * By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode. + * Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode. + * + * @param {enable} false to disable vibrate, true to re-enable it. + */ + @Cordova({ sync: true }) + static enableVibrate(enable: boolean): void { } + + /** + * Warning: + * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications. + * + * By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on. + * Passing false means that the device will only vibrate unless the device is set to a total silent mode. + * + * @param {enable} false to disable sound, true to re-enable it. + */ + @Cordova({ sync: true }) + static enableSound(enable: boolean): void { } + + /** + * Warning: + * Only applies to Android and Amazon devices. + * + * By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired. + * If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification. + * + * @param {enable} enable + */ + @Cordova({ sync: true }) + static enableNotificationsWhenActive(enable: boolean): void { } + + /** + * By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired. + * If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app. + * The notificationOpenedCallback is then fired after the alert box is closed. + * + * @param {enable} enable + */ + @Cordova({ sync: true }) + static enableInAppAlertNotification(enable: boolean): void { } + + /** + * You can call this method with false to opt users out of receiving all notifications through OneSignal. + * You can pass true later to opt users back into notifications. + * + * @param {enable} enable + */ + @Cordova({ sync: true }) + static setSubscription(enable: boolean): void { } + + /** + * + * @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification) + * @returns {Promise} Returns a Promise that resolves if the notification was send successfully. + */ + @Cordova() + static postNotification(notificationObj: { + app_id: string, + contents: any, + headings?: any, + isIos?: boolean, + isAndroid?: boolean, + isWP?: boolean, + isWP_WNS?: boolean, + isAdm?: boolean, + isChrome?: boolean, + isChromeWeb?: boolean, + isSafari?: boolean, + isAnyWeb?: boolean, + included_segments?: string[], + excluded_segments?: string[], + include_player_ids?: string[], + include_ios_tokens?: string[], + include_android_reg_ids?: string[], + include_wp_uris?: string[], + include_wp_wns_uris?: string[], + include_amazon_reg_ids?: string[], + include_chrome_reg_ids?: string[], + include_chrome_web_reg_ids?: string[], + app_ids?: string[]; + tags?: any[], + ios_badgeType?: string, + ios_badgeCount?: number, + ios_sound?: string, + android_sound?: string, + adm_sound?: string, + wp_sound?: string, + wp_wns_sound?: string, + data?: any, + buttons?: any, + small_icon?: string, + large_icon?: string, + big_picture?: string, + adm_small_icon?: string, + adm_large_icon?: string, + adm_big_picture?: string, + chrome_icon?: string, + chrome_big_picture?: string, + chrome_web_icon?: string, + firefox_icon?: string, + url?: string, + send_after?: string, + delayed_option?: string, + delivery_time_of_day?: string, + android_led_color?: string, + android_accent_color?: string, + android_visibility?: number, + content_available?: boolean, + amazon_background_data?: boolean, + template_id?: string, + android_group?: string, + android_group_message?: any, + adm_group?: string, + adm_group_message?: any, + ttl?: number, + priority?: number, + ios_category?: string + }): Promise { return; } + + /** + * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard. + */ + @Cordova({ sync: true }) + static promptLocation(): void { } + + /** + * Enable logging to help debug if you run into an issue setting up OneSignal. + * The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose + + * The higher the value the more information is shown. + * + * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages) + */ + @Cordova({ sync: true }) + static setLogLevel(logLevel: { + logLevel: number, + visualLevel: number + }): void { } - * The higher the value the more information is shown. - * - * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages) - */ - @Cordova({ sync: true }) - static setLogLevel(logLevel: { - logLevel: number, - visualLevel: number - }): void { } } From b329d9f36b2ec13b38aa66a4f6bef610bcc27370 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:03:30 +0200 Subject: [PATCH 076/231] refactor(pinDialog): --- src/plugins/pin-dialog.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/pin-dialog.ts b/src/plugins/pin-dialog.ts index bc6671fe..e6811376 100644 --- a/src/plugins/pin-dialog.ts +++ b/src/plugins/pin-dialog.ts @@ -1,4 +1,6 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + + /** * @name Pin Dialog * @description @@ -33,5 +35,6 @@ export class PinDialog { @Cordova({ successIndex: 1 }) - static prompt(message: string, title: string, buttons: string[]): Promise<{buttonIndex: number, input1: string}> {return; } + static prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number, input1: string }> { return; } + } From 8d82aff41fab558b6fcad971e5ec96f2fb4d142f Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:04:06 +0200 Subject: [PATCH 077/231] refactor(plugin): --- src/plugins/plugin.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 99b99c0e..eed38bac 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -1,4 +1,4 @@ -import {get} from '../util'; +import { get } from '../util'; declare var window; declare var Promise; @@ -36,7 +36,7 @@ export const cordovaWarn = function(pluginName: string, method: string) { 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'); 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'); }; -function setIndex (args: any[], opts: any= {}, resolve?: Function, reject?: Function): any { +function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any { // If the plugin method expects myMethod(success, err, options) if (opts.callbackOrder === 'reverse') { // Get those arguments in the order [resolve, reject, ...restOfArgs] @@ -55,10 +55,10 @@ 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); + args = setIndex(args, opts, resolve, reject); let pluginInstance = getPlugin(pluginObj.pluginRef); @@ -96,7 +96,7 @@ function getPromise(cb) { } } -function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) { +function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) { let pluginResult, rej; const p = getPromise((resolve, reject) => { pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject); @@ -106,7 +106,7 @@ 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(() => { }); rej(pluginResult.error); } return p; @@ -139,7 +139,7 @@ function callInstance(pluginObj: any, methodName: string, args: any[], opts: any return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args); } -function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) { +function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) { return (...args) => { if (opts.sync) { // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is @@ -172,7 +172,7 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) { * @param event * @returns {Observable} */ -function wrapEventObservable (event: string): Observable { +function wrapEventObservable(event: string): Observable { return new Observable(observer => { window.addEventListener(event, observer.next.bind(observer), false); return () => window.removeEventListener(event, observer.next.bind(observer), false); @@ -186,7 +186,7 @@ function wrapEventObservable (event: string): Observable { * @param opts * @returns {function(...[any]): (undefined|*|Observable|*|*)} */ -export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) { +export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) { return (...args) => { if (opts.sync) @@ -288,7 +288,7 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed let pluginInstance = getPlugin(pluginObj.pluginRef); if (!pluginInstance) { pluginWarn(this, key); - return { }; + return {}; } return originalMethod.apply(this, args); }; From 957fbd81939368769d7a74ddb59388c0054a9ce7 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:05:49 +0200 Subject: [PATCH 078/231] refactor(printer): --- src/plugins/printer.ts | 97 ++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts index cfa35ef1..93aa5b8c 100644 --- a/src/plugins/printer.ts +++ b/src/plugins/printer.ts @@ -1,64 +1,67 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + + declare var cordova: any; export interface PrintOptions { - /** - * The name of the print job and the document - */ - name?: string; + /** + * The name of the print job and the document + */ + name?: string; - /** - * The network URL of the printer. - * Only supported on iOS. - */ - printerId?: string; + /** + * The network URL of the printer. + * Only supported on iOS. + */ + printerId?: string; - /** - * Specifies the duplex mode to use for the print job. - * Either double-sided (duplex:true) or single-sided (duplex:false). - * Double-sided by default. - * Only supported on iOS - */ - duplex?: boolean; + /** + * Specifies the duplex mode to use for the print job. + * Either double-sided (duplex:true) or single-sided (duplex:false). + * Double-sided by default. + * Only supported on iOS + */ + duplex?: boolean; - /** - * The orientation of the printed content, portrait or landscape - * Portrait by default. - */ - landscape?: boolean; + /** + * The orientation of the printed content, portrait or landscape + * Portrait by default. + */ + landscape?: boolean; - /** - * If your application only prints black text, setting this property to true can result in better performance in many cases. - * False by default. - */ - grayscale?: boolean; + /** + * If your application only prints black text, setting this property to true can result in better performance in many cases. + * False by default. + */ + grayscale?: boolean; - /** - * The Size and position of the print view - */ - bounds?: number[] | any; + /** + * The Size and position of the print view + */ + bounds?: number[] | any; } @Plugin({ - plugin: 'de.appplant.cordova.plugin.printer', - pluginRef: 'cordova.plugins.printer', - repo: 'https://github.com/katzer/cordova-plugin-printer.git', - platforms: ['Android', 'iOS'] + plugin: 'de.appplant.cordova.plugin.printer', + pluginRef: 'cordova.plugins.printer', + repo: 'https://github.com/katzer/cordova-plugin-printer.git', + platforms: ['Android', 'iOS'] }) export class Printer { - /** - * Checks whether to device is capable of printing. - */ - @Cordova() - static isAvailable(): Promise { return; } + /** + * Checks whether to device is capable of printing. + */ + @Cordova() + static isAvailable(): Promise { return; } + + /** + * Sends content to the printer. + * @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used. + * @param {options} The options to pass to the printer + */ + @Cordova() + static print(content: string | HTMLElement, options?: PrintOptions): Promise { return; } - /** - * Sends content to the printer. - * @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used. - * @param {options} The options to pass to the printer - */ - @Cordova() - static print(content: string | HTMLElement, options?: PrintOptions): Promise { return; } } From c771abc8c3d50f6f7d56d41c7b3dca4d45dfa91f Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:06:40 +0200 Subject: [PATCH 079/231] refactor(push): --- src/plugins/push.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 42cb47d3..6cd38315 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error; @@ -265,7 +266,7 @@ export interface PushOptions { } declare var PushNotification: { - new(): PushNotification + new (): PushNotification }; /** From d46f22d2a18c0319de09b61f541b0313014e01f6 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:07:18 +0200 Subject: [PATCH 080/231] refactor(safariviewcontroller): --- src/plugins/safari-view-controller.ts | 92 ++++++++++++++------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index e6c80e9e..0580c16f 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name SafariViewController @@ -39,59 +40,60 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - plugin: 'cordova-plugin-safariviewcontroller', - pluginRef: 'SafariViewController', - platforms: ['iOS', 'Android'], - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller' + plugin: 'cordova-plugin-safariviewcontroller', + pluginRef: 'SafariViewController', + platforms: ['iOS', 'Android'], + repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller' }) export class SafariViewController { - /** - * Checks if SafariViewController is available - */ - @Cordova() - static isAvailable(): Promise {return; } + /** + * Checks if SafariViewController is available + */ + @Cordova() + static isAvailable(): Promise { return; } - /** - * Shows Safari View Controller - * @param options - */ - @Cordova() - static show(options?: SafariViewControllerOptions): Promise {return; } + /** + * Shows Safari View Controller + * @param options + */ + @Cordova() + static show(options?: SafariViewControllerOptions): Promise { return; } - /** - * Hides Safari View Controller - */ - @Cordova() - static hide(): void {} + /** + * Hides Safari View Controller + */ + @Cordova() + static hide(): void { } - /** - * Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below. - */ - @Cordova() - static connectToService(): Promise {return; } + /** + * Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below. + */ + @Cordova() + static connectToService(): Promise { return; } - /** - * Call this method whenever there's a chance the user will open an external url. - */ - @Cordova() - static warmUp(): Promise {return; } + /** + * Call this method whenever there's a chance the user will open an external url. + */ + @Cordova() + static warmUp(): Promise { return; } + + /** + * For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL. + * @param url + */ + @Cordova() + static mayLaunchUrl(url: string): Promise { return; } - /** - * For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL. - * @param url - */ - @Cordova() - static mayLaunchUrl(url: string): Promise {return; } } export interface SafariViewControllerOptions { - url?: string; - hidden?: boolean; - toolbarColor?: string; - animated?: boolean; - showDefaultShareMenuItem?: boolean; - enterReaderModeIfAvailable?: boolean; - tintColor?: string; - transition?: string; + url?: string; + hidden?: boolean; + toolbarColor?: string; + animated?: boolean; + showDefaultShareMenuItem?: boolean; + enterReaderModeIfAvailable?: boolean; + tintColor?: string; + transition?: string; } From 313b6952ae27ef2afbdb9f6d0763315b72934ca7 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:07:49 +0200 Subject: [PATCH 081/231] refactor(screenshot): --- src/plugins/screenshot.ts | 123 +++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index 710efc09..a712151b 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -1,60 +1,63 @@ -import {Cordova, Plugin} from './plugin'; -declare var navigator: any; -@Plugin({ - plugin: 'https://github.com/gitawego/cordova-screenshot.git', - pluginRef: 'navigator.screenshot', - repo: 'https://github.com/gitawego/cordova-screenshot.git' -}) -export class Screenshot { - -/** - * Takes screenshot and saves the image - * - * @param {string} format. Format can take the value of either 'jpg' or 'png' - * On ios, only 'jpg' format is supported - * @param {number} quality. Determines the quality of the screenshot. - * Default quality is set to 100. - * @param {string} filename. Name of the file as stored on the storage - */ - static save (format?: string, quality?: number, filename?: string): Promise { - return new Promise( - (resolve, reject) => { - navigator.screenshot.save( - (error, result) => { - if (error) { - reject(error); - }else { - resolve(result); - } - }, - format, - quality, - filename - ); - } - ); - } - -/** - * Takes screenshot and returns the image as an URI - * - * @param {number} quality. Determines the quality of the screenshot. - * Default quality is set to 100. - */ - static URI (quality?: number): Promise { - return new Promise( - (resolve, reject) => { - navigator.screenshot.URI( - (error, result) => { - if (error) { - reject(error); - }else { - resolve(result); - } - }, - quality - ); - } - ); - } -} +import { Cordova, Plugin } from './plugin'; + + +declare var navigator: any; + +@Plugin({ + plugin: 'https://github.com/gitawego/cordova-screenshot.git', + pluginRef: 'navigator.screenshot', + repo: 'https://github.com/gitawego/cordova-screenshot.git' +}) +export class Screenshot { + + /** + * Takes screenshot and saves the image + * + * @param {string} format. Format can take the value of either 'jpg' or 'png' + * On ios, only 'jpg' format is supported + * @param {number} quality. Determines the quality of the screenshot. + * Default quality is set to 100. + * @param {string} filename. Name of the file as stored on the storage + */ + static save(format?: string, quality?: number, filename?: string): Promise { + return new Promise( + (resolve, reject) => { + navigator.screenshot.save( + (error, result) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }, + format, + quality, + filename + ); + } + ); + } + + /** + * Takes screenshot and returns the image as an URI + * + * @param {number} quality. Determines the quality of the screenshot. + * Default quality is set to 100. + */ + static URI(quality?: number): Promise { + return new Promise( + (resolve, reject) => { + navigator.screenshot.URI( + (error, result) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }, + quality + ); + } + ); + } +} From fea162a4683106c4e05b497cddc10b3c749663ea Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:08:17 +0200 Subject: [PATCH 082/231] refactor(sim): --- src/plugins/sim.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts index 7155cb7a..21f6dace 100644 --- a/src/plugins/sim.ts +++ b/src/plugins/sim.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Sim From 45cf787625d8465cbe300ab34c5eaf43f21d1987 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:09:07 +0200 Subject: [PATCH 083/231] refactor(sms): --- src/plugins/sms.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index a2bc2e7c..4e705e46 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * Options for sending an SMS @@ -60,6 +61,6 @@ export class SMS { phoneNumber: string | string[], message: string, options?: SmsOptions - ): Promise { return; } + ): Promise { return; } } From c98f0fb125db50530f3c1fb50c48ffc4fdda6fb9 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:10:11 +0200 Subject: [PATCH 084/231] refactor(socialsharing): --- src/plugins/socialsharing.ts | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index c6053bad..dfe532cb 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Social Sharing @@ -20,7 +21,6 @@ import {Plugin, Cordova} from './plugin'; }) export class SocialSharing { - /** * Shares using the share sheet * @param message {string} The message you would like to share. @@ -29,7 +29,7 @@ export class SocialSharing { * @param url {string} A URL to share */ @Cordova() - static share (message?: string, subject?: string, file?: string|Array, url?: string): Promise {return; } + static share(message?: string, subject?: string, file?: string | Array, url?: string): Promise { return; } /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) @@ -38,7 +38,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareWithOptions (options: { message?: string, subject?: string, file?: string|Array, url?: string, chooserTitle?: string }): Promise {return; } + static shareWithOptions(options: { message?: string, subject?: string, file?: string | Array, url?: string, chooserTitle?: string }): Promise { return; } /** * Checks if you can share via a specific app. @@ -47,7 +47,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static canShareVia (appName: string): Promise {return; } + static canShareVia(appName: string): Promise { return; } /** * Shares directly to Twitter @@ -58,7 +58,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaTwitter (message: string, image?: string, url?: string): Promise {return; } + static shareViaTwitter(message: string, image?: string, url?: string): Promise { return; } /** * Shares directly to Facebook @@ -69,7 +69,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaFacebook (message: string, image?: string, url?: string): Promise {return; } + static shareViaFacebook(message: string, image?: string, url?: string): Promise { return; } /** @@ -82,7 +82,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaFacebookWithPasteMessageHint (message: string, image?: string, url?: string, pasteMessageHint?: string): Promise {return; } + static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise { return; } /** * Shares directly to Instagram @@ -92,7 +92,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaInstagram (message: string, image: string): Promise {return; } + static shareViaInstagram(message: string, image: string): Promise { return; } /** * Shares directly to WhatsApp @@ -103,7 +103,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaWhatsApp (message: string, image?: string, url?: string): Promise {return; } + static shareViaWhatsApp(message: string, image?: string, url?: string): Promise { return; } /** * Shares directly to a WhatsApp Contact @@ -115,7 +115,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaWhatsAppToReceiver (receiver: string, message: string, image?: string, url?: string): Promise {return; } + static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise { return; } /** * Share via SMS @@ -125,7 +125,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaSMS(messge: string, phoneNumber: string): Promise {return; } + static shareViaSMS(messge: string, phoneNumber: string): Promise { return; } /** * Share via Email @@ -139,7 +139,6 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaEmail(message: string, subject: string, to: Array, cc: Array, bcc: Array, files: string|Array): Promise {return; } - + static shareViaEmail(message: string, subject: string, to: Array, cc: Array, bcc: Array, files: string | Array): Promise { return; } } From 13f10f7e19731fac0554b745374fed7ac4eefacb Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:11:04 +0200 Subject: [PATCH 085/231] refactor(spinnerDialog): --- src/plugins/spinnerdialog.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/spinnerdialog.ts b/src/plugins/spinnerdialog.ts index b577ee57..cd39c3cb 100644 --- a/src/plugins/spinnerdialog.ts +++ b/src/plugins/spinnerdialog.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Spinner Dialog @@ -22,7 +23,6 @@ import {Plugin, Cordova} from './plugin'; }) export class SpinnerDialog { - /** * Shows the spinner dialog * @param title {string} Spinner title (shows on Android only) From 499e89e254d3227e43d712812cf2a8decb82dae9 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:11:35 +0200 Subject: [PATCH 086/231] refactor(splashscreen): --- src/plugins/splashscreen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/splashscreen.ts b/src/plugins/splashscreen.ts index 695c6d0b..1879b84b 100644 --- a/src/plugins/splashscreen.ts +++ b/src/plugins/splashscreen.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name Splashscreen @@ -37,4 +38,4 @@ export class Splashscreen { }) static hide(): void {} -} \ No newline at end of file +} From 9c25244bc64209744fb244685b034a99924feea4 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:21:04 +0200 Subject: [PATCH 087/231] refactor(SQLite): --- src/plugins/sqlite.ts | 225 +++++++++++++++++++++--------------------- 1 file changed, 114 insertions(+), 111 deletions(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 8d37a967..74225643 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -1,5 +1,8 @@ -import {CordovaInstance, Plugin, Cordova} from './plugin'; +import { Cordova, CordovaInstance, Plugin } from './plugin'; + + declare var sqlitePlugin; + /** * @name SQLite * @@ -34,142 +37,142 @@ declare var sqlitePlugin; }) export class SQLite { - private _objectInstance: any; - get databaseFeatures(): any { - return this._objectInstance.databaseFeatures; - } + private _objectInstance: any; + get databaseFeatures(): any { + return this._objectInstance.databaseFeatures; + } - constructor () {} + constructor() { } - /** - * Open or create a SQLite database file. - * - * See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database - * - * @param config the config for opening the database. - * @usage - * - * ```ts - * import { SQLite } from 'ionic-native'; - * - * let db = new SQLite(); - * db.openDatabase({ - * name: 'data.db', - * location: 'default' // the location field is required - * }).then(() => { - * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => { - * - * }, (err) => { - * console.error('Unable to execute sql', err); - * }) - * }, (err) => { - * console.error('Unable to open database', err); - * }); - * ``` - */ - openDatabase (config: any): Promise { - return new Promise((resolve, reject) => { - sqlitePlugin.openDatabase(config, db => { - this._objectInstance = db; - resolve(db); - }, error => { - console.warn(error); - reject(error); - }); + /** + * Open or create a SQLite database file. + * + * See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database + * + * @param config the config for opening the database. + * @usage + * + * ```ts + * import { SQLite } from 'ionic-native'; + * + * let db = new SQLite(); + * db.openDatabase({ + * name: 'data.db', + * location: 'default' // the location field is required + * }).then(() => { + * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => { + * + * }, (err) => { + * console.error('Unable to execute sql', err); + * }) + * }, (err) => { + * console.error('Unable to open database', err); + * }); + * ``` + */ + openDatabase(config: any): Promise { + return new Promise((resolve, reject) => { + sqlitePlugin.openDatabase(config, db => { + this._objectInstance = db; + resolve(db); + }, error => { + console.warn(error); + reject(error); }); - } + }); + } - @CordovaInstance({ - sync: true - }) - addTransaction (transaction: any): void {} + @CordovaInstance({ + sync: true + }) + addTransaction(transaction: any): void { } - @CordovaInstance() - transaction (fn: any): Promise {return; } + @CordovaInstance() + transaction(fn: any): Promise { return; } - @CordovaInstance() - readTransaction (fn: any): Promise {return; } + @CordovaInstance() + readTransaction(fn: any): Promise { return; } - @CordovaInstance({ - sync: true - }) - startNextTransaction (): void {} + @CordovaInstance({ + sync: true + }) + startNextTransaction(): void { } - @CordovaInstance() - close (): Promise {return; } + @CordovaInstance() + close(): Promise { return; } - @CordovaInstance({ - sync: true - }) - start (): void {} + @CordovaInstance({ + sync: true + }) + start(): void { } - /** - * Execute SQL on the opened database. Note, you must call `openDatabase` first, and - * ensure it resolved and successfully opened the database. - * - * @usage - * - * ```ts - * db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => { - * // Access the items through resultSet.rows - * // resultSet.rows.item(i) - * }, (err) => {}) - * ``` - */ - @CordovaInstance() - executeSql (statement: string, params: any): Promise {return; } + /** + * Execute SQL on the opened database. Note, you must call `openDatabase` first, and + * ensure it resolved and successfully opened the database. + * + * @usage + * + * ```ts + * db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => { + * // Access the items through resultSet.rows + * // resultSet.rows.item(i) + * }, (err) => {}) + * ``` + */ + @CordovaInstance() + executeSql(statement: string, params: any): Promise { return; } - @CordovaInstance() - addSatement (sql, values): Promise {return; } + @CordovaInstance() + addSatement(sql, values): Promise { return; } - @CordovaInstance() - sqlBatch (sqlStatements: any): Promise {return; } + @CordovaInstance() + sqlBatch(sqlStatements: any): Promise { return; } - @CordovaInstance({ - sync: true - }) - abortallPendingTransactions (): void {} + @CordovaInstance({ + sync: true + }) + abortallPendingTransactions(): void { } - @CordovaInstance({ - sync: true - }) - handleStatementSuccess (handler, response): void {} + @CordovaInstance({ + sync: true + }) + handleStatementSuccess(handler, response): void { } - @CordovaInstance({ - sync: true - }) - handleStatementFailure (handler, response): void {} + @CordovaInstance({ + sync: true + }) + handleStatementFailure(handler, response): void { } - @CordovaInstance({ - sync: true - }) - run (): void {} + @CordovaInstance({ + sync: true + }) + run(): void { } - @CordovaInstance({ - sync: true - }) - abort (txFailure): void {} + @CordovaInstance({ + sync: true + }) + abort(txFailure): void { } - @CordovaInstance({ - sync: true - }) - finish (): void {} + @CordovaInstance({ + sync: true + }) + finish(): void { } - @CordovaInstance({ - sync: true - }) - abortFromQ (sqlerror): void {} + @CordovaInstance({ + sync: true + }) + abortFromQ(sqlerror): void { } - @Cordova() - static echoTest (): Promise {return; } + @Cordova() + static echoTest(): Promise { return; } - @Cordova() - static deleteDatabase (first): Promise {return; } + @Cordova() + static deleteDatabase(first): Promise { return; } } From f461a0f9bbee2a0d204679753ded512a71f1d951 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:21:19 +0200 Subject: [PATCH 088/231] refactor(toast): --- src/plugins/toast.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 2606a330..7a6a50ba 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -1,5 +1,6 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + export interface ToastOptions { /** From 70b30a390f075fefdca77e16cabf2c6c9ed6d59c Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:21:38 +0200 Subject: [PATCH 089/231] refactor(StatusBar): --- src/plugins/statusbar.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index b9a42e5d..0307b5cc 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova, CordovaProperty} from './plugin'; +import { Cordova, CordovaProperty, Plugin } from './plugin'; + declare var window; @@ -37,7 +38,7 @@ export class StatusBar { @Cordova({ sync: true }) - static overlaysWebView(doesOverlay: boolean) {}; + static overlaysWebView(doesOverlay: boolean) { }; /** * Use the default statusbar (dark text, for light backgrounds). @@ -45,7 +46,7 @@ export class StatusBar { @Cordova({ sync: true }) - static styleDefault() {}; + static styleDefault() { }; /** * Use the lightContent statusbar (light text, for dark backgrounds). @@ -53,7 +54,7 @@ export class StatusBar { @Cordova({ sync: true }) - static styleLightContent() {}; + static styleLightContent() { }; /** * Use the blackTranslucent statusbar (light text, for dark backgrounds). @@ -61,7 +62,7 @@ export class StatusBar { @Cordova({ sync: true }) - static styleBlackTranslucent() {}; + static styleBlackTranslucent() { }; /** * Use the blackOpaque statusbar (light text, for dark backgrounds). @@ -69,7 +70,7 @@ export class StatusBar { @Cordova({ sync: true }) - static styleBlackOpaque() {}; + static styleBlackOpaque() { }; /** * Set the status bar to a specific named color. Valid options: @@ -82,7 +83,7 @@ export class StatusBar { @Cordova({ sync: true }) - static backgroundColorByName(colorName: string) {}; + static backgroundColorByName(colorName: string) { }; /** * Set the status bar to a specific hex color (CSS shorthand supported!). @@ -94,7 +95,7 @@ export class StatusBar { @Cordova({ sync: true }) - static backgroundColorByHexString(hexString: string) {}; + static backgroundColorByHexString(hexString: string) { }; /** * Hide the StatusBar @@ -102,7 +103,7 @@ export class StatusBar { @Cordova({ sync: true }) - static hide() {}; + static hide() { }; /** * Show the StatusBar @@ -110,11 +111,12 @@ export class StatusBar { @Cordova({ sync: true }) - static show() {}; + static show() { }; /** * Whether the StatusBar is currently visible or not. */ @CordovaProperty static get isVisible() { return window.StatusBar.isVisible; } + } From 81a0696e70579feb8160ac43b16fbf26b3b877b2 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:22:05 +0200 Subject: [PATCH 090/231] refactor(TouchID): --- src/plugins/touchid.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index 86d0ccaf..bf963286 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + /** * @name TouchID @@ -82,4 +83,5 @@ export class TouchID { */ @Cordova() static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise { return; } + } From 6c0aaa643ec301036d5a64a9c5e522fb59a32bb3 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:22:30 +0200 Subject: [PATCH 091/231] refactor(vibration): --- src/plugins/vibration.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/vibration.ts b/src/plugins/vibration.ts index 910c6a8c..43c56a3c 100644 --- a/src/plugins/vibration.ts +++ b/src/plugins/vibration.ts @@ -1,4 +1,6 @@ -import {Plugin, Cordova} from './plugin'; +import { Cordova, Plugin } from './plugin'; + + /** * @name Vibration * @description Vibrates the device @@ -37,6 +39,6 @@ export class Vibration { @Cordova({ sync: true }) - static vibrate(time: number|Array) {} + static vibrate(time: number | Array) { } -} \ No newline at end of file +} From 68db707f7bbca9077143d42aec0f444f0f758303 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 20:23:02 +0200 Subject: [PATCH 092/231] refactor(webintent): --- src/plugins/webintent.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/plugins/webintent.ts b/src/plugins/webintent.ts index 6c679847..8c642394 100644 --- a/src/plugins/webintent.ts +++ b/src/plugins/webintent.ts @@ -1,5 +1,8 @@ -import {Cordova, CordovaProperty, Plugin} from './plugin'; +import { Cordova, CordovaProperty, Plugin } from './plugin'; + + declare var window; + /** * @name WebIntent * @description @@ -15,31 +18,31 @@ declare var window; export class WebIntent { @CordovaProperty - static get ACTION_VIEW () { + static get ACTION_VIEW() { return window.plugins.webintent.ACTION_VIEW; } @CordovaProperty - static get EXTRA_TEXT () { + static get EXTRA_TEXT() { return window.plugins.webintent.EXTRA_TEXT; } @Cordova() - static startActivity (options: {action: any, url: string}): Promise {return; } + static startActivity(options: { action: any, url: string }): Promise { return; } @Cordova() - static hasExtra (extra: any): Promise {return; } + static hasExtra(extra: any): Promise { return; } @Cordova() - static getExtra (extra: any): Promise {return; } + static getExtra(extra: any): Promise { return; } @Cordova() - static getUri (): Promise {return; }; + static getUri(): Promise { return; }; @Cordova() - static onNewIntent(): Promise {return; }; + static onNewIntent(): Promise { return; }; @Cordova() - static sendBroadcast(options: {action: string, extras?: {option: boolean}}): Promise {return; } + static sendBroadcast(options: { action: string, extras?: { option: boolean } }): Promise { return; } } From 074d16605d609e8d6adbbe26d46244d4ae0a0ae2 Mon Sep 17 00:00:00 2001 From: Job Date: Mon, 18 Jul 2016 04:35:38 +0200 Subject: [PATCH 093/231] fix(contacts): missing name property, types (#320) --- src/plugins/contacts.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index e079b69c..4c3665f2 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -7,7 +7,7 @@ export interface IContactProperties { /** The name of this Contact, suitable for display to end users. */ displayName?: string; /** An object containing all components of a persons name. */ - name?: ContactName; + name?: IContactName; /** A casual name by which to address the contact. */ nickname?: string; /** An array of all the contact's phone numbers. */ @@ -15,11 +15,11 @@ export interface IContactProperties { /** An array of all the contact's email addresses. */ emails?: IContactField[]; /** An array of all the contact's addresses. */ - addresses?: ContactAddress[]; + addresses?: IContactAddress[]; /** An array of all the contact's IM addresses. */ ims?: IContactField[]; /** An array of all the contact's organizations. */ - organizations?: ContactOrganization[]; + organizations?: IContactOrganization[]; /** The birthday of the contact. */ birthday?: Date; /** A note about the contact. */ @@ -36,16 +36,17 @@ export interface IContactProperties { /** * @private */ -export class Contact { +export class Contact implements IContactProperties { private _objectInstance: any; @InstanceProperty get id(): string {return; } @InstanceProperty get displayName(): string {return; } - @InstanceProperty get nickname(): ContactName {return; } - @InstanceProperty get phoneNumbers(): string {return; } + @InstanceProperty get name(): IContactName {return; } + @InstanceProperty get nickname(): string {return; } + @InstanceProperty get phoneNumbers(): IContactField[] {return; } @InstanceProperty get emails(): IContactField[] {return; } - @InstanceProperty get addresses(): ContactAddress[] {return; } + @InstanceProperty get addresses(): IContactAddress[] {return; } @InstanceProperty get ims(): IContactField[] {return; } - @InstanceProperty get organizations(): ContactOrganization[] {return; } + @InstanceProperty get organizations(): IContactOrganization[] {return; } @InstanceProperty get birthday(): Date {return; } @InstanceProperty get note(): string {return; } @InstanceProperty get photos(): IContactField[] {return; } From 1b161d8c9e8155bb88983ea9a82f4063386a6d0b Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 17 Jul 2016 23:01:03 -0400 Subject: [PATCH 094/231] fix(geolocation): handle errors on watchPosition closes #322 --- src/plugins/geolocation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 60d28a7e..06ffd8d8 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -154,7 +154,7 @@ export class Geolocation { static watchPosition(options?: GeolocationOptions): Observable { return new Observable( (observer: any) => { - let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), options); + let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.error.bind(observer), options); return () => navigator.geolocation.clearWatch(watchId); } ); From 445570c241841d68ba81cfcf2a7abb6d9de3f823 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 23:12:09 -0400 Subject: [PATCH 095/231] 1.3.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b349181..e48b7fa6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.6", + "version": "1.3.7", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From f0bb4cfeff8f69b6d074eae0d8f02273bf2fda85 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 23:12:52 -0400 Subject: [PATCH 096/231] chore(changelog): update changelog --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80112298..42e5d64a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +## [1.3.7](https://github.com/driftyco/ionic-native/compare/v1.3.6...v1.3.7) (2016-07-18) + + +### Bug Fixes + +* **contacts:** missing name property, types ([#320](https://github.com/driftyco/ionic-native/issues/320)) ([074d166](https://github.com/driftyco/ionic-native/commit/074d166)) +* **geolocation:** handle errors on watchPosition ([1b161d8](https://github.com/driftyco/ionic-native/commit/1b161d8)), closes [#322](https://github.com/driftyco/ionic-native/issues/322) + + +### Features + +* **sim:** Add sim plugin ([#317](https://github.com/driftyco/ionic-native/issues/317)) ([4f85110](https://github.com/driftyco/ionic-native/commit/4f85110)) + + + ## [1.3.6](https://github.com/driftyco/ionic-native/compare/v1.3.5...v1.3.6) (2016-07-17) From 5afcbfc4bf40ef272de52ae7467fe0f74fe806e8 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 18 Jul 2016 00:08:21 -0400 Subject: [PATCH 097/231] minor fix' --- src/plugins/globalization.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index af21271d..1fb4b023 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -40,7 +40,7 @@ export class Globalization { */ @Cordova({ successIndex: 1, - errorIndex 2 + errorIndex: 2 }) static dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; } From f982b401660af3a798a929f3b2a5af5177dffd17 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Mon, 18 Jul 2016 06:09:38 +0200 Subject: [PATCH 098/231] chore(tslint-rules): Use ionic-tslint-rules (#276) * chore(tslint-rules): Use ionic-tslint-rules * chore(tslint): Use ionic-gulp-tslint --- gulpfile.js | 8 ++----- package.json | 3 ++- tslint.json | 63 ++-------------------------------------------------- 3 files changed, 6 insertions(+), 68 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index e7ae4090..30898341 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,7 @@ var gulp = require('gulp'); var minimist = require('minimist'); var uglify = require('gulp-uglify'); var rename = require("gulp-rename"); -var tslint = require('gulp-tslint'); +var tslint = require('ionic-gulp-tslint'); var flagConfig = { string: ['port', 'version', 'ngVersion', 'animations'], @@ -25,8 +25,4 @@ gulp.task("minify:dist", function(){ .pipe(gulp.dest('./dist')); }); -gulp.task("tslint", function(){ - gulp.src("src/**/*.ts") - .pipe(tslint()) - .pipe(tslint.report('verbose')); -}); +gulp.task('lint', tslint); diff --git a/package.json b/package.json index e48b7fa6..f1de9ed3 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "gulp-rename": "^1.2.2", "gulp-tslint": "^5.0.0", "gulp-uglify": "^1.5.4", + "ionic-gulp-tslint": "^1.0.0", "lodash": "3.10.1", "minimist": "^1.1.3", "mkdirp": "^0.5.1", @@ -30,7 +31,7 @@ "q": "1.4.1", "semver": "^5.0.1", "tslint": "^3.8.1", - "tslint-eslint-rules": "^1.3.0", + "tslint-ionic-rules": "0.0.3", "typescript": "^1.8.10" }, "scripts": { diff --git a/tslint.json b/tslint.json index ca17685f..aa8b53d9 100644 --- a/tslint.json +++ b/tslint.json @@ -1,62 +1,3 @@ { - "rulesDirectory": "node_modules/tslint-eslint-rules/dist/rules", - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-var-keyword": false, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "single" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "no-inner-declarations": [ - true, - "functions" - ] - } -} \ No newline at end of file + "extends": "tslint-ionic-rules" +} From 57725828a6b4d781e7d89a5a35f77ae977ac90b1 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 18 Jul 2016 00:13:13 -0400 Subject: [PATCH 099/231] chore(build): update lint command --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f1de9ed3..1133a9df 100644 --- a/package.json +++ b/package.json @@ -36,9 +36,9 @@ }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "tslint": "./node_modules/.bin/gulp tslint", + "lint": "./node_modules/.bin/gulp lint", "watch": "./node_modules/.bin/tsc -w", - "build": "npm run tslint && npm run build:js && npm run build:bundle && npm run build:minify", + "build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify", "build:js": "./node_modules/.bin/tsc", "build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js", "build:minify": "./node_modules/.bin/gulp minify:dist", From 006bc70387afb9677e5bbc4be5c13dc8830cfc1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wado=C5=84?= Date: Mon, 18 Jul 2016 12:34:31 +0200 Subject: [PATCH 100/231] fix(sqlite): fix method attribute typo (#324) --- src/plugins/sqlite.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 74225643..c4dfc722 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -123,7 +123,7 @@ export class SQLite { executeSql(statement: string, params: any): Promise { return; } @CordovaInstance() - addSatement(sql, values): Promise { return; } + addStatement(sql, values): Promise { return; } @CordovaInstance() sqlBatch(sqlStatements: any): Promise { return; } From f59570e39d5bb73a8d38432a8a13f6441274a450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wado=C5=84?= Date: Mon, 18 Jul 2016 14:04:49 +0200 Subject: [PATCH 101/231] refactor(camera): set properties as public (#326) * Change static fields from default (private) to public * Move methods below primitve * Stay @private in docs due to prevent the docs generator from documenting them --- src/plugins/camera.ts | 148 +++++++++++++++++++++--------------------- 1 file changed, 73 insertions(+), 75 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index d62b9cea..de625cbb 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -111,6 +111,79 @@ export interface CameraPopoverOptions { platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu'] }) export class Camera { + /** + * @private + * @enum {number} + */ + public static DestinationType = { + /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */ + DATA_URL: 0, + /** Return file uri (content://media/external/images/media/2 for Android) */ + FILE_URI: 1, + /** Return native uri (eg. asset-library://... for iOS) */ + NATIVE_URI: 2 + }; + + /** + * @private + * @enum {number} + */ + public static EncodingType = { + /** Return JPEG encoded image */ + JPEG: 0, + /** Return PNG encoded image */ + PNG: 1 + }; + /** + * @private + * @enum {number} + */ + public static MediaType = { + /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */ + PICTURE: 0, + /** Allow selection of video only, ONLY RETURNS URL */ + VIDEO: 1, + /** Allow selection from all media types */ + ALLMEDIA: 2 + }; + + /** + * @private + * @enum {number} + */ + public static PictureSourceType = { + /** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */ + PHOTOLIBRARY: 0, + /** Take picture from camera */ + CAMERA: 1, + /** Choose image from picture library (same as PHOTOLIBRARY for Android) */ + SAVEDPHOTOALBUM: 2 + }; + + /** + * @private + * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover. + * @enum {number} + */ + public static PopoverArrowDirection = { + ARROW_UP: 1, + ARROW_DOWN: 2, + ARROW_LEFT: 4, + ARROW_RIGHT: 8, + ARROW_ANY: 15 + }; + + /** + * @private + * @enum {number} + */ + public static Direction = { + /** Use the back-facing camera */ + BACK: 0, + /** Use the front-facing camera */ + FRONT: 1 + }; + /** * Take a picture or video, or load one from the library. * @param {CameraOptions} options Options that you want to pass to the camera. Encoding type, quality, etc. @@ -131,79 +204,4 @@ export class Camera { }) static cleanup() { }; - /** - * @private - * @enum {number} - */ - static DestinationType = { - /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */ - DATA_URL: 0, - /** Return file uri (content://media/external/images/media/2 for Android) */ - FILE_URI: 1, - /** Return native uri (eg. asset-library://... for iOS) */ - NATIVE_URI: 2 - }; - - /** - * @private - * @enum {number} - */ - static EncodingType = { - /** Return JPEG encoded image */ - JPEG: 0, - /** Return PNG encoded image */ - PNG: 1 - }; - /** - * @private - * @enum {number} - */ - static MediaType = { - /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */ - PICTURE: 0, - /** Allow selection of video only, ONLY RETURNS URL */ - VIDEO: 1, - /** Allow selection from all media types */ - ALLMEDIA: 2 - }; - - /** - * @private - * @enum {number} - */ - static PictureSourceType = { - /** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */ - PHOTOLIBRARY: 0, - /** Take picture from camera */ - CAMERA: 1, - /** Choose image from picture library (same as PHOTOLIBRARY for Android) */ - SAVEDPHOTOALBUM: 2 - }; - - /** - * @private - * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover. - * @enum {number} - */ - static PopoverArrowDirection = { - ARROW_UP: 1, - ARROW_DOWN: 2, - ARROW_LEFT: 4, - ARROW_RIGHT: 8, - ARROW_ANY: 15 - }; - - /** - * @private - * @enum {number} - */ - static Direction = { - /** Use the back-facing camera */ - BACK: 0, - /** Use the front-facing camera */ - FRONT: 1 - }; - } - - From 0aee6c88cea499f762bd84ab3bce0572d98984c5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 18 Jul 2016 10:51:39 -0400 Subject: [PATCH 102/231] feat(otherPromise): can work better with plugins that return promises (#304) --- src/plugins/plugin.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index eed38bac..0e04679a 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -112,6 +112,16 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any return p; } +function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) { + return getPromise((resolve, reject) => { + let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts); + if (pluginResult && pluginResult.error) { + reject(pluginResult.error); + } + pluginResult.then(resolve).catch(reject); + }); +} + function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) { return new Observable(observer => { let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer)); @@ -199,6 +209,9 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) else if (opts.eventObservable && opts.event) return wrapEventObservable(opts.event); + else if (opts.otherPromise) + return wrapOtherPromise(pluginObj, methodName, args, opts); + else return wrapPromise(pluginObj, methodName, args, opts); }; From 5979e9a8b0918ab0a2e930b7f7536c7865e7371f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 18 Jul 2016 11:39:53 -0400 Subject: [PATCH 103/231] refactor(plugin): refreactor to match tslint rules --- src/plugins/plugin.ts | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 0e04679a..77d39f13 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -22,8 +22,11 @@ export const getPlugin = function(pluginRef: string): any { */ export const pluginWarn = function(pluginObj: any, method: string) { let pluginName = pluginObj.name, plugin = pluginObj.plugin; - if (method) 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.'); + if (method) { + 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('Install the ' + pluginName + ' plugin: \'ionic plugin add ' + plugin + '\''); }; @@ -33,8 +36,11 @@ export const pluginWarn = function(pluginObj: any, method: string) { * @param method */ export const cordovaWarn = function(pluginName: string, method: string) { - 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'); - 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'); + 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'); + } 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'); + } }; function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any { // If the plugin method expects myMethod(success, err, options) @@ -169,6 +175,11 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) { } }; }); + } else if (opts.otherPromise) { + return getPromise((resolve, reject) => { + let result = callInstance(pluginObj, methodName, args, opts, resolve, reject); + result.then(resolve, reject); + }); } else { return getPromise((resolve, reject) => { callInstance(pluginObj, methodName, args, opts, resolve, reject); @@ -198,22 +209,18 @@ function wrapEventObservable(event: string): Observable { */ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) { return (...args) => { - - if (opts.sync) + if (opts.sync) { // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is return callCordovaPlugin(pluginObj, methodName, args, opts); - - else if (opts.observable) + } else if (opts.observable) { return wrapObservable(pluginObj, methodName, args, opts); - - else if (opts.eventObservable && opts.event) + } else if (opts.eventObservable && opts.event) { return wrapEventObservable(opts.event); - - else if (opts.otherPromise) + } else if (opts.otherPromise) { return wrapOtherPromise(pluginObj, methodName, args, opts); - - else + } else { return wrapPromise(pluginObj, methodName, args, opts); + } }; }; From a8fa61ddb94bd7bf0ef09a7cf3aed0e91cad4b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wado=C5=84?= Date: Tue, 19 Jul 2016 10:28:48 +0200 Subject: [PATCH 104/231] docs(filetransfer): Improve docs for FileTransferError and wrap existing usage in ts (#329) * Improve docs for FileTransferError and wrap existing usage in ts * Add closing code tag * Doubled space between param name and description --- src/plugins/filetransfer.ts | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 85d7844c..372e20f7 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -107,19 +107,32 @@ export interface FileTransferError { /** * @name Transfer - * @description This plugin allows you to upload and download files. - * Example: + * + * @description + * This plugin allows you to upload and download files. + * + * @usage + * * Create instance: + * ```ts * const fileTransfer = new Transfer(); + * ``` * * Upload a file: + * ```ts * fileTransfer.upload(..).then(..).catch(..); + * ``` * * Download a file: + * ```ts * fileTransfer.download(..).then(..).catch(..); + * ``` * * Abort active transfer: + * ```ts * fileTransfer.abort(); + * ``` + * */ @Plugin({ plugin: 'cordova-plugin-file-transfer', @@ -128,11 +141,23 @@ export interface FileTransferError { }) export class Transfer { - public static FILE_NOT_FOUND_ERR: number = 1; - public static INVALID_URL_ERR: number = 2; - public static CONNECTION_ERR: number = 3; - public static ABORT_ERR: number = 4; - public static NOT_MODIFIED_ERR: number = 4; + /** + * Error code rejected from upload with FileTransferError + * Defined in FileTransferError. + * FILE_NOT_FOUND_ERR: 1 Return when file was not found + * INVALID_URL_ERR: 2, Return when url was invalid + * CONNECTION_ERR: 3, Return on connection error + * ABORT_ERR: 4, Return on aborting + * NOT_MODIFIED_ERR: 5 Return on "304 Not Modified" HTTP response + * @enum {number} + */ + public static FileTransferErrorCode = { + FILE_NOT_FOUND_ERR: 1, + INVALID_URL_ERR: 2, + CONNECTION_ERR: 3, + ABORT_ERR: 4, + NOT_MODIFIED_ERR: 5 + }; private _objectInstance: any; @@ -146,7 +171,7 @@ export class Transfer { * @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 {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. * @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError. */ @CordovaInstance({ From 5807dd7f09d9b94b80b9cfc8a0fc03caff365338 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Wed, 20 Jul 2016 11:45:00 +0200 Subject: [PATCH 105/231] feat(social-sharing): add canShareViaEmail (#333) * - Add support for canShareViaEmail - Make the following parameters in shareViaEmail method optional: cc, bcc, files - Add usage for canShareViaEmail and shareViaEmail - Fix some formatting to be more consistent - Fix pluginRef * Fix import --- src/plugins/socialsharing.ts | 51 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index dfe532cb..1f8178ff 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -1,35 +1,44 @@ import { Cordova, Plugin } from './plugin'; - /** * @name Social Sharing * @description * Share text, files, images, and links via social networks, sms, and email. * @usage - * ```js + * ```ts * import {SocialSharing} from 'ionic-native'; * - * ... - * // TODO add usage info + * // Check if sharing via email is supported + * SocialSharing.canShareViaEmail().then(() => { + * // Sharing via email is possible + * }).catch(() => { + * // Sharing via email is not possible + * }); + * + * // Share via email + * SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => { + * // Success! + * }).catch(() => { + * // Error! + * }); * ``` */ @Plugin({ plugin: 'cordova-plugin-x-socialsharing', - pluginRef: 'window.plugins.socialsharing', + pluginRef: 'plugins.socialsharing', repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin', platforms: ['iOS', 'Android', 'Windows Phone'] }) export class SocialSharing { - /** * Shares using the share sheet * @param message {string} The message you would like to share. * @param subject {string} The subject - * @param file {string|Array} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone. + * @param file {string|string[]} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone. * @param url {string} A URL to share */ @Cordova() - static share(message?: string, subject?: string, file?: string | Array, url?: string): Promise { return; } + static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise { return; } /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) @@ -38,7 +47,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareWithOptions(options: { message?: string, subject?: string, file?: string | Array, url?: string, chooserTitle?: string }): Promise { return; } + static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise { return; } /** * Checks if you can share via a specific app. @@ -128,17 +137,25 @@ export class SocialSharing { static shareViaSMS(messge: string, phoneNumber: string): Promise { return; } /** - * Share via Email - * @param message {string} - * @param subject {string} - * @param to {Array} - * @param cc {Array} - * @param bcc {Array} - * @param files {string|Array} URL or local path to file(s) to attach + * Checks if you can share via email */ @Cordova({ platforms: ['iOS', 'Android'] }) - static shareViaEmail(message: string, subject: string, to: Array, cc: Array, bcc: Array, files: string | Array): Promise { return; } + static canShareViaEmail(): Promise { return; } + + /** + * Share via Email + * @param message {string} + * @param subject {string} + * @param to {string[]} + * @param cc {string[]} + * @param bcc {string[]} + * @param files {string|string[]} URL or local path to file(s) to attach + */ + @Cordova({ + platforms: ['iOS', 'Android'] + }) + static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise { return; } } From 979838f4b7a24c441445b363daf798923568ce37 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 20 Jul 2016 05:55:20 -0400 Subject: [PATCH 106/231] feat(twitter-connect): add twitter connect plugin closes #308 --- src/index.ts | 3 +++ src/plugins/twitter-connect.ts | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/plugins/twitter-connect.ts diff --git a/src/index.ts b/src/index.ts index 45a511cb..5b5902ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -72,6 +72,7 @@ import {StatusBar} from './plugins/statusbar'; import {ThreeDeeTouch} from './plugins/3dtouch'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; +import {TwitterConnect} from './plugins/twitter-connect'; import {Vibration} from './plugins/vibration'; import {WebIntent} from './plugins/webintent'; export * from './plugins/3dtouch'; @@ -145,6 +146,7 @@ export { StatusBar, TouchID, Transfer, + TwitterConnect, Vibration, WebIntent } @@ -220,6 +222,7 @@ window['IonicNative'] = { Toast: Toast, TouchID: TouchID, Transfer: Transfer, + TwitterConnect: TwitterConnect, Vibration: Vibration, WebIntent: WebIntent }; diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts new file mode 100644 index 00000000..b9310ab3 --- /dev/null +++ b/src/plugins/twitter-connect.ts @@ -0,0 +1,45 @@ +import { Plugin, Cordova } from './plugin'; +/** + * @name Twitter Connect + * @description + * Plugin to use Twitter Single Sign On + * Uses Twitter's Fabric SDK + */ +@Plugin({ + plugin: 'twitter-connect-plugin', + pluginRef: 'TwitterConnect', + repo: '', + install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=' +}) +export class TwitterConnect { + /** + * Logs in + * @return {Promise} returns a promise that resolves if logged in and rejects if failed to login + */ + @Cordova() + static login(): Promise {return; } + /** + * Logs out + * @return {Promise} returns a promise that resolves if logged out and rejects if failed to logout + */ + @Cordova() + static logout(): Promise {return; } +} +export interface TwitterConnectResponse { + /** + * Twitter Username + */ + userName: string; + /** + * Twitter User ID + */ + userId: string; + /** + * Twitter OAuth Secret + */ + secret: string; + /** + * Twitter OAuth Token + */ + token: string; +} From 8b27bed4df9754c0cd775ca62fb82a0df34ffc6a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 20 Jul 2016 07:10:01 -0400 Subject: [PATCH 107/231] feat(facebook): add FacebookLoginResponse interface --- src/plugins/facebook.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 4beeee6e..2b6867e3 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -113,10 +113,10 @@ export class Facebook { * ``` * * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in. - * @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. + * @return {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. */ @Cordova() - static login(permissions: string[]): Promise { return; } + static login(permissions: string[]): Promise { return; } /** * Logout of Facebook. @@ -246,3 +246,14 @@ export class Facebook { picture: string }): Promise { return; } } +export interface FacebookLoginResponse { + status: string; + authResponse: { + session_key: boolean; + accessToken: string; + expiresIn: number; + sig: string; + secret: string; + userID: string; + }; +} From d4bee49678cc1bf2ea9771f8800555fd4442dca9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 20 Jul 2016 07:12:44 -0400 Subject: [PATCH 108/231] fix(base64togallery): update plugin wrapper to match latest version closes #335 --- src/plugins/base64togallery.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index a5cc2d2a..b55be642 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -24,11 +24,11 @@ export class Base64ToGallery { /** * Converts a base64 string to an image file in the device gallery * @param {string} data The actual base64 string that you want to save - * @param {string} prefix Prefix the file with a string. Default is 'img_'. Optional. + * @param {any} options (optional) An object with properties: prefix, mediaScanner * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova() - static base64ToGallery(data: string, prefix?: string): Promise { + static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise { return; } From a279ee02e01c81233e3736b2544b53443f372d42 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 20 Jul 2016 07:13:11 -0400 Subject: [PATCH 109/231] 1.3.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1133a9df..5e0ca258 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.7", + "version": "1.3.8", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From d4d30ab9c995a31b91de8293cbb98e6db2a2dcc5 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 20 Jul 2016 07:13:34 -0400 Subject: [PATCH 110/231] chore(changelog): update changelog --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42e5d64a..758b7498 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ + +## [1.3.8](https://github.com/driftyco/ionic-native/compare/v1.3.7...v1.3.8) (2016-07-20) + + +### Bug Fixes + +* **base64togallery:** update plugin wrapper to match latest version ([d4bee49](https://github.com/driftyco/ionic-native/commit/d4bee49)), closes [#335](https://github.com/driftyco/ionic-native/issues/335) +* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70)), closes [#324](https://github.com/driftyco/ionic-native/issues/324) + + +### Features + +* **facebook:** add FacebookLoginResponse interface ([8b27bed](https://github.com/driftyco/ionic-native/commit/8b27bed)) +* **otherPromise:** can work better with plugins that return promises ([#304](https://github.com/driftyco/ionic-native/issues/304)) ([0aee6c8](https://github.com/driftyco/ionic-native/commit/0aee6c8)) +* **social-sharing:** add canShareViaEmail ([#333](https://github.com/driftyco/ionic-native/issues/333)) ([5807dd7](https://github.com/driftyco/ionic-native/commit/5807dd7)) +* **twitter-connect:** add twitter connect plugin ([979838f](https://github.com/driftyco/ionic-native/commit/979838f)), closes [#308](https://github.com/driftyco/ionic-native/issues/308) + + + ## [1.3.7](https://github.com/driftyco/ionic-native/compare/v1.3.6...v1.3.7) (2016-07-18) From 7952f9ef606647f26b68cb5f67d978f4a0fef53c Mon Sep 17 00:00:00 2001 From: Guillermo Date: Wed, 20 Jul 2016 17:17:09 +0200 Subject: [PATCH 111/231] Improvements on documentation (#340) * Improvements on documentation and some refactor * ts | js -> typescript (docs) --- README.md | 2 +- src/plugins/3dtouch.ts | 11 +++-- src/plugins/actionsheet.ts | 8 ++-- src/plugins/appavailability.ts | 14 +++--- src/plugins/apprate.ts | 4 +- src/plugins/appversion.ts | 4 +- src/plugins/background-geolocation.ts | 5 +-- src/plugins/backgroundmode.ts | 5 ++- src/plugins/badge.ts | 5 ++- src/plugins/barcodescanner.ts | 4 +- src/plugins/base64togallery.ts | 8 ++-- src/plugins/batterystatus.ts | 7 ++- src/plugins/ble.ts | 10 ++--- src/plugins/bluetoothserial.ts | 14 +++--- src/plugins/brightness.ts | 6 ++- src/plugins/calendar.ts | 1 + src/plugins/camera-preview.ts | 61 ++++++++++++++------------- src/plugins/camera.ts | 8 ++-- src/plugins/card-io.ts | 5 ++- src/plugins/clipboard.ts | 13 +++--- src/plugins/contacts.ts | 14 +++--- src/plugins/datepicker.ts | 9 ++-- src/plugins/dbmeter.ts | 11 +++-- src/plugins/deeplinks.ts | 5 ++- src/plugins/device.ts | 6 +-- src/plugins/deviceaccounts.ts | 1 + src/plugins/devicemotion.ts | 12 +++--- src/plugins/deviceorientation.ts | 11 +++-- src/plugins/diagnostic.ts | 1 + src/plugins/dialogs.ts | 4 +- src/plugins/emailcomposer.ts | 6 +-- src/plugins/facebook.ts | 8 ++-- src/plugins/filetransfer.ts | 18 +++----- src/plugins/flashlight.ts | 4 +- src/plugins/geolocation.ts | 15 +++---- src/plugins/globalization.ts | 5 +-- src/plugins/google-plus.ts | 4 +- src/plugins/googlemaps.ts | 4 +- src/plugins/hotspot.ts | 13 +++--- src/plugins/ibeacon.ts | 12 +++--- src/plugins/imagepicker.ts | 7 ++- src/plugins/insomnia.ts | 5 ++- src/plugins/keyboard.ts | 4 +- src/plugins/launchnavigator.ts | 10 ++--- src/plugins/localnotifications.ts | 19 ++++----- src/plugins/media-capture.ts | 3 +- src/plugins/media.ts | 12 +++--- src/plugins/nativestorage.ts | 2 +- src/plugins/network.ts | 10 ++--- src/plugins/onesignal.ts | 11 ++--- src/plugins/pin-dialog.ts | 5 +-- src/plugins/plugin.ts | 4 +- src/plugins/push.ts | 23 +++++----- src/plugins/safari-view-controller.ts | 11 +++-- src/plugins/sim.ts | 8 ++-- src/plugins/sms.ts | 8 ++-- src/plugins/socialsharing.ts | 5 ++- src/plugins/spinnerdialog.ts | 5 +-- src/plugins/splashscreen.ts | 5 +-- src/plugins/sqlite.ts | 12 +++--- src/plugins/statusbar.ts | 5 +-- src/plugins/toast.ts | 7 ++- src/plugins/touchid.ts | 14 +++--- src/plugins/twitter-connect.ts | 2 + src/plugins/vibration.ts | 5 +-- 65 files changed, 281 insertions(+), 279 deletions(-) diff --git a/README.md b/README.md index 2da5cf8e..e2d56841 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ For the full Ionic Native documentation, please visit [http://ionicframework.com Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754), providing a common interface for all plugins and ensuring that native events trigger change detection in Angular 2. ``` -import {Geolocation} from 'ionic-native'; +import { Geolocation } from 'ionic-native'; Geolocation.getCurrentPosition().then(pos => { console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude); diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 61e81c4d..bbbc9d22 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -10,13 +10,13 @@ declare var window: any; * @usage * Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient. * ``` - * import {ThreeDeeTouch} from 'ionic-native'; + * import { ThreeDeeTouch } from 'ionic-native'; * * // import for type completion on variables - * import {ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native'; + * import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native'; * ... * - * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)): + * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)); * * ThreeDeeTouch.watchForceTouches() * .subscribe( @@ -57,7 +57,7 @@ declare var window: any; * ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe( * (payload) => { * // returns an object that is the button you presed - * console.log(`Pressed the ${payload.title} button`) + * console.log('Pressed the ${payload.title} button') * console.log(payload.type) * * } @@ -130,13 +130,16 @@ export class ThreeDeeTouch { sync: true }) static disableLinkPreview(): void { } + } + export interface ThreeDeeTouchQuickAction { type?: string; title: string; subtitle?: string; iconType?: string; } + export interface ThreeDeeTouchForceTouch { force: number; timestamp: number; diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 5c7738a9..8edd3204 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -9,8 +9,9 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet). * * @usage - * ```ts - * import {ActionSheet} from 'ionic-native'; + * ```typescript + * import { ActionSheet } from 'ionic-native'; + * * * let buttonLabels = ['Share via Facebook', 'Share via Twitter']; * ActionSheet.show({ @@ -18,7 +19,7 @@ import { Cordova, Plugin } from './plugin'; * 'buttonLabels': buttonLabels, * 'addCancelButtonWithLabel': 'Cancel', * 'addDestructiveButtonWithLabel' : 'Delete' - * }).then(buttonIndex => { + * }).then((buttonIndex: number) => { * console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]); * }); * ``` @@ -72,4 +73,5 @@ export class ActionSheet { */ @Cordova() static hide(options?: any): Promise { return; } + } diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index cf0ffd41..58232e20 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -8,22 +8,22 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability). * * @usage - * ```js - * import {AppAvailability} from 'ionic-native'; + * ```typescript + * import { AppAvailability } from 'ionic-native'; * * - * var app; + * let app; * - * if(device.platform === 'iOS') { + * if (device.platform === 'iOS') { * app = 'twitter://'; - * }else if(device.platform === 'Android'){ + * } else if (device.platform === 'Android') { * app = 'com.twitter.android'; * } * * AppAvailability.check(app) * .then( - * yes => console.log(app + " is available"), - * no => console.log(app + " is NOT available") + * (yes: string) => console.log(app + ' is available'), + * (no: string) => console.log(app + ' is NOT available') * ); * ``` */ diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 876d3535..9dbe8d6d 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -11,8 +11,8 @@ declare var window; * Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate). * * @usage - * ```js - * import {AppRate} from 'ionic-native'; + * ```typescript + * import { AppRate } from 'ionic-native'; * * * AppRate.preferences.storeAppURL.ios = ''; diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 9932af27..644f9657 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version). * * @usage - * ```js - * import {AppVersion} from 'ionic-native'; + * ```typescript + * import { AppVersion } from 'ionic-native'; * * * AppVersion.getAppName(); diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 7bd45799..fe183067 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -162,9 +162,8 @@ export interface Config { * * @usage * - * ```ts - * import {BackgroundGeolocation} from 'ionic-native'; - * + * ```typescript + * import { BackgroundGeolocation } from 'ionic-native'; * * * // When device is ready : diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index f1b9c56f..309509a3 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -6,8 +6,8 @@ import { Cordova, Plugin } from './plugin'; * Cordova plugin to prevent the app from going to sleep while in background. * Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization *@usage -* ```js -* import {BackgroundMode} from 'ionic-native'; +* ```typescript +* import { BackgroundMode } from 'ionic-native'; * * BackgroundMode.enable(); * ``` @@ -91,6 +91,7 @@ export class BackgroundMode { sync: true }) static on(eventName: string, callback: any): void { } + } /** diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index f29ee2bc..c188d273 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge). * * @usage - * ```js - * import {Badge} from 'ionic-native'; + * ```typescript + * import { Badge } from 'ionic-native'; * * * Badge.set(10); @@ -74,4 +74,5 @@ export class Badge { */ @Cordova() static registerPermission(): Promise { return; } + } diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index c00aad09..b6bb0e07 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * * @usage - * ```js - * import {BarcodeScanner} from 'ionic-native'; + * ```typescript + * import { BarcodeScanner } from 'ionic-native'; * * * BarcodeScanner.scan().then((barcodeData) => { diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index b55be642..f4b86f00 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -3,13 +3,13 @@ import { Cordova, Plugin } from './plugin'; * @name Base64 To Gallery * @description This plugin allows you to save base64 data as a png image into the device * @usage - * ```ts - * import {Base64ToGallery} from 'ionic-native'; + * ```typescript + * import { Base64ToGallery } from 'ionic-native'; * * * Base64ToGallery.base64ToGallery(base64Data, 'img_').then( - * res => console.log("Saved image to gallery ", res), - * err => console.log("Error saving image to gallery ", err) + * res => console.log('Saved image to gallery ', res), + * err => console.log('Error saving image to gallery ', err) * ); * ``` */ diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index cf19c658..c70beae6 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -7,14 +7,13 @@ import { Observable } from 'rxjs/Observable'; * Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status). * * @usage - * ```js - * import {BatteryStatus} from 'ionic-native'; - * + * ```typescript + * import { BatteryStatus } from 'ionic-native'; * * * // watch change in battery status * let subscription = BatteryStatus.onChange().subscribe( - * status => { + * (status: StatusObject) => { * console.log(status.level, status.isPlugged); * } * ); diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 5a7657f2..6df9f2f6 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -24,7 +24,7 @@ import { Observable } from 'rxjs/Observable'; * * Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning. * - * ```ts + * ```typescript * { * "name": "Battery Demo", * "id": "20:FF:D0:FF:D1:C0", @@ -34,7 +34,7 @@ import { Observable } from 'rxjs/Observable'; * ``` * After connecting, the peripheral object also includes service, characteristic and descriptor information. * - * ```ts + * ```typescript * { * "name": "Battery Demo", * "id": "20:FF:D0:FF:D1:C0", @@ -93,7 +93,7 @@ import { Observable } from 'rxjs/Observable'; * * ### Android * - * ```ts + * ```typescript * { * "name": "demo", * "id": "00:1A:7D:DA:71:13", @@ -108,7 +108,7 @@ import { Observable } from 'rxjs/Observable'; * * Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future. * - * ```ts + * ```typescript * { * "name": "demo", * "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802", @@ -137,7 +137,7 @@ import { Observable } from 'rxjs/Observable'; * * This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving. * - * ```ts + * ```typescript * // ASCII only * function stringToBytes(string) { * var array = new Uint8Array(string.length); diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index bfef832e..069fed3f 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -5,12 +5,15 @@ import { Observable } from 'rxjs/Observable'; * @name Bluetooth Serial * @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino. * @usage - * ```ts + * ```typescript + * import { BluetoothSerial } from 'ionic-native'; + * + * * // Write a string - * Bluetooth.write("hello world").then(success, failure); + * BluetoothSerial.write("hello world").then(success, failure); * * // Array of int or bytes - * Bluetooth.write([186, 220, 222]).then(success, failure); + * BluetoothSerial.write([186, 220, 222]).then(success, failure); * * // Typed Array * var data = new Uint8Array(4); @@ -18,10 +21,10 @@ import { Observable } from 'rxjs/Observable'; * data[1] = 0x42; * data[2] = 0x43; * data[3] = 0x44; - * Bluetooth.write(data).then(success, failure); + * BluetoothSerial.write(data).then(success, failure); * * // Array Buffer - * Bluetooth.write(data.buffer).then(success, failure); + * BluetoothSerial.write(data.buffer).then(success, failure); * ``` */ @Plugin({ @@ -218,4 +221,5 @@ export class BluetoothSerial { sync: true }) static setDiscoverable(discoverableDuration: number): void { } + } diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts index bf50fbbe..934379e7 100644 --- a/src/plugins/brightness.ts +++ b/src/plugins/brightness.ts @@ -8,8 +8,9 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness). * * @usage - * ```ts - * import {Brightness} from 'ionic-native'; + * ```typescript + * import { Brightness } from 'ionic-native'; + * * * let brightnessValue: number = 0.8; * Brightness.setBrightness(brightnessValue); @@ -47,4 +48,5 @@ export class Brightness { */ @Cordova() static setKeepScreenOn(value: boolean): void { } + } diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 82f144d6..0435427b 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -417,4 +417,5 @@ export class Calendar { */ @Cordova() static openCalendar(date: Date): Promise { return; } + } diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 72cf1b2d..c6038eef 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -1,30 +1,31 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + export interface CameraPreviewOptions { - x: number; - y: number; - width: number; - height: number; - /** - * Choose the camera to use (front- or back-facing). - * 'front' for front camera - * 'rear' for rear camera - */ - camera: string; - /** Take photo on tap */ - tapPhoto: boolean; - /** */ - previewDrag: boolean; - /** */ - toBack: boolean; - /** Alpha use when toBack is set to true */ - alpha: number; + x: number; + y: number; + width: number; + height: number; + /** + * Choose the camera to use (front- or back-facing). + * 'front' for front camera + * 'rear' for rear camera + */ + camera: string; + /** Take photo on tap */ + tapPhoto: boolean; + /** */ + previewDrag: boolean; + /** */ + toBack: boolean; + /** Alpha use when toBack is set to true */ + alpha: number; } export interface CameraPreviewSize { - maxWidth: number; - maxHeight: number; + maxWidth: number; + maxHeight: number; } /** @@ -50,7 +51,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static startCamera(options: CameraPreviewOptions): void {}; + static startCamera(options: CameraPreviewOptions): void { }; /** * Stops the camera preview instance. @@ -58,7 +59,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static stopCamera(): void {}; + static stopCamera(): void { }; /** * Take the picture, the parameter size is optional @@ -66,7 +67,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static takePicture(size: CameraPreviewSize): void {}; + static takePicture(size: CameraPreviewSize): void { }; /** * Register a callback function that receives the original picture and the image captured from the preview box. @@ -82,7 +83,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static switchCamera(): void {}; + static switchCamera(): void { }; /** * Show the camera preview box. @@ -90,7 +91,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static show(): void {}; + static show(): void { }; /** * Hide the camera preview box. @@ -98,7 +99,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static hide(): void {}; + static hide(): voi { }; /** * Set the default mode for the Flash. @@ -106,7 +107,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static setFlashMode(mode: number): void {}; + static setFlashMode(mode: number): void { }; /** * Set camera color effect. @@ -114,7 +115,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static setColorEffect(effect: string): void {}; + static setColorEffect(effect: string): void { }; /** * @private diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index de625cbb..dd2ba531 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -93,14 +93,16 @@ export interface CameraPopoverOptions { * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera). * * @usage - * ```js - * import {Camera} from 'ionic-native'; + * ```typescript + * import { Camera } from 'ionic-native'; + * * * Camera.getPicture(options).then((imageData) => { * // imageData is either a base64 encoded string or a file URI * // If it's base64: - * let base64Image = "data:image/jpeg;base64," + imageData; + * let base64Image = 'data:image/jpeg;base64,' + imageData; * }, (err) => { + * // Handle error * }); * ``` */ diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index f6fc26e7..ef695278 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -1,13 +1,13 @@ import { Cordova, Plugin } from './plugin'; + /** * @name CardIO * @description * @usage * ``` - * import {CardIO} from 'ionic-native'; + * import { CardIO } from 'ionic-native'; * - * ... * * CardIO.canScan() * .then( @@ -51,6 +51,7 @@ export class CardIO { */ @Cordova() static version(): Promise { return; } + } export interface CardIOOptions { diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 0fccfa4f..77e50219 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -10,19 +10,18 @@ import { Cordova, Plugin } from './plugin'; * For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git). * * @usage - * ```js - * import {Clipboard} from 'ionic-native'; + * ```typescript + * import { Clipboard } from 'ionic-native'; * * - * - * Clipboard.copy("Hello world"); + * Clipboard.copy('Hello world'); * * Clipboard.paste().then( - * (resolve : string) => { + * (resolve: string) => { * alert(resolve); * }, - * (reject : string) => { - * alert("Error: " + reject); + * (reject: string) => { + * alert('Error: ' + reject); * } * ); * ); diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index dabd0628..ee5335c4 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -1,4 +1,4 @@ -import { Cordova, CordovaInstance, Plugin, InstanceProperty } from './plugin'; +import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin'; declare var window: any, @@ -257,16 +257,15 @@ export class ContactFindOptions implements IContactFindOptions { * * @usage * - * ```js - * import {Contact} from 'ionic-native'; - * + * ```typescript + * import { Contact } from 'ionic-native'; * * * let contact = new Contact(); - * contact.displayName = "Mr. Ionitron"; + * contact.displayName = 'Mr. Ionitron'; * contact.save().then( - * () => console.log("Contact saved!", contact), - * (error: any) => console.error("Error saving contact.", error) + * () => console.log('Contact saved!', contact), + * (error: any) => console.error('Error saving contact.', error) * ); * ``` * @@ -308,4 +307,5 @@ export class Contacts { */ @Cordova() static pickContact(): Promise { return; } + } diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 255dab7e..71fc988d 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -1,5 +1,6 @@ import { Cordova, Plugin } from './plugin'; + export interface DatePickerOptions { /** * Platforms: iOS, Android, Windows @@ -73,16 +74,16 @@ export interface DatePickerOptions { * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). * * @usage - * ```js - * import {DatePicker} from 'ionic-native'; + * ```typescript + * import { DatePicker } from 'ionic-native'; * * * DatePicker.show({ * date: new Date(), * mode: 'date' * }).then( - * date => console.log("Got date: ", date), - * err => console.log("Error occurred while getting date:", err) + * date => console.log('Got date: ', date), + * err => console.log('Error occurred while getting date: ', err) * ); * ``` * diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index 05471fff..138ee643 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -6,9 +6,8 @@ import { Observable } from 'rxjs/Observable'; * @name DB Meter * @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone. * @usage - * ```ts - * import {DBMeter} from 'ionic-native'; - * + * ```typescript + * import { DBMeter } from 'ionic-native'; * * * // Start listening @@ -18,7 +17,7 @@ import { Observable } from 'rxjs/Observable'; * * // Check if we are listening * DBMeter.isListening().then( - * (isListening : boolean) => console.log(isListening) + * (isListening: boolean) => console.log(isListening) * ); * * // Stop listening @@ -26,8 +25,8 @@ import { Observable } from 'rxjs/Observable'; * * // Delete DBMeter instance from memory * DBMeter.delete().then( - * () => console.log("Deleted DB Meter instance"), - * error => console.log("Error occurred while deleting DB Meter instance") + * () => console.log('Deleted DB Meter instance'), + * error => console.log('Error occurred while deleting DB Meter instance') * ); * ``` */ diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index ab6172c2..c394150b 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -27,8 +27,8 @@ export interface DeeplinkMatch { * and Universal App Links. * * @usage - * ```ts - * import {IonicDeeplinks} from 'ionic-native'; + * ```typescript + * import { IonicDeeplinks } from 'ionic-native'; * * ``` */ @@ -77,4 +77,5 @@ export class Deeplinks { observable: true }) static routeWithNavController(navController, paths): Observable { return; } + } diff --git a/src/plugins/device.ts b/src/plugins/device.ts index 453e3ad1..6dd10693 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -33,9 +33,8 @@ export interface Device { * Access information about the underlying device and platform. * * @usage - * ```js - * import {Device} from 'ionic-native'; - * + * ```typescript + * import { Device } from 'ionic-native'; * * * console.log('Device UUID is: ' + Device.device.uuid); @@ -55,4 +54,5 @@ export class Device { */ @CordovaProperty static get device() { return window.device; } + } diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts index 7497671b..1b1a7a11 100644 --- a/src/plugins/deviceaccounts.ts +++ b/src/plugins/deviceaccounts.ts @@ -32,4 +32,5 @@ export class DeviceAccounts { */ @Cordova() static getEmail(): Promise { return; } + } diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 42246f97..b3a67bcf 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -41,19 +41,18 @@ export interface AccelerometerOptions { * Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion). * * @usage - * ```ts - * import {DeviceMotion} from 'ionic-native'; - * + * ```typescript + * import { DeviceMotion } from 'ionic-native'; * * * // Get the device current acceleration * DeviceMotion.getCurrentAcceleration().then( - * acceleration => console.log(acceleration), - * error => console.log(error) + * (acceleration: AccelerationData) => console.log(acceleration), + * (error: any) => console.log(error) * ); * * // Watch device acceleration - * var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => { + * var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => { * console.log(acceleration); * }); * @@ -87,4 +86,5 @@ export class DeviceMotion { clearFunction: 'clearWatch' }) static watchAcceleration(options?: AccelerometerOptions): Observable { return; } + } diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 257cb27d..0766345f 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -46,20 +46,19 @@ export interface CompassOptions { * Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation). * * @usage - * ```ts - * import {DeviceOrientation} from 'ionic-native'; - * + * ```typescript + * import { DeviceOrientation } from 'ionic-native'; * * * // Get the device current compass heading * DeviceOrientation.getCurrentHeading().then( - * data => console.log(data), - * error => console.log(error) + * (data: CompassHeading) => console.log(data), + * (error: any) => console.log(error) * ); * * // Watch the device compass heading change * var subscription = DeviceOrientation.watchHeading().subscribe( - * data => console.log(data) + * (data: CompassHeading) => console.log(data) * ); * * // Stop watching heading change diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 4037fa98..aebe92c4 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -95,4 +95,5 @@ export class Diagnostic { */ @Cordova() static isRegisteredForRemoteNotifications(): Promise { return; } + } diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index a619244a..bfda6f7f 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -23,8 +23,8 @@ export interface PromptCallback { * Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs). * * @usage - * ```js - * import {Dialogs} from 'ionic-native'; + * ```typescript + * import { Dialogs } from 'ionic-native'; * * * diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index 532f9fe6..82fa266d 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -12,11 +12,11 @@ declare var cordova: any; * DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version. * * @usage - * ```ts - * import {EmailComposer} from 'ionic-native'; + * ```typescript + * import { EmailComposer } from 'ionic-native'; * * - * EmailComposer.isAvailable().then((available) =>{ + * EmailComposer.isAvailable().then((available: boolean) =>{ * if(available) { * //Now we know we can send * } diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 2b6867e3..f236b0c4 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -69,8 +69,8 @@ import { Cordova, Plugin } from './plugin'; * For tracking events, see `logEvent` and `logPurchase`. * * @usage - * ```js - * import {Facebook} from 'ionic-native'; + * ```typescript + * import { Facebook } from 'ionic-native'; * * * @@ -98,7 +98,7 @@ export class Facebook { /** * Login to Facebook to authenticate this app. * - * ```ts + * ```typescript * { * status: "connected", * authResponse: { @@ -245,7 +245,9 @@ export class Facebook { url: string, picture: string }): Promise { return; } + } + export interface FacebookLoginResponse { status: string; authResponse: { diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 372e20f7..a2414cad 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -112,24 +112,20 @@ export interface FileTransferError { * This plugin allows you to upload and download files. * * @usage + * ```typescript + * import { Transfer } from 'ionic-native'; * - * Create instance: - * ```ts + * + * // Create instance: * const fileTransfer = new Transfer(); - * ``` * - * Upload a file: - * ```ts + * // Upload a file: * fileTransfer.upload(..).then(..).catch(..); - * ``` * - * Download a file: - * ```ts + * // Download a file: * fileTransfer.download(..).then(..).catch(..); - * ``` * - * Abort active transfer: - * ```ts + * // Abort active transfer: * fileTransfer.abort(); * ``` * diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 034114b2..57a8b669 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin). * * @usage - * ```js - * import {Flashlight} from 'ionic-native'; + * ```typescript + * import { Flashlight } from 'ionic-native'; * * * diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 892f3400..795f0be1 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -102,20 +102,19 @@ export interface GeolocationOptions { * * @usage * - * ```ts - * import {Geolocation} from 'ionic-native'; - * + * ```typescript + * import { Geolocation } from 'ionic-native'; * * * Geolocation.getCurrentPosition().then((resp) => { - * //resp.coords.latitude - * //resp.coords.longitude + * // resp.coords.latitude + * // resp.coords.longitude * }) * * let watch = Geolocation.watchPosition(); * watch.subscribe((data) => { - * //data.coords.latitude - * //data.coords.longitude + * // data.coords.latitude + * // data.coords.longitude * }) * ``` */ @@ -140,7 +139,7 @@ export class Geolocation { * Watch the current device's position. Clear the watch by unsubscribing from * Observable changes. * - * ```ts + * ```typescript * var subscription = Geolocation.watchPosition().subscribe(position => { * console.log(position.coords.longitude + ' ' + position.coords.latitude); * }); diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index 1fb4b023..88988a8a 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -4,9 +4,8 @@ import { Cordova, Plugin } from './plugin'; * @name Globalization * @description * @usage - * ```js - * import {Globalization} from 'ionic-native'; - * + * ```typescript + * import { Globalization } from 'ionic-native'; * * * ``` diff --git a/src/plugins/google-plus.ts b/src/plugins/google-plus.ts index 09b2550c..e3401e15 100644 --- a/src/plugins/google-plus.ts +++ b/src/plugins/google-plus.ts @@ -5,7 +5,9 @@ import { Cordova, Plugin } from './plugin'; * @name Google Plus * @description * @usage - * ``` + * ```typescript + * import { GooglePlus } from 'ionic-native'; + * * * ``` */ diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 2ba6beb5..231a9144 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -46,14 +46,14 @@ export const GoogleMapsAnimation = { * @description This plugin uses the native Google Maps SDK * @usage * ``` - * import {GoogleMap, GoogleMapsEvent} from 'ionic-native'; + * import { GoogleMap, GoogleMapsEvent } from 'ionic-native'; * * ... * * // somewhere in your component * let map = new GoogleMap('elementID'); * - * map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log("Map is ready!")); + * map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); * ``` */ @Plugin({ diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index 0c927e6c..79b8a29c 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -4,14 +4,13 @@ import { Cordova, Plugin } from './plugin'; * @name Hotspot * @description * @usage - * ```js - * import {Hotspot, Network} from 'ionic-native'; + * ```typescript + * import { Hotspot, Network } from 'ionic-native'; * - * ... - * Hotspot.scanWifi().then((networks: Array) => { - * console.log(networks); - * }); - * ... + * + * Hotspot.scanWifi().then((networks: Array) => { + * console.log(networks); + * }); * * ``` */ diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index cb9d2fdf..b68e5e43 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -231,8 +231,8 @@ export interface Delegate { * * @usage * - * ```ts - * import {IBeacon} from 'ionic-native'; + * ```typescript + * import { IBeacon } from 'ionic-native'; * * * // Request permission to use location on iOS @@ -243,13 +243,13 @@ export interface Delegate { * // Subscribe to some of the delegate's event handlers * delegate.didRangeBeaconsInRegion() * .subscribe( - * data => {console.log('didRangeBeaconsInRegion: ', data)}, - * error => console.error + * data => console.log('didRangeBeaconsInRegion: ', data), + * error => console.error(); * ); * delegate.didStartMonitoringForRegion() * .subscribe( - * data => {console.log('didStartMonitoringForRegion: ', data)}, - * error => console.error + * data => console.log('didStartMonitoringForRegion: ', data), + * error => console.error(); * ); * delegate.didEnterRegion() * .subscribe( diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 45bacc98..7347951b 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -27,8 +27,8 @@ export interface ImagePickerOptions { * For more info, please see the https://github.com/wymsee/cordova-imagePicker * * @usage - * ```js - * import {ImagePicker} from 'ionic-native'; + * ```typescript + * import { ImagePicker } from 'ionic-native'; * * * @@ -36,8 +36,7 @@ export interface ImagePickerOptions { * for (var i = 0; i < results.length; i++) { * console.log('Image URI: ' + results[i]); * } - * }, (err) => { - * }); + * }, (err) => { }); * ``` */ @Plugin({ diff --git a/src/plugins/insomnia.ts b/src/plugins/insomnia.ts index 95fb7238..8e39c442 100644 --- a/src/plugins/insomnia.ts +++ b/src/plugins/insomnia.ts @@ -7,8 +7,9 @@ import { Cordova, Plugin } from './plugin'; * Prevent the screen of the mobile device from falling asleep. * * @usage - * ```js - * import {Insomnia} from 'ionic-native'; + * ```typescript + * import { Insomnia } from 'ionic-native'; + * * * Insomnia.keepAwake() * .then( diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index bda2758a..57f09143 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -6,8 +6,8 @@ import { Observable } from 'rxjs/Observable'; * @name Keyboard * @description * @usage - * ```js - * import {Keyboard} from 'ionic-native'; + * ```typescript + * import { Keyboard } from 'ionic-native'; * * * diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index a01326f3..03bd91e6 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -66,18 +66,18 @@ export interface LaunchNavigatorOptions { * @usage * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper. * - * ```js - * import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native'; + * ```typescript + * import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native'; * * let options: LaunchNavigatorOptions = { * start: 'London, ON', * app: LaunchNavigator.APPS.UBER * }; * - * LaunchNavigator.navigate("Toronto, ON", options) + * LaunchNavigator.navigate('Toronto, ON', options) * .then( - * success => console.log("Launched navigator"), - * error => console.log("Error launching navigator", error) + * success => console.log('Launched navigator'), + * error => console.log('Error launching navigator', error) * ); * ``` */ diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index fd03199f..9d56d59e 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -7,15 +7,14 @@ import { Cordova, Plugin } from './plugin'; * This plugin allows you to display local notifications on the device * * @usage - * ```ts - * import {LocalNotifications} from 'ionic-native'; - * + * ```typescript + * import { LocalNotifications } from 'ionic-native'; * * * // Schedule a single notification * LocalNotifications.schedule({ * id: 1, - * text: "Single Notification", + * text: 'Single Notification', * sound: isAndroid? 'file://sound.mp3': 'file://beep.caf' * data: { secret: key } * }); @@ -24,22 +23,22 @@ import { Cordova, Plugin } from './plugin'; * // Schedule multiple notifications * LocalNotifications.schedule([{ * id: 1, - * text: "Multi Notification 1", + * text: 'Multi Notification 1', * sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf', * data: { secret:key } * },{ * id: 2, - * title: "Local Notification Example", - * text: "Multi Notification 2", - * icon: "http://example.com/icon.png" + * title: 'Local Notification Example', + * text: 'Multi Notification 2', + * icon: 'http://example.com/icon.png' * }]); * * * // Schedule delayed notification * LocalNotifications.schedule({ - * text: "Delayed Notification", + * text: 'Delayed Notification', * at: new Date(new Date().getTime() + 3600), - * led: "FF0000", + * led: 'FF0000', * sound: null * }); * ``` diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 668dc5c2..8366a7c9 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -9,9 +9,8 @@ declare var navigator: any; * @description * @usage * ```typescript - * import {MediaCapture} from 'ionic-native'; + * import { MediaCapture } from 'ionic-native'; * - * ... * * let options: CaptureImageOptions = { limit: 3 }; * MediaCapture.captureImage(options) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index 425e0ec7..78e01ce4 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -8,22 +8,22 @@ declare var Media: any; * @name MediaPlugin * @description * @usage - * ```ts - * import {MediaPlugin} from 'ionic-native'; + * ```typescript + * import { MediaPlugin } from 'ionic-native'; * * * * // Create a MediaPlugin instance. Expects path to file or url as argument - * var file = new MediaPlugin("path/to/file.mp3"); + * var file = new MediaPlugin('path/to/file.mp3'); * * // Catch the Success & Error Output * // Platform Quirks * // iOS calls success on completion of playback only * // Android calls success on completion of playback AND on release() * file.init.then(() => { - * console.log("Playback Finished"); + * console.log('Playback Finished'); * }, (err) => { - * console.log("somthing went wrong! error code: "+err.code+" message: "+err.message); + * console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message); * }); * * // play the file @@ -55,7 +55,7 @@ declare var Media: any; * file.release(); * * // Recording to a file - * var newFile = new MediaPlugin("path/to/file.mp3"); + * var newFile = new MediaPlugin('path/to/file.mp3'); * newFile.startRecord(); * * newFile.stopRecord(); diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 00399a1e..35f96a60 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -7,7 +7,7 @@ import { Cordova, Plugin } from './plugin'; * * @usage * ```typescript - * import {NativeStorage} from 'ionic-native'; + * import { NativeStorage } from 'ionic-native'; * * NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) * .then( diff --git a/src/plugins/network.ts b/src/plugins/network.ts index b1f3da4e..a5cd45e2 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -10,12 +10,12 @@ declare var navigator: any; * Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information). * * @usage - * ```js - * import {Network} from 'ionic-native'; + * ```typescript + * import { Network } from 'ionic-native'; * * // watch network for a disconnect * let disconnectSubscription = Network.onDisconnect().subscribe(() => { - * console.log('network was disconnected :-( ') + * console.log('network was disconnected :-('); * }); * * // stop disconnect watch @@ -24,9 +24,9 @@ declare var navigator: any; * * // watch network for a connection * let connectSubscription = Network.onConnect().subscribe(() => { - * console.log('network connected!');
* + * console.log('network connected!');
 * // We just got a connection but we need to wait briefly - *
// before we determine the connection type. Might need to wait
 + *
 // before we determine the connection type. Might need to wait
 * // prior to doing any api requests as well. * setTimeout(() => { * if (Network.connection === 'wifi') { diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index d7041197..4ab9afe1 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -10,15 +10,16 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation). * * @usage - * ```ts - * import {OneSignal} from 'ionic-native'; + * ```typescript + * import { OneSignal } from 'ionic-native'; * * let notificationOpenedCallback(jsonData: any) { * console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData)); * }; - * OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba", - * {googleProjectNumber: "703322744261"}, - * notificationOpenedCallback); + * + * OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', + * {googleProjectNumber: '703322744261'}, + * notificationOpenedCallback); * * OneSignal.enableInAppAlertNotification(true); * ``` diff --git a/src/plugins/pin-dialog.ts b/src/plugins/pin-dialog.ts index e6811376..3e2ac519 100644 --- a/src/plugins/pin-dialog.ts +++ b/src/plugins/pin-dialog.ts @@ -7,14 +7,13 @@ import { Cordova, Plugin } from './plugin'; * * @usage * ```typescript - * import {PinDialog} from 'ionic-native'; + * import { PinDialog } from 'ionic-native'; * - * ... * * PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel']) * .then( * (result: any) => { - * if(result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1); + * if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1); * else if(result.buttonIndex == 2) console.log('User cancelled'); * } * ); diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 77d39f13..7d40780f 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -1,10 +1,10 @@ import { get } from '../util'; +import { Observable } from 'rxjs/Observable'; declare var window; declare var Promise; declare var $q; -import {Observable} from 'rxjs/Observable'; /** * @private @@ -230,7 +230,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) * Class decorator specifying Plugin metadata. Required for all plugins. * * @usage - * ```ts + * ```typescript * @Plugin({ * name: 'MyPlugin', * plugin: 'cordova-plugin-myplugin', diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 6cd38315..dea0b200 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -65,19 +65,19 @@ export interface PushNotification { * @param event * @param callback */ - on(event: "registration", callback: (response: RegistrationEventResponse) => any): void; + on(event: 'registration', callback: (response: RegistrationEventResponse) => any): void; /** * The event notification will be triggered each time a push notification is received by a 3rd party push service on the device. * @param event * @param callback */ - on(event: "notification", callback: (response: NotificationEventResponse) => any): void; + on(event: 'notification', callback: (response: NotificationEventResponse) => any): void; /** * The event error will trigger when an internal error occurs and the cache is aborted. * @param event * @param callback */ - on(event: "error", callback: (response: Error) => any): void; + on(event: 'error', callback: (response: Error) => any): void; /** * * @param event Name of the event to listen to. See below(above) for all the event names. @@ -87,9 +87,9 @@ export interface PushNotification { */ on(event: string, callback: (response: EventResponse) => any): void; - off(event: "registration", callback: (response: RegistrationEventResponse) => any): void; - off(event: "notification", callback: (response: NotificationEventResponse) => any): void; - off(event: "error", callback: (response: Error) => any): void; + off(event: 'registration', callback: (response: RegistrationEventResponse) => any): void; + off(event: 'notification', callback: (response: NotificationEventResponse) => any): void; + off(event: 'error', callback: (response: Error) => any): void; /** * As stated in the example, you will have to store your event handler if you are planning to remove it. * @param event Name of the event type. The possible event names are the same as for the push.on function. @@ -279,11 +279,8 @@ declare var PushNotification: { * For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md). * * @usage - * ```js - * import {Push} from 'ionic-native'; - * - * - * + * ```typescript + * import { Push } from 'ionic-native'; * ``` */ @Plugin({ @@ -299,10 +296,10 @@ export class Push { * ``` * var push = Push.init({ * android: { - * senderID: "12345679" + * senderID: '12345679' * }, * ios: { - * alert: "true", + * alert: 'true', * badge: true, * sound: 'false' * }, diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 0580c16f..62d34291 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -6,13 +6,12 @@ import { Cordova, Plugin } from './plugin'; * @description * @usage * ``` - * import {SafariViewController} from 'ionic-native'; + * import { SafariViewController } from 'ionic-native'; * - * ... * * SafariViewController.isAvailable() * .then( - * (available) => { + * (available: boolean) => { * if(available){ * * SafariViewController.show({ @@ -25,9 +24,9 @@ import { Cordova, Plugin } from './plugin'; * }) * .then( * (result: any) => { - * if(result.event === 'opened') console.log("Opened"); - * else if(result.event === 'loaded') console.log("Loaded"); - * else if(result.event === 'closed') console.log("Closed"); + * if(result.event === 'opened') console.log('Opened'); + * else if(result.event === 'loaded') console.log('Loaded'); + * else if(result.event === 'closed') console.log('Closed'); * }, * (error: any) => console.error(error) * ); diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts index 21f6dace..bff9a49b 100644 --- a/src/plugins/sim.ts +++ b/src/plugins/sim.ts @@ -9,13 +9,13 @@ import { Cordova, Plugin } from './plugin'; * Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim). * * @usage - * ```js - * import {Sim} from 'ionic-native'; + * ```typescript + * import { Sim } from 'ionic-native'; * * * Sim.getSimInfo().then( - * (info) => console.log('Sim info:', info), - * (err) => console.log('Unable to get sim info:', err) + * (info) => console.log('Sim info: ', info), + * (err) => console.log('Unable to get sim info: ', err) * ); * ``` */ diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 4e705e46..d659fc6a 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -31,14 +31,12 @@ export interface SmsOptionsAndroid { * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). * * @usage - * ```ts - * import {SMS} from 'ionic-native'; - * + * ```typescript + * import { SMS } from 'ionic-native'; * * * // Send a text message using default options - * SMS.send('416123456','Hello world!'); - * + * SMS.send('416123456', 'Hello world!'); * ``` */ @Plugin({ diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index 1f8178ff..d194b221 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -1,12 +1,13 @@ import { Cordova, Plugin } from './plugin'; + /** * @name Social Sharing * @description * Share text, files, images, and links via social networks, sms, and email. * @usage - * ```ts - * import {SocialSharing} from 'ionic-native'; + * ```typescript + * import { SocialSharing } from 'ionic-native'; * * // Check if sharing via email is supported * SocialSharing.canShareViaEmail().then(() => { diff --git a/src/plugins/spinnerdialog.ts b/src/plugins/spinnerdialog.ts index cd39c3cb..6f539711 100644 --- a/src/plugins/spinnerdialog.ts +++ b/src/plugins/spinnerdialog.ts @@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin'; * @name Spinner Dialog * @description * @usage - * ```js - * import {SpinnerDialog} from 'ionic-native'; - * + * ```typescript + * import { SpinnerDialog } from 'ionic-native'; * * * SpinnerDialog.show(); diff --git a/src/plugins/splashscreen.ts b/src/plugins/splashscreen.ts index 1879b84b..f5bc8662 100644 --- a/src/plugins/splashscreen.ts +++ b/src/plugins/splashscreen.ts @@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin'; * @name Splashscreen * @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded. * @usage - * ```ts - * import {Splashscreen} from 'ionic-native'; - * + * ```typescript + * import { Splashscreen } from 'ionic-native'; * * * Splashscreen.show(); diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index c4dfc722..b4e1971c 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -11,7 +11,7 @@ declare var sqlitePlugin; * * @usage * - * ```ts + * ```typescript * import { SQLite } from 'ionic-native'; * * let db = new SQLite(); @@ -22,10 +22,10 @@ declare var sqlitePlugin; * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => { * * }, (err) => { - * console.error('Unable to execute sql', err); - * }) + * console.error('Unable to execute sql: ', err); + * }); * }, (err) => { - * console.error('Unable to open database', err); + * console.error('Unable to open database: ', err); * }); * ``` * @@ -52,7 +52,7 @@ export class SQLite { * @param config the config for opening the database. * @usage * - * ```ts + * ```typescript * import { SQLite } from 'ionic-native'; * * let db = new SQLite(); @@ -112,7 +112,7 @@ export class SQLite { * * @usage * - * ```ts + * ```typescript * db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => { * // Access the items through resultSet.rows * // resultSet.rows.item(i) diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index 0307b5cc..decd53f9 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -11,10 +11,9 @@ declare var window; * Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar). * * @usage - * ```ts - * import {StatusBar} from 'ionic-native'; + * ```typescript + * import { StatusBar } from 'ionic-native'; * - * ... * * StatuBar.overlaysWebView(true); // let status var overlay webview * diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 7a6a50ba..0b0ccc16 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -43,12 +43,11 @@ export interface ToastOptions { * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin). * * @usage - * ```ts - * import {Toast} from 'ionic-native'; + * ```typescript + * import { Toast } from 'ionic-native'; * * - * - * Toast.show("I'm a toast", "5000", "center").subscribe( + * Toast.show("I'm a toast", '5000', 'center').subscribe( * toast => { * console.log(toast); * } diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index bf963286..058edc01 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -21,23 +21,21 @@ import { Cordova, Plugin } from './plugin'; * - `-6` - TouchID is not Available * - `-8` - TouchID is locked out from too many tries * @usage - * ```js - * import {TouchID} from 'ionic-native'; + * ```typescript + * import { TouchID } from 'ionic-native'; * - * ... * * TouchID.isAvailable() * .then( - * res => console.log("TouchID is available!"), - * err => console.error("TouchID isn't available", err) + * res => console.log('TouchID is available!'), + * err => console.error('TouchID isn't available', err) * ); * * TouchID.verifyFingerprint('Scan your fingerprint please') * .then( - * res => console.log("Ok", res), - * err => console.error("Error", err) + * res => console.log('Ok', res), + * err => console.error('Error', err) * ); - * * ``` */ @Plugin({ diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index b9310ab3..31295935 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -1,4 +1,6 @@ import { Plugin, Cordova } from './plugin'; + + /** * @name Twitter Connect * @description diff --git a/src/plugins/vibration.ts b/src/plugins/vibration.ts index 43c56a3c..c67843d9 100644 --- a/src/plugins/vibration.ts +++ b/src/plugins/vibration.ts @@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin'; * @name Vibration * @description Vibrates the device * @usage - * ```ts - * import {Vibration} from 'ionic-native'; - * + * ```typescript + * import { Vibration } from 'ionic-native'; * * * // Vibrate the device for a second From b95191af0687a5c93ad30282afaa936cc12f2e1c Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Thu, 21 Jul 2016 09:40:51 -0700 Subject: [PATCH 112/231] docs(): CameraPreview, Base64ToGallery and Developer.MD (#343) -DEVELOPER.md: Corrects 'npm run tslint' instruction to 'npm run lint' -CameraPreview: Fixes syntax error in hide -Base64ToGallery: Adds desc of options obj props --- .DS_Store | Bin 0 -> 6148 bytes DEVELOPER.md | 2 +- src/plugins/base64togallery.ts | 2 +- src/plugins/camera-preview.ts | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0621cca1bf5717c982e8e6129df7585fc08742b5 GIT binary patch literal 6148 zcmeHKNlpVX5G+F^0ttd6$2oEVi60Ch0V1&}ELR{4BVb4(771?ij68}5@S9NGwqV9d zt_Xo!vdi&wxw~r?#{f+2rMm^J0w}WymX_E}F}W^n!sgt}3eo5qduZSQ$JoQ>gm;(- z3Iqjyn*#FgR*vPRG6X*GG?GI>KXHk8{Y zD`7P$S4fHxg=t<35r?>@?)U5y)t*_B*Y|j$Lq6gn^=j}=*KtUkqMY1gQ_e+N;JO{& z<6CC>>{kRTQShFpH=hSD3&}pe=CZ8BRhh5qELG3Uzrd_0Gi5e?j%Kj5hP+w}^nGLg z!b+yrkoT77;C~qRY_W31V(5bcL4lyamjd#Ah}Z;UhnYqFbgbTbQpK|FfOujClsU6xqhVXFtNqZ2L*xxMFr;V z&sEv~8?(> Date: Fri, 22 Jul 2016 11:08:11 -0700 Subject: [PATCH 113/231] fix(file): readAsText() and adds readAsDataURL() in File plugin (#346) * Updates docs for CameraPreview, Base64ToGallery and Developer.MD -DEVELOPER.md: Corrects 'npm run tslint' instruction to 'npm run lint' -CameraPreview: Fixes syntax error in hide -Base64ToGallery: Adds desc of options obj props * Fixes resolveLocalFileSystemURL bug in File.readAsText() and adds File.readAsDataUrl() - File.readAsText(): window.resolveLocalFileSystemURL() was incorrectly implemented * Updates callback arg in File.checkFile() Callback arg of window.resolveLocalFileSystemURL was fileSystem, but it actually returns fileEntry * Corrects repo link and comments out setFlashMode() - Repo prop and link in desc were not pointing to the same gh repo as the plugin - setFlashMode() is not currently available in the repo that gets pulled by the corodova plugin --- src/plugins/camera-preview.ts | 12 +++--- src/plugins/file.ts | 70 +++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 492ecb4c..27e17f50 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -33,13 +33,13 @@ export interface CameraPreviewSize { * @description * Showing camera preview in HTML * - * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview). + * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview). * */ @Plugin({ plugin: 'cordova-plugin-camera-preview', pluginRef: 'cordova.plugins.camerapreview', - repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', + repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview', platforms: ['Android', 'iOS'] }) export class CameraPreview { @@ -104,10 +104,10 @@ export class CameraPreview { /** * Set the default mode for the Flash. */ - @Cordova({ - sync: true - }) - static setFlashMode(mode: number): void { }; + // @Cordova({ + // sync: true + // }) + // static setFlashMode(mode: number): void { }; /** * Set camera color effect. diff --git a/src/plugins/file.ts b/src/plugins/file.ts index cb043703..1b18704a 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -363,9 +363,9 @@ export class File { try { var directory = path + file; - window.resolveLocalFileSystemURL(directory, function (fileSystem) { - if (fileSystem.isFile === true) { - resolveFn(fileSystem); + window.resolveLocalFileSystemURL(directory, function (fileEntry) { + if (fileEntry.isFile === true) { + resolveFn(fileEntry); } else { rejectFn({code: 13, message: 'input is not a file'}); } @@ -474,21 +474,17 @@ export class File { /** * Read a file as string. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} fileName Name of file to move + * @param {string} uri Base FileSystem. Please refer to the iOS and Android filesystems above * @return Returns a Promise that resolves or rejects with an error. */ - static readAsText(path: string, fileName: string): Promise { + static readAsText(file_uri: string): Promise { let resolveFn, rejectFn; let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; }); - if ((/^\//.test(fileName))) { - rejectFn('file-name cannot start with \/'); - } - try { - window.resolveLocalFileSystemURL(path, function (fileSystem) { - fileSystem.getFile(fileName, {create: false}, function (fileEntry) { + + window.resolveLocalFileSystemURL(file_uri, function (fileEntry) { + fileEntry.file(function (file) { var reader = new FileReader(); @@ -503,10 +499,52 @@ export class File { }; reader.readAsText(file); - }, function (error) { - error.message = File.cordovaFileError[error.code]; - rejectFn(error); - }); + + }, function (err) { + err.message = File.cordovaFileError[err.code]; + rejectFn(err); + }); + }, function (er) { + er.message = File.cordovaFileError[er.code]; + rejectFn(er); + }); + } catch (e) { + e.message = File.cordovaFileError[e.code]; + rejectFn(e); + } + + return promise; + } + + /** + * Read a file as string. + * + * @param {string} uri Base FileSystem. Please refer to the iOS and Android filesystems above + * @return Returns a Promise that resolves or rejects with an error. + */ + static readAsDataURL(file_uri: string): Promise { + let resolveFn, rejectFn; + let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; }); + + try { + + window.resolveLocalFileSystemURL(file_uri, function (fileEntry) { + + fileEntry.file(function (file) { + var reader = new FileReader(); + + reader.onloadend = function(e) { + if (this.result !== undefined && this.result !== null) { + resolveFn(this.result); + } else if (this.error !== undefined && this.error !== null) { + rejectFn(this.error); + } else { + rejectFn({code: null, message: 'READER_ONLOADEND_ERR'}); + } + }; + + reader.readAsDataURL(file); + }, function (err) { err.message = File.cordovaFileError[err.code]; rejectFn(err); From 075842d69d3722c4d64d01a2f8077251917c006a Mon Sep 17 00:00:00 2001 From: begriffin Date: Sat, 23 Jul 2016 05:45:53 -0500 Subject: [PATCH 114/231] feat(secure-storage): Add Secure Storage Wrapper (#347) * Add SecureStorage plugin. * Add SecureStorage plugin. * Added create() and removed init() to provide more consistency to ionic-native plugins. Edited comments to reflect changes. * Removed init and comment edit. --- src/index.ts | 3 ++ src/plugins/securestorage.ts | 92 ++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 src/plugins/securestorage.ts diff --git a/src/index.ts b/src/index.ts index 5b5902ef..43347506 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; import {SafariViewController} from './plugins/safari-view-controller'; import {Screenshot} from './plugins/screenshot'; +import {SecureStorage} from './plugins/securestorage'; import {Sim} from './plugins/sim'; import {SMS} from './plugins/sms'; import {SocialSharing} from './plugins/socialsharing'; @@ -139,6 +140,7 @@ export { OneSignal, PinDialog, Screenshot, + SecureStorage, SocialSharing, Sim, Splashscreen, @@ -211,6 +213,7 @@ window['IonicNative'] = { PinDialog: PinDialog, SafariViewController: SafariViewController, Screenshot: Screenshot, + SecureStorage: SecureStorage, Sim: Sim, SMS: SMS, SocialSharing: SocialSharing, diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts new file mode 100644 index 00000000..7b306162 --- /dev/null +++ b/src/plugins/securestorage.ts @@ -0,0 +1,92 @@ +import { CordovaInstance, Plugin } from './plugin'; + +declare var cordova: any; + +/** + * @name Secure Storage + * @description + * This plugin gets, sets and removes key,value pairs from a device's secure storage. + * + * Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage). + * + * @usage + * + * ```typescript + * import { SecureStorage } from 'ionic-native'; + * + * let secureStorage: SecureStorage = new SecureStorage(); + * secureStorage.create('my_store_name') + * .then( + * () => console.log('Success'), + * error => console.log(error); + * ); + * + * secureStorage.get('myitem') + * .then( + * data => console.log(data), + * error => console.log(error) + * ); + * + * secureStorage.set('myitem', 'myvalue') + * .then( + * data => console.log(data), + * error => console.log(error) + * ); + * + * secureStorage.remove('myitem') + * .then( + * data => console.log(data), + * error => console.log(error) + * ); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-secure-storage', + pluginRef: 'plugins.securestorage', + repo: 'https://github.com/Crypho/cordova-plugin-secure-storage', + platforms: ['Android', 'iOS', 'Windows Phone', 'Browser'] +}) +export class SecureStorage { + + private _objectInstance: any; + + constructor() {} + + /** + * Creates a namespaced storage. + * @param store {string} + */ + create(store: string): Promise { + return new Promise((res, rej) => { + this._objectInstance = new cordova.plugins.SecureStorage(res, rej, store); + }); + } + + /** + * Gets a stored item + * @param reference {string} + */ + @CordovaInstance({ + callbackOrder: 'reverse' + }) + get(reference: string): Promise { return; } + + /** + * Stores a value + * @param reference {string} + * @param value {string} + */ + @CordovaInstance({ + callbackOrder: 'reverse' + }) + set(reference: string, value: string): Promise { return; } + + /** + * Removes a single stored item + * @param reference {string} + */ + @CordovaInstance({ + callbackOrder: 'reverse' + }) + remove(reference: string): Promise { return; } +} From cb24876f23e82bcc35927add3a8101012a4d270a Mon Sep 17 00:00:00 2001 From: "Sameera (Sam)" Date: Sat, 23 Jul 2016 20:48:55 +1000 Subject: [PATCH 115/231] docs(transfer): example added for Transfer plugin (#349) --- src/plugins/filetransfer.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index a2414cad..defdbeec 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -127,6 +127,27 @@ export interface FileTransferError { * * // Abort active transfer: * fileTransfer.abort(); + * + * E.g + * + * upload(){ + * const fileTransfer = new Transfer(); + * var options: any; + * + * options = { + * fileKey: 'file', + * fileName: 'name.jpg', + * headers: {} + * ..... + * } + * fileTransfer.upload("", "", options) + * .then((data) => { + * // success + * }, (err) => { + * // error + * }) + * } + * * ``` * */ From b8f475f1884ae1a7e65a289a2db43655c2bc7bcd Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sat, 23 Jul 2016 07:01:02 -0400 Subject: [PATCH 116/231] refactor(index): export interfaces from Facebook and Twitter closes #344 --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 43347506..2ed85d41 100644 --- a/src/index.ts +++ b/src/index.ts @@ -88,6 +88,7 @@ export * from './plugins/datepicker'; export * from './plugins/device'; export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; +export * from './plugins/facebook'; export * from './plugins/filetransfer'; export * from './plugins/googlemaps'; export * from './plugins/httpd'; @@ -104,6 +105,7 @@ export * from './plugins/safari-view-controller'; export * from './plugins/sms'; export * from './plugins/spinnerdialog'; export * from './plugins/toast'; +export * from './plugins/twitter-connect'; export { ActionSheet, AdMob, @@ -125,7 +127,6 @@ export { Dialogs, Diagnostic, EmailComposer, - Facebook, File, Flashlight, Geolocation, @@ -148,7 +149,6 @@ export { StatusBar, TouchID, Transfer, - TwitterConnect, Vibration, WebIntent } From df326f773fcbe96ee7aec78ab3d1fa96aa7f9e34 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sat, 23 Jul 2016 07:13:35 -0400 Subject: [PATCH 117/231] feat(android-fingerprint-auth): add wrapper for plugin closes #334 --- src/index.ts | 3 + src/plugins/android-fingerprint-auth.ts | 77 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/plugins/android-fingerprint-auth.ts diff --git a/src/index.ts b/src/index.ts index 2ed85d41..6a16480e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,6 +6,7 @@ declare var window; import {ActionSheet} from './plugins/actionsheet'; import {AdMob} from './plugins/admob'; +import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth'; import {AppAvailability} from './plugins/appavailability'; import {AppRate} from './plugins/apprate'; import {AppVersion} from './plugins/appversion'; @@ -109,6 +110,7 @@ export * from './plugins/twitter-connect'; export { ActionSheet, AdMob, + AndroidFingerprintAuth, AppAvailability, AppRate, AppVersion, @@ -159,6 +161,7 @@ export * from './plugins/plugin'; window['IonicNative'] = { ActionSheet: ActionSheet, AdMob: AdMob, + AndroidFingerprintAuth: AndroidFingerprintAuth, AppAvailability: AppAvailability, AppRate: AppRate, AppVersion: AppVersion, diff --git a/src/plugins/android-fingerprint-auth.ts b/src/plugins/android-fingerprint-auth.ts new file mode 100644 index 00000000..d75713ac --- /dev/null +++ b/src/plugins/android-fingerprint-auth.ts @@ -0,0 +1,77 @@ +import { Cordova, Plugin } from './plugin'; +/** + * @name Android Fingerprint Auth + * @description + * This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup. + * @usage + * ```typescript + * import { AndroidFingerprintAuth } from 'ionic-native'; + * + * AndroidFingerprintAuth.isAvailable() + * .then((result)=> { + * if(result.isAvailable){ + * // it is available + * + * AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" }) + * .then(result => { + * if(result.withFingerprint) { + * console.log('Successfully authenticated with fingerprint!'); + * } else if(result.withPassword) { + * console.log('Successfully authenticated with backup password!'); + * } else console.log('Didn\'t authenticate!'); + * }) + * .catch(error => console.error(error)); + * + * } else { + * // fingerprint auth isn't available + * } + * }) + * .catch(error => console.error(error)); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-android-fingerprint-auth', + pluginRef: 'FingerprintAuth', + repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth' +}) +export class AndroidFingerprintAuth { + /** + * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device. + * @param params {any} + */ + @Cordova() + static show(params: { + /** + * Used as the alias for your key in the Android Key Store. + */ + clientId: string; + /** + * Used to encrypt the token returned upon successful fingerprint authentication. + */ + clientSecret: string; + /** + * Set to true to remove the "USE BACKUP" button + */ + disableBackup?: boolean; + /** + * Change the language. (en_US or es) + */ + locale?: string + }): Promise<{ + /** + * Base64 encoded string + */ + withFingerprint: string; + /** + * + */ + withPassword: boolean; + }> {return; } + + /** + * Check if service is available + */ + @Cordova() + static isAvailable(): Promise<{isAvailable: boolean}> {return; } + +} From 971ee4addac580685c8cdf169394360b0426116a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sat, 23 Jul 2016 07:18:32 -0400 Subject: [PATCH 118/231] minor refractor --- src/plugins/securestorage.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts index 7b306162..7427b6cc 100644 --- a/src/plugins/securestorage.ts +++ b/src/plugins/securestorage.ts @@ -1,7 +1,5 @@ import { CordovaInstance, Plugin } from './plugin'; - declare var cordova: any; - /** * @name Secure Storage * @description @@ -10,29 +8,29 @@ declare var cordova: any; * Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage). * * @usage - * + * * ```typescript * import { SecureStorage } from 'ionic-native'; * * let secureStorage: SecureStorage = new SecureStorage(); * secureStorage.create('my_store_name') * .then( - * () => console.log('Success'), + * () => console.log('Storage is ready!'), * error => console.log(error); * ); - * + * * secureStorage.get('myitem') * .then( * data => console.log(data), * error => console.log(error) * ); - * + * * secureStorage.set('myitem', 'myvalue') * .then( * data => console.log(data), * error => console.log(error) * ); - * + * * secureStorage.remove('myitem') * .then( * data => console.log(data), @@ -50,10 +48,10 @@ export class SecureStorage { private _objectInstance: any; - constructor() {} + constructor() {} /** - * Creates a namespaced storage. + * Creates a namespaced storage. * @param store {string} */ create(store: string): Promise { From cfcf9fbfd1da58bbcfc32bd76fa5b304d2a14a0e Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sat, 23 Jul 2016 07:19:06 -0400 Subject: [PATCH 119/231] 1.3.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e0ca258..2de86760 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.8", + "version": "1.3.9", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From af97b7a362b4e0d37759de7fa139defd928fa83c Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sat, 23 Jul 2016 07:19:29 -0400 Subject: [PATCH 120/231] chore(changelog): update changelog --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 758b7498..14492c1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +## [1.3.9](https://github.com/driftyco/ionic-native/compare/v1.3.8...v1.3.9) (2016-07-23) + + +### Bug Fixes + +* **file:** readAsText() and adds readAsDataURL() in File plugin ([#346](https://github.com/driftyco/ionic-native/issues/346)) ([77d31cd](https://github.com/driftyco/ionic-native/commit/77d31cd)) + + +### Features + +* **android-fingerprint-auth:** add wrapper for plugin ([df326f7](https://github.com/driftyco/ionic-native/commit/df326f7)), closes [#334](https://github.com/driftyco/ionic-native/issues/334) +* **secure-storage:** Add Secure Storage Wrapper ([#347](https://github.com/driftyco/ionic-native/issues/347)) ([075842d](https://github.com/driftyco/ionic-native/commit/075842d)) + + + ## [1.3.8](https://github.com/driftyco/ionic-native/compare/v1.3.7...v1.3.8) (2016-07-20) From c854c5a18c0adb3f98dc14cf0f029beb4561248f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 23 Jul 2016 07:21:10 -0400 Subject: [PATCH 121/231] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 0621cca1bf5717c982e8e6129df7585fc08742b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKNlpVX5G+F^0ttd6$2oEVi60Ch0V1&}ELR{4BVb4(771?ij68}5@S9NGwqV9d zt_Xo!vdi&wxw~r?#{f+2rMm^J0w}WymX_E}F}W^n!sgt}3eo5qduZSQ$JoQ>gm;(- z3Iqjyn*#FgR*vPRG6X*GG?GI>KXHk8{Y zD`7P$S4fHxg=t<35r?>@?)U5y)t*_B*Y|j$Lq6gn^=j}=*KtUkqMY1gQ_e+N;JO{& z<6CC>>{kRTQShFpH=hSD3&}pe=CZ8BRhh5qELG3Uzrd_0Gi5e?j%Kj5hP+w}^nGLg z!b+yrkoT77;C~qRY_W31V(5bcL4lyamjd#Ah}Z;UhnYqFbgbTbQpK|FfOujClsU6xqhVXFtNqZ2L*xxMFr;V z&sEv~8?(> Date: Sun, 24 Jul 2016 20:50:01 -0400 Subject: [PATCH 122/231] fix(brightness): use correct pluginRef --- src/plugins/brightness.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts index 934379e7..f2316189 100644 --- a/src/plugins/brightness.ts +++ b/src/plugins/brightness.ts @@ -19,7 +19,7 @@ import { Cordova, Plugin } from './plugin'; */ @Plugin({ plugin: 'cordova-plugin-brightness', - pluginRef: 'plugins.brightness', + pluginRef: 'cordova.plugins.brightness', repo: 'https://github.com/mgcrea/cordova-plugin-brightness', platforms: ['Android', 'iOS'] }) From 8b9e3175192b1e736abef9275689143fc78e8895 Mon Sep 17 00:00:00 2001 From: Ankur Raiyani Date: Mon, 25 Jul 2016 19:04:24 +0530 Subject: [PATCH 123/231] docs(statusbar): fix typo (#351) --- src/plugins/statusbar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index decd53f9..f7d56380 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -15,7 +15,7 @@ declare var window; * import { StatusBar } from 'ionic-native'; * * - * StatuBar.overlaysWebView(true); // let status var overlay webview + * StatusBar.overlaysWebView(true); // let status var overlay webview * * StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white * ``` From 08fe04e87eada6f416ce2909b8e79776eb7825a8 Mon Sep 17 00:00:00 2001 From: Aaron Czichon Date: Mon, 25 Jul 2016 15:52:17 +0200 Subject: [PATCH 124/231] fix(one-signal): return Observable instead of promise (#352) * Added OneSignal wrapper * documentation * Changes for callback of notification revieced * fixes for @Cordova decorators without Promise return * Merge * Improvements to OneSignal extended init function with notificationOpenedCallback as an optional parameter * Platforms removed OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms. * Init method turned into observable --- src/plugins/onesignal.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 4ab9afe1..379d4bd5 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -1,4 +1,5 @@ import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** @@ -28,8 +29,7 @@ import { Cordova, Plugin } from './plugin'; @Plugin({ plugin: 'onesignal-cordova-plugin', pluginRef: 'plugins.OneSignal', - repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK', - platforms: ['Android', 'iOS', 'Windows Phone 8'] + repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK' }) export class OneSignal { @@ -38,14 +38,14 @@ export class OneSignal { * * @param {appId} Your AppId from your OneSignal app * @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option. - * @returns {Promise} Returns a Promise that resolves when remote notification was recieved. + * @returns {Observable} when a notification is received. Handle your notification action here. */ - @Cordova() + @Cordova({ observable: true }) static init(appId: string, options: { googleProjectNumber: string, autoRegister: boolean - }): Promise { return; } + }): Observable { return; } /** @@ -253,4 +253,4 @@ export class OneSignal { visualLevel: number }): void { } -} +} \ No newline at end of file From 2c01d1998ffdd334fd0e98b2bf28972a8a27f95c Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 26 Jul 2016 13:34:53 -0500 Subject: [PATCH 125/231] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e2d56841..40779be1 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ watch.unsubscribe(); Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it. +![img](http://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png) + ## Installation Run following commmand to install ionic-native in your project. From 1da35968de40470d6a5f1660aa8d2528e3fd0fb4 Mon Sep 17 00:00:00 2001 From: Fabien Duthu Date: Wed, 27 Jul 2016 10:07:33 +0200 Subject: [PATCH 126/231] Estimate beacons plugin class --- src/index.ts | 3 + src/plugins/estimote-beacons.ts | 525 ++++++++++++++++++++++++++++++++ 2 files changed, 528 insertions(+) create mode 100644 src/plugins/estimote-beacons.ts diff --git a/src/index.ts b/src/index.ts index 6a16480e..b55aeb0f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,6 +35,7 @@ import {DeviceOrientation} from './plugins/deviceorientation'; import {Diagnostic} from './plugins/diagnostic'; import {Dialogs} from './plugins/dialogs'; import {EmailComposer} from './plugins/emailcomposer'; +import {EstimoteBeacons} from './plugins/estimote-beacons'; import {Facebook} from './plugins/facebook'; import {File} from './plugins/file'; import {Transfer} from './plugins/filetransfer'; @@ -129,6 +130,7 @@ export { Dialogs, Diagnostic, EmailComposer, + EstimoteBeacons, File, Flashlight, Geolocation, @@ -190,6 +192,7 @@ window['IonicNative'] = { Dialogs: Dialogs, Diagnostic: Diagnostic, EmailComposer: EmailComposer, + EstimoteBeacons: EstimoteBeacons, Facebook: Facebook, File: File, Flashlight: Flashlight, diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts new file mode 100644 index 00000000..cabf9d0e --- /dev/null +++ b/src/plugins/estimote-beacons.ts @@ -0,0 +1,525 @@ +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + +/** + * @name EstimoteBeacons + * + * @description + * This plugin enables communication between a phone and Estimote Beacons peripherals. + * + */ +@Plugin({ + plugin: 'cordova-plugin-estimote', + pluginRef: 'estimote.beacons', + repo: 'https://github.com/evothings/phonegap-estimotebeacons', + platforms: ['iOS', 'Android'] +}) +export class EstimoteBeacons { + + /** Proximity value */ + public static ProximityUnknown = 0; + + /** Proximity value */ + public static ProximityImmediate = 1; + + /** Proximity value */ + public static ProximityNear = 2; + + /** Proximity value */ + public static ProximityFar = 3; + + /** Beacon colour */ + public static BeaconColorUnknown = 0; + + /** Beacon colour */ + public static BeaconColorMintCocktail = 1; + + /** Beacon colour */ + public static BeaconColorIcyMarshmallow = 2; + + /** Beacon colour */ + public static BeaconColorBlueberryPie = 3; + /** + * Beacon colour. + */ + public static BeaconColorSweetBeetroot = 4; + + /** Beacon colour */ + public static BeaconColorCandyFloss = 5; + + /** Beacon colour */ + public static BeaconColorLemonTart = 6; + + /** Beacon colour */ + public static BeaconColorVanillaJello = 7; + + /** Beacon colour */ + public static BeaconColorLiquoriceSwirl = 8; + + /** Beacon colour */ + public static BeaconColorWhite = 9; + + /** Beacon colour */ + public static BeaconColorTransparent = 10; + + /** Region state */ + public static RegionStateUnknown = 'unknown'; + + /** Region state */ + public static RegionStateOutside = 'outside'; + + /** Region state */ + public static RegionStateInside = 'inside'; + + /** + * Ask the user for permission to use location services + * while the app is in the foreground. + * You need to call this function or requestAlwaysAuthorization + * on iOS 8+. + * Does nothing on other platforms. + * + * @usage + * ``` + * EstimoteBeacons.requestWhenInUseAuthorization().then( + * () => { console.log('on success'); }, + * () => { console.log('on error'); } + * ); + * ``` + * + * @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services} + * @return Returns a Promise. + */ + @Cordova() + static requestWhenInUseAuthorization(): Promise { return; } + + /** + * Ask the user for permission to use location services + * whenever the app is running. + * You need to call this function or requestWhenInUseAuthorization + * on iOS 8+. + * Does nothing on other platforms. + * + * @usage + * ``` + * EstimoteBeacons.requestAlwaysAuthorization().then( + * () => { console.log('on success'); }, + * () => { console.log('on error'); } + * ); + * ``` + * + * @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services} + * @return Returns a Promise. + */ + @Cordova() + static requestAlwaysAuthorization(): Promise { return; } + + /** + * Get the current location authorization status. + * Implemented on iOS 8+. + * Does nothing on other platforms. + * + * @usage + * ``` + * EstimoteBeacons.authorizationStatus().then( + * (result) => { console.log('Location authorization status: ' + result); }, + * (errorMessage) => { console.log('Error: ' + errorMessage); } + * ); + * ``` + * + * @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services} + * @return Returns a Promise. + */ + @Cordova() + static authorizationStatus(): Promise { return; } + + /** + * Start advertising as a beacon. + * + * @usage + * ``` + * EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion') + * .then(() => { console.log('Beacon started'); }); + * setTimeout(() => { + * 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). + * @return Returns a Promise. + */ + @Cordova({ + clearFunction: 'stopAdvertisingAsBeacon' + }) + static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise { return; } + + /** + * Stop advertising as a beacon. + * + * @usage + * ``` + * EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion') + * .then(() => { console.log('Beacon started'); }); + * setTimeout(() => { + * EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); }); + * }, 5000); + * ``` + * @return Returns a Promise. + */ + @Cordova() + static stopAdvertisingAsBeacon(): Promise { return; } + + /** + * Enable analytics. + * + * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} + * + * @usage + * ``` + * EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); }); + * ``` + * @param enable {number} Boolean value to turn analytics on or off (mandatory). + * @return Returns a Promise. + */ + @Cordova() + static enableAnalytics(enable: boolean): Promise { return; } + + /** + * Test if analytics is enabled. + * + * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details} + * + * @usage + * ``` + * EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); }); + * ``` + * @return Returns a Promise. + */ + @Cordova() + static 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} + * + * @usage + * ``` + * EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); }); + * ``` + * @return Returns a Promise. + */ + @Cordova() + static isAuthorized(): Promise { return; } + + /** + * 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). + * @return Returns a Promise. + */ + @Cordova() + static setupAppIDAndAppToken(appID: string, appToken: string): Promise { return; } + + /** + * Beacon region object. + * @typedef {Object} BeaconRegion + * @property {string} identifier Region identifier + * (id set by the application, not related actual beacons). + * @property {string} uuid The UUID of the region. + * @property {number} major The UUID major value of the region. + * @property {number} major The UUID minor value of the region. + */ + + /** + * Beacon info object. Consists of a region and an array of beacons. + * @typedef {Object} BeaconInfo + * @property {BeaconRegion} region Beacon region. Not available when scanning on iOS. + * @property {Beacon[]} beacons Array of {@link Beacon} objects. + */ + + /** + * Beacon object. Different properties are available depending on + * platform (iOS/Android) and whether scanning (iOS) or ranging (iOS/Android). + * @typedef {Object} Beacon + * @property {number} major Major value of the beacon (ranging/scanning iOS/Android). + * @property {number} color One of the estimote.beacons.BeaconColor* values (ranging/scanning iOS/Android). + * @property {number} rssi - The Received Signal Strength Indication (ranging/scanning, iOS/Android). + * @property {string} proximityUUID - UUID of the beacon (ranging iOS/Android) + * @property {number} proximity One of estimote.beacons.Proximity* values (ranging iOS). + * @property {string} macAddress (scanning iOS, ranging Android). + * @property {number} measuredPower (scanning iOS, ranging Android). + * @property {string} name The name advertised by the beacon (ranging Android). + * @property {number} distance Estimated distance from the beacon in meters (ranging iOS). + */ + + /** + * Region state object. This object is given as a result when + * monitoring for beacons. + * @typedef {Object} RegionState + * @property {string} identifier Region identifier + * (id set by the application, not related actual beacons). + * @property {string} uuid The UUID of the region. + * @property {number} major The UUID major value of the region. + * @property {number} major The UUID minor value of the region. + * @property {string} state One of + * {@link estimote.beacons.RegionStateInside}, + * {@link estimote.beacons.RegionStateOutside}, + * {@link estimote.beacons.RegionStateUnknown}. + */ + + /** + * Start scanning for all nearby beacons using CoreBluetooth (no region object is used). + * Available on iOS. + * + * @usage + * ``` + * EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => { + * console.log(JSON.stringify(beacons)); + * }); + * setTimeout(() => { + * EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); }); + * }, 5000); + * ``` + * @return Returns an Observable that notifies of each beacon discovered. + */ + @Cordova({ + observable: true, + clearFunction: 'stopEstimoteBeaconDiscovery' + }) + static startEstimoteBeaconDiscovery(): Observable { return; } + + /** + * Stop CoreBluetooth scan. Available on iOS. + * + * @usage + * ``` + * EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => { + * console.log(JSON.stringify(beacons)); + * }); + * setTimeout(() => { + * EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); }); + * }, 5000); + * ``` + * @return returns a Promise. + */ + @Cordova() + static stopEstimoteBeaconDiscovery(): Promise { return; } + + /** + * Start ranging beacons. Available on iOS and Android. + * + * @usage + * ``` + * let region: BeaconRegion = {} // Empty region matches all beacons. + * EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => { + * console.log(JSON.stringify(info)); + * }); + * setTimeout(() => { + * EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); }); + * }, 5000); + * ``` + * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @return Returns an Observable that notifies of each beacon discovered. + */ + @Cordova({ + observable: true, + clearFunction: 'stopRangingBeaconsInRegion' + }) + static startRangingBeaconsInRegion(region: BeaconRegion): Observable { return; } + + /** + * Stop ranging beacons. Available on iOS and Android. + * + * @usage + * ``` + * let region: BeaconRegion = {} // Empty region matches all beacons. + * EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => { + * console.log(JSON.stringify(info)); + * }); + * setTimeout(() => { + * EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); }); + * }, 5000); + * ``` + * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @return returns a Promise. + */ + @Cordova() + static stopRangingBeaconsInRegion(region: BeaconRegion): Promise { return; } + + /** + * Start ranging secure beacons. Available on iOS. + * This function has the same parameters/behaviour as + * {@link EstimoteBeacons.startRangingBeaconsInRegion}. + * To use secure beacons set the App ID and App Token using + * {@link EstimoteBeacons.setupAppIDAndAppToken}. + */ + @Cordova({ + observable: true, + clearFunction: 'stopRangingSecureBeaconsInRegion' + }) + static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable { return; } + + /** + * Stop ranging secure beacons. Available on iOS. + * This function has the same parameters/behaviour as + * {@link EstimoteBeacons.stopRangingBeaconsInRegion}. + */ + @Cordova() + static stopRangingSecureBeaconsInRegion(region: BeaconRegion): Promise { return; } + + /** + * Start monitoring beacons. Available on iOS and Android. + * + * @usage + * ``` + * let region: BeaconRegion = {} // Empty region matches all beacons. + * EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => { + * console.log('Region state: ' + JSON.stringify(state)); + * }); + * ``` + * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @param [notifyEntryStateOnDisplay=false] {boolean} 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 (optional, defaults to false, iOS only). + * @return Returns an Observable that notifies of each region state discovered. + */ + @Cordova({ + observable: true, + clearFunction: 'stopMonitoringForRegion', + successIndex: 1, + errorIndex: 2 + }) + static startMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } + + /** + * Stop monitoring beacons. Available on iOS and Android. + * + * @usage + * ``` + * let region: BeaconRegion = {} // Empty region matches all beacons. + * EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); }); + * ``` + * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @return returns a Promise. + */ + @Cordova() + static stopMonitoringForRegion(region: BeaconRegion): Promise { return; } + + /** + * Start monitoring secure beacons. Available on iOS. + * This function has the same parameters/behaviour as + * EstimoteBeacons.startMonitoringForRegion. + * To use secure beacons set the App ID and App Token using + * {@link EstimoteBeacons.setupAppIDAndAppToken}. + * @see {@link EstimoteBeacons.startMonitoringForRegion} + */ + @Cordova({ + observable: true, + clearFunction: 'stopSecureMonitoringForRegion', + successIndex: 1, + errorIndex: 2 + }) + static startSecureMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } + + + /** + * Stop monitoring secure beacons. Available on iOS. + * This function has the same parameters/behaviour as + * {@link EstimoteBeacons.stopMonitoringForRegion}. + */ + @Cordova() + static stopSecureMonitoringForRegion(region: BeaconRegion): Promise { return; } + + /** + * Connect to Estimote Beacon. Available on Android. + * + * @usage + * ``` + * EstimoteBeacons.connectToBeacon(FF:0F:F0:00:F0:00); + * ``` + * ``` + * EstimoteBeacons.connectToBeacon({ + * proximityUUID: '000000FF-F00F-0FF0-F000-000FF0F00000', + * major: 1, + * minor: 1 + * }); + * ``` + * @param beacon {Beacon} Beacon to connect to. + * @return returns a Promise. + */ + @Cordova() + static connectToBeacon(beacon: any): Promise { return; } + + /** + * Disconnect from connected Estimote Beacon. Available on Android. + * + * @usage + * ``` + * EstimoteBeacons.disconnectConnectedBeacon(); + * ``` + * @return returns a Promise. + */ + @Cordova() + static disconnectConnectedBeacon(): Promise { return; } + + /** + * Write proximity UUID to connected Estimote Beacon. Available on Android. + * + * @usage + * ``` + * // Example that writes constant ESTIMOTE_PROXIMITY_UUID + * EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID); + * + * @param uuid {string} String to write as new UUID + * @return returns a Promise. + */ + @Cordova() + static writeConnectedProximityUUID(uuid: any): Promise { return; } + + /** + * Write major to connected Estimote Beacon. Available on Android. + * + * @usage + * ``` + * // Example that writes 1 + * EstimoteBeacons.writeConnectedMajor(1); + * + * @param major {number} number to write as new major + * @return returns a Promise. + */ + @Cordova() + static writeConnectedMajor(major: number): Promise { return; } + + /** + * Write minor to connected Estimote Beacon. Available on Android. + * + * @usage + * ``` + * // Example that writes 1 + * EstimoteBeacons.writeConnectedMinor(1); + * + * @param minor {number} number to write as new minor + * @return returns a Promise. + */ + @Cordova() + static writeConnectedMinor(minor: number): Promise { return; } + +} + +export interface BeaconRegion { + state?: string; + major: number; + minor: number; + identifier?: string; + uuid: string; +} From d3d14d0b86445d419db9c4fbd825c1941122b3d6 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 28 Jul 2016 09:28:58 -0500 Subject: [PATCH 127/231] Update README.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 40779be1..d8b224b8 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,24 @@ let watch = Geolocation.watchPosition().subscribe(pos => { watch.unsubscribe(); ``` +### Angular 1 + +Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCorodva` as our module. + +As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`: + +```javascript +angular.module('myApp', ['ionic', 'ionic.native']) + +.controller('MyCtrl', function($scope, $cordovaCamera) { + $scope.takePicture = function() { + $cordovaCamera.getPicture(opts).then(function(p) { + }, function(err) { + }); + }; +}); +``` + ### Runtime Diagnostics Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it. From 2c9245c06c522cbe5ca4557a57ed1d4853478738 Mon Sep 17 00:00:00 2001 From: Bruno Sato Date: Thu, 28 Jul 2016 13:44:14 -0300 Subject: [PATCH 128/231] docs(): fix typo (#358) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8b224b8..b8b6baa1 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ watch.unsubscribe(); ### Angular 1 -Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCorodva` as our module. +Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCordova` as our module. As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`: From 41c9adf55a4229a0ff6d6912965cbc815dfc8c5f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 28 Jul 2016 12:45:37 -0400 Subject: [PATCH 129/231] feat(crop): add crop plugin (#284) --- src/index.ts | 3 +++ src/plugins/crop.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/plugins/crop.ts diff --git a/src/index.ts b/src/index.ts index 6a16480e..3f4681b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,6 +25,7 @@ import {CameraPreview} from './plugins/camera-preview'; import {CardIO} from './plugins/card-io'; import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; +import {Crop} from './plugins/crop'; import {DatePicker} from './plugins/datepicker'; import {DBMeter} from './plugins/dbmeter'; import {Deeplinks} from './plugins/deeplinks'; @@ -123,6 +124,7 @@ export { BluetoothSerial, CameraPreview, Clipboard, + Crop, DBMeter, Deeplinks, DeviceAccounts, @@ -180,6 +182,7 @@ window['IonicNative'] = { CardIO: CardIO, Clipboard: Clipboard, Contacts: Contacts, + Crop: Crop, DatePicker: DatePicker, DBMeter: DBMeter, Deeplinks: Deeplinks, diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts new file mode 100644 index 00000000..86dc9129 --- /dev/null +++ b/src/plugins/crop.ts @@ -0,0 +1,34 @@ +import {Cordova, Plugin} from './plugin'; +/** + * @name Crop + * @description Crops images + * @usage + * ``` + * import {Crop} from 'ionic-native'; + * + * ... + * + * Crop.crop('path/to/image.jpg', {quality: 75}) + * .then( + * newImage => console.log("new image path is: " + newImage), + * error => console.error("Error cropping image", error) + * ); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-crop', + pluginRef: 'plugins', + repo: 'https://github.com/jeduan/cordova-plugin-crop' +}) +export class Crop { + /** + * Crops an image + * @param pathToImage + * @param options + * @return {Promise} Returns a promise that resolves with the new image path, or rejects if failed to crop. + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static crop(pathToImage: string, options?: {quality: number}): Promise {return; } +} \ No newline at end of file From 40bd9bb20d274c8e100fca114177426ef2877fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wado=C5=84?= Date: Thu, 28 Jul 2016 18:46:48 +0200 Subject: [PATCH 130/231] Image resizer plugin class (#355) --- src/index.ts | 3 ++ src/plugins/imageresizer.ts | 77 +++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/plugins/imageresizer.ts diff --git a/src/index.ts b/src/index.ts index 3f4681b1..43bdb90a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -49,6 +49,7 @@ import {Hotspot} from './plugins/hotspot'; import {Httpd} from './plugins/httpd'; import {IBeacon} from './plugins/ibeacon'; import {ImagePicker} from './plugins/imagepicker'; +import {ImageResizer} from './plugins/imageresizer'; import {InAppBrowser} from './plugins/inappbrowser'; import {Insomnia} from './plugins/insomnia'; import {Keyboard} from './plugins/keyboard'; @@ -96,6 +97,7 @@ export * from './plugins/googlemaps'; export * from './plugins/httpd'; export * from './plugins/ibeacon'; export * from './plugins/imagepicker'; +export * from './plugins/imageresizer'; export * from './plugins/inappbrowser'; export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; @@ -205,6 +207,7 @@ window['IonicNative'] = { Httpd: Httpd, IBeacon: IBeacon, ImagePicker: ImagePicker, + ImageResizer: ImageResizer, InAppBrowser: InAppBrowser, Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, diff --git a/src/plugins/imageresizer.ts b/src/plugins/imageresizer.ts new file mode 100644 index 00000000..a2e2f7cb --- /dev/null +++ b/src/plugins/imageresizer.ts @@ -0,0 +1,77 @@ +import { Cordova, Plugin } from './plugin'; + +export interface ImageResizerOptions { + /** + * The URI for the image on the device to get scaled + */ + uri: string; + + /** + * The width of the new image + */ + width: number; + + /** + * The height of the new image + */ + height: number; + + /** + * The name of the folder the image should be put + * (Android only) + */ + folderName?: string; + + /** + * + * Quality given as Number for the quality of the new image + * (Android and iOS only) + */ + quality?: number; + + /** + * A custom name for the file. Default name is a timestamp + * (Android and Windows only) + */ + fileName?: string; +} + +/** + * @name ImageResizer + * @description + * Cordova Plugin For Image Resize + * + * Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command: + * `ionic plugin add https://github.com/protonet/cordova-plugin-image-resizer.git` + * + * For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer + * + * @usage + * ```typescript + * import { ImageResizer, ImageResizerOptions } from 'ionic-native'; + * + * let options = { + * uri: uri, + * folderName: 'Protonet', + * quality: 90, + * width: 1280, + * height: 1280 + * } as ImageResizerOptions; + * + * ImageResizer + * .resize(options) + * .then( + * (filePath: string) => { console.log('FilePath', filePath); }, + * () => { console.log('Error occured'); } + * ) + * ``` + */ +@Plugin({ + plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git', + pluginRef: 'window.ImageResizer', + repo: 'https://github.com/protonet/cordova-plugin-image-resizer' +}) +export class ImageResizer { + @Cordova() + static resize(options: ImageResizerOptions): Promise { return; } +} From aa51c03c5c02f3c095bebd40dc60952892909888 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 28 Jul 2016 12:51:35 -0400 Subject: [PATCH 131/231] remove window --- src/plugins/imageresizer.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/imageresizer.ts b/src/plugins/imageresizer.ts index a2e2f7cb..bf0f7d75 100644 --- a/src/plugins/imageresizer.ts +++ b/src/plugins/imageresizer.ts @@ -23,7 +23,7 @@ export interface ImageResizerOptions { folderName?: string; /** - * + * * Quality given as Number for the quality of the new image * (Android and iOS only) */ @@ -40,16 +40,16 @@ export interface ImageResizerOptions { * @name ImageResizer * @description * Cordova Plugin For Image Resize - * + * * Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command: * `ionic plugin add https://github.com/protonet/cordova-plugin-image-resizer.git` - * + * * For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer - * + * * @usage * ```typescript * import { ImageResizer, ImageResizerOptions } from 'ionic-native'; - * + * * let options = { * uri: uri, * folderName: 'Protonet', @@ -57,7 +57,7 @@ export interface ImageResizerOptions { * width: 1280, * height: 1280 * } as ImageResizerOptions; - * + * * ImageResizer * .resize(options) * .then( @@ -68,10 +68,10 @@ export interface ImageResizerOptions { */ @Plugin({ plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git', - pluginRef: 'window.ImageResizer', + pluginRef: 'ImageResizer', repo: 'https://github.com/protonet/cordova-plugin-image-resizer' }) -export class ImageResizer { +export class ImageResizer { @Cordova() static resize(options: ImageResizerOptions): Promise { return; } } From 5506e8a2e2c1eb1abaa726f0d9e3a6d86549bcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1r=20Do=C4=9Fan?= Date: Sun, 31 Jul 2016 21:24:15 +0300 Subject: [PATCH 132/231] docs(): Update inappbrowser.ts (#376) --- src/plugins/inappbrowser.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index 75bf7722..6540bceb 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -71,6 +71,9 @@ export interface InAppBrowserRef { }) export class InAppBrowser { + + + /** * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. * @param url The URL to load. @@ -79,6 +82,21 @@ export class InAppBrowser { * The options string must not contain any blank space, and each feature's * name/value pairs must be separated by a comma. Feature names are case insensitive. */ + + /** + * @name InAppBrowser + * @description + * @usage + * ```typescript + * import { InAppBrowser } from 'ionic-native'; + * + * + * + * InAppBrowser.open(url, target, options); + * + * + * ``` + */ @Cordova({ sync: true }) From 817a4340e76233f4e8953880acd991f6126ea5a0 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Sun, 31 Jul 2016 19:24:56 +0100 Subject: [PATCH 133/231] fix(ng1): use $q promises instead of the native Promise (#378) --- src/plugins/plugin.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 7d40780f..a1b2cbc1 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -88,15 +88,15 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts } function getPromise(cb) { - if (window.Promise) { - return new Promise((resolve, reject) => { - cb(resolve, reject); - }); - } else if (window.angular) { + if (window.angular) { let $q = window.angular.injector(['ng']).get('$q'); return $q((resolve, reject) => { cb(resolve, reject); }); + } else if (window.Promise) { + return new Promise((resolve, reject) => { + cb(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 1/2 or on a recent browser.'); } From 8dfe0dbaf2866a0f0a81a1011255911b861b27dc Mon Sep 17 00:00:00 2001 From: Daniele Sartiano Date: Sun, 31 Jul 2016 20:25:27 +0200 Subject: [PATCH 134/231] docs(): Update sqlite.ts (#375) Fixed typo --- src/plugins/sqlite.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index b4e1971c..5a98ba61 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -15,7 +15,7 @@ declare var sqlitePlugin; * import { SQLite } from 'ionic-native'; * * let db = new SQLite(); - * db.openDatabse({ + * db.openDatabase({ * name: 'data.db', * location: 'default' // the location field is required * }).then(() => { From eeb5393a3fc2475a79bc233eb5b5d95e7c1b9076 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Sun, 31 Jul 2016 13:25:51 -0500 Subject: [PATCH 135/231] docs(): Adds basic documentation for importing Diagnostic plugin (#374) --- src/plugins/diagnostic.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index aebe92c4..18a0bf3b 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,6 +1,15 @@ import { Cordova, Plugin } from './plugin'; - +/** + * @name Diagnostic + * @description + * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi + * + * @usage + * ```typescript + * import { Diagnostic } from 'ionic-native'; + * ``` + */ @Plugin({ plugin: 'cordova.plugins.diagnostic', pluginRef: 'cordova.plugins.diagnostic', From ccf7fb56c8d87c82bb56c2c80bf44a5ed9fd380b Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Sun, 31 Jul 2016 13:30:48 -0500 Subject: [PATCH 136/231] fix(diagnostics): Corrects isEnabled functions to isAvailable (#373) - Location, camera, wifi, and bluetooth 'isEnabled' functions are incorrect. All should be is Available. --- src/plugins/diagnostic.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 18a0bf3b..1c68370d 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -20,28 +20,28 @@ export class Diagnostic { * Checks if app is able to access device location. */ @Cordova() - static isLocationEnabled(): Promise { return; } + static 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. * On Android this requires permission. `` */ @Cordova() - static isWifiEnabled(): Promise { return; } + static 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. */ @Cordova() - static isCameraEnabled(): Promise { return; } + static isCameraAvailable(): 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) * On Android this requires permission */ @Cordova() - static isBluetoothEnabled(): Promise { return; } + static isBluetoothAvailable(): Promise { return; } /** * Returns the location authorization status for the application. From 58c3fda95627e74cf937050d1f31839b5ff97c19 Mon Sep 17 00:00:00 2001 From: "John C. Bland II" Date: Sun, 31 Jul 2016 13:31:02 -0500 Subject: [PATCH 137/231] docs(): Change to not break the doc formatter (#371) --- src/plugins/twitter-connect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index 31295935..c0d453ef 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -11,7 +11,7 @@ import { Plugin, Cordova } from './plugin'; plugin: 'twitter-connect-plugin', pluginRef: 'TwitterConnect', repo: '', - install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=' + install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key' }) export class TwitterConnect { /** From 206fa625fdbbca71fc18916d405457b770d63fa1 Mon Sep 17 00:00:00 2001 From: "John C. Bland II" Date: Sun, 31 Jul 2016 13:31:27 -0500 Subject: [PATCH 138/231] docs(): Fix quotes on TouchID.isAvailable error comment (#370) --- src/plugins/touchid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index 058edc01..2f922aa1 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -28,7 +28,7 @@ import { Cordova, Plugin } from './plugin'; * TouchID.isAvailable() * .then( * res => console.log('TouchID is available!'), - * err => console.error('TouchID isn't available', err) + * err => console.error("TouchID isn't available", err) * ); * * TouchID.verifyFingerprint('Scan your fingerprint please') From bd9366bdfee947b63f15722a46e9087c8a4bc5ac Mon Sep 17 00:00:00 2001 From: Aaron Czichon Date: Sun, 31 Jul 2016 20:32:34 +0200 Subject: [PATCH 139/231] feat(screen-orientation): Added Screen Orientation Plugin #342 (#366) * Added OneSignal wrapper * documentation * Changes for callback of notification revieced * fixes for @Cordova decorators without Promise return * Merge * Improvements to OneSignal extended init function with notificationOpenedCallback as an optional parameter * Platforms removed OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms. * Init method turned into observable * Screen Orientation Plugin added. Closes #342 --- src/index.ts | 3 ++ src/plugins/screen-orientation.ts | 65 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 src/plugins/screen-orientation.ts diff --git a/src/index.ts b/src/index.ts index 43bdb90a..7ee5c053 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,7 @@ import {NativeStorage} from './plugins/nativestorage'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; +import {ScreenOrientation} from './plugins/screen-orientation'; import {PinDialog} from './plugins/pin-dialog'; import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; @@ -145,6 +146,7 @@ export { NativeStorage, Network, OneSignal, + ScreenOrientation, PinDialog, Screenshot, SecureStorage, @@ -219,6 +221,7 @@ window['IonicNative'] = { Printer: Printer, Push: Push, OneSignal: OneSignal, + ScreenOrientation: ScreenOrientation, PinDialog: PinDialog, SafariViewController: SafariViewController, Screenshot: Screenshot, diff --git a/src/plugins/screen-orientation.ts b/src/plugins/screen-orientation.ts new file mode 100644 index 00000000..bf057974 --- /dev/null +++ b/src/plugins/screen-orientation.ts @@ -0,0 +1,65 @@ +import { Cordova, CordovaProperty, Plugin } from './plugin'; + +declare var window; + +/** + * @name Screen Orientation + * @description + * Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10. + * This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec. + * + * Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation). + * + * @usage + * ```typescript + * import { ScreenOrientation } from 'ionic-native'; + * + * + * // set to either landscape + * ScreenOrientation.lockOrientation('landscape'); + * + * // allow user rotate + * ScreenOrientation.unlockOrientation(); + * ``` + * + */ +@Plugin({ + plugin: 'cordova-plugin-screen-orientation', + pluginRef: 'window.screen', + repo: 'https://github.com/apache/cordova-plugin-screen-orientation', + platforms: ['Android', 'iOS', 'Windows Phone 8'] +}) +export class ScreenOrientation { + + /** + * Lock the orientation to the passed value. + * + * Accepted orientation values: + * | Value | Description | + * |-------------------------------|------------------------------------------------------------------------------| + * | portrait-primary | The orientation is in the primary portrait mode. | + * | portrait-secondary | The orientation is in the secondary portrait mode. | + * | landscape-primary | The orientation is in the primary landscape mode. | + * | landscape-secondary | The orientation is in the secondary landscape mode. | + * | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). | + * | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). | + * + * @param {orientation} The orientation which should be locked. Accepted values see table above. + */ + @Cordova({ sync: true }) + static lockOrientation(orientation: string): void { } + + /** + * Unlock and allow all orientations. + */ + @Cordova({ sync: true }) + static unlockOrientation(): void { } + + /* + * Get the current orientation of the device. + */ + @CordovaProperty + static get orientation() { + return window.screen.orientation; + } +} From 080c5a19e68f467198227f82475ab0d8c07edfe0 Mon Sep 17 00:00:00 2001 From: Fabien Duthu Date: Sun, 31 Jul 2016 21:14:45 +0200 Subject: [PATCH 140/231] Added missing clearWithArgs option to the @Cordova decorator --- src/plugins/estimote-beacons.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index cabf9d0e..befd3a14 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -332,7 +332,8 @@ export class EstimoteBeacons { */ @Cordova({ observable: true, - clearFunction: 'stopRangingBeaconsInRegion' + clearFunction: 'stopRangingBeaconsInRegion', + clearWithArgs: true }) static startRangingBeaconsInRegion(region: BeaconRegion): Observable { return; } @@ -364,7 +365,8 @@ export class EstimoteBeacons { */ @Cordova({ observable: true, - clearFunction: 'stopRangingSecureBeaconsInRegion' + clearFunction: 'stopRangingSecureBeaconsInRegion', + clearWithArgs: true }) static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable { return; } @@ -396,6 +398,7 @@ export class EstimoteBeacons { @Cordova({ observable: true, clearFunction: 'stopMonitoringForRegion', + clearWithArgs: true, successIndex: 1, errorIndex: 2 }) @@ -426,6 +429,7 @@ export class EstimoteBeacons { @Cordova({ observable: true, clearFunction: 'stopSecureMonitoringForRegion', + clearWithArgs: true, successIndex: 1, errorIndex: 2 }) From 838629db3af35c78f38c6c5f97315f333ba044eb Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 1 Aug 2016 02:32:11 -0400 Subject: [PATCH 141/231] 1.3.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2de86760..74ed11c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.9", + "version": "1.3.10", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From ea049ff82fade7c4e264a4ed7e2580252d81780a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 1 Aug 2016 02:32:27 -0400 Subject: [PATCH 142/231] chore(): update changelog --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14492c1a..110015d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ + +## [1.3.10](https://github.com/driftyco/ionic-native/compare/v1.3.9...v1.3.10) (2016-08-01) + + +### Bug Fixes + +* **brightness:** use correct pluginRef ([e20c411](https://github.com/driftyco/ionic-native/commit/e20c411)) +* **diagnostics:** Corrects isEnabled functions to isAvailable ([#373](https://github.com/driftyco/ionic-native/issues/373)) ([ccf7fb5](https://github.com/driftyco/ionic-native/commit/ccf7fb5)) +* **ng1:** use $q promises instead of the native Promise ([#378](https://github.com/driftyco/ionic-native/issues/378)) ([817a434](https://github.com/driftyco/ionic-native/commit/817a434)) +* **one-signal:** return Observable instead of promise ([#352](https://github.com/driftyco/ionic-native/issues/352)) ([08fe04e](https://github.com/driftyco/ionic-native/commit/08fe04e)) + + +### Features + +* **crop:** add crop plugin ([#284](https://github.com/driftyco/ionic-native/issues/284)) ([41c9adf](https://github.com/driftyco/ionic-native/commit/41c9adf)) +* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b)), closes [#342](https://github.com/driftyco/ionic-native/issues/342) + + + ## [1.3.9](https://github.com/driftyco/ionic-native/compare/v1.3.8...v1.3.9) (2016-07-23) From 5162411b38ff73612684c500a4fba1838537e725 Mon Sep 17 00:00:00 2001 From: mhartington Date: Mon, 1 Aug 2016 14:01:54 -0400 Subject: [PATCH 143/231] docs(): updated docs --- src/plugins/actionsheet.ts | 2 +- src/plugins/apprate.ts | 8 ++--- src/plugins/calendar.ts | 52 +++++++++++--------------------- src/plugins/deviceorientation.ts | 3 +- 4 files changed, 25 insertions(+), 40 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 8edd3204..c5f45786 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -20,7 +20,7 @@ import { Cordova, Plugin } from './plugin'; * 'addCancelButtonWithLabel': 'Cancel', * 'addDestructiveButtonWithLabel' : 'Delete' * }).then((buttonIndex: number) => { - * console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]); + * console.log('Button pressed: ' + buttonIndex); * }); * ``` * diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 9dbe8d6d..91cd59f7 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -14,11 +14,11 @@ declare var window; * ```typescript * import { AppRate } from 'ionic-native'; * + * AppRate.preferences.storeAppURL = { + * ios: '', + * android: 'market://details?id=', + * }; * - * AppRate.preferences.storeAppURL.ios = ''; - * AppRate.preferences.storeAppURL.android = 'market://details?id='; - * AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/'; - * AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name='; * AppRate.promptForRating(); * ``` * diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 0435427b..0f09902b 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -1,6 +1,9 @@ import { Cordova, Plugin } from './plugin'; +/** + * @private + */ export interface CalendarOptions { firstReminderMinutes?: number; secondReminderMinutes?: number; @@ -12,11 +15,6 @@ export interface CalendarOptions { url?: string; } -export interface Calendar { - id: number; - name: string; -} - /** * @name Calendar * @description @@ -24,7 +22,18 @@ export interface Calendar { * * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). * + * * @usage + * ``` + * import {Calendar} from 'ionic-native'; + * + * + * + * Calendar.createCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` * */ @Plugin({ @@ -87,23 +96,8 @@ export class Calendar { /** * Create a calendar. (iOS only) * - * @usage - * ``` - * import {Calendar} from 'ionic-native'; - * - * - * - * Calendar.createCalendar('MyCalendar').then( - * (msg) => { console.log(msg); }, - * (err) => { console.log(err); } - * ); - * ``` - * - * @param {string | Object} nameOrOptions either a string name or a options object. - * options: - * calendarName: string the name of the calendar - * calendarColor: string the hex color of the calendar - * @return Returns a Promise + * @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string + * @return {Promise} Returns a Promise */ @Cordova() static createCalendar( @@ -112,15 +106,6 @@ export class Calendar { /** * Delete a calendar. (iOS only) - * - * @usage - * ``` - * Calendar.deleteCalendar('MyCalendar').then( - * (msg) => { console.log(msg); }, - * (err) => { console.log(err); } - * ); - * ``` - * * @param {string} name Name of the calendar to delete. * @return Returns a Promise */ @@ -158,7 +143,6 @@ export class Calendar { /** * Silently create an event. - * * @param {string} [title] The event title * @param {string} [location] The event location * @param {string} [notes] The event notes @@ -268,7 +252,6 @@ export class Calendar { /** * Find an event with additional options. - * * @param {string} [title] The event title * @param {string} [location] The event location * @param {string} [notes] The event notes @@ -413,7 +396,8 @@ export class Calendar { /** * Open the calendar at the specified date. - * @return {Date} date + * @param {Date} date The date you want to open the calendar on + * @return {Promise} Promise returns a promise */ @Cordova() static openCalendar(date: Date): Promise { return; } diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 0766345f..431b9aa2 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -47,7 +47,8 @@ export interface CompassOptions { * * @usage * ```typescript - * import { DeviceOrientation } from 'ionic-native'; + * // CompassHeading is an interface for compass + * import { DeviceOrientation, CompassHeading } from 'ionic-native'; * * * // Get the device current compass heading From 06c749ffabd49479aba5de0c4be0d813f042b75e Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 1 Aug 2016 13:46:52 -0500 Subject: [PATCH 144/231] chore(docs): camera preview link. Fixes #361 --- src/plugins/camera-preview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 27e17f50..57f16f9a 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -33,7 +33,7 @@ export interface CameraPreviewSize { * @description * Showing camera preview in HTML * - * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview). + * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview). * */ @Plugin({ From 53b6d813d5db5e00ea7c49111f2318fa93e60f0f Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 1 Aug 2016 14:25:55 -0500 Subject: [PATCH 145/231] note about ng1 observables --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b8b6baa1..e1be9d43 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.gi ``` import { Geolocation } from 'ionic-native'; -Geolocation.getCurrentPosition().then(pos => { +Geolocation.getCurrentPosition().then(pos => { console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude); }); @@ -49,6 +49,23 @@ angular.module('myApp', ['ionic', 'ionic.native']) }); ``` +For services that return observables, the Angular 1 digest cycle must be done manually (currently): + +```javascript +angular.module('myApp', ['ionic', 'ionic.native']) + +.controller('MyCtrl', function($scope, $cordovaGeolocation) { + $scope.takePicture = function() { + $cordovaGeolocation.watchPosition(opts).subscribe(function(p) { + $scope.$apply(function() { + $scope.position = p.coords; + }); + }, function(err) { + }); + }; +}); +``` + ### Runtime Diagnostics Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it. @@ -57,7 +74,7 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or ## Installation -Run following commmand to install ionic-native in your project. +Run following commmand to install ionic-native in your project. ``` npm install ionic-native --save ``` From 4e206812f0af2982b280e645de63934188b308a5 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 1 Aug 2016 16:41:59 -0500 Subject: [PATCH 146/231] fix(backgroundGeolocation): update config and move to sync. Fixes #331 --- src/plugins/background-geolocation.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index fe183067..96525634 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -89,7 +89,7 @@ export interface Config { * When enabled, the plugin will emit sounds for life-cycle events of * background-geolocation! See debugging sounds table. */ - debug: boolean; + debug?: boolean; /** * The minimum distance (measured in meters) a device must move horizontally @@ -100,7 +100,9 @@ export interface Config { /** * IOS, ANDROID ONLY * Enable this in order to force a stop() when the application terminated - * (e.g. on iOS, double-tap home button, swipe away the app). + * (e.g. on iOS, double-tap home button, swipe away the app).o + * + * Defaults to true */ stopOnTerminate?: boolean; @@ -111,7 +113,7 @@ export interface Config { * and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval) * for more information */ - locationTimeout?: number; + interval?: number; /** * ANDROID ONLY @@ -142,7 +144,7 @@ export interface Config { * ANDROID ONLY * Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers) */ - locationService?: number; + locationProvider?: number; /** * IOS ONLY @@ -219,9 +221,9 @@ export class BackgroundGeolocation { * Options a json object of type Config */ @Cordova({ - callbackOrder: 'reverse' + sync: true }) - static configure(options: Config): Promise { return; } + static configure(callback: Function, errorCallback: Function, options: Config): void { return; } /** From 09e6fc973869d62babd738ee18d27c235643983c Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 1 Aug 2016 16:44:51 -0500 Subject: [PATCH 147/231] chore(backgroundGeolocation): update usage --- src/plugins/background-geolocation.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 96525634..dc452efd 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -180,18 +180,19 @@ export interface Config { * stopOnTerminate: false, // enable this to clear background location settings when the app terminates * }; * - * BackgroundGeolocation.configure(config) - * .then((location) => { - * console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude); - * - * // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished, - * // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not. - * // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background. - * BackgroundGeolocation.finish(); // FOR IOS ONLY - * }) - * .catch((error) => { - * console.log('BackgroundGeolocation error'); - * }); + * BackgroundGeolocation.configure((location) => { + console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude); + + // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished, + // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not. + // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background. + BackgroundGeolocation.finish(); // FOR IOS ONLY + + * }, (error) => { + * console.log('BackgroundGeolocation error'); + * }, { + * //options + * }); * * // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app. * BackgroundGeolocation.start(); From 29816f7ab589398abf270f9b20df8ee0d049a53f Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 2 Aug 2016 10:17:35 -0500 Subject: [PATCH 148/231] Created bower package. #369 --- bower.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 00000000..9e75af44 --- /dev/null +++ b/bower.json @@ -0,0 +1,24 @@ +{ + "name": "ionic-native", + "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", + "main": "dist/ionic.native.js", + "authors": [ + "Max Lynch " + ], + "license": "MIT", + "keywords": [ + "ionic", + "native", + "html5", + "hybrid", + "mobile" + ], + "homepage": "https://github.com/driftyco/ionic-native", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} From f23436fe6d2d8feec35c20e17e88ab23a97de174 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 2 Aug 2016 11:03:23 -0500 Subject: [PATCH 149/231] Bower release --- .gitignore | 1 + bower.json | 2 +- scripts/bower.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 scripts/bower.sh diff --git a/.gitignore b/.gitignore index faa71d20..d2d96851 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ .idea dist/ +scripts/ionic-native-bower diff --git a/bower.json b/bower.json index 9e75af44..0ad72511 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,7 @@ "hybrid", "mobile" ], - "homepage": "https://github.com/driftyco/ionic-native", + "homepage": "https://github.com/driftyco/ionic-native-bower", "ignore": [ "**/.*", "node_modules", diff --git a/scripts/bower.sh b/scripts/bower.sh new file mode 100644 index 00000000..77e72541 --- /dev/null +++ b/scripts/bower.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + + +# readJsonProp(jsonFile, property) +# - restriction: property needs to be on an own line! +function readJsonProp { + echo $(sed -En 's/.*"'$2'"[ ]*:[ ]*"(.*)".*/\1/p' $1) +} + +VERSION=$(readJsonProp "package.json" "version") + +echo "BOWERING IONIC-NATIVE VERSION $VERSION. FOR GREAT JUSTICE..." + +DIR="scripts/ionic-native-bower" +rm -rf $DIR +mkdir $DIR +cp dist/ionic.native.js dist/ionic.native.min.js $DIR +cd $DIR +git init +git remote add origin git@github.com:driftyco/ionic-native-bower.git +git add . +git commit -m "Bower release" +git tag -f -m v$VERSION v$VERSION +git push -f --tags origin master + +echo "BOWERING COMPLETED SOMEWHAT SUCCESSFULLY" From 990c9c2a4915cf2825d95d4d038d9daafce3cd26 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 2 Aug 2016 11:23:39 -0500 Subject: [PATCH 150/231] Bower script --- bower.json => scripts/bower.json | 5 ++++- scripts/bower.sh | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) rename bower.json => scripts/bower.json (87%) diff --git a/bower.json b/scripts/bower.json similarity index 87% rename from bower.json rename to scripts/bower.json index 0ad72511..4843ffdd 100644 --- a/bower.json +++ b/scripts/bower.json @@ -1,7 +1,10 @@ { "name": "ionic-native", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", - "main": "dist/ionic.native.js", + "main": [ + "ionic.native.js", + "ionic.native.min.js" + ], "authors": [ "Max Lynch " ], diff --git a/scripts/bower.sh b/scripts/bower.sh index 77e72541..cf70d373 100644 --- a/scripts/bower.sh +++ b/scripts/bower.sh @@ -19,6 +19,7 @@ cp dist/ionic.native.js dist/ionic.native.min.js $DIR cd $DIR git init git remote add origin git@github.com:driftyco/ionic-native-bower.git +cp ../bower.json . git add . git commit -m "Bower release" git tag -f -m v$VERSION v$VERSION From 899c695414fece6f7d93a7e322651f5fc249132f Mon Sep 17 00:00:00 2001 From: Saurabh Vyas Date: Wed, 3 Aug 2016 04:00:56 +0530 Subject: [PATCH 151/231] docs(): Missing Comma / Syntax Error (#381) A comma was missing :) --- src/plugins/localnotifications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 9d56d59e..8c763dfe 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -15,7 +15,7 @@ import { Cordova, Plugin } from './plugin'; * LocalNotifications.schedule({ * id: 1, * text: 'Single Notification', - * sound: isAndroid? 'file://sound.mp3': 'file://beep.caf' + * sound: isAndroid? 'file://sound.mp3': 'file://beep.caf', * data: { secret: key } * }); * From 2503ef2ee58448732c06d99c49091b56f742848c Mon Sep 17 00:00:00 2001 From: Gilles Callebaut Date: Wed, 3 Aug 2016 00:52:37 +0200 Subject: [PATCH 152/231] docs(): Update nativestorage.ts (#384) --- src/plugins/nativestorage.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 35f96a60..66bc7e9e 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -2,8 +2,8 @@ import { Cordova, Plugin } from './plugin'; /** - * @name Native Storage - * @description + * @name NativeStorage + * @description Native storage of variables in Android and iOS * * @usage * ```typescript @@ -30,7 +30,7 @@ import { Cordova, Plugin } from './plugin'; export class NativeStorage { /** * Stores a value - * @param reference + * @param reference {string} * @param value */ @Cordova() @@ -38,14 +38,14 @@ export class NativeStorage { /** * Gets a stored item - * @param reference + * @param reference {string} */ @Cordova() static getItem(reference: string): Promise {return; } /** * Removes a single stored item - * @param reference + * @param reference {string} */ @Cordova() static remove(reference: string): Promise {return; } From 7ae82f471d779d31b27c2b3eb1953612d7ed52f9 Mon Sep 17 00:00:00 2001 From: Michael Callaghan Date: Tue, 2 Aug 2016 23:20:00 -0400 Subject: [PATCH 153/231] Removed unnecessary ionic.native.min.js walkingriver commented 9 minutes ago When installing the bower package created from this, a couple of warnings are printed: bower ionic-native#* invalid-meta The "main" field cannot contain minified files bower ionic-native#* invalid-meta The "main" field has to contain only 1 file per filetype; found multiple .js files: ["ionic.native.js","ionic.native.min.js"] --- scripts/bower.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/bower.json b/scripts/bower.json index 4843ffdd..678bac59 100644 --- a/scripts/bower.json +++ b/scripts/bower.json @@ -2,8 +2,7 @@ "name": "ionic-native", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": [ - "ionic.native.js", - "ionic.native.min.js" + "ionic.native.js" ], "authors": [ "Max Lynch " From 049903222af8903ab13abc4089dab0c32786add6 Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Thu, 4 Aug 2016 08:31:51 -0400 Subject: [PATCH 154/231] Updates to google maps docs. I would do more, but I'll see what kind of feedback I get first from these changes. --- src/plugins/googlemaps.ts | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 231a9144..96dff4bd 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -51,7 +51,9 @@ export const GoogleMapsAnimation = { * ... * * // somewhere in your component - * let map = new GoogleMap('elementID'); + * let map = new GoogleMap('elementID', { + * // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions + }); * * map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); * ``` @@ -65,8 +67,9 @@ export class GoogleMap { _objectInstance: any; /** - * Checks if a map object has been created. - * @return {Promise} returns a promise that resolves with a boolean that indicates if the plugin is available. + * Checks if a map object has been created and is available. + * + * @return {Promise} */ @Cordova() static isAvailable(): Promise { @@ -76,7 +79,12 @@ export class GoogleMap { constructor(elementId: string, options?: any) { this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options); } - + + /** + * Listen to a map event. + * + * @return {Observable} + */ on(event: any): Observable { return new Observable( (observer) => { @@ -85,14 +93,18 @@ export class GoogleMap { } ); } - + + /** + * Listen to a map event only once. + * + * @return{ Promise} + */ one(event: any): Promise { return new Promise( resolve => this._objectInstance.one(event, resolve) ); } - @CordovaInstance({ sync: true }) setDebuggable(isDebuggable: boolean): void { } @@ -102,7 +114,9 @@ export class GoogleMap { } /** - * Get the position of the camera + * Get the position of the camera. + * + * @return {Promise} */ @CordovaInstance() getCameraPosition(): Promise { @@ -110,7 +124,9 @@ export class GoogleMap { } /** - * Get the location of the user + * Get the location of the user. + * + * @return {Promise} */ @CordovaInstance() getMyLocation(): Promise { @@ -118,7 +134,9 @@ export class GoogleMap { } /** - * Get the visible region + * Get the visible region. + * + * @return {Promise} */ @CordovaInstance() getVisibleRegion(): Promise { From 484f9a0076b29801dd536d31996c1a41d18683df Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Thu, 4 Aug 2016 08:36:59 -0400 Subject: [PATCH 155/231] Extra space. --- src/plugins/googlemaps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 96dff4bd..7a95e726 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -97,7 +97,7 @@ export class GoogleMap { /** * Listen to a map event only once. * - * @return{ Promise} + * @return{Promise} */ one(event: any): Promise { return new Promise( From 8242c88cbbe11281c420e61aa09c301eb69b6b37 Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Thu, 4 Aug 2016 08:37:45 -0400 Subject: [PATCH 156/231] Update googlemaps.ts --- src/plugins/googlemaps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 7a95e726..c4e5131e 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -97,7 +97,7 @@ export class GoogleMap { /** * Listen to a map event only once. * - * @return{Promise} + * @return {Promise} */ one(event: any): Promise { return new Promise( From 066821dbecab8704c37ac81db1019fe6417352c1 Mon Sep 17 00:00:00 2001 From: Michael Callaghan Date: Thu, 4 Aug 2016 10:01:34 -0400 Subject: [PATCH 157/231] Added comment for iOS. It doesn't matter what you send as the duration to vibrate() under iOS, it's always the same. --- src/plugins/vibration.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/vibration.ts b/src/plugins/vibration.ts index c67843d9..5f2c82a5 100644 --- a/src/plugins/vibration.ts +++ b/src/plugins/vibration.ts @@ -10,6 +10,7 @@ import { Cordova, Plugin } from './plugin'; * * * // Vibrate the device for a second + * // Duration is ignored on iOS. * Vibration.vibrate(1000); * * // Vibrate 2 seconds From 9ca38cd8a11e27322a1a061e00d23a10ae4e8f2b Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 4 Aug 2016 09:40:24 -0500 Subject: [PATCH 158/231] fix(ng1): Copy object properly. Fixes #357 --- src/ng1.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ng1.ts b/src/ng1.ts index 9bca8116..5f56f3db 100644 --- a/src/ng1.ts +++ b/src/ng1.ts @@ -15,14 +15,11 @@ export function initAngular1(plugins) { (function(serviceName, cls, name) { window.angular.module('ionic.native').service(serviceName, [function() { - let funcs = {}; - for (var k in cls) { - funcs[k] = cls[k]; - } - funcs['name'] = name; + var funcs = window.angular.copy(cls); + funcs.prototype['name'] = name; return funcs; }]); })(serviceName, cls, name); } } -} \ No newline at end of file +} From cabeeb8dabfdd0a545734d293a840f4cd05e7f46 Mon Sep 17 00:00:00 2001 From: Aaron Czichon Date: Thu, 4 Aug 2016 23:57:44 +0200 Subject: [PATCH 159/231] feat(video-player): Added video player plugin (#391) * Added OneSignal wrapper * documentation * Changes for callback of notification revieced * fixes for @Cordova decorators without Promise return * Merge * Improvements to OneSignal extended init function with notificationOpenedCallback as an optional parameter * Platforms removed OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms. * Init method turned into observable * Screen Orientation Plugin added. Closes #342 * Added VideoPlayer plugin #318 --- src/index.ts | 3 ++ src/plugins/video-player.ts | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 src/plugins/video-player.ts diff --git a/src/index.ts b/src/index.ts index 7ee5c053..02b32b76 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,6 +79,7 @@ import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; import {TwitterConnect} from './plugins/twitter-connect'; import {Vibration} from './plugins/vibration'; +import {VideoPlayer} from './plugins/video-player'; import {WebIntent} from './plugins/webintent'; export * from './plugins/3dtouch'; export * from './plugins/background-geolocation'; @@ -111,6 +112,7 @@ export * from './plugins/sms'; export * from './plugins/spinnerdialog'; export * from './plugins/toast'; export * from './plugins/twitter-connect'; +export * from './plugins/video-player'; export { ActionSheet, AdMob, @@ -238,6 +240,7 @@ window['IonicNative'] = { TouchID: TouchID, Transfer: Transfer, TwitterConnect: TwitterConnect, + VideoPlayer: VideoPlayer, Vibration: Vibration, WebIntent: WebIntent }; diff --git a/src/plugins/video-player.ts b/src/plugins/video-player.ts new file mode 100644 index 00000000..33e8306e --- /dev/null +++ b/src/plugins/video-player.ts @@ -0,0 +1,62 @@ +import { Cordova, Plugin } from './plugin'; + +/** + * Options for the video playback using the `play` function. + */ +export interface VideoOptions { + /** + * Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%. + * For example: for a volume of 30% set the value to 0.3. + */ + volume?: number; + /** + * There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING. + * These strings are the only ones which can be passed as option. + */ + scalingMode?: string; +} + +/** + * @name VideoPlayer + * @description + * A Codova plugin that simply allows you to immediately play a video in fullscreen mode. + * + * Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer). + * + * @usage + * ```typescript + * import { VideoPlayer } from 'ionic-native'; + * + * + * // Playing a video. + * VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => { + * console.log('video completed'); + * }).catch(err => { + * console.log(err); + * }); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-videoplayer', + pluginRef: 'VideoPlayer', + repo: 'https://github.com/moust/cordova-plugin-videoplayer', + platforms: ['Android'] +}) +export class VideoPlayer { + + /** + * Plays the video from the passed url. + * @param fileUrl {string} File url to the video. + * @param options {VideoOptions?} Optional video playback settings. See options above. + * @returns {Promise} Resolves promise when the video was played successfully. + */ + @Cordova() + static play(fileUrl: string, options?: VideoOptions): Promise { return; } + + /** + * Stops the video playback immediatly. + */ + @Cordova({ sync: true }) + static close(): void { } +} \ No newline at end of file From 225a44ca4dcd278127cfec0de636d330b5c3d6c0 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Thu, 4 Aug 2016 14:58:35 -0700 Subject: [PATCH 160/231] docs(TouchID): Improves formatting of usage docs (#397) * Fixes syntax error in usage example, and improves usage formatting * Moves error codes into usage section --- src/plugins/touchid.ts | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index 2f922aa1..559aa805 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -8,6 +8,29 @@ import { Cordova, Plugin } from './plugin'; * * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id). * + * @usage + * ### Import Touch ID Plugin into Project + * ```typescript + * import { TouchID } from 'ionic-native'; + * ``` + * ### Check for Touch ID Availability + * ```typescript + * TouchID.isAvailable() + * .then( + * res => console.log('TouchID is available!'), + * err => console.error('TouchID is not available', err) + * ); + * ``` + * ### Invoke Touch ID w/ Custom Message + * + * ```typescript + * TouchID.verifyFingerprint('Scan your fingerprint please') + * .then( + * res => console.log('Ok', res), + * err => console.error('Error', err) + * ); + * ``` + * * ### Error Codes * * The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently. @@ -20,23 +43,6 @@ import { Cordova, Plugin } from './plugin'; * - `-4` - The scan was cancelled by the system (Home button for example) * - `-6` - TouchID is not Available * - `-8` - TouchID is locked out from too many tries - * @usage - * ```typescript - * import { TouchID } from 'ionic-native'; - * - * - * TouchID.isAvailable() - * .then( - * res => console.log('TouchID is available!'), - * err => console.error("TouchID isn't available", err) - * ); - * - * TouchID.verifyFingerprint('Scan your fingerprint please') - * .then( - * res => console.log('Ok', res), - * err => console.error('Error', err) - * ); - * ``` */ @Plugin({ plugin: 'cordova-plugin-touch-id', @@ -47,7 +53,7 @@ import { Cordova, Plugin } from './plugin'; export class TouchID { /** - * Whether TouchID is available or not. + * Checks Whether TouchID is available or not. * * @return {Promise} Returns a Promise that resolves if yes, rejects if no. */ From 36624aff9cca5c9c67d5d682cdd5e92cee61c764 Mon Sep 17 00:00:00 2001 From: Brian Dennis Date: Fri, 5 Aug 2016 10:44:33 -0500 Subject: [PATCH 161/231] docs(flashlight): fix isSwitchedOn return type --- src/plugins/flashlight.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 57a8b669..13790181 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -53,7 +53,7 @@ export class Flashlight { /** * Checks if the flashlight is turned on. - * Returns a boolean + * @returns {boolean} */ @Cordova({ sync: true From b413f21d4b9921551617638222e36f0171e2526a Mon Sep 17 00:00:00 2001 From: Max Keyner Date: Sat, 6 Aug 2016 08:45:53 +0200 Subject: [PATCH 162/231] docs(): remove unnecessary semicolumn (#400) --- src/plugins/securestorage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts index 7427b6cc..7344bd39 100644 --- a/src/plugins/securestorage.ts +++ b/src/plugins/securestorage.ts @@ -16,7 +16,7 @@ declare var cordova: any; * secureStorage.create('my_store_name') * .then( * () => console.log('Storage is ready!'), - * error => console.log(error); + * error => console.log(error) * ); * * secureStorage.get('myitem') From 306cb5d2a3acaa6381aefae0757523fab0595315 Mon Sep 17 00:00:00 2001 From: Markus Wagner Date: Sat, 6 Aug 2016 08:46:36 +0200 Subject: [PATCH 163/231] feat(ibeacon): using option otherPromise instead of sync (#388) Since the plugin's methods return already a promise, the workaround with the `sync` option was used. This worked well for the method calls. However, when either cordova or the plugin was not available, an error was thrown, instead of rejecting the returned promise. Therefore a better way is to use the `otherPromise` option, introduced with https://github.com/driftyco/ionic-native/releases/tag/v1.3.8. --- src/plugins/ibeacon.ts | 50 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index b68e5e43..c310f603 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -419,7 +419,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the request and started to send events. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static onDomDelegateReady(): Promise { return; } /** @@ -427,7 +427,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with a {Boolean} * indicating whether bluetooth is active. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static isBluetoothEnabled(): Promise { return; } /** @@ -436,7 +436,7 @@ export class IBeacon { * @returns Returns a promise which is resolved when Bluetooth * could be enabled. If not, the promise will be rejected with an error. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static enableBluetooth(): Promise { return; } /** @@ -445,7 +445,7 @@ export class IBeacon { * @returns Returns a promise which is resolved when Bluetooth * could be enabled. If not, the promise will be rejected with an error. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static disableBluetooth(): Promise { return; } /** @@ -465,7 +465,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the monitoring request. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static startMonitoringForRegion(region: BeaconRegion): Promise { return; } /** @@ -482,7 +482,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static stopMonitoringForRegion(region: BeaconRegion): Promise { return; } /** @@ -498,7 +498,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static requestStateForRegion(region: Region): Promise { return; } @@ -516,7 +516,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the monitoring request. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static startRangingBeaconsInRegion(region: BeaconRegion): Promise { return; } /** @@ -533,7 +533,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static stopRangingBeaconsInRegion(region: BeaconRegion): Promise { return; } /** @@ -542,7 +542,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with the * requested authorization status. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static getAuthorizationStatus(): Promise { return; } /** @@ -554,7 +554,7 @@ export class IBeacon { * If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization} * @returns Returns a promise that is resolved when the request dialog is shown. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static requestWhenInUseAuthorization(): Promise { return; } @@ -564,7 +564,7 @@ export class IBeacon { * @returns Returns a promise which is resolved when the native layer * shows the request dialog. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static requestAlwaysAuthorization(): Promise { return; } /** @@ -572,7 +572,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with an {Array} * of {Region} instances that are being monitored by the native layer. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static getMonitoredRegions(): Promise { return; } /** @@ -580,7 +580,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with an {Array} * of {Region} instances that are being ranged by the native layer. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static getRangedRegions(): Promise { return; } /** @@ -588,7 +588,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with a {Boolean} * indicating whether ranging is available or not. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static isRangingAvailable(): Promise { return; } /** @@ -600,7 +600,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with a {Boolean} * indicating whether the region type is supported or not. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static isMonitoringAvailableForClass(region: Region): Promise { return; } /** @@ -620,7 +620,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the advertising request. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static startAdvertising(region: Region, measuredPower: number): Promise { return; } /** @@ -631,7 +631,7 @@ export class IBeacon { * @return Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop advertising. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static stopAdvertising(region: Region): Promise { return; } /** @@ -639,7 +639,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with a {Boolean} * indicating whether advertising is available or not. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static isAdvertisingAvailable(): Promise { return; } /** @@ -647,7 +647,7 @@ export class IBeacon { * @returns Returns a promise which is resolved with a {Boolean} * indicating whether advertising is active. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static isAdvertising(): Promise { return; } /** @@ -657,7 +657,7 @@ export class IBeacon { * @returns Returns a promise which is resolved as soon as the * native layer has set the logging level accordingly. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static disableDebugLogs(): Promise { return; } /** @@ -668,7 +668,7 @@ export class IBeacon { * @returns Returns a promise which is resolved as soon as the * native layer has set the flag to enabled. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static enableDebugNotifications(): Promise { return; } /** @@ -678,7 +678,7 @@ export class IBeacon { * @returns Returns a promise which is resolved as soon as the * native layer has set the flag to disabled. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static disableDebugNotifications(): Promise { return; } /** @@ -688,7 +688,7 @@ export class IBeacon { * @returns Returns a promise which is resolved as soon as the * native layer has set the logging level accordingly. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static enableDebugLogs(): Promise { return; } /** @@ -701,7 +701,7 @@ export class IBeacon { * message received by the native layer for appending. The returned message * is expected to be equivalent to the one provided in the original call. */ - @Cordova({sync: true}) + @Cordova({otherPromise: true}) static appendToDeviceLog(message: string): Promise { return; } } From 0c486b09657c92823dd3abfa39fa67a5a1754f32 Mon Sep 17 00:00:00 2001 From: cither1 Date: Sat, 6 Aug 2016 16:20:38 +0900 Subject: [PATCH 164/231] fix(index): export Geolocation interfaces. (#404) --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 02b32b76..08af6817 100644 --- a/src/index.ts +++ b/src/index.ts @@ -95,6 +95,7 @@ export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; export * from './plugins/facebook'; export * from './plugins/filetransfer'; +export * from './plugins/geolocation'; export * from './plugins/googlemaps'; export * from './plugins/httpd'; export * from './plugins/ibeacon'; @@ -138,7 +139,6 @@ export { EmailComposer, File, Flashlight, - Geolocation, Globalization, GooglePlus, GoogleAnalytics, From 3748bccad2844283ae9ea1494f5a8e91405fb698 Mon Sep 17 00:00:00 2001 From: "Keith D. Moore" Date: Sat, 6 Aug 2016 09:56:34 -0500 Subject: [PATCH 165/231] Network: Changed connection to return a Typescript string --- src/plugins/network.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/network.ts b/src/plugins/network.ts index a5cd45e2..4b238ca1 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -54,7 +54,7 @@ export class Network { * Return the network connection type */ @CordovaProperty - static get connection(): String { return navigator.connection.type; } + static get connection(): string { return navigator.connection.type; } /** * Get notified when the device goes offline From 7a84262feeb02ec976d8ad2e2f2a7ffbd4429548 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 9 Aug 2016 01:30:15 -0400 Subject: [PATCH 166/231] feat(keyboard): enable hideKeyboardAccessoryBar function (#398) closes #394 --- src/plugins/keyboard.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index 57f09143..07ecad05 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -24,9 +24,8 @@ export class Keyboard { * Hide the keyboard accessory bar with the next, previous and done buttons. * @param hide {boolean} */ - static hideKeyboardAccessoryBar(hide: boolean): void { - console.log('hideKeyboardAccessoryBar method has been removed temporarily.'); - } + @Cordova({sync: true}) + static hideKeyboardAccessoryBar(hide: boolean): void { } /** * Force keyboard to be shown. From cf3f0f63c31c65a41e9cdf08d4029283fabfd907 Mon Sep 17 00:00:00 2001 From: Kessiler Date: Tue, 9 Aug 2016 02:30:53 -0300 Subject: [PATCH 167/231] feat(GoogleAnalytics): Add campaign measurement tracking (#405) --- src/plugins/googleanalytics.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index a50d6c74..d7939b16 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -31,10 +31,11 @@ export class GoogleAnalytics { * Track a screen * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens * - * @param {string} title Screen title + * @param {string} title Screen title + * @param {string} campaignUrl Campaign url for measuring referrals */ @Cordova() - static trackView(title: string): Promise { return; } + static trackView(title: string, campaignUrl?: string): Promise { return; } /** * Track an event From 43e8a6d3d2333224a552fd1496c09236fe7b9b1b Mon Sep 17 00:00:00 2001 From: Kessiler Date: Tue, 9 Aug 2016 02:37:16 -0300 Subject: [PATCH 168/231] feat(GoogleMaps): Allow specify enableHighAccuracy option that attempt to get your location with highest accuracy (#410) --- src/plugins/googlemaps.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index c4e5131e..97f48c7a 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -129,7 +129,7 @@ export class GoogleMap { * @return {Promise} */ @CordovaInstance() - getMyLocation(): Promise { + getMyLocation(options?:MyLocationOptions): Promise { return; } @@ -361,6 +361,13 @@ export interface MyLocation { bearing?: number; } +/** + * @private + */ +export interface MyLocationOptions { + enableHighAccuracy?: boolean; +} + /** * @private */ From 6ed32efe2759fafb75dcd80856a29b4f70343ffc Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 11 Aug 2016 07:21:02 -0400 Subject: [PATCH 169/231] feat(file): alternate file implementation (#283) * alternate file implementation * SocialSharing: Add recommended `shareWithOptions` method * Revert "SocialSharing: Add recommended `shareWithOptions` method" * refactor(file): tslint & remove window declaration * export all from file * remove the cordova export and declaration --- src/index.ts | 8 + src/plugins/file.ts | 1201 ++++++++++++++++++++++++++++--------------- 2 files changed, 790 insertions(+), 419 deletions(-) diff --git a/src/index.ts b/src/index.ts index 08af6817..804ca43a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -93,7 +93,11 @@ export * from './plugins/datepicker'; export * from './plugins/device'; export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; +<<<<<<< HEAD +export * from './plugins/file'; +======= export * from './plugins/facebook'; +>>>>>>> master export * from './plugins/filetransfer'; export * from './plugins/geolocation'; export * from './plugins/googlemaps'; @@ -137,7 +141,11 @@ export { Dialogs, Diagnostic, EmailComposer, +<<<<<<< HEAD + Facebook, +======= File, +>>>>>>> master Flashlight, Globalization, GooglePlus, diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 1b18704a..4ec1f1e6 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1,7 +1,340 @@ -import { Cordova, Plugin } from './plugin'; +import {Plugin, Cordova} from './plugin'; +declare var window: any; +declare var cordova: any; +/** This interface represents a file system. */ +export interface FileSystem { + /* The name of the file system, unique across the list of exposed file systems. */ + name: string; + /** The root directory of the file system. */ + root: DirectoryEntry; +} -declare var window; +/** + * An abstract interface representing entries in a file system, + * each of which may be a File or DirectoryEntry. + */ +export interface Entry { + /** Entry is a file. */ + isFile: boolean; + /** Entry is a directory. */ + isDirectory: boolean; + /** The name of the entry, excluding the path leading to it. */ + name: string; + /** The full absolute path from the root to the entry. */ + fullPath: string; + /** The file system on which the entry resides. */ + fileSystem: FileSystem; + nativeURL: string; + /** + * Look up metadata about this entry. + * @param successCallback A callback that is called with the time of the last modification. + * @param errorCallback A callback that is called when errors happen. + */ + getMetadata(successCallback: (metadata: Metadata) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Move an entry to a different location on the file system. It is an error to try to: + * move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided; + * move a file to a path occupied by a directory; + * move a directory to a path occupied by a file; + * move any element to a path occupied by a directory which is not empty. + * 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. + * @param parent The directory to which to move the entry. + * @param newName The new name of the entry. Defaults to the Entry's current name if unspecified. + * @param successCallback A callback that is called with the Entry for the new location. + * @param errorCallback A callback that is called when errors happen. + */ + moveTo(parent: DirectoryEntry, + newName?: string, + successCallback?: (entry: Entry) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Copy an entry to a different location on the file system. It is an error to try to: + * copy a directory inside itself or to any child at any depth; + * copy an entry into its parent if a name different from its current one isn't provided; + * copy a file to a path occupied by a directory; + * copy a directory to a path occupied by a file; + * copy any element to a path occupied by a directory which is not empty. + * A copy of a file on top of an existing file must attempt to delete and replace that file. + * A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory. + * Directory copies are always recursive--that is, they copy all contents of the directory. + * @param parent The directory to which to move the entry. + * @param newName The new name of the entry. Defaults to the Entry's current name if unspecified. + * @param successCallback A callback that is called with the Entry for the new object. + * @param errorCallback A callback that is called when errors happen. + */ + copyTo(parent: DirectoryEntry, + newName?: string, + successCallback?: (entry: Entry) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Returns a URL that can be used as the src attribute of a