From f1988f67f53be0e4a32b046e1553131ca48c64c6 Mon Sep 17 00:00:00 2001 From: mhartington Date: Fri, 15 Jul 2016 17:33:55 -0400 Subject: [PATCH 001/382] feat(inAppPurchase): add inAppPurchase --- src/index.ts | 3 + src/plugins/inapppurchase.ts | 109 +++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/plugins/inapppurchase.ts diff --git a/src/index.ts b/src/index.ts index 3e1867830..b85cc9d52 100644 --- a/src/index.ts +++ b/src/index.ts @@ -47,6 +47,7 @@ import {Httpd} from './plugins/httpd'; import {IBeacon} from './plugins/ibeacon'; import {ImagePicker} from './plugins/imagepicker'; import {InAppBrowser} from './plugins/inappbrowser'; +import {InAppPurchase} from './plugins/inapppurchase'; import {Insomnia} from './plugins/insomnia'; import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; @@ -125,6 +126,7 @@ export { GooglePlus, GoogleAnalytics, Hotspot, + InAppPurchase, Insomnia, Keyboard, Network, @@ -187,6 +189,7 @@ window['IonicNative'] = { IBeacon: IBeacon, ImagePicker: ImagePicker, InAppBrowser: InAppBrowser, + InAppPurchase: InAppPurchase, Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts new file mode 100644 index 000000000..9dea2733d --- /dev/null +++ b/src/plugins/inapppurchase.ts @@ -0,0 +1,109 @@ +import {Plugin, Cordova} from './plugin'; + + +/** + * @name InAppPurchase + * @description + * A lightweight Cordova plugin for in app purchases on iOS/Android. + * + * For more info, please see the [InAppPurchase plugin docs](https://github.com/AlexDisler/cordova-plugin-inapppurchase). + * + * @usage + * ```ts + * import {InAppPurchase} from 'ionic-native'; + * + * InAppPurchase + * .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...]) + * .then((products) => { + * console.log(products); + * // [{ productId: 'com.yourapp.prod1', 'title': '...', description: '...', price: '...' }, ...] + * }) + * .catch((err) => { + * console.log(err); + * }); + * + * + * InAppPurchase + * .buy('com.yourapp.prod1') + * .then((data)=> { + * console.log(data); + * // { + * // transactionId: ... + * // receipt: ... + * // signature: ... + * // } + * }) + * .catch((err)=> { + * console.log(err); + * }); + * + * ``` + * + * @advanced + * + * ```ts + * // fist buy the product... + * InAppPurchase + * .buy('com.yourapp.consumable_prod1') + * .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature)) + * .then(() => console.log('product was successfully consumed!')) + * .catch( err=> console.log(err)) + * ``` + * + * + */ +@Plugin({ + plugin: 'cordova-plugin-inapppurchase', + pluginRef: 'inAppPurchase', + platforms: ['Android', 'iOS'] +}) +export class InAppPurchase { + + /** + * Retrieves a list of full product data from Apple/Google. This method must be called before making purchases. + * @param {array} productId an array of product ids. + * @returns {Promise} Returns a Promise that resolves with an array of objects. + */ + @Cordova() + static getProducts(productId: array): Promise { return; } + + /** + * Buy a product that matches the productId. + * @param {string} productId A string that matches the product you want to buy. + * @returns {Promise} Returns a Promise that resolves with the transaction details. + */ + @Cordova() + static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; } + + /** + * Same as buy, but for subscription based products. + * @param {string} productId A string that matches the product you want to subscribe to. + * @returns {Promise} Returns a Promise that resolves with the transaction details. + */ + @Cordova() + static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; } + + /** + * Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message: + * @param {string} productType + * @param {string} receipt + * @param {string} signature + */ + @Cordova() + static consume(productType: string, receipt: string, signature: string): void { } + + /** + * Restore all purchases from the store + * @returns {Promise} Returns a promise with an array of purchases. + */ + @Cordova() + static restorePurchases(): Promise { return; } + + /** + * Get the receipt. + * @returns {Promise} Returns a promise that contains the string for the receipt + */ + @Cordova() + static getReceipt(): Promise { return; } + +} From 1da35968de40470d6a5f1660aa8d2528e3fd0fb4 Mon Sep 17 00:00:00 2001 From: Fabien Duthu Date: Wed, 27 Jul 2016 10:07:33 +0200 Subject: [PATCH 002/382] 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 6a16480ee..b55aeb0f0 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 000000000..cabf9d0ee --- /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 080c5a19e68f467198227f82475ab0d8c07edfe0 Mon Sep 17 00:00:00 2001 From: Fabien Duthu Date: Sun, 31 Jul 2016 21:14:45 +0200 Subject: [PATCH 003/382] 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 cabf9d0ee..befd3a144 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 1e300ae35fcab018291236cba2215902875e3494 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 15 Aug 2016 01:15:20 -0400 Subject: [PATCH 004/382] add otherPromise option to decorator --- src/plugins/inapppurchase.ts | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts index 9dea2733d..ba68223a8 100644 --- a/src/plugins/inapppurchase.ts +++ b/src/plugins/inapppurchase.ts @@ -6,8 +6,6 @@ import {Plugin, Cordova} from './plugin'; * @description * A lightweight Cordova plugin for in app purchases on iOS/Android. * - * For more info, please see the [InAppPurchase plugin docs](https://github.com/AlexDisler/cordova-plugin-inapppurchase). - * * @usage * ```ts * import {InAppPurchase} from 'ionic-native'; @@ -55,7 +53,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-inapppurchase', pluginRef: 'inAppPurchase', - platforms: ['Android', 'iOS'] + platforms: ['Android', 'iOS'], + repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase' }) export class InAppPurchase { @@ -64,15 +63,19 @@ export class InAppPurchase { * @param {array} productId an array of product ids. * @returns {Promise} Returns a Promise that resolves with an array of objects. */ - @Cordova() - static getProducts(productId: array): Promise { return; } + @Cordova({ + otherPromise: true + }) + static getProducts(productId: string[]): Promise { return; } /** * Buy a product that matches the productId. * @param {string} productId A string that matches the product you want to buy. * @returns {Promise} Returns a Promise that resolves with the transaction details. */ - @Cordova() + @Cordova({ + otherPromise: true + }) static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; } /** @@ -80,7 +83,9 @@ export class InAppPurchase { * @param {string} productId A string that matches the product you want to subscribe to. * @returns {Promise} Returns a Promise that resolves with the transaction details. */ - @Cordova() + @Cordova({ + otherPromise: true + }) static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; } /** @@ -89,21 +94,28 @@ export class InAppPurchase { * @param {string} receipt * @param {string} signature */ - @Cordova() - static consume(productType: string, receipt: string, signature: string): void { } + @Cordova({ + otherPromise: true + }) + static consume(productType: string, receipt: string, signature: string): Promise { return; } /** * Restore all purchases from the store * @returns {Promise} Returns a promise with an array of purchases. */ - @Cordova() + @Cordova({ + otherPromise: true + }) static restorePurchases(): Promise { return; } /** * Get the receipt. * @returns {Promise} Returns a promise that contains the string for the receipt */ - @Cordova() + @Cordova({ + otherPromise: true, + platforms: ['iOS'] + }) static getReceipt(): Promise { return; } } From aaddd9eea28de508b154ecab7e5aecca913f6c21 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 03:58:06 -0400 Subject: [PATCH 005/382] fix(datepicker): date now accepts Date, string, or number (#428) closes #354 --- src/plugins/datepicker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 71fc988d1..cb16a453a 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -13,7 +13,7 @@ export interface DatePickerOptions { * Platforms: iOS, Android, Windows * Selected date */ - date: Date; + date: Date | string | number; /** * Platforms: iOS, Android, Windows @@ -21,7 +21,7 @@ export interface DatePickerOptions { * Type: Date | empty String * Default: empty String */ - minDate?: Date; + minDate?: Date | string | number; /** * Platforms?: iOS, Android, Windows @@ -29,7 +29,7 @@ export interface DatePickerOptions { * Type?: Date | empty String * Default?: empty String */ - maxDate?: Date; + maxDate?: Date | string | number; /** * Platforms?: Android From 8cd6686803603c2beb79d7b227ffd9c6cf87cce1 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 03:58:20 -0400 Subject: [PATCH 006/382] feat(native-audio): Add native audio plugin (#427) closes #315 --- src/index.ts | 3 ++ src/plugins/native-audio.ts | 91 +++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/plugins/native-audio.ts diff --git a/src/index.ts b/src/index.ts index c53bb8872..f6fc22937 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,6 +56,7 @@ import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; import {MediaCapture} from './plugins/media-capture'; +import {NativeAudio} from './plugins/native-audio'; import {NativeStorage} from './plugins/nativestorage'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; @@ -146,6 +147,7 @@ export { Hotspot, Insomnia, Keyboard, + NativeAudio, NativeStorage, Network, OneSignal, @@ -220,6 +222,7 @@ window['IonicNative'] = { LocalNotifications: LocalNotifications, MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, + NativeAudio: NativeAudio, NativeStorage: NativeStorage, Network: Network, Printer: Printer, diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts new file mode 100644 index 000000000..a3b4e0858 --- /dev/null +++ b/src/plugins/native-audio.ts @@ -0,0 +1,91 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name NativeAudio + * @description Native Audio Playback + * @usage + * ```typescript + * import {NativeAudio} from 'ionic-native'; + * + * NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError); + * NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError); + * + * NativeAudio.play('uniqueId1').then(onSuccess, onError); + * NativeAudio.loop('uniqueId2').then(onSuccess, onError); + * + * NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError); + * + * NativeAudio.stop('uniqueId1').then(onSuccess,onError); + * + * NativeAudio.unload('uniqueId1').then(onSuccess,onError); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-nativeaudio', + pluginRef: 'NativeAudio', + repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio' +}) +export class NativeAudio { + /** + * Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped. + * @param id {string} unique ID for the audio file + * @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset. + * @returns {Promise} + */ + @Cordova() + static preloadSimple(id: string, assetPath: string): Promise {return; } + + /** + * Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter. + * @param id {string} unique ID for the audio file + * @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset. + * @param volume {number} the volume of the preloaded sound (0.1 to 1.0) + * @param voices {number} the number of multichannel voices available + * @param delay {number} + * @returns {Promise} + */ + @Cordova() + static preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise {return; } + + /** + * Plays an audio asset + * @param id {string} unique ID for the audio file + * @param completeCallback {Function} callback to be invoked when audio is done playing + */ + @Cordova({ + successIndex: 1, + errorIndex: 2 + }) + static play(id: string, completeCallback: Function): Promise {return; } + + /** + * Stops playing an audio + * @param id {string} unique ID for the audio file + */ + @Cordova() + static stop(id: string): Promise {return; } + + /** + * Loops an audio asset infinitely, this only works for complex assets + * @param id {string} unique ID for the audio file + * @return {Promise} + */ + @Cordova() + static loop(id: string): Promise {return; } + + /** + * Unloads an audio file from memory + * @param id {string} unique ID for the audio file + */ + @Cordova() + static unload(id: string): Promise {return; } + + /** + * Changes the volume for preloaded complex assets. + * @param id {string} unique ID for the audio file + * @param volume {number} the volume of the audio asset (0.1 to 1.0) + */ + @Cordova() + static setVolumeForComplexAsset(id: string, volume: number): Promise {return; } + +} From 203d4c76692ea4db95f202c53aa6cb2072954dc8 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 03:58:34 -0400 Subject: [PATCH 007/382] feat(shake): add Shake plugin (#426) closes #313 --- src/index.ts | 3 +++ src/plugins/shake.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/plugins/shake.ts diff --git a/src/index.ts b/src/index.ts index f6fc22937..f1a5a86e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,6 +69,7 @@ import {Push} from './plugins/push'; import {SafariViewController} from './plugins/safari-view-controller'; import {Screenshot} from './plugins/screenshot'; import {SecureStorage} from './plugins/securestorage'; +import {Shake} from './plugins/shake'; import {Sim} from './plugins/sim'; import {SMS} from './plugins/sms'; import {SocialSharing} from './plugins/socialsharing'; @@ -156,6 +157,7 @@ export { PinDialog, Screenshot, SecureStorage, + Shake, SocialSharing, Sim, Splashscreen, @@ -234,6 +236,7 @@ window['IonicNative'] = { SafariViewController: SafariViewController, Screenshot: Screenshot, SecureStorage: SecureStorage, + Shake: Shake, Sim: Sim, SMS: SMS, SocialSharing: SocialSharing, diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts new file mode 100644 index 000000000..86cf63ff3 --- /dev/null +++ b/src/plugins/shake.ts @@ -0,0 +1,35 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from 'rxjs/Observable'; +/** + * @name Shake + * @description Handles shake gesture + * @usage + * ```typescript + * import {Shake} from 'ionic-native'; + * + * let watch = Shake.startWatch(60).subscribe(() => { + * // do something + * }); + * + * watch.unsubscribe(); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-shake', + pluginRef: 'shake', + repo: 'https://github.com/leecrossley/cordova-plugin-shake' +}) +export class Shake { + /** + * Watch for shake gesture + * @param sensitivity {number} Optional sensitivity parameter. Defaults to 40 + */ + @Cordova({ + observable: true, + clearFunction: 'stopWatch', + successIndex: 0, + errorIndex: 2 + }) + static startWatch(sensitivity?: number): Observable {return; } + +} From d4c6ea46e6a81ae5016fa9ea93eaa44cb03317c6 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 04:46:54 -0400 Subject: [PATCH 008/382] chore(): add plugin template and generator (#429) * chore(): add plugin template and generator * docs(): add instructions to use plugin generator --- DEVELOPER.md | 10 ++++++++++ TEMPLATE | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 13 +++++++++++++ package.json | 5 ++++- 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 TEMPLATE diff --git a/DEVELOPER.md b/DEVELOPER.md index 888361a5b..57e86bc12 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -5,6 +5,16 @@ This is a short guide on creating new plugin wrappers for Ionic Native. ## Creating Plugin Wrappers +First, let's start by creating a new plugin wrapper from template. + +``` +// Call this command, and replace PluginName with the name of the plugin you wish to add +// Make sure to capitalize the first letter, or use CamelCase if necessary. + +gulp plugin:create -n PluginName +``` + + Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity): ``` diff --git a/TEMPLATE b/TEMPLATE new file mode 100644 index 000000000..4b8667d0b --- /dev/null +++ b/TEMPLATE @@ -0,0 +1,50 @@ +/** + * This is a template for new plugin wrappers + * + * TODO: + * - Add/Change information below + * - Document usage (importing, executing main functionality) + * - Remove any imports that you are not using + * - Add this file to /src/index.ts (follow style of other plugins) + * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs. + * - Remove this note + * + */ +import {Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty} from './plugin'; +import {Observable} from 'rxjs/Observable'; + +/** + * @name PluginName + * @description + * This plugin does something + * + * @usage + * ``` + * import {PluginName} from 'ionic-native'; + * + * PluginName.functionName('Hello', 123) + * .then((something: any) => doSomething(something)) + * .catch((error: any) => console.log(error)); + * + * ``` + */ +@Plugin({ + plugin: '', // npm package name, example: cordova-plugin-camera + pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation + repo: '', // the github repository URL for the plugin + install: '' // OPTIONAL install command, in case the plugin requires variables +}) +export class PluginName { + + /** + * This function does something + * @param arg1 {string} Some param to configure something + * @param arg2 {number} Another param to configure something + * @return {Promise} Returns a promise that resolves when something happens + */ + @Cordova() + static functionName(arg1: string, arg2: number): Promise { + return; // We add return; here to avoid any IDE / Compiler errors + } + +} diff --git a/gulpfile.js b/gulpfile.js index 308983416..863d6db0e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,6 +3,8 @@ var minimist = require('minimist'); var uglify = require('gulp-uglify'); var rename = require("gulp-rename"); var tslint = require('ionic-gulp-tslint'); +var decamelize = require('decamelize'); +var replace = require('gulp-replace'); var flagConfig = { string: ['port', 'version', 'ngVersion', 'animations'], @@ -26,3 +28,14 @@ gulp.task("minify:dist", function(){ }); gulp.task('lint', tslint); + +gulp.task('plugin:create', function(){ + if(flags.n && flags.n !== ''){ + return gulp.src('./TEMPLATE') + .pipe(replace('PluginName', flags.n)) + .pipe(rename(decamelize(flags.n, '-') + '.ts')) + .pipe(gulp.dest('./src/plugins/')); + } else { + console.log("Usage is: gulp plugin:create -n PluginName"); + } +}); diff --git a/package.json b/package.json index 2da5c4698..b4a54d1ff 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,13 @@ "conventional-github-releaser": "^1.1.3", "cpr": "^1.0.0", "cz-conventional-changelog": "^1.1.6", + "decamelize": "^1.2.0", "dgeni": "^0.4.2", "dgeni-packages": "^0.10.18", "glob": "^6.0.4", "gulp": "^3.9.1", "gulp-rename": "^1.2.2", + "gulp-replace": "^0.5.4", "gulp-tslint": "^5.0.0", "gulp-uglify": "^1.5.4", "ionic-gulp-tslint": "^1.0.0", @@ -42,7 +44,8 @@ "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", - "changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0" + "changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0", + "plugin:create": "gulp plugin:create" }, "repository": { "type": "git", From e34f94e0c1f1e6a8e26f5bfd743b6de76c040e72 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 05:10:43 -0400 Subject: [PATCH 009/382] feat(zip): add zip plugin (#430) closes #421 --- src/index.ts | 7 +++++-- src/plugins/zip.ts | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/plugins/zip.ts diff --git a/src/index.ts b/src/index.ts index f1a5a86e9..e08c85e4a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,6 +84,7 @@ import {TwitterConnect} from './plugins/twitter-connect'; import {Vibration} from './plugins/vibration'; import {VideoPlayer} from './plugins/video-player'; import {WebIntent} from './plugins/webintent'; +import {Zip} from './plugins/zip'; export * from './plugins/3dtouch'; export * from './plugins/background-geolocation'; export * from './plugins/backgroundmode'; @@ -166,7 +167,8 @@ export { TouchID, Transfer, Vibration, - WebIntent + WebIntent, + Zip } export * from './plugins/plugin'; @@ -251,7 +253,8 @@ window['IonicNative'] = { TwitterConnect: TwitterConnect, VideoPlayer: VideoPlayer, Vibration: Vibration, - WebIntent: WebIntent + WebIntent: WebIntent, + Zip: Zip }; initAngular1(window['IonicNative']); diff --git a/src/plugins/zip.ts b/src/plugins/zip.ts new file mode 100644 index 000000000..79cfeef4c --- /dev/null +++ b/src/plugins/zip.ts @@ -0,0 +1,39 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * @name Zip + * @description + * A Cordova plugin to unzip files in Android and iOS. + * + * @usage + * ``` + * import {Zip} from 'ionic-native'; + * + * Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%')) + * .then((result) => { + * if(result === 0) console.log('SUCCESS'); + * if(result === -1) console.log('FAILED'); + * }); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-zip', + pluginRef: 'zip', + repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip', +}) +export class Zip { + /** + * Extracts files from a ZIP archive + * @param sourceZip {string} Source ZIP file + * @param destUrl {string} Destination folder + * @param onProgress {Function} optional callback to be called on progress update + * @return {Promise} returns a promise that resolves with a number. 0 is success, -1 is error + */ + @Cordova({ + successIndex: 2, + errorIndex: 4 + }) + static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise {return; } + +} From 0a54929169f6d8d7da064b84af5d368e7b603db0 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 05:13:31 -0400 Subject: [PATCH 010/382] 1.3.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b4a54d1ff..45d3c28ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.13", + "version": "1.3.14", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From b4158f4f8548428d8bdf45695f2bc7013bb89acd Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 05:14:06 -0400 Subject: [PATCH 011/382] chore(): update changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8142e7df4..edb8df9ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.13...v1.3.14) (2016-08-15) + + +### Bug Fixes + +* **datepicker:** date now accepts Date, string, or number ([#428](https://github.com/driftyco/ionic-native/issues/428)) ([aaddd9e](https://github.com/driftyco/ionic-native/commit/aaddd9e)), closes [#354](https://github.com/driftyco/ionic-native/issues/354) + + +### Features + +* **native-audio:** Add native audio plugin ([#427](https://github.com/driftyco/ionic-native/issues/427)) ([8cd6686](https://github.com/driftyco/ionic-native/commit/8cd6686)), closes [#315](https://github.com/driftyco/ionic-native/issues/315) +* **shake:** add Shake plugin ([#426](https://github.com/driftyco/ionic-native/issues/426)) ([203d4c7](https://github.com/driftyco/ionic-native/commit/203d4c7)), closes [#313](https://github.com/driftyco/ionic-native/issues/313) +* **zip:** add zip plugin ([#430](https://github.com/driftyco/ionic-native/issues/430)) ([e34f94e](https://github.com/driftyco/ionic-native/commit/e34f94e)), closes [#421](https://github.com/driftyco/ionic-native/issues/421) + + + ## [1.3.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13) From dcf3ab27871e8ebaec393f2ad183ffb6024b77f3 Mon Sep 17 00:00:00 2001 From: Christopher Manouvrier Date: Mon, 15 Aug 2016 23:29:51 +1000 Subject: [PATCH 012/382] feat(TTS): add tts plugin (#431) * Initial Pass at TTS * Rename and fix index * Remove unnecessary window in reference closes #311 --- src/index.ts | 3 +++ src/plugins/text-to-speech.ts | 47 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/plugins/text-to-speech.ts diff --git a/src/index.ts b/src/index.ts index e08c85e4a..b1cb06cd4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -80,6 +80,7 @@ import {StatusBar} from './plugins/statusbar'; import {ThreeDeeTouch} from './plugins/3dtouch'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; +import {TextToSpeech} from './plugins/text-to-speech'; import {TwitterConnect} from './plugins/twitter-connect'; import {Vibration} from './plugins/vibration'; import {VideoPlayer} from './plugins/video-player'; @@ -166,6 +167,7 @@ export { StatusBar, TouchID, Transfer, + TextToSpeech, Vibration, WebIntent, Zip @@ -250,6 +252,7 @@ window['IonicNative'] = { Toast: Toast, TouchID: TouchID, Transfer: Transfer, + TextToSpeech: TextToSpeech, TwitterConnect: TwitterConnect, VideoPlayer: VideoPlayer, Vibration: Vibration, diff --git a/src/plugins/text-to-speech.ts b/src/plugins/text-to-speech.ts new file mode 100644 index 000000000..c6c521934 --- /dev/null +++ b/src/plugins/text-to-speech.ts @@ -0,0 +1,47 @@ +import {Plugin, Cordova} from './plugin'; + +export interface TTSOptions { + /** text to speak */ + text: string; + /** a string like 'en-US', 'zh-CN', etc */ + locale?: string; + /** speed rate, 0 ~ 1 */ + rate?: number; +} + +/** + * @name TTS + * @description + * Text to Speech plugin + * + * @usage + * ``` + * import {TTS} from 'ionic-native'; + * + * TTS.speak('Hello World') + * .then(() => console.log('Success')) + * .catch((reason: any) => console.log(reason)); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-tts', + pluginRef: 'TTS', + repo: 'https://github.com/vilic/cordova-plugin-tts' +}) +export class TextToSpeech { + + /** + * This function speaks + * @param options {string | TTSOptions} Text to speak or TTSOptions + * @return {Promise} Returns a promise that resolves when the speaking finishes + */ + @Cordova({ + successIndex: 1, + errorIndex: 2 + }) + static speak(options: string | TTSOptions): Promise { + return; + } + +} From 689bfd9568ce8c850dd44820df8d4b1096a47e1d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 11:48:40 -0400 Subject: [PATCH 013/382] feat(google-analytics): add missing functions --- src/plugins/googleanalytics.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index d7939b16c..001437b94 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -107,13 +107,34 @@ export class GoogleAnalytics { * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id * @param {string} id */ - @Cordova() - static setUserId(id: string): Promise { return; } + @Cordova({sync: true}) + static setUserId(id: string): void { } + + /** + * Sets the app version + * @param appVersion + */ + @Cordova({sync: true}) + static setAppVersion(appVersion: string): void { } + + /** + * Set a anonymize Ip address + * @param anonymize + */ + @Cordova({sync: true}) + static setAnonymizeIp(anonymize: boolean): void { } + + /** + * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more + * @param allow + */ + @Cordova({sync: true}) + static setAllowIDFACollection(allow: boolean): void { } /** * Enable verbose logging */ - @Cordova() + @Cordova({sync: true}) static debugMode(): Promise { return; } /** From f3c5ebd28b79713a40246b917b47d630a9556b84 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 11:49:32 -0400 Subject: [PATCH 014/382] 1.3.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 45d3c28ab..28bfee894 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.14", + "version": "1.3.15", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 93ce44346777ddbe9b76339f413136b7b61f0c48 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 11:50:16 -0400 Subject: [PATCH 015/382] chore(): update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edb8df9ba..d1305bf90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## [1.3.15](https://github.com/driftyco/ionic-native/compare/v1.3.14...v1.3.15) (2016-08-15) + + +### Features + +* **google-analytics:** add missing functions ([689bfd9](https://github.com/driftyco/ionic-native/commit/689bfd9)) +* **TTS:** add tts plugin ([#431](https://github.com/driftyco/ionic-native/issues/431)) ([dcf3ab2](https://github.com/driftyco/ionic-native/commit/dcf3ab2)), closes [#311](https://github.com/driftyco/ionic-native/issues/311) + + + ## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.13...v1.3.14) (2016-08-15) From 8bc499f221fdfb7fb7d23bb93517e6561d330939 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 13:37:24 -0400 Subject: [PATCH 016/382] fix(photo-viewer): method is static --- src/plugins/photo-viewer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/photo-viewer.ts b/src/plugins/photo-viewer.ts index 2c61a77d5..95728f0fd 100644 --- a/src/plugins/photo-viewer.ts +++ b/src/plugins/photo-viewer.ts @@ -24,5 +24,5 @@ export class PhotoViewer { * @param options {any} */ @Cordova({sync: true}) - show(url: string, title?: string, options?: {share?: boolean; }): void { } + static show(url: string, title?: string, options?: {share?: boolean; }): void { } } From dc0039b820c791bc01c1f3db590d063f7d514b92 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 13:37:56 -0400 Subject: [PATCH 017/382] 1.3.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28bfee894..d2fd11cdd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.15", + "version": "1.3.16", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 560e5ce7bb6bce32299023420c1895bff61e39f5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 15 Aug 2016 13:39:43 -0400 Subject: [PATCH 018/382] chore(): update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1305bf90..e3ea16afa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [1.3.16](https://github.com/driftyco/ionic-native/compare/v1.3.15...v1.3.16) (2016-08-15) + + +### Bug Fixes + +* **photo-viewer:** method is static ([8bc499f](https://github.com/driftyco/ionic-native/commit/8bc499f)) + + + ## [1.3.15](https://github.com/driftyco/ionic-native/compare/v1.3.14...v1.3.15) (2016-08-15) From 9a2ea25308d5ed7ee42eb09940ba63bd33686ac0 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 16 Aug 2016 01:53:15 -0300 Subject: [PATCH 019/382] style(): fix angular style (#434) --- src/plugins/native-audio.ts | 2 +- src/plugins/shake.ts | 4 ++-- src/plugins/text-to-speech.ts | 2 +- src/plugins/zip.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts index a3b4e0858..e788fd51b 100644 --- a/src/plugins/native-audio.ts +++ b/src/plugins/native-audio.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name NativeAudio * @description Native Audio Playback diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts index 86cf63ff3..4e5208f03 100644 --- a/src/plugins/shake.ts +++ b/src/plugins/shake.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Plugin, Cordova } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name Shake * @description Handles shake gesture diff --git a/src/plugins/text-to-speech.ts b/src/plugins/text-to-speech.ts index c6c521934..420b96018 100644 --- a/src/plugins/text-to-speech.ts +++ b/src/plugins/text-to-speech.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; export interface TTSOptions { /** text to speak */ diff --git a/src/plugins/zip.ts b/src/plugins/zip.ts index 79cfeef4c..b2d4058b1 100644 --- a/src/plugins/zip.ts +++ b/src/plugins/zip.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name Zip From c37fdf47a432d9807646c65f438e460d44c2180e Mon Sep 17 00:00:00 2001 From: Joel Jeske Date: Wed, 17 Aug 2016 00:59:02 -0500 Subject: [PATCH 020/382] docs(): Fix typo "$cordov" -> "$cordova" (#443) --- src/ng1.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng1.ts b/src/ng1.ts index 5f56f3dbf..384bd02f8 100644 --- a/src/ng1.ts +++ b/src/ng1.ts @@ -3,7 +3,7 @@ declare var window; /** * Initialize the ionic.native Angular module if we're running in ng1. * This iterates through the list of registered plugins and dynamically - * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovStatusBar. + * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar. */ export function initAngular1(plugins) { if (window.angular) { From e45d7c4ab165c65f423fc9540ba939cd36ebb49d Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Wed, 17 Aug 2016 00:09:06 -0700 Subject: [PATCH 021/382] docs(): Adds commit message guidelines (#447) --- DEVELOPER.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/DEVELOPER.md b/DEVELOPER.md index 57e86bc12..24857dc5c 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -113,3 +113,32 @@ You need to run `npm run lint` to analyze the code and ensure it's consistency w ### 'Wrapping' Up That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles. + +## Commit Message Format + +We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the our change log. (Ok you got us, it's basically Angular's commit message format). + +`type(scope): subject` + +#### Type +Must be one of the following: + +* **fix**: A bug fix +* **feat**: A new feature +* **docs**: Documentation only changes +* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) +* **refactor**: A code change that neither fixes a bug nor adds a feature +* **perf**: A code change that improves performance +* **test**: Adding missing tests +* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation + +#### Scope +The scope could be anything specifying place of the commit change. For example, the name of the plugin being changed + +#### Subject +The subject contains succinct description of the change: + +* use the imperative, present tense: "change" not "changed" nor "changes" +* do not capitalize first letter +* do not place a period (.) at the end +* entire length of the commit message must not go over 50 characters \ No newline at end of file From 4c00e14cd425daeb1adb2e50dc2b899d419539ac Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 17 Aug 2016 04:09:34 -0300 Subject: [PATCH 022/382] refractor(): fix angular style (#445) * - fix angular style * - Fix angular style --- src/index.ts | 162 +++++++++++++++++++++++++-------------------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/src/index.ts b/src/index.ts index b1cb06cd4..a3be13d2e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,91 +1,91 @@ -import {initAngular1} from './ng1'; +import { initAngular1 } from './ng1'; const DEVICE_READY_TIMEOUT = 2000; declare var window; -import {ActionSheet} from './plugins/actionsheet'; -import {AdMob} from './plugins/admob'; +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'; -import {Badge} from './plugins/badge'; -import {BackgroundGeolocation} from './plugins/background-geolocation'; -import {BackgroundMode} from './plugins/backgroundmode'; -import {BarcodeScanner} from './plugins/barcodescanner'; -import {Base64ToGallery} from './plugins/base64togallery'; -import {BatteryStatus} from './plugins/batterystatus'; -import {Brightness} from './plugins/brightness'; -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'; -import {Crop} from './plugins/crop'; -import {DatePicker} from './plugins/datepicker'; -import {DBMeter} from './plugins/dbmeter'; -import {Deeplinks} from './plugins/deeplinks'; -import {Device} from './plugins/device'; -import {DeviceAccounts} from './plugins/deviceaccounts'; -import {DeviceMotion} from './plugins/devicemotion'; -import {DeviceOrientation} from './plugins/deviceorientation'; -import {Diagnostic} from './plugins/diagnostic'; -import {Dialogs} from './plugins/dialogs'; -import {EmailComposer} from './plugins/emailcomposer'; -import {Facebook} from './plugins/facebook'; -import {File} from './plugins/file'; -import {Transfer} from './plugins/filetransfer'; -import {Flashlight} from './plugins/flashlight'; -import {Geolocation} from './plugins/geolocation'; -import {Globalization} from './plugins/globalization'; -import {GooglePlus} from './plugins/google-plus'; -import {GoogleMap} from './plugins/googlemaps'; -import {GoogleAnalytics} from './plugins/googleanalytics'; -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'; -import {LaunchNavigator} from './plugins/launchnavigator'; -import {LocalNotifications} from './plugins/localnotifications'; -import {MediaCapture} from './plugins/media-capture'; -import {NativeAudio} from './plugins/native-audio'; -import {NativeStorage} from './plugins/nativestorage'; -import {MediaPlugin} from './plugins/media'; -import {Network} from './plugins/network'; -import {OneSignal} from './plugins/onesignal'; +import { AppAvailability } from './plugins/appavailability'; +import { AppRate } from './plugins/apprate'; +import { AppVersion } from './plugins/appversion'; +import { Badge } from './plugins/badge'; +import { BackgroundGeolocation } from './plugins/background-geolocation'; +import { BackgroundMode } from './plugins/backgroundmode'; +import { BarcodeScanner } from './plugins/barcodescanner'; +import { Base64ToGallery } from './plugins/base64togallery'; +import { BatteryStatus } from './plugins/batterystatus'; +import { Brightness } from './plugins/brightness'; +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'; +import { Crop } from './plugins/crop'; +import { DatePicker } from './plugins/datepicker'; +import { DBMeter } from './plugins/dbmeter'; +import { Deeplinks } from './plugins/deeplinks'; +import { Device } from './plugins/device'; +import { DeviceAccounts } from './plugins/deviceaccounts'; +import { DeviceMotion } from './plugins/devicemotion'; +import { DeviceOrientation } from './plugins/deviceorientation'; +import { Diagnostic } from './plugins/diagnostic'; +import { Dialogs } from './plugins/dialogs'; +import { EmailComposer } from './plugins/emailcomposer'; +import { Facebook } from './plugins/facebook'; +import { File } from './plugins/file'; +import { Transfer } from './plugins/filetransfer'; +import { Flashlight } from './plugins/flashlight'; +import { Geolocation } from './plugins/geolocation'; +import { Globalization } from './plugins/globalization'; +import { GooglePlus } from './plugins/google-plus'; +import { GoogleMap } from './plugins/googlemaps'; +import { GoogleAnalytics } from './plugins/googleanalytics'; +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'; +import { LaunchNavigator } from './plugins/launchnavigator'; +import { LocalNotifications } from './plugins/localnotifications'; +import { MediaCapture } from './plugins/media-capture'; +import { NativeAudio } from './plugins/native-audio'; +import { NativeStorage } from './plugins/nativestorage'; +import { MediaPlugin } from './plugins/media'; +import { Network } from './plugins/network'; +import { OneSignal } from './plugins/onesignal'; import { PhotoViewer } from './plugins/photo-viewer'; -import {ScreenOrientation} from './plugins/screen-orientation'; -import {PinDialog} from './plugins/pin-dialog'; -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 {Shake} from './plugins/shake'; -import {Sim} from './plugins/sim'; -import {SMS} from './plugins/sms'; -import {SocialSharing} from './plugins/socialsharing'; -import {SpinnerDialog} from './plugins/spinnerdialog'; -import {Splashscreen} from './plugins/splashscreen'; -import {SQLite} from './plugins/sqlite'; -import {StatusBar} from './plugins/statusbar'; -import {ThreeDeeTouch} from './plugins/3dtouch'; -import {Toast} from './plugins/toast'; -import {TouchID} from './plugins/touchid'; -import {TextToSpeech} from './plugins/text-to-speech'; -import {TwitterConnect} from './plugins/twitter-connect'; -import {Vibration} from './plugins/vibration'; -import {VideoPlayer} from './plugins/video-player'; -import {WebIntent} from './plugins/webintent'; -import {Zip} from './plugins/zip'; +import { ScreenOrientation } from './plugins/screen-orientation'; +import { PinDialog } from './plugins/pin-dialog'; +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 { Shake } from './plugins/shake'; +import { Sim } from './plugins/sim'; +import { SMS } from './plugins/sms'; +import { SocialSharing } from './plugins/socialsharing'; +import { SpinnerDialog } from './plugins/spinnerdialog'; +import { Splashscreen } from './plugins/splashscreen'; +import { SQLite } from './plugins/sqlite'; +import { StatusBar } from './plugins/statusbar'; +import { ThreeDeeTouch } from './plugins/3dtouch'; +import { Toast } from './plugins/toast'; +import { TouchID } from './plugins/touchid'; +import { TextToSpeech } from './plugins/text-to-speech'; +import { TwitterConnect } from './plugins/twitter-connect'; +import { Vibration } from './plugins/vibration'; +import { VideoPlayer } from './plugins/video-player'; +import { WebIntent } from './plugins/webintent'; +import { Zip } from './plugins/zip'; export * from './plugins/3dtouch'; export * from './plugins/background-geolocation'; export * from './plugins/backgroundmode'; From abd706f4350acfbd405bc890db797febfe8d0057 Mon Sep 17 00:00:00 2001 From: Jochen Bedersdorfer Date: Wed, 17 Aug 2016 00:11:10 -0700 Subject: [PATCH 023/382] refractor(file): additions to documentation and type definitions for File plugin (#446) * Additions to documentations and type definitions Added return types to documentation as well as modified return type definition to match actual types returned. Used union types for promises where applicable. Builds and gulp docs ok. * Update file.ts --- src/plugins/file.ts | 135 +++++++++++++++++++++++++++++++------------- 1 file changed, 95 insertions(+), 40 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 4ec1f1e64..3bea03c61 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -341,6 +341,17 @@ declare var FileError: { * @description * This plugin implements a File API allowing read/write access to files residing on the device. * + * The File class implements static convenience functions to access files and directories. + * + * Example: + * ``` + * import { File } from 'ionic-native'; + * + * declare var cordova: any; + * const fs:string = cordova.file.dataDirectory; + * File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh')); + * ``` + * * This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/ * The (now-defunct) Directories and System extensions Latest: http://www.w3.org/TR/2012/WD-file-system-api-20120417/ * Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/ @@ -379,14 +390,14 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dir Name of directory to check - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to true if the directory exists or rejects with an error. */ - static checkDir(path: string, dir: string): Promise { + static checkDir(path: string, dir: string): Promise { if ((/^\//.test(dir))) { let err = new FileError(5); err.message = 'directory cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } let fullpath = path + dir; @@ -404,14 +415,14 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dirName Name of directory to create * @param {boolean} replace If true, replaces file with same name. If false returns error - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. */ - static createDir(path: string, dirName: string, replace: boolean): Promise { + static createDir(path: string, dirName: string, replace: boolean): Promise { if ((/^\//.test(dirName))) { let err = new FileError(5); err.message = 'directory cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } let options: Flags = { @@ -433,14 +444,14 @@ export class File { * * @param {string} path The path to the directory * @param {string} dirName The directory name - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ - static removeDir(path: string, dirName: string): Promise { + static removeDir(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { let err = new FileError(5); err.message = 'directory cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveDirectoryUrl(path) @@ -459,16 +470,16 @@ export class File { * @param {string} dirName The source directory name * @param {string} newPath The destionation path to the directory * @param {string} newDirName The destination directory name - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. */ - static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { + static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { newDirName = newDirName || dirName; if ((/^\//.test(newDirName))) { let err = new FileError(5); err.message = 'directory cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return this.resolveDirectoryUrl(path) @@ -490,13 +501,13 @@ export class File { * @param {string} dirName Name of directory to copy * @param {string} newPath Base FileSystem of new location * @param {string} newDirName New name of directory to copy to (leave blank to remain the same) - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. */ - static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { + static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { if ((/^\//.test(newDirName))) { let err = new FileError(5); err.message = 'directory cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return this.resolveDirectoryUrl(path) @@ -516,7 +527,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dirName Name of directory - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to an array of Entry objects or rejects with an error. */ static listDir(path: string, dirName: string): Promise { @@ -541,7 +552,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dirName Name of directory - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves with a RemoveResult or rejects with an error. */ static removeRecursively(path: string, dirName: string): Promise { @@ -565,14 +576,14 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} file Name of file to check - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves with a boolean or rejects with an error. */ - static checkFile(path: string, file: string): Promise { + static checkFile(path: string, file: string): Promise { if ((/^\//.test(file))) { let err = new FileError(5); err.message = 'file cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveLocalFilesystemUrl(path + file) @@ -595,13 +606,13 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName Name of file to create * @param {boolean} replace If true, replaces file with same name. If false returns error - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to a FileEntry or rejects with an error. */ - static createFile(path: string, fileName: string, replace: boolean): Promise { + static createFile(path: string, fileName: string, replace: boolean): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } let options: Flags = { @@ -623,14 +634,14 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName Name of file to remove - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ - static removeFile(path: string, fileName: string): Promise { + static removeFile(path: string, fileName: string): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveDirectoryUrl(path) @@ -642,6 +653,14 @@ export class File { }); } + /** Write a new file to the desired location. + * + * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param {string} fileName path relative to base path + * @param {string} text content to write + * @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information. + * @returns {Promise} Returns a Promise that resolves or rejects with an error. + */ static writeFile(path: string, fileName: string, text: string, replaceOrOptions: boolean | WriteOptions): Promise { if ((/^\//.test(fileName))) { @@ -681,6 +700,13 @@ export class File { }); } + /** Write to an existing file. + * + * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param {string} fileName path relative to base path + * @param {string} text content to write + * @returns {Promise} Returns a Promise that resolves or rejects with an error. + */ static writeExistingFile(path: string, fileName: string, text: string): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); @@ -700,11 +726,18 @@ export class File { }); } - static readAsText(path: string, file: string): Promise { + /** + * Read the contents of a file as text. + * + * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param {string} file Name of file, relative to path. + * @return {Promise} Returns a Promise that resolves with the contents of the file as string or rejects with an error. + */ + static readAsText(path: string, file: string): Promise { if ((/^\//.test(file))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveDirectoryUrl(path) @@ -728,12 +761,20 @@ export class File { }); }); } + /** + * Read file and return data as a base64 encoded data url. + * A data url is of the form: + * data:[][;base64], - static readAsDataURL(path: string, file: string): Promise { + * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param {string} file Name of file, relative to path. + * @return {Promise} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error. + */ + static readAsDataURL(path: string, file: string): Promise { if ((/^\//.test(file))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveDirectoryUrl(path) @@ -758,11 +799,18 @@ export class File { }); } - static readAsBinaryString(path: string, file: string): Promise { + /** + * Read file and return data as a binary data. + + * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param {string} file Name of file, relative to path. + * @return {Promise} Returns a Promise that resolves with the contents of the file as string rejects with an error. + */ + static readAsBinaryString(path: string, file: string): Promise { if ((/^\//.test(file))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveDirectoryUrl(path) @@ -787,11 +835,18 @@ export class File { }); } - static readAsArrayBuffer(path: string, file: string): Promise { + /** + * Read file and return data as an ArrayBuffer. + + * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param {string} file Name of file, relative to path. + * @return {Promise} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error. + */ + static readAsArrayBuffer(path: string, file: string): Promise { if ((/^\//.test(file))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return File.resolveDirectoryUrl(path) @@ -823,15 +878,15 @@ export class File { * @param {string} fileName Name of file to move * @param {string} newPath Base FileSystem of new location * @param {string} newFileName New name of file to move to (leave blank to remain the same) - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to the new Entry or rejects with an error. */ - static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { + static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { newFileName = newFileName || fileName; if ((/^\//.test(newFileName))) { let err = new FileError(5); err.message = 'file name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return this.resolveDirectoryUrl(path) @@ -853,15 +908,15 @@ export class File { * @param {string} fileName Name of file to copy * @param {string} newPath Base FileSystem of new location * @param {string} newFileName New name of file to copy to (leave blank to remain the same) - * @return Returns a Promise that resolves or rejects with an error. + * @return {Promise} Returns a Promise that resolves to an Entry or rejects with an error. */ - static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { + static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { newFileName = newFileName || fileName; if ((/^\//.test(newFileName))) { let err = new FileError(5); err.message = 'file name cannot start with \/'; - return Promise.reject(err); + return Promise.reject(err); } return this.resolveDirectoryUrl(path) From 22ab575dd0b0c06b155144dcde2eb4d9e9c6721f Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Wed, 17 Aug 2016 00:11:52 -0700 Subject: [PATCH 024/382] docs(DEVELOPER.MD): Adds steps for adding new plugins to index.ts (#444) * Adds steps for updating index.ts * Adds .DS_Store to gitignore * Adds step for exporting --- .gitignore | 1 + DEVELOPER.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/.gitignore b/.gitignore index d2d968513..1e12dbb4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ .idea dist/ diff --git a/DEVELOPER.md b/DEVELOPER.md index 24857dc5c..e52ff352b 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -102,6 +102,58 @@ The `@Cordova` decorator has a few more options now. `clearFunction` is used in conjunction with the `observable` option and indicates the function to be called when the Observable is disposed. +### Updating index.ts + +For new plugins, you will need to update `/src/index.ts` to properly export your plugin and make it available for use. + +1. Import the plugin class into `index.ts`: + +`import {PluginClassName} from ./plugins/filenameForPlugin` + +No need to put the `.ts` extension on the filename. + +2. Add the plugin class name to the list in the `export` object: + +``` +export { + ActionSheet, + AdMob, + AndroidFingerprintAuth, + YourPluginClassName, + ... +} +``` + +3. Add the plugin class name to the `window['IonicNative']` object: + +``` +window['IonicNative'] = { + ActionSheet: ActionSheet, + AdMob: AdMob, + AndroidFingerprintAuth: AndroidFingerprintAuth, + YourPluginClassName: YourPluginClassName, + ... +``` + +4. If your plugin exports any other objects outside of the plugin class, add an export statement for the file: + +`export * from './plugins/filenameForPlugin';` + +No need to put the `.ts` extension on the filename. + +For example, `googlemaps.ts` exports a const outside of the plugin's main `GoogleMap` class: + +``` +export const GoogleMapsAnimation = { + BOUNCE: 'BOUNCE', + DROP: 'DROP' +}; +``` + +To properly export `GoogleMapsAnimation`, `index.ts` is updated with: + +`export * from './plugins/googlemaps';` + ### Testing your changes You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one. From 95e256293f60f922a2966675fa8a5100da21472b Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Aug 2016 07:28:21 -0400 Subject: [PATCH 025/382] docs(barcodescanner): update docs addresses #260 --- src/plugins/barcodescanner.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index b6bb0e07e..65b4227ff 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -38,6 +38,7 @@ export class BarcodeScanner { }; /** * Open the barcode scanner. + * @param options {Object} Optional options to pass to the scanner * @return Returns a Promise that resolves with scanner data, or rejects with an error. */ @Cordova({ @@ -48,8 +49,8 @@ export class BarcodeScanner { /** * Encodes data into a barcode. * NOTE: not well supported on Android - * @param type - * @param data + * @param type {string} Type of encoding + * @param data {any} Data to encode */ @Cordova() static encode(type: string, data: any): Promise { return; } From 4e87ac72eabfe4da38124b9025d4b71325999855 Mon Sep 17 00:00:00 2001 From: Kevin Boosten Date: Wed, 17 Aug 2016 13:34:11 +0200 Subject: [PATCH 026/382] fix(): add the reject function at the expected errorIndex position in the args array (#436) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't want that the reject cb takes the position of an optional argument that has not been defined For example the Dialogs.alert method takes an optional 'buttonLabel' string. In case we do not set this value, and thus want to use the default value, the 'reject' callback get spliced into this position due the fact that the splice start index is bigger than the array length. Dialogs.alert("title", "message", "My button text") --> args = ["title", resolve, "message", "My button text", reject] Dialogs.alert("title", "message") --> args = ["title", resolve, "message", reject] --> reject is on the position of the buttontitle! The cordova-plugin-dialogs alert function receives the wrong arguments —> alert: function(message, completeCallback, title, buttonLabel) The buttonLabel will receive the "reject" callback instead of a undefined value. --- src/plugins/plugin.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index a1b2cbc1a..1be9f8508 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -51,7 +51,13 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func } else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') { // If we've specified a success/error index args.splice(opts.successIndex, 0, resolve); - args.splice(opts.errorIndex, 0, reject); + + // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour. + if (opts.errorIndex > args.length) { + args[opts.errorIndex] = reject; //insert the reject fn at the correct specific index + } else { + args.splice(opts.errorIndex, 0, reject); //otherwise just splice it into the array + } } else { // Otherwise, let's tack them on to the end of the argument list // which is 90% of cases From f2bf2b56264603ed0e3a743f4e1a6b04ed7b25bd Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Fri, 19 Aug 2016 08:34:12 +0100 Subject: [PATCH 027/382] refactor: use es6 features in index file --- src/index.ts | 172 +++++++++++++++++++++++++-------------------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/src/index.ts b/src/index.ts index a3be13d2e..de5f50f10 100644 --- a/src/index.ts +++ b/src/index.ts @@ -177,87 +177,87 @@ export * from './plugins/plugin'; // Window export to use outside of a module loading system window['IonicNative'] = { - ActionSheet: ActionSheet, - AdMob: AdMob, - AndroidFingerprintAuth: AndroidFingerprintAuth, - AppAvailability: AppAvailability, - AppRate: AppRate, - AppVersion: AppVersion, - Badge: Badge, - BackgroundGeolocation: BackgroundGeolocation, - BackgroundMode: BackgroundMode, - BarcodeScanner: BarcodeScanner, - Base64ToGallery: Base64ToGallery, - BatteryStatus: BatteryStatus, - Brightness: Brightness, - BLE: BLE, - BluetoothSerial: BluetoothSerial, - Calendar: Calendar, - Camera: Camera, - CameraPreview: CameraPreview, - CardIO: CardIO, - Clipboard: Clipboard, - Contacts: Contacts, - Crop: Crop, - DatePicker: DatePicker, - DBMeter: DBMeter, - Deeplinks: Deeplinks, - Device: Device, - DeviceAccounts: DeviceAccounts, - DeviceMotion: DeviceMotion, - DeviceOrientation: DeviceOrientation, - Dialogs: Dialogs, - Diagnostic: Diagnostic, - EmailComposer: EmailComposer, - Facebook: Facebook, - File: File, - Flashlight: Flashlight, - Geolocation: Geolocation, - Globalization: Globalization, - GooglePlus: GooglePlus, - GoogleMap : GoogleMap, - GoogleAnalytics: GoogleAnalytics, - Hotspot: Hotspot, - Httpd: Httpd, - IBeacon: IBeacon, - ImagePicker: ImagePicker, - ImageResizer: ImageResizer, - InAppBrowser: InAppBrowser, - Keyboard: Keyboard, - LaunchNavigator: LaunchNavigator, - LocalNotifications: LocalNotifications, - MediaCapture: MediaCapture, - MediaPlugin: MediaPlugin, - NativeAudio: NativeAudio, - NativeStorage: NativeStorage, - Network: Network, - Printer: Printer, - Push: Push, - OneSignal: OneSignal, - PhotoViewer: PhotoViewer, - ScreenOrientation: ScreenOrientation, - PinDialog: PinDialog, - SafariViewController: SafariViewController, - Screenshot: Screenshot, - SecureStorage: SecureStorage, - Shake: Shake, - Sim: Sim, - SMS: SMS, - SocialSharing: SocialSharing, - SpinnerDialog: SpinnerDialog, - Splashscreen: Splashscreen, - SQLite: SQLite, - StatusBar: StatusBar, - ThreeDeeTouch: ThreeDeeTouch, - Toast: Toast, - TouchID: TouchID, - Transfer: Transfer, - TextToSpeech: TextToSpeech, - TwitterConnect: TwitterConnect, - VideoPlayer: VideoPlayer, - Vibration: Vibration, - WebIntent: WebIntent, - Zip: Zip + ActionSheet, + AdMob, + AndroidFingerprintAuth, + AppAvailability, + AppRate, + AppVersion, + Badge, + BackgroundGeolocation, + BackgroundMode, + BarcodeScanner, + Base64ToGallery, + BatteryStatus, + Brightness, + BLE, + BluetoothSerial, + Calendar, + Camera, + CameraPreview, + CardIO, + Clipboard, + Contacts, + Crop, + DatePicker, + DBMeter, + Deeplinks, + Device, + DeviceAccounts, + DeviceMotion, + DeviceOrientation, + Dialogs, + Diagnostic, + EmailComposer, + Facebook, + File, + Flashlight, + Geolocation, + Globalization, + GooglePlus, + GoogleMap, + GoogleAnalytics, + Hotspot, + Httpd, + IBeacon, + ImagePicker, + ImageResizer, + InAppBrowser, + Keyboard, + LaunchNavigator, + LocalNotifications, + MediaCapture, + MediaPlugin, + NativeAudio, + NativeStorage, + Network, + Printer, + Push, + OneSignal, + PhotoViewer, + ScreenOrientation, + PinDialog, + SafariViewController, + Screenshot, + SecureStorage, + Shake, + Sim, + SMS, + SocialSharing, + SpinnerDialog, + Splashscreen, + SQLite, + StatusBar, + ThreeDeeTouch, + Toast, + TouchID, + Transfer, + TextToSpeech, + TwitterConnect, + VideoPlayer, + Vibration, + WebIntent, + Zip }; initAngular1(window['IonicNative']); @@ -266,16 +266,16 @@ initAngular1(window['IonicNative']); // log an error if it didn't fire in a reasonable amount of time. Generally, // when this happens, developers should remove and reinstall plugins, since // an inconsistent plugin is often the culprit. -let before = +new Date; +const before = Date.now(); let didFireReady = false; -document.addEventListener('deviceready', function() { - console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms'); +document.addEventListener('deviceready', () => { + console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms'); didFireReady = true; }); -setTimeout(function() { +setTimeout(() => { if (!didFireReady && window.cordova) { - console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.'); + console.warn(`Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`); } }, DEVICE_READY_TIMEOUT); From 4a0f082158ba518da080dac9c47c4dd38c3aaef4 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 19 Aug 2016 04:00:05 -0700 Subject: [PATCH 028/382] Feat(twitter): adds showUser() (#454) --- src/plugins/twitter-connect.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index aee4480c4..bfdc5928b 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -45,6 +45,13 @@ export class TwitterConnect { */ @Cordova() static logout(): Promise {return; } + + /** + * Returns user's profile information + * @return {Promise} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails + */ + @Cordova() + static showUser(): Promise {return; } } export interface TwitterConnectResponse { /** From 7a5301381924fba99f0fd9b71b06a51b0fd2de67 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Fri, 19 Aug 2016 12:05:11 +0100 Subject: [PATCH 029/382] feat(VideoEditor): add video editor plugin. (#457) Closes #316 --- src/index.ts | 3 + src/plugins/video-editor.ts | 200 ++++++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 src/plugins/video-editor.ts diff --git a/src/index.ts b/src/index.ts index a3be13d2e..de1d6bd1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,6 +83,7 @@ import { TouchID } from './plugins/touchid'; import { TextToSpeech } from './plugins/text-to-speech'; import { TwitterConnect } from './plugins/twitter-connect'; import { Vibration } from './plugins/vibration'; +import { VideoEditor } from './plugins/video-editor'; import { VideoPlayer } from './plugins/video-player'; import { WebIntent } from './plugins/webintent'; import { Zip } from './plugins/zip'; @@ -118,6 +119,7 @@ export * from './plugins/sms'; export * from './plugins/spinnerdialog'; export * from './plugins/toast'; export * from './plugins/twitter-connect'; +export * from './plugins/video-editor'; export * from './plugins/video-player'; export { ActionSheet, @@ -254,6 +256,7 @@ window['IonicNative'] = { Transfer: Transfer, TextToSpeech: TextToSpeech, TwitterConnect: TwitterConnect, + VideoEditor: VideoEditor, VideoPlayer: VideoPlayer, Vibration: Vibration, WebIntent: WebIntent, diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts new file mode 100644 index 000000000..8b6c2b636 --- /dev/null +++ b/src/plugins/video-editor.ts @@ -0,0 +1,200 @@ +import {Plugin, Cordova} from './plugin'; + +export interface TranscodeOptions { + + /** The path to the video on the device. */ + fileUri: string; + + /** The file name for the transcoded video */ + outputFileName: string; + + /** Instructions on how to encode the video. Android is always mp4 */ + outputFileType?: number; + + /** Should the video be processed with quailty or speed in mind. iOS only */ + optimizeForNetworkUse?: number; + + /** Save the new video the library. Not supported in windows. Defaults to true */ + saveToLibrary?: boolean; + + /** Delete the original video. Android only. Defaults to false */ + deleteInputFile?: boolean; + + /** iOS only. Defaults to true */ + maintainAspectRatio?: boolean; + + /** Width of the result */ + width?: number; + + /** Height of the result */ + height?: number; + + /** Bitrate in bits. Defaults to 1 megabit (1000000). */ + videoBitrate?: number; + + /** Frames per second of the result. Android only. Defaults to 24. */ + fps?: number; + + /** Number of audio channels. iOS only. Defaults to 2. */ + audioChannels?: number; + + /** Sample rate for the audio. iOS only. Defaults to 44100*/ + audioSampleRate?: number; + + /** Sample rate for the audio. iOS only. Defaults to 128 kilobits (128000). */ + audioBitrate?: number; + + /** Not supported in windows, progress on the transcode. info will be a number from 0 to 100 */ + progress?: (info: number) => void; +} + +export interface TrimOptions { + + /** Path to input video. */ + fileUri: string; + + /** Time to start trimming in seconds */ + trimStart: number; + + /** Time to end trimming in seconds */ + trimEnd: number; + + /** Output file name */ + outputFileName: string; + + /** Progress on transcode. info will be a number from 0 to 100 */ + progress?: (info: any) => void; + +} + +export interface CreateThumbnailOptions { + + /** The path to the video on the device */ + fileUri: string; + + /** The file name for the JPEG image */ + outputFileName: string; + + /** Location in the video to create the thumbnail (in seconds) */ + atTime?: number; + + /** Width of the thumbnail. */ + width?: number; + + /** Height of the thumbnail. */ + height?: number; + + /** Quality of the thumbnail (between 1 and 100). */ + quality?: number; + +} + +export interface GetVideoInfoOptions { + + /** The path to the video on the device. */ + fileUri: string + +} + +export interface VideoInfo { + + /** Width of the video in pixels. */ + width: number; + + /** Height of the video in pixels. */ + height: number; + + /** Orientation of the video. Will be either portrait or landscape. */ + orientation: 'portrait' | 'landscape'; + + /** Duration of the video in seconds. */ + duration: number; + + /** Size of the video in bytes. */ + size: number; + + /** Bitrate of the video in bits per second. */ + bitrate: number; + +} + +/** + * @name VideoEditor + * @description Edit videos using native device APIs + * + * @usage + * ``` + * import {VideoEditor} from 'ionic-native'; + * + * VideoEditor.transcodeVideo({ + * fileUri: '/path/to/input.mov', + * outputFileName: 'output.mp4', + * outputFileType: VideoEditor.OutputFileType.MPEG4 + * }) + * .then((fileUri: string) => console.log('video transcode success', fileUri)) + * .catch((error: any) => console.log('video transcode error', error)); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-video-editor', + pluginRef: 'VideoEditor', + repo: 'https://github.com/jbavari/cordova-plugin-video-editor', + platforms: ['Android', 'iOS', 'Windows Phone 8'] +}) +export class VideoEditor { + + static OptimizeForNetworkUse = { + NO: 0, + YES: 1 + }; + + static OutputFileType = { + M4V: 0, + MPEG4: 1, + M4A: 2, + QUICK_TIME: 3 + }; + + /** + * Transcode a video + * @param options {TranscodeOptions} Options + * @return {Promise} Returns a promise that resolves to the path of the transcoded video + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static transcodeVideo(options: TranscodeOptions): Promise { return; } + + /** + * Trim a video + * @param options {TrimOptions} Options + * @return {Promise} Returns a promise that resolves to the path of the trimmed video + */ + @Cordova({ + callbackOrder: 'reverse', + platforms: ['iOS'] + }) + static trim(options: TrimOptions): Promise { return; } + + /** + * Create a JPEG thumbnail from a video + * @param options {CreateThumbnailOptions} Options + * @return {Promise} Returns a promise that resolves to the path to the jpeg image on the device + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static createThumbnail(options: CreateThumbnailOptions): Promise { return; } + + /** + * Get info on a video (width, height, orientation, duration, size, & bitrate) + * @param options {GetVideoInfoOptions} Options + * @return {Promise} Returns a promise that resolves to an object containing info on the video + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static getVideoInfo(options: GetVideoInfoOptions): Promise { return; } + +} From 62bcd313e3ea55e3bb15bdcde8470a1dd474f9dc Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 19 Aug 2016 04:06:17 -0700 Subject: [PATCH 030/382] docs(file): adds Entry to types returned in File.moveDir promise (#456) --- src/plugins/file.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 3bea03c61..051ca2ba9 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -470,10 +470,10 @@ export class File { * @param {string} dirName The source directory name * @param {string} newPath The destionation path to the directory * @param {string} newDirName The destination directory name - * @return {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. + * @return {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. */ - static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { + static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { newDirName = newDirName || dirName; if ((/^\//.test(newDirName))) { From 14e41a31ef043b94e5404939de6cd279b03b68ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20St=C3=B6rcher?= Date: Fri, 19 Aug 2016 15:07:32 +0200 Subject: [PATCH 031/382] fix(file): fixes exclusive option (#459) Exclusive means that the file will not be Overridden so it has to be set if replace is False. --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 051ca2ba9..b7cc3bda7 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -619,7 +619,7 @@ export class File { create: true }; - if (replace) { + if (!replace) { options.exclusive = true; } From f3e698f1bec6da76d6b29a1a9d2b61a9f5dbf056 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Fri, 19 Aug 2016 14:08:05 +0100 Subject: [PATCH 032/382] feat(instagram): add instagram sharing plugin (#453) Closes #307 --- src/index.ts | 3 +++ src/plugins/instagram.ts | 57 ++++++++++++++++++++++++++++++++++++++++ src/plugins/plugin.ts | 8 ++++++ 3 files changed, 68 insertions(+) create mode 100644 src/plugins/instagram.ts diff --git a/src/index.ts b/src/index.ts index de1d6bd1e..774886eea 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,6 +52,7 @@ import { ImagePicker } from './plugins/imagepicker'; import { ImageResizer } from './plugins/imageresizer'; import { InAppBrowser } from './plugins/inappbrowser'; import { Insomnia } from './plugins/insomnia'; +import { Instagram } from './plugins/instagram'; import { Keyboard } from './plugins/keyboard'; import { LaunchNavigator } from './plugins/launchnavigator'; import { LocalNotifications } from './plugins/localnotifications'; @@ -151,6 +152,7 @@ export { GoogleAnalytics, Hotspot, Insomnia, + Instagram, Keyboard, NativeAudio, NativeStorage, @@ -225,6 +227,7 @@ window['IonicNative'] = { ImagePicker: ImagePicker, ImageResizer: ImageResizer, InAppBrowser: InAppBrowser, + Instagram: Instagram, Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, diff --git a/src/plugins/instagram.ts b/src/plugins/instagram.ts new file mode 100644 index 000000000..7ad21515c --- /dev/null +++ b/src/plugins/instagram.ts @@ -0,0 +1,57 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * @name Instagram + * @description Share a photo with the instagram app + * + * @usage + * ``` + * import {Instagram} from 'ionic-native'; + * + * Instagram.share('data:image/png;uhduhf3hfif33', 'Caption') + * .then(() => console.log('Shared!')) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-instagram-plugin', + pluginRef: 'Instagram', + repo: 'https://github.com/vstirbu/InstagramPlugin' +}) +export class Instagram { + + /** + * Detect if the Instagram application is installed on the device. + * + * @return {Promise} Returns a promise that returns a boolean value if installed, or the app version on android + */ + @Cordova({ + callbackStyle: 'node' + }) + static isInstalled(): Promise {return;} + + /** + * Share an image on Instagram + * Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption. + * + * @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share + * @param caption The caption of the image + * @return {Promise} Returns a promise that resolves if the image was shared + */ + @Cordova({ + callbackStyle: 'node' + }) + static share(canvasIdOrDataUrl: string, caption?: string): Promise {return;} + + /** + * Share a library asset or video + * @param assetLocalIdentifier A local fileURI + * @return {Promise} Returns a promise that resolves if the image was shared + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static shareAsset(assetLocalIdentifier: string): Promise {return;} + +} diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 1be9f8508..3adc4eecc 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -48,6 +48,14 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func // Get those arguments in the order [resolve, reject, ...restOfArgs] args.unshift(reject); args.unshift(resolve); + } else if (opts.callbackStyle === 'node') { + args.push((err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); } else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') { // If we've specified a success/error index args.splice(opts.successIndex, 0, resolve); From 55ba65ac684c59e224d5fd857593962a83dec5c5 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 19 Aug 2016 06:10:05 -0700 Subject: [PATCH 033/382] fix(camera-preview): changes implementation to match Cordova plugin (#441) * Removes preview settings from options obj and creates proper rect interface * Changes startCamera() signature to match plugin * Adds alpha to function signature * Removes CameraPreviewOptions and CameraPreviewSize interfaces that don't match plugin * Adds back CameraPreviewSize interface - oops * Updates docs for startCamera() * Changes CameraPreviewSize interface to Size to match plugin * Adds docs for takePicture * Reverts change to signature of setOnPictureTakenHandler * Adds CameraPreview prefix to interfaces --- src/plugins/camera-preview.ts | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 57f16f9ae..0c45db674 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -2,25 +2,11 @@ import { Cordova, Plugin } from './plugin'; import { Observable } from 'rxjs/Observable'; -export interface CameraPreviewOptions { +export interface CameraPreviewRect { 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 { @@ -46,12 +32,19 @@ export class CameraPreview { /** * Starts the camera preview instance. - * @param {CameraPreviewOptions} options for the preview + * @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number} + * @param {string} which camera to use - 'front' | 'back' + * @param {boolean} enable tap to take picture + * @param {boolean} enable preview box drag across the screen + * @param {boolean} send preview box to the back of the webview + * @param {number} alpha of the preview box */ @Cordova({ sync: true }) - static startCamera(options: CameraPreviewOptions): void { }; + static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { + + }; /** * Stops the camera preview instance. @@ -63,6 +56,7 @@ export class CameraPreview { /** * Take the picture, the parameter size is optional + * @param {CameraPreviewSize} optional - size of the picture to take */ @Cordova({ sync: true From a94912912ebd1a208d7fd9727bcfb199c625d4fd Mon Sep 17 00:00:00 2001 From: Guillermo Date: Fri, 19 Aug 2016 17:01:24 +0200 Subject: [PATCH 034/382] chore(deps): bump tslint-ionic-rules (#460) * Bump tslint-ionic-rules * Bump tslint-ionic-rules --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2fd11cdd..9bcd30bd2 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "q": "1.4.1", "semver": "^5.0.1", "tslint": "^3.8.1", - "tslint-ionic-rules": "0.0.3", + "tslint-ionic-rules": "0.0.5", "typescript": "^1.8.10" }, "scripts": { From eab0bf44b26a6c5368fb4f882679d3607f92ec0e Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Sun, 21 Aug 2016 07:42:11 -0700 Subject: [PATCH 035/382] refractor(media): change MediaError to interface, and error codes to static members (#463) --- src/plugins/media.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index 78e01ce47..b9d91a14b 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -4,6 +4,11 @@ import { Observable } from 'rxjs/Observable'; declare var Media: any; +export interface MediaError { + code: number; + message: string; +} + /** * @name MediaPlugin * @description @@ -78,6 +83,12 @@ export class MediaPlugin { static MEDIA_PAUSED: number = 3; static MEDIA_STOPPED: number = 4; + //error codes + static MEDIA_ERR_ABORTED: number = 1; + static MEDIA_ERR_NETWORK: number = 2; + static MEDIA_ERR_DECODE: number = 3; + static MEDIA_ERR_NONE_SUPPORTED: number = 4; + // Properties private _objectInstance: any; status: Observable; @@ -188,13 +199,4 @@ export class MediaPlugin { }) 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; } - code: number; - message: string; -} +} \ No newline at end of file From af392821914c06d58e597809b4f4a2eb3fd40603 Mon Sep 17 00:00:00 2001 From: Fabien Duthu Date: Mon, 22 Aug 2016 15:37:51 +0200 Subject: [PATCH 036/382] Removed 'public' before the property names and cleaned c/p extra docs --- src/plugins/estimote-beacons.ts | 83 +++++++-------------------------- 1 file changed, 18 insertions(+), 65 deletions(-) diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index befd3a144..2896120c1 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -17,59 +17,59 @@ import { Observable } from 'rxjs/Observable'; export class EstimoteBeacons { /** Proximity value */ - public static ProximityUnknown = 0; + static ProximityUnknown = 0; /** Proximity value */ - public static ProximityImmediate = 1; + static ProximityImmediate = 1; /** Proximity value */ - public static ProximityNear = 2; + static ProximityNear = 2; /** Proximity value */ - public static ProximityFar = 3; + static ProximityFar = 3; /** Beacon colour */ - public static BeaconColorUnknown = 0; + static BeaconColorUnknown = 0; /** Beacon colour */ - public static BeaconColorMintCocktail = 1; + static BeaconColorMintCocktail = 1; /** Beacon colour */ - public static BeaconColorIcyMarshmallow = 2; + static BeaconColorIcyMarshmallow = 2; /** Beacon colour */ - public static BeaconColorBlueberryPie = 3; + static BeaconColorBlueberryPie = 3; /** * Beacon colour. */ - public static BeaconColorSweetBeetroot = 4; + static BeaconColorSweetBeetroot = 4; /** Beacon colour */ - public static BeaconColorCandyFloss = 5; + static BeaconColorCandyFloss = 5; /** Beacon colour */ - public static BeaconColorLemonTart = 6; + static BeaconColorLemonTart = 6; /** Beacon colour */ - public static BeaconColorVanillaJello = 7; + static BeaconColorVanillaJello = 7; /** Beacon colour */ - public static BeaconColorLiquoriceSwirl = 8; + static BeaconColorLiquoriceSwirl = 8; /** Beacon colour */ - public static BeaconColorWhite = 9; + static BeaconColorWhite = 9; /** Beacon colour */ - public static BeaconColorTransparent = 10; + static BeaconColorTransparent = 10; /** Region state */ - public static RegionStateUnknown = 'unknown'; + static RegionStateUnknown = 'unknown'; /** Region state */ - public static RegionStateOutside = 'outside'; + static RegionStateOutside = 'outside'; /** Region state */ - public static RegionStateInside = 'inside'; + static RegionStateInside = 'inside'; /** * Ask the user for permission to use location services @@ -229,53 +229,6 @@ export class EstimoteBeacons { @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. From 38ff6f2a32cf2879c7ed8ad8070c1afeccf5a64e Mon Sep 17 00:00:00 2001 From: Aaron Czichon Date: Tue, 23 Aug 2016 00:18:23 +0200 Subject: [PATCH 037/382] docs(onesignal): updated the OneSignal docs (#467) --- src/plugins/onesignal.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 379d4bd51..365fcbb2f 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -14,13 +14,11 @@ import { Observable } from 'rxjs/Observable'; * ```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); + * {googleProjectNumber: '703322744261'}) + * .subscribe(jsonData => { + * console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData)); + * }); * * OneSignal.enableInAppAlertNotification(true); * ``` From 16628a49f7ee1304b136db6796d10234c79a37d7 Mon Sep 17 00:00:00 2001 From: Robert Coie Date: Mon, 22 Aug 2016 15:18:53 -0700 Subject: [PATCH 038/382] fix(file): initialize writeFile options (#468) --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index b7cc3bda7..d03d752de 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -669,7 +669,7 @@ export class File { return Promise.reject(err); } - let opts: WriteOptions; + let opts: WriteOptions = {}; if (replaceOrOptions) { if (typeof(replaceOrOptions) === 'boolean') { opts.replace = replaceOrOptions; From ed8c67ce7ede4530d55a1e550785a1fb9274abc3 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Mon, 22 Aug 2016 19:19:43 -0300 Subject: [PATCH 039/382] chore(): tslint (#466) * fix src tslint gulp ionic * - fix errors tslint --- gulpfile.js | 4 ++- src/plugins/3dtouch.ts | 5 +-- src/plugins/background-geolocation.ts | 2 -- src/plugins/camera-preview.ts | 2 +- src/plugins/crop.ts | 2 +- src/plugins/emailcomposer.ts | 19 ++++++++-- src/plugins/file.ts | 4 --- src/plugins/googlemaps.ts | 51 +++++++++++++++++++-------- src/plugins/instagram.ts | 6 ++-- src/plugins/media.ts | 10 +++--- src/plugins/onesignal.ts | 2 +- src/plugins/plugin.ts | 4 +-- src/plugins/screenshot.ts | 2 +- src/plugins/twitter-connect.ts | 2 +- src/plugins/video-editor.ts | 2 +- src/plugins/video-player.ts | 2 +- 16 files changed, 76 insertions(+), 43 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 863d6db0e..eaaf8e872 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,7 +27,9 @@ gulp.task("minify:dist", function(){ .pipe(gulp.dest('./dist')); }); -gulp.task('lint', tslint); +gulp.task('lint', function() { + tslint({src: 'src/**/*.ts'}); +}); gulp.task('plugin:create', function(){ if(flags.n && flags.n !== ''){ diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index bbbc9d226..0288a28df 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -106,8 +106,9 @@ export class ThreeDeeTouch { */ static onHomeIconPressed(): Observable { return new Observable(observer => { - if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer); - else { + if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) { + window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer); + } else { observer.error('3dTouch plugin is not available.'); observer.complete(); } diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index dc452efd2..bafbb8966 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -1,6 +1,4 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; - declare var window; diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 0c45db674..af0499f38 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -42,7 +42,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { + static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }; diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts index 86dc91294..92f42d000 100644 --- a/src/plugins/crop.ts +++ b/src/plugins/crop.ts @@ -31,4 +31,4 @@ export class Crop { callbackOrder: 'reverse' }) static crop(pathToImage: string, options?: {quality: number}): Promise {return; } -} \ No newline at end of file +} diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index c1cdddd1b..7701a5235 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -59,8 +59,23 @@ export class EmailComposer { */ 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(); }); + if (app) { + cordova.plugins.email.isAvailable(app, (isAvailable) => { + if (isAvailable) { + resolve(); + } else { + reject(); + } + }); + } else { + cordova.plugins.email.isAvailable((isAvailable) => { + if (isAvailable) { + resolve(); + } else { + reject(); + } + }); + } }); } diff --git a/src/plugins/file.ts b/src/plugins/file.ts index d03d752de..213d33150 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -676,10 +676,6 @@ export class File { } } - let cflags: Flags = { - create: true - }; - return File.resolveDirectoryUrl(path) .then((fse) => { return File.getFile(fse, fileName, opts); diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 4b4f1530a..a6faa97d2 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -204,8 +204,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addMarker(options, (marker: any) => { - if (marker) resolve(new GoogleMapsMarker(marker)); - else reject(); + if (marker) { + resolve(new GoogleMapsMarker(marker)); + } else { + reject(); + } }); } ); @@ -215,8 +218,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addCircle(options, (circle: any) => { - if (circle) resolve(new GoogleMapsCircle(circle)); - else reject(); + if (circle) { + resolve(new GoogleMapsCircle(circle)); + } else { + reject(); + } }); } ); @@ -226,8 +232,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addPolygon(options, (polygon: any) => { - if (polygon) resolve(new GoogleMapsPolygon(polygon)); - else reject(); + if (polygon) { + resolve(new GoogleMapsPolygon(polygon)); + } else { + reject(); + } }); } ); @@ -237,8 +246,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addPolyline(options, (polyline: any) => { - if (polyline) resolve(new GoogleMapsPolyline(polyline)); - else reject(); + if (polyline) { + resolve(new GoogleMapsPolyline(polyline)); + } else { + reject(); + } }); } ); @@ -248,8 +260,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addTileOverlay(options, (tileOverlay: any) => { - if (tileOverlay) resolve(new GoogleMapsTileOverlay(tileOverlay)); - else reject(); + if (tileOverlay) { + resolve(new GoogleMapsTileOverlay(tileOverlay)); + } else { + reject(); + } }); } ); @@ -259,8 +274,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => { - if (groundOverlay) resolve(new GoogleMapsGroundOverlay(groundOverlay)); - else reject(); + if (groundOverlay) { + resolve(new GoogleMapsGroundOverlay(groundOverlay)); + } else { + reject(); + } }); } ); @@ -270,8 +288,11 @@ export class GoogleMap { return new Promise( (resolve, reject) => { this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => { - if (kmlOverlay) resolve(new GoogleMapsKmlOverlay(kmlOverlay)); - else reject(); + if (kmlOverlay) { + resolve(new GoogleMapsKmlOverlay(kmlOverlay)); + } else { + reject(); + } }); } ); @@ -1047,7 +1068,7 @@ export interface GeocoderResult { permises?: string; phone?: string; url?: string - }, + }; locale?: string; locality?: string; position?: { lat: number; lng: number }; diff --git a/src/plugins/instagram.ts b/src/plugins/instagram.ts index 7ad21515c..743d979a6 100644 --- a/src/plugins/instagram.ts +++ b/src/plugins/instagram.ts @@ -29,7 +29,7 @@ export class Instagram { @Cordova({ callbackStyle: 'node' }) - static isInstalled(): Promise {return;} + static isInstalled(): Promise { return; } /** * Share an image on Instagram @@ -42,7 +42,7 @@ export class Instagram { @Cordova({ callbackStyle: 'node' }) - static share(canvasIdOrDataUrl: string, caption?: string): Promise {return;} + static share(canvasIdOrDataUrl: string, caption?: string): Promise { return; } /** * Share a library asset or video @@ -52,6 +52,6 @@ export class Instagram { @Cordova({ callbackOrder: 'reverse' }) - static shareAsset(assetLocalIdentifier: string): Promise {return;} + static shareAsset(assetLocalIdentifier: string): Promise { return; } } diff --git a/src/plugins/media.ts b/src/plugins/media.ts index b9d91a14b..cd939f084 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable'; declare var Media: any; -export interface MediaError { +export interface MediaError { code: number; message: string; } @@ -83,12 +83,12 @@ export class MediaPlugin { static MEDIA_PAUSED: number = 3; static MEDIA_STOPPED: number = 4; - //error codes + // error codes static MEDIA_ERR_ABORTED: number = 1; - static MEDIA_ERR_NETWORK: number = 2; + static MEDIA_ERR_NETWORK: number = 2; static MEDIA_ERR_DECODE: number = 3; static MEDIA_ERR_NONE_SUPPORTED: number = 4; - + // Properties private _objectInstance: any; status: Observable; @@ -199,4 +199,4 @@ export class MediaPlugin { }) stop(): void { } -} \ No newline at end of file +} diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 365fcbb2f..cf6f14674 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -251,4 +251,4 @@ export class OneSignal { visualLevel: number }): void { } -} \ No newline at end of file +} diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 3adc4eecc..0ea2ae7fb 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -62,9 +62,9 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour. if (opts.errorIndex > args.length) { - args[opts.errorIndex] = reject; //insert the reject fn at the correct specific index + args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index } else { - args.splice(opts.errorIndex, 0, reject); //otherwise just splice it into the array + args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array } } else { // Otherwise, let's tack them on to the end of the argument list diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index e23e87f5d..376d6aa26 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -1,4 +1,4 @@ -import { Cordova, Plugin } from './plugin'; +import { Plugin } from './plugin'; declare var navigator: any; diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index bfdc5928b..f39c93b5b 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -51,7 +51,7 @@ export class TwitterConnect { * @return {Promise} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails */ @Cordova() - static showUser(): Promise {return; } + static showUser(): Promise {return; } } export interface TwitterConnectResponse { /** diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts index 8b6c2b636..92e59d734 100644 --- a/src/plugins/video-editor.ts +++ b/src/plugins/video-editor.ts @@ -92,7 +92,7 @@ export interface CreateThumbnailOptions { export interface GetVideoInfoOptions { /** The path to the video on the device. */ - fileUri: string + fileUri: string; } diff --git a/src/plugins/video-player.ts b/src/plugins/video-player.ts index 33e8306e8..a39ad9812 100644 --- a/src/plugins/video-player.ts +++ b/src/plugins/video-player.ts @@ -59,4 +59,4 @@ export class VideoPlayer { */ @Cordova({ sync: true }) static close(): void { } -} \ No newline at end of file +} From 2510c5fd4aacd5d4b088a947d29a8458ad8c8ff7 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 22 Aug 2016 21:45:37 -0400 Subject: [PATCH 040/382] fix(nativeaudio): fix plugin reference --- src/plugins/native-audio.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts index e788fd51b..3eef0d13a 100644 --- a/src/plugins/native-audio.ts +++ b/src/plugins/native-audio.ts @@ -22,7 +22,7 @@ import { Plugin, Cordova } from './plugin'; */ @Plugin({ plugin: 'cordova-plugin-nativeaudio', - pluginRef: 'NativeAudio', + pluginRef: 'plugins.NativeAudio', repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio' }) export class NativeAudio { From ffcbb6a355db74280807bb3589f7dd78d06a7f8f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 22 Aug 2016 21:48:13 -0400 Subject: [PATCH 041/382] 1.3.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9bcd30bd2..653a247ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.16", + "version": "1.3.17", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 34f34521d926a5da824e055ad6d63b99dff51ece Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 22 Aug 2016 21:48:45 -0400 Subject: [PATCH 042/382] chore(): update changelog --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ea16afa..013a33745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ + +## [1.3.17](https://github.com/driftyco/ionic-native/compare/v1.3.16...v1.3.17) (2016-08-23) + + +### Bug Fixes + +* add the reject function at the expected errorIndex position in the args array ([#436](https://github.com/driftyco/ionic-native/issues/436)) ([4e87ac7](https://github.com/driftyco/ionic-native/commit/4e87ac7)) +* **camera-preview:** changes implementation to match Cordova plugin ([#441](https://github.com/driftyco/ionic-native/issues/441)) ([55ba65a](https://github.com/driftyco/ionic-native/commit/55ba65a)) +* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3)), closes [#459](https://github.com/driftyco/ionic-native/issues/459) +* **file:** initialize writeFile options ([#468](https://github.com/driftyco/ionic-native/issues/468)) ([16628a4](https://github.com/driftyco/ionic-native/commit/16628a4)) +* **nativeaudio:** fix plugin reference ([2510c5f](https://github.com/driftyco/ionic-native/commit/2510c5f)) + + +### Features + +* **instagram:** add instagram sharing plugin ([#453](https://github.com/driftyco/ionic-native/issues/453)) ([f3e698f](https://github.com/driftyco/ionic-native/commit/f3e698f)), closes [#307](https://github.com/driftyco/ionic-native/issues/307) +* **VideoEditor:** add video editor plugin. ([#457](https://github.com/driftyco/ionic-native/issues/457)) ([7a53013](https://github.com/driftyco/ionic-native/commit/7a53013)), closes [#316](https://github.com/driftyco/ionic-native/issues/316) + + + ## [1.3.16](https://github.com/driftyco/ionic-native/compare/v1.3.15...v1.3.16) (2016-08-15) From ea58a78f622bf5294d6c7888f79d055d5a05a6e0 Mon Sep 17 00:00:00 2001 From: Mike Hartington Date: Tue, 23 Aug 2016 12:47:11 -0400 Subject: [PATCH 043/382] docs(backgroundMode): update docs --- src/plugins/backgroundmode.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 309509a35..9db7f4c86 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -85,7 +85,7 @@ export class BackgroundMode { /** * Sets a callback for a specific event * Can be used to get notified or run function when the background mode has been activated, deactivated or failed. - * @param eventName The name of the event. Available events: activate, deactivate, failure + * @param {string} eventName The name of the event. Available events: activate, deactivate, failure */ @Cordova({ sync: true From dfdaa157a42550c2049d840bf303553f4cae31ef Mon Sep 17 00:00:00 2001 From: Mike Hartington Date: Tue, 23 Aug 2016 14:13:57 -0400 Subject: [PATCH 044/382] docs(screenOrientation): update docs --- src/plugins/screen-orientation.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/plugins/screen-orientation.ts b/src/plugins/screen-orientation.ts index bf0579747..9a3d12b10 100644 --- a/src/plugins/screen-orientation.ts +++ b/src/plugins/screen-orientation.ts @@ -22,6 +22,17 @@ declare var window; * ScreenOrientation.unlockOrientation(); * ``` * + * @advanced + * 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). | + * */ @Plugin({ plugin: 'cordova-plugin-screen-orientation', @@ -33,17 +44,7 @@ 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). | - * + * See below for accepted values * @param {orientation} The orientation which should be locked. Accepted values see table above. */ @Cordova({ sync: true }) From e4f198ae424fe7eae05a5781828051817da302b2 Mon Sep 17 00:00:00 2001 From: Daniel Salvagni Date: Fri, 26 Aug 2016 06:14:32 -0300 Subject: [PATCH 045/382] docs(screen-orientation): fixes the advanced table info (#481) --- src/plugins/screen-orientation.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/screen-orientation.ts b/src/plugins/screen-orientation.ts index 9a3d12b10..f5c4d4463 100644 --- a/src/plugins/screen-orientation.ts +++ b/src/plugins/screen-orientation.ts @@ -23,7 +23,9 @@ declare var window; * ``` * * @advanced + * * Accepted orientation values: + * * | Value | Description | * |-------------------------------|------------------------------------------------------------------------------| * | portrait-primary | The orientation is in the primary portrait mode. | @@ -45,7 +47,7 @@ export class ScreenOrientation { /** * Lock the orientation to the passed value. * See below for accepted values - * @param {orientation} The orientation which should be locked. Accepted values see table above. + * @param {orientation} The orientation which should be locked. Accepted values see table below. */ @Cordova({ sync: true }) static lockOrientation(orientation: string): void { } From aa76fac3af3c4865637e4d7693904bc0c054d40e Mon Sep 17 00:00:00 2001 From: Daniel Salvagni Date: Fri, 26 Aug 2016 06:14:57 -0300 Subject: [PATCH 046/382] docs(screenshot): fixes Screenshot spelling on the example code (#480) Screenshot was spelling wrong: `Screneshot`. --- src/plugins/screenshot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index 376d6aa26..9b8d97381 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -10,10 +10,10 @@ declare var navigator: any; * import {Screenshot} from 'ionic-native'; * * // Take a screenshot and save to file - * Screneshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError); + * Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError); * * // Take a screenshot and get temporary file URI - * Screneshot.URI(80).then(onSuccess, onError); + * Screenshot.URI(80).then(onSuccess, onError); * ``` */ @Plugin({ From dd39ba8c485557f39191d3d7f885cc8cde4d8ad9 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Fri, 26 Aug 2016 10:16:20 +0100 Subject: [PATCH 047/382] feat(IsDebug): add the IsDebug plugin (#475) --- src/index.ts | 2 ++ src/plugins/is-debug.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/plugins/is-debug.ts diff --git a/src/index.ts b/src/index.ts index 774886eea..5872852db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,6 +53,7 @@ import { ImageResizer } from './plugins/imageresizer'; import { InAppBrowser } from './plugins/inappbrowser'; import { Insomnia } from './plugins/insomnia'; import { Instagram } from './plugins/instagram'; +import { IsDebug } from './plugins/is-debug'; import { Keyboard } from './plugins/keyboard'; import { LaunchNavigator } from './plugins/launchnavigator'; import { LocalNotifications } from './plugins/localnotifications'; @@ -228,6 +229,7 @@ window['IonicNative'] = { ImageResizer: ImageResizer, InAppBrowser: InAppBrowser, Instagram: Instagram, + IsDebug: IsDebug, Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, diff --git a/src/plugins/is-debug.ts b/src/plugins/is-debug.ts new file mode 100644 index 000000000..af478722d --- /dev/null +++ b/src/plugins/is-debug.ts @@ -0,0 +1,35 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * @name IsDebug + * @description + * Detect if the app is running in debug mode or not. + * Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user. + * + * @usage + * ``` + * import {IsDebug} from 'ionic-native'; + * + * IsDebug.getIsDebug() + * .then((isDebug: boolean) => console.log('Is debug:', isDebug)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-is-debug', + pluginRef: 'cordova.plugins.IsDebug', + repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug' +}) +export class IsDebug { + + /** + * Determine if an app was installed via xcode / eclipse / the ionic CLI etc + * @return {Promise} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user. + */ + @Cordova() + static getIsDebug(): Promise { + return; + } + +} From c4110eedf4a588e739b976630f59add2d0fca043 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 07:54:52 -0400 Subject: [PATCH 048/382] fix(facebook): export interfaces --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index eba48092b..582e90388 100644 --- a/src/index.ts +++ b/src/index.ts @@ -102,6 +102,7 @@ export * from './plugins/datepicker'; export * from './plugins/device'; export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; +export * from './plugins/facebook'; export * from './plugins/file'; export * from './plugins/filetransfer'; export * from './plugins/geolocation'; @@ -147,7 +148,6 @@ export { Dialogs, Diagnostic, EmailComposer, - Facebook, EstimoteBeacons, File, Flashlight, From 47a9b34ea27edccf816a69ddfd7fea597c36e920 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 08:06:04 -0400 Subject: [PATCH 049/382] feat(diagnostic): add full plugin functionality (#424) * feat(diagnostic): add full plugin functionality closes #224 * docs(): calendar methods (#476) * feat(diag): add constants --- src/plugins/diagnostic.ts | 427 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 407 insertions(+), 20 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 1c68370dd..fbb031067 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,4 +1,4 @@ -import { Cordova, Plugin } from './plugin'; +import {Cordova, Plugin, CordovaProperty} from './plugin'; /** * @name Diagnostic @@ -8,6 +8,24 @@ import { Cordova, Plugin } from './plugin'; * @usage * ```typescript * import { Diagnostic } from 'ionic-native'; + * + * let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }; + * let errorCallback = (e) => console.error(e); + * + * Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback); + * + * Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback); + * + * + * Diagnostic.getBluetoothState() + * .then((state) => { + * if(state == Diagnostic.bluetoothStates.POWERED_ON){ + * // do something + * } else { + * // do something else + * } + * }).catch(e => console.error(e)); + * * ``` */ @Plugin({ @@ -16,6 +34,73 @@ import { Cordova, Plugin } from './plugin'; repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin' }) export class Diagnostic { + + static permission = { + 'READ_CALENDAR': 'READ_CALENDAR', + 'WRITE_CALENDAR': 'WRITE_CALENDAR', + 'CAMERA': 'CAMERA', + 'READ_CONTACTS': 'READ_CONTACTS', + 'WRITE_CONTACTS': 'WRITE_CONTACTS', + 'GET_ACCOUNTS': 'GET_ACCOUNTS', + 'ACCESS_FINE_LOCATION': 'ACCESS_FINE_LOCATION', + 'ACCESS_COARSE_LOCATION': 'ACCESS_COARSE_LOCATION', + 'RECORD_AUDIO': 'RECORD_AUDIO', + 'READ_PHONE_STATE': 'READ_PHONE_STATE', + 'CALL_PHONE': 'CALL_PHONE', + 'ADD_VOICEMAIL': 'ADD_VOICEMAIL', + 'USE_SIP': 'USE_SIP', + 'PROCESS_OUTGOING_CALLS': 'PROCESS_OUTGOING_CALLS', + 'READ_CALL_LOG': 'READ_CALL_LOG', + 'WRITE_CALL_LOG': 'WRITE_CALL_LOG', + 'SEND_SMS': 'SEND_SMS', + 'RECEIVE_SMS': 'RECEIVE_SMS', + 'READ_SMS': 'READ_SMS', + 'RECEIVE_WAP_PUSH': 'RECEIVE_WAP_PUSH', + 'RECEIVE_MMS': 'RECEIVE_MMS', + 'WRITE_EXTERNAL_STORAGE': 'WRITE_EXTERNAL_STORAGE', + 'READ_EXTERNAL_STORAGE': 'READ_EXTERNAL_STORAGE', + 'BODY_SENSORS': 'BODY_SENSORS' + }; + + static permissionStatus = { + 'NOT_REQUESTED': 'not_determined', + 'DENIED': 'denied', + 'RESTRICTED': 'restricted', + 'GRANTED': 'authorized', + 'GRANTED_WHEN_IN_USE': 'authorized_when_in_use' + }; + + static locationAuthorizationMode = { + 'ALWAYS': 'always', + 'WHEN_IN_USE': 'when_in_use' + }; + + static permissionGroups = { + 'GRANTED': 'GRANTED', + 'DENIED': 'DENIED', + 'NOT_REQUESTED': 'NOT_REQUESTED', + 'DENIED_ALWAYS': 'DENIED_ALWAYS' + }; + + static locationMode = { + 'HIGH_ACCURACY': 'high_accuracy', + 'DEVICE_ONLY': 'device_only', + 'BATTERY_SAVING': 'battery_saving', + 'LOCATION_OFF': 'location_off' + }; + + static bluetoothState = { + 'UNKNOWN': 'unknown', + 'RESETTING': 'resetting', // iOS + 'UNSUPPORTED': 'unsupported', // iOS + 'UNAUTHORIZED': 'unauthorized', // iOS + 'POWERED_OFF': 'powered_off', + 'POWERED_ON': 'powered_on', + 'POWERING_OFF': 'powering_off', + 'POWERING_ON': 'powering_on' + }; + + /** * Checks if app is able to access device location. */ @@ -44,13 +129,56 @@ export class Diagnostic { static isBluetoothAvailable(): Promise { return; } /** - * Returns the location authorization status for the application. - * 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. - * - * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". + * Displays the device location settings to allow user to enable location services/change location mode. */ - @Cordova() - static requestLocationAuthorization(mode?: string): Promise { return; } + @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + static switchToLocationSettings(): void { } + + /** + * Displays mobile settings to allow user to enable mobile data. + */ + @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + static switchToMobileDataSettings(): void { } + + /** + * Displays Bluetooth settings to allow user to enable Bluetooth. + */ + @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + static switchToBluetoothSettings(): void { } + + /** + * Displays WiFi settings to allow user to enable WiFi. + */ + @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + static switchToWifiSettings(): void { } + + /** + * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()` + */ + @Cordova({platforms: ['Android', 'Windows 10']}) + static isWifiEnabled(): Promise { return; } + + /** + * Enables/disables WiFi on the device. + * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android + * @param state {boolean} + */ + @Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']}) + static setWifiState(state: boolean): Promise { return; } + + /** + * Enables/disables Bluetooth on the device. + * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android + * @param state {boolean} + */ + @Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']}) + static setBluetoothState(state: boolean): Promise { return; } + + /** + * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static isLocationEnabled(): Promise {return; } /** * Checks if the application is authorized to use location. @@ -59,50 +187,309 @@ export class Diagnostic { @Cordova() static isLocationAuthorized(): Promise { return; } + /** + * Returns the location authorization status for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static getLocationAuthorizationStatus(): Promise {return; } + + /** + * Returns the location authorization status for the application. + * 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. + * + * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". + */ + @Cordova({platforms: ['Android', 'iOS']}) + static requestLocationAuthorization(mode?: string): Promise { return; } + /** * Checks if camera hardware is present on device. */ - @Cordova() + @Cordova({platforms: ['Android', 'iOS']}) 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() + @Cordova({platforms: ['Android', 'iOS']}) static isCameraAuthorized(): Promise { return; } + + /** + * Returns the camera authorization status for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static getCameraAuthorizationStatus(): Promise { return; } + + /** + * Requests camera authorization for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static requestCameraAuthorization(): Promise { return; } + + /** + * Checks if the application is authorized to use the microphone. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static isMicrophoneAuthorized(): Promise { return; } + + /** + * Returns the microphone authorization status for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static getMicrophoneAuthorizationStatus(): Promise { return; } + + /** + * Requests microphone authorization for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static requestMicrophoneAuthorization(): Promise { return; } + + /** + * Checks if the application is authorized to use contacts (address book). + */ + @Cordova({platforms: ['Android', 'iOS']}) + static isContactsAuthorized(): Promise { return; } + + /** + * Returns the contacts authorization status for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static getContactsAuthroizationStatus(): Promise { return; } + + /** + * Requests contacts authorization for the application. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static requestContactsAuthorization(): Promise { return; } + + /** + * Checks if the application is authorized to use the calendar. + * + * Notes 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. + * + * Notes for iOS: + * - This relates to Calendar Events (not Calendar Reminders) + */ + @Cordova({platforms: ['Android', 'iOS']}) + static isCalendarAuthorized(): Promise { return; } + + /** + * Returns the calendar authorization status for the application. + * + * Notes 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. + * + * Notes for iOS: + * - This relates to Calendar Events (not Calendar Reminders) + * + */ + @Cordova({platforms: ['Android', 'iOS']}) + static getCalendarAuthorizationStatus(): Promise { return; } + + /** + * Requests calendar authorization for the application. + * + * Notes for iOS: + * - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status. + * - This relates to Calendar Events (not Calendar Reminders) + * + * Notes for Android: + * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time. + * - This requests permission for `READ_CALENDAR` run-time permission + * - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR` + * + */ + @Cordova({platforms: ['Android', 'iOS']}) + static requestCalendarAuthorization(): Promise { return; } + + /** + * Opens settings page for this app. + * On Android, this opens the "App Info" page in the Settings app. + * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static switchToSettings(): Promise {return; } + + /** + * Returns the state of Bluetooth on the device. + */ + @Cordova({platforms: ['Android', 'iOS']}) + static getBluetoothState(): Promise {return; } + + /** + * Registers a function to be called when a change in Bluetooth state occurs. + * @param handler + */ + @Cordova({platforms: ['Android', 'iOS'], sync: true}) + static registerBluetoothStateChangeHandler(handler: Function): void { } + + /** + * Registers a function to be called when a change in Location state occurs. + * @param handler + */ + @Cordova({platforms: ['Android', 'iOS'], sync: true}) + static registerLocationStateChangeHandler(handler: Function): void { } + + /** + * Checks if high-accuracy locations are available to the app from GPS hardware. Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. + */ + @Cordova({platforms: ['Android']}) + static isGpsLocationAvailable(): 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: * - Device only = GPS hardware only (high accuracy) * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) */ - @Cordova() + @Cordova({platforms: ['Android']}) static isGpsLocationEnabled(): Promise { return; } + /** + * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location. + */ + @Cordova({platforms: ['Android']}) + static isNetworkLocationAvailable(): Promise {return; } + /** * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points. * Returns true if Location mode is enabled and is set to either: * - Battery saving = network triangulation and Wifi network IDs (low accuracy) * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) */ - @Cordova() + @Cordova({platforms: ['Android']}) static isNetworkLocationEnabled(): Promise { return; } /** - * Checks if remote (push) notifications are enabled. - * On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts"). - * 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(). + * Returns the current location mode setting for the device. */ - @Cordova() - static isRemoteNotificationsEnabled(): Promise { return; } + @Cordova({platforms: ['Android']}) + static getLocationMode(): Promise {return; } + + /** + * Returns the current authorisation status for a given permission. + * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. + * @param permission + */ + @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) + static getPermissionAuthorizationStatus(permission: any): Promise {return; } + + /** + * Returns the current authorisation status for multiple permissions. + * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. + * @param permissions + */ + @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) + static getPermissionsAuthorizationStatus(permissions: any[]): Promise {return; } + + /** + * Requests app to be granted authorisation for a runtime permission. + * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time. + * @param permission + */ + @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) + static requestRuntimePermission(permission: any): Promise {return; } + + /** + * Requests app to be granted authorisation for multiple runtime permissions. + * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. + * @param permissions + */ + @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) + static requestRuntimePermissions(permissions: any[]): Promise {return; } + + /** + * Checks if the device setting for Bluetooth is switched on. + * This requires `BLUETOOTH` permission on Android + */ + @Cordova({platforms: ['Android']}) + static isBluetoothEnabled(): Promise {return; } + + /** + * Checks if the device has Bluetooth capabilities. + */ + @Cordova({platforms: ['Android']}) + static hasBluetoothSupport(): Promise {return; } + + /** + * Checks if the device has Bluetooth Low Energy (LE) capabilities. + */ + @Cordova({platforms: ['Android']}) + static hasBluetoothLESupport(): Promise {return; } + + /** + * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. + */ + @Cordova({platforms: ['Android']}) + static hasBluetoothLEPeripheralSupport(): Promise {return; } + + /** + * Checks if the application is authorized to use the Camera Roll in Photos app. + */ + @Cordova({platforms: ['iOS']}) + static isCameraRollAuthorized(): Promise {return; } + + /** + * Returns the authorization status for the application to use the Camera Roll in Photos app. + */ + @Cordova({platforms: ['iOS']}) + static getCameraRollAuthorizationStatus(): Promise {return; } + + /** + * Requests camera roll authorization for the application. Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect. + */ + @Cordova({platforms: ['iOS']}) + static requestCameraRollAuthorization(): Promise {return; } + + /** + * Checks if remote (push) notifications are enabled. + */ + @Cordova({platforms: ['iOS']}) + static isRemoteNotificationsEnabled(): Promise {return; } /** * Indicates if the app is registered for remote (push) notifications on the device. - * On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this. - * 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; } + @Cordova({platforms: ['iOS']}) + static isRegisteredForRemoteNotifications(): Promise {return; } + + /** + * Indicates the current setting of notification types for the app in the Settings app. + * Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled. + */ + @Cordova({platforms: ['iOS']}) + static getRemoteNotificationTypes(): Promise {return; } + + /** + * Checks if the application is authorized to use reminders. + */ + @Cordova({platforms: ['iOS']}) + static isRemindersAuthorized(): Promise {return; } + + /** + * Returns the reminders authorization status for the application. + */ + @Cordova({platforms: ['iOS']}) + static getRemindersAuthorizationStatus(): Promise {return; } + + /** + * Requests reminders authorization for the application. + */ + @Cordova({platforms: ['iOS']}) + static requestRemindersAuthorization(): Promise {return; } + + /** + * Checks if the application is authorized for background refresh. + */ + @Cordova({platforms: ['iOS']}) + static isBackgroundRefreshAuthorized(): Promise {return; } + + /** + * Returns the background refresh authorization status for the application. + */ + @Cordova({platforms: ['iOS']}) + static getBackgroundRefreshStatus(): Promise {return; } } From a438967336053abecab315c29e0fe9cd0dfe339b Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 26 Aug 2016 05:06:36 -0700 Subject: [PATCH 050/382] feat(geofence): Adds geofence plugin (#442) * Fixes syntax error in usage example, and improves usage formatting * Moves error codes into usage section * Adds basics of geofence plugin * Updates exports to include Geofence * Adds geofence docs and tested functions * Corrects promise types and comments out unimplemented functions * Minor updates to geofence * Reverts camera-preview changes for this branch to master --- .DS_Store | Bin 0 -> 8196 bytes src/.DS_Store | Bin 0 -> 6148 bytes src/index.ts | 4 + src/plugins/geofence.ts | 168 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 .DS_Store create mode 100644 src/.DS_Store create mode 100644 src/plugins/geofence.ts diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..29398bdba0bc72036b3c02ffaf80465bd1eac897 GIT binary patch literal 8196 zcmeHM&2G~`5T0!VO`BAt0;D1?K7v%LRFw9brYTT~(x@q|5Je$wOlolLC~+F9DpC%d zcmmG+KL~;g4*;*irF^ry1jk7(91w`zXlKUud^jS zB+_1XyII$F*LS<_xy>+}{U*l76KBp&Bqyg*{K?ErJuDpr?NV3?Tg`l>@jxEARmawL zu@WBqw6}x6>)921$93A}%!Sp!4=b+kG$PQwUDvM$?R?PktIfTV8gJLFh6m-$#bU!b z0<>81ogKI7+OFq@$H__llrxu3P8OE3**R-*aiKG3oh&c2eSN9Z$vjUcFJHZ}vT?uO zdGYG?o44=YfB5)GW=ujaTXbF>_vGhad>oY;z8Cm4oMG>2<{R9js`75+dt+pk`>K$V zNDnphVU0k^N=NUh3HTnP%8aTFt#rg&rUM~YVQ91d_bO@(!@$46z_^;`Ebsr45{~(kqc(s2(YNZrHB5K5AexN_Ve-q!#tZhWr9nj}9Fr@(EEa$2+d@ikI86ei%vg7rS)r8Mdgf z#v^*`UzPQWV=BxI%VlRq4>%=zgW3LDd)$u$?irp?q9I@BFlF{^xl=ZabRBEpfc>_7 zuFAUFD8oh@s=H;royxsjpJen`$!1t65DJ6>p+G1wqJW+$wCvn5>QEpQ2nBWu=>Cwi zC>9A@N837B*%N>`VYeB5y)tV|p0G&RI&y?29!m63Nly&%aQ5ekS0rp5JsgrAAChMN ze!Pgy&iuL2A%$bqp+G1wRN&Z~Q$7E$`OAzx@`oYO3I#%ef2M#;7R$w)AC=D5AD^dZ wZO(GfqNco79UA??C4ddxM=os8$8+_`D-yPjnnn99oER4Y6C|oo;1?A50z>RVtpET3 literal 0 HcmV?d00001 diff --git a/src/index.ts b/src/index.ts index 582e90388..c004b4637 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,6 +41,7 @@ import { Facebook } from './plugins/facebook'; import { File } from './plugins/file'; import { Transfer } from './plugins/filetransfer'; import { Flashlight } from './plugins/flashlight'; +import {Geofence} from './plugins/geofence'; import { Geolocation } from './plugins/geolocation'; import { Globalization } from './plugins/globalization'; import { GooglePlus } from './plugins/google-plus'; @@ -64,6 +65,7 @@ import { NativeStorage } from './plugins/nativestorage'; import { MediaPlugin } from './plugins/media'; import { Network } from './plugins/network'; import { OneSignal } from './plugins/onesignal'; + import { PhotoViewer } from './plugins/photo-viewer'; import { ScreenOrientation } from './plugins/screen-orientation'; import { PinDialog } from './plugins/pin-dialog'; @@ -151,6 +153,7 @@ export { EstimoteBeacons, File, Flashlight, + Geofence, Globalization, GooglePlus, GoogleAnalytics, @@ -221,6 +224,7 @@ window['IonicNative'] = { Facebook: Facebook, File: File, Flashlight: Flashlight, + Geofence: Geofence, Geolocation: Geolocation, Globalization: Globalization, GooglePlus: GooglePlus, diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts new file mode 100644 index 000000000..23959d090 --- /dev/null +++ b/src/plugins/geofence.ts @@ -0,0 +1,168 @@ +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; +/** + * @name Geofence + * @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence. + * Geofences persist after device reboot. Geofences will be monitored even when the app is not running. + * @usage + * ``` + * import { Geofence } from 'ionic-native'; + * import { Platform } from 'ionic-angular' + * ... + * + * constructor(private platform: Platform) { + * this.platform.ready().then(() => { + // initialize the plugin + * Geofence.initialize().then( + * // resolved promise does not return a value + * () => console.log('Geofence Plugin Ready'), + * (err) => console.log(err) + * ) + * }) + * } + * + * private addGeofence() { + * //options describing geofence + * let fence = { + * id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb", //any unique ID + * latitude: 37.285951, //center of geofence radius + * longitude: -121.936650, + * radius: 100, //radius to edge of geofence + * transitionType: 3, //see 'Transition Types' below + * notification: { //notification settings + * id: 1, //any unique ID + * title: "You crossed a fence", //notification title + * text: "You just arrived to Gliwice city center.", //notification body + * openAppOnClick: true //open app when notification is tapped + * } + * } + * + * Geofence.addOrUpdate(fence).then( + * () => console.log('Geofence added'), + * (err) => console.log('Geofence failed to add') + * ); + * } + * + * ``` + * ### Transition Types ### + * Transition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence. + * + * #### Supported values #### + * - 1: Enter + * - 2: Leave + * - 3: Both + * + * ### Defining a Geofence ### + * Geofences are defined by an object that is passed to `addOrUpdate()`. Object properties are: + * - id: Any unique ID for the geofence. This ID is used to remove and update a geofence + * - latitude: Latitude coordinate of the center of the geofence radius + * - longitude: Latitude coordinate of the center of the geofence radius + * - radius: Radius from the center to the edge of the geofence + * - transitionType: Type of geofence transition to monitor for. See 'Transition Types' above + * - notification: Object. Options for defining the notification sent when a geofence is crossed + * - id: Any unique ID + * - title: Notification title + * - text: Notification body + * - openAppOnClick: Boolean. Whether to open the app when the notification is tapped by the user + * + * ### Troubleshooting ### + * #### I get compile errors when I run `ionic build ios` or `ionic run ios`. #### + * This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly. + * Try running `ionic platform rm ` then run `ionic platform add ` to recreate the + * platform directories. + */ +declare var window: any; + +@Plugin({ + plugin: 'cordova-plugin-geofence', + pluginRef: 'geofence', + repo: 'https://github.com/cowbell/cordova-plugin-geofence/', + platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone'] +}) + +export class Geofence { + + public static TransitionType = { + ENTER: 1, + EXIT: 2, + BOTH: 3 + }; + + public static onTrasitionReceived: Function; + + /** + * Initializes the plugin. User will be prompted to allow the app to use location and notifications. + * + * @return {Promise} + */ + @Cordova() + static initialize(): Promise { return }; + + /** + * Adds a new geofence or array of geofences. For geofence object, see above. + * + * @return {Promise} + */ + @Cordova() + static addOrUpdate(geofences: Object | Array): Promise { return }; + + /** + * Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the + * geofence was created. + * + * @return {Promise} + */ + @Cordova() + static remove(geofenceId: string | Array): Promise { return }; + + /** + * Removes all geofences. + * + * @return {Promise} + */ + @Cordova() + static removeAll(): Promise { return }; + + /** + * Returns an array of geofences currently being monitored. + * + * @return {Promise>} + */ + @Cordova() + static getWatched(): Promise { return }; + + /** + * Called when a geofence is crossed in the direction specified by `TransitType`. + * Commenting out. Not yet implemented in plugin. + * + * @return {Promise} + */ + @Cordova() + static onTransitionReceived(): Observable { + + return new Observable((observer) => { + window.geofence.onTransitionReceived = observer.next.bind(observer); + return null; + // undefined can be replaced with ()=>{} .. whichever works better + }); + + } + + /** + * Called when the user clicks a geofence notification. iOS and Android only. + * Commenting out. Not yet implemented in plugin. + * + * @return {Promise} + */ + @Cordova() + static onNotificationClicked(): Observable { + + return new Observable((observer) => { + window.geofence.onNotificationClicked = observer.next.bind(observer); + return () => window.geofence.onNotificationClicked = () => {} + // undefined can be replaced with ()=>{} .. whichever works better + }); + + } + +} \ No newline at end of file From abfa8a5f0f9d4bc4d59e37b2ce6cd2ae5afd2bcb Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 08:07:20 -0400 Subject: [PATCH 051/382] remove DS_STORE files --- .DS_Store | Bin 8196 -> 0 bytes src/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store delete mode 100644 src/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 29398bdba0bc72036b3c02ffaf80465bd1eac897..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM&2G~`5T0!VO`BAt0;D1?K7v%LRFw9brYTT~(x@q|5Je$wOlolLC~+F9DpC%d zcmmG+KL~;g4*;*irF^ry1jk7(91w`zXlKUud^jS zB+_1XyII$F*LS<_xy>+}{U*l76KBp&Bqyg*{K?ErJuDpr?NV3?Tg`l>@jxEARmawL zu@WBqw6}x6>)921$93A}%!Sp!4=b+kG$PQwUDvM$?R?PktIfTV8gJLFh6m-$#bU!b z0<>81ogKI7+OFq@$H__llrxu3P8OE3**R-*aiKG3oh&c2eSN9Z$vjUcFJHZ}vT?uO zdGYG?o44=YfB5)GW=ujaTXbF>_vGhad>oY;z8Cm4oMG>2<{R9js`75+dt+pk`>K$V zNDnphVU0k^N=NUh3HTnP%8aTFt#rg&rUM~YVQ91d_bO@(!@$46z_^;`Ebsr45{~(kqc(s2(YNZrHB5K5AexN_Ve-q!#tZhWr9nj}9Fr@(EEa$2+d@ikI86ei%vg7rS)r8Mdgf z#v^*`UzPQWV=BxI%VlRq4>%=zgW3LDd)$u$?irp?q9I@BFlF{^xl=ZabRBEpfc>_7 zuFAUFD8oh@s=H;royxsjpJen`$!1t65DJ6>p+G1wqJW+$wCvn5>QEpQ2nBWu=>Cwi zC>9A@N837B*%N>`VYeB5y)tV|p0G&RI&y?29!m63Nly&%aQ5ekS0rp5JsgrAAChMN ze!Pgy&iuL2A%$bqp+G1wRN&Z~Q$7E$`OAzx@`oYO3I#%ef2M#;7R$w)AC=D5AD^dZ wZO(GfqNco79UA??C4ddxM=os8$8+_`D-yPjnnn99oER4Y6C|oo;1?A50z>RVtpET3 From efa222fb55cdd47cc608d0876b29afa6893a2094 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 08:12:28 -0400 Subject: [PATCH 052/382] fix(geofence): fix event listeners --- src/plugins/geofence.ts | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index 23959d090..d474687b7 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -20,7 +20,7 @@ import { Observable } from 'rxjs/Observable'; * ) * }) * } - * + * * private addGeofence() { * //options describing geofence * let fence = { @@ -36,13 +36,13 @@ import { Observable } from 'rxjs/Observable'; * openAppOnClick: true //open app when notification is tapped * } * } - * + * * Geofence.addOrUpdate(fence).then( * () => console.log('Geofence added'), * (err) => console.log('Geofence failed to add') - * ); + * ); * } - * + * * ``` * ### Transition Types ### * Transition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence. @@ -67,7 +67,7 @@ import { Observable } from 'rxjs/Observable'; * * ### Troubleshooting ### * #### I get compile errors when I run `ionic build ios` or `ionic run ios`. #### - * This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly. + * This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly. * Try running `ionic platform rm ` then run `ionic platform add ` to recreate the * platform directories. */ @@ -97,7 +97,7 @@ export class Geofence { */ @Cordova() static initialize(): Promise { return }; - + /** * Adds a new geofence or array of geofences. For geofence object, see above. * @@ -105,16 +105,16 @@ export class Geofence { */ @Cordova() static addOrUpdate(geofences: Object | Array): Promise { return }; - + /** - * Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the + * Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the * geofence was created. * * @return {Promise} */ @Cordova() static remove(geofenceId: string | Array): Promise { return }; - + /** * Removes all geofences. * @@ -122,7 +122,7 @@ export class Geofence { */ @Cordova() static removeAll(): Promise { return }; - + /** * Returns an array of geofences currently being monitored. * @@ -132,18 +132,16 @@ export class Geofence { static getWatched(): Promise { return }; /** - * Called when a geofence is crossed in the direction specified by `TransitType`. + * Called when a geofence is crossed in the direction specified by `TransitType`. * Commenting out. Not yet implemented in plugin. * * @return {Promise} */ - @Cordova() static onTransitionReceived(): Observable { return new Observable((observer) => { - window.geofence.onTransitionReceived = observer.next.bind(observer); - return null; - // undefined can be replaced with ()=>{} .. whichever works better + window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer)); + return () => window.geofence.onTransitionReceived = () => {}; }); } @@ -154,15 +152,13 @@ export class Geofence { * * @return {Promise} */ - @Cordova() static onNotificationClicked(): Observable { - return new Observable((observer) => { - window.geofence.onNotificationClicked = observer.next.bind(observer); - return () => window.geofence.onNotificationClicked = () => {} - // undefined can be replaced with ()=>{} .. whichever works better + return new Observable((observer) => { + window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer)); + return () => window.geofence.onNotificationClicked = () => {}; }); } -} \ No newline at end of file +} From 61716467df3e44da63ced3ff19f8b81edddd140c Mon Sep 17 00:00:00 2001 From: Justin Schuldt Date: Fri, 26 Aug 2016 07:14:54 -0500 Subject: [PATCH 053/382] docs(background-geolocation): config method, example fix (#478) --- src/plugins/background-geolocation.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index bafbb8966..c7100a618 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -188,13 +188,11 @@ export interface Config { * }, (error) => { * console.log('BackgroundGeolocation error'); - * }, { - * //options - * }); + * }, config); * * // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app. * BackgroundGeolocation.start(); - * } + * }) * * // If you wish to turn OFF background-tracking, call the #stop method. * BackgroundGeolocation.stop(); @@ -211,13 +209,14 @@ export class BackgroundGeolocation { /** * Configure the plugin. - * Success callback will be called with one argument - Location object, which tries to mimic w3c Coordinates interface. + * + * @param {Function} Success callback will be called when background location is determined. + * @param {Function} Fail callback to be executed every time a geolocation error occurs. + * @param {Object} An object of type Config + * + * @return Location object, which tries to mimic w3c Coordinates interface. * See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface * Callback to be executed every time a geolocation is recorded in the background. - * - * Fail callback to be executed every time a geolocation error occurs. - * - * Options a json object of type Config */ @Cordova({ sync: true From 8526e89e12a425ad17c51b40cae166682c73bcec Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 08:18:43 -0400 Subject: [PATCH 054/382] feat(inAppPurchase): add inAppPurhcase plugin (#423) * feat(inAppPurchase): add inAppPurchase * add otherPromise option to decorator --- src/index.ts | 6 +- src/plugins/inapppurchase.ts | 121 +++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 src/plugins/inapppurchase.ts diff --git a/src/index.ts b/src/index.ts index c004b4637..2368cdeb8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,7 +41,7 @@ import { Facebook } from './plugins/facebook'; import { File } from './plugins/file'; import { Transfer } from './plugins/filetransfer'; import { Flashlight } from './plugins/flashlight'; -import {Geofence} from './plugins/geofence'; +import { Geofence } from './plugins/geofence'; import { Geolocation } from './plugins/geolocation'; import { Globalization } from './plugins/globalization'; import { GooglePlus } from './plugins/google-plus'; @@ -53,6 +53,7 @@ import { IBeacon } from './plugins/ibeacon'; import { ImagePicker } from './plugins/imagepicker'; import { ImageResizer } from './plugins/imageresizer'; import { InAppBrowser } from './plugins/inappbrowser'; +import { InAppPurchase } from './plugins/inapppurchase'; import { Insomnia } from './plugins/insomnia'; import { Instagram } from './plugins/instagram'; import { IsDebug } from './plugins/is-debug'; @@ -65,7 +66,6 @@ import { NativeStorage } from './plugins/nativestorage'; import { MediaPlugin } from './plugins/media'; import { Network } from './plugins/network'; import { OneSignal } from './plugins/onesignal'; - import { PhotoViewer } from './plugins/photo-viewer'; import { ScreenOrientation } from './plugins/screen-orientation'; import { PinDialog } from './plugins/pin-dialog'; @@ -158,6 +158,7 @@ export { GooglePlus, GoogleAnalytics, Hotspot, + InAppPurchase, Insomnia, Instagram, Keyboard, @@ -236,6 +237,7 @@ window['IonicNative'] = { ImagePicker: ImagePicker, ImageResizer: ImageResizer, InAppBrowser: InAppBrowser, + InAppPurchase: InAppPurchase, Instagram: Instagram, IsDebug: IsDebug, Keyboard: Keyboard, diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts new file mode 100644 index 000000000..ba68223a8 --- /dev/null +++ b/src/plugins/inapppurchase.ts @@ -0,0 +1,121 @@ +import {Plugin, Cordova} from './plugin'; + + +/** + * @name InAppPurchase + * @description + * A lightweight Cordova plugin for in app purchases on iOS/Android. + * + * @usage + * ```ts + * import {InAppPurchase} from 'ionic-native'; + * + * InAppPurchase + * .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...]) + * .then((products) => { + * console.log(products); + * // [{ productId: 'com.yourapp.prod1', 'title': '...', description: '...', price: '...' }, ...] + * }) + * .catch((err) => { + * console.log(err); + * }); + * + * + * InAppPurchase + * .buy('com.yourapp.prod1') + * .then((data)=> { + * console.log(data); + * // { + * // transactionId: ... + * // receipt: ... + * // signature: ... + * // } + * }) + * .catch((err)=> { + * console.log(err); + * }); + * + * ``` + * + * @advanced + * + * ```ts + * // fist buy the product... + * InAppPurchase + * .buy('com.yourapp.consumable_prod1') + * .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature)) + * .then(() => console.log('product was successfully consumed!')) + * .catch( err=> console.log(err)) + * ``` + * + * + */ +@Plugin({ + plugin: 'cordova-plugin-inapppurchase', + pluginRef: 'inAppPurchase', + platforms: ['Android', 'iOS'], + repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase' +}) +export class InAppPurchase { + + /** + * Retrieves a list of full product data from Apple/Google. This method must be called before making purchases. + * @param {array} productId an array of product ids. + * @returns {Promise} Returns a Promise that resolves with an array of objects. + */ + @Cordova({ + otherPromise: true + }) + static getProducts(productId: string[]): Promise { return; } + + /** + * Buy a product that matches the productId. + * @param {string} productId A string that matches the product you want to buy. + * @returns {Promise} Returns a Promise that resolves with the transaction details. + */ + @Cordova({ + otherPromise: true + }) + static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; } + + /** + * Same as buy, but for subscription based products. + * @param {string} productId A string that matches the product you want to subscribe to. + * @returns {Promise} Returns a Promise that resolves with the transaction details. + */ + @Cordova({ + otherPromise: true + }) + static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; } + + /** + * Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message: + * @param {string} productType + * @param {string} receipt + * @param {string} signature + */ + @Cordova({ + otherPromise: true + }) + static consume(productType: string, receipt: string, signature: string): Promise { return; } + + /** + * Restore all purchases from the store + * @returns {Promise} Returns a promise with an array of purchases. + */ + @Cordova({ + otherPromise: true + }) + static restorePurchases(): Promise { return; } + + /** + * Get the receipt. + * @returns {Promise} Returns a promise that contains the string for the receipt + */ + @Cordova({ + otherPromise: true, + platforms: ['iOS'] + }) + static getReceipt(): Promise { return; } + +} From eff7841ec2721bb541b9781588fefb3fffaf1be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20St=C3=B6rcher?= Date: Fri, 26 Aug 2016 15:22:59 +0200 Subject: [PATCH 055/382] fix(File): fixed readFileAs (#479) * Fix(File): Fixing readFileAs https://developer.mozilla.org/de/docs/Web/API/FileReader --> FileReader expects File and not FileEntry. * Fix(File): Fixing readFileAs refactoring to arrow Functions --- src/plugins/file.ts | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 213d33150..409127d9a 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -300,10 +300,10 @@ export interface FileReader { onabort: (evt: ProgressEvent) => void; abort(): void; - readAsText(fe: FileEntry, encoding?: string): void; - readAsDataURL(fe: FileEntry): void; - readAsBinaryString(fe: FileEntry): void; - readAsArrayBuffer(fe: FileEntry): void; + readAsText(fe: File, encoding?: string): void; + readAsDataURL(fe: File): void; + readAsBinaryString(fe: File): void; + readAsArrayBuffer(fe: File): void; } declare var FileReader: { @@ -752,8 +752,12 @@ export class File { reject({code: null, message: 'READER_ONLOADEND_ERR'}); } }; + fe.file(file => { + reader.readAsText(file); + }, error => { + reject(error); + }) - reader.readAsText(fe); }); }); } @@ -790,7 +794,13 @@ export class File { } }; - reader.readAsDataURL(fe); + + + fe.file(file => { + reader.readAsDataURL(file); + }, error => { + reject(error); + }) }); }); } @@ -826,7 +836,12 @@ export class File { } }; - reader.readAsBinaryString(fe); + fe.file(file => { + reader.readAsBinaryString(file); + }, error => { + reject(error); + }) + }); }); } @@ -862,7 +877,12 @@ export class File { } }; - reader.readAsArrayBuffer(fe); + fe.file(file => { + reader.readAsArrayBuffer(file); + }, error => { + reject(error); + }) + }); }); } From 905f988d43747c076e2132ef9b0e08868c0604b9 Mon Sep 17 00:00:00 2001 From: Kapil Sachdeva Date: Fri, 26 Aug 2016 11:06:26 -0500 Subject: [PATCH 056/382] feat(code-push): add wrapper for cordova-plugin-code-push (#420) * feat - introduce the plugin wrapper for code-push and type definitions * feat(code-push) - change the signature of the methods to return Promise & decorate them with Cordova decorator * fix(code push) - in sync method call the native method * fix(code-push) : use decorator on syc to mark it as an observable / add sample usage * docs(code-push) : add the link to the sample repository * fix - merge errors * fix(code-push) : add description field on CodePush class / remove not needed IWindow interface declaration --- src/index.ts | 116 ++++----- src/plugins/code-push.ts | 516 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 576 insertions(+), 56 deletions(-) create mode 100644 src/plugins/code-push.ts diff --git a/src/index.ts b/src/index.ts index 2368cdeb8..fb3cf9ddc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,7 @@ import { Camera } from './plugins/camera'; import { CameraPreview } from './plugins/camera-preview'; import { CardIO } from './plugins/card-io'; import { Clipboard } from './plugins/clipboard'; +import { CodePush } from './plugins/code-push'; import { Contacts } from './plugins/contacts'; import { Crop } from './plugins/crop'; import { DatePicker } from './plugins/datepicker'; @@ -99,6 +100,7 @@ export * from './plugins/batterystatus'; export * from './plugins/calendar'; export * from './plugins/camera'; export * from './plugins/card-io'; +export * from './plugins/code-push'; export * from './plugins/contacts'; export * from './plugins/datepicker'; export * from './plugins/device'; @@ -128,61 +130,62 @@ export * from './plugins/twitter-connect'; export * from './plugins/video-editor'; export * from './plugins/video-player'; export { - ActionSheet, - AdMob, - AndroidFingerprintAuth, - AppAvailability, - AppRate, - AppVersion, - Badge, - BarcodeScanner, - Base64ToGallery, - BatteryStatus, - Brightness, - BLE, - BluetoothSerial, - CameraPreview, - Clipboard, - Crop, - DBMeter, - Deeplinks, - DeviceAccounts, - Dialogs, - Diagnostic, - EmailComposer, - EstimoteBeacons, - File, - Flashlight, - Geofence, - Globalization, - GooglePlus, - GoogleAnalytics, - Hotspot, - InAppPurchase, - Insomnia, - Instagram, - Keyboard, - NativeAudio, - NativeStorage, - Network, - OneSignal, - PhotoViewer, - ScreenOrientation, - PinDialog, - Screenshot, - SecureStorage, - Shake, - SocialSharing, - Sim, - Splashscreen, - SQLite, - StatusBar, - TouchID, - Transfer, - TextToSpeech, - Vibration, - WebIntent, - Zip +ActionSheet, +AdMob, +AndroidFingerprintAuth, +AppAvailability, +AppRate, +AppVersion, +Badge, +BarcodeScanner, +Base64ToGallery, +BatteryStatus, +Brightness, +BLE, +BluetoothSerial, +CameraPreview, +Clipboard, +CodePush, +Crop, +DBMeter, +Deeplinks, +DeviceAccounts, +Dialogs, +Diagnostic, +EmailComposer, +EstimoteBeacons, +File, +Flashlight, +Geofence, +Globalization, +GooglePlus, +GoogleAnalytics, +Hotspot, +InAppPurchase, +Insomnia, +Instagram, +Keyboard, +NativeAudio, +NativeStorage, +Network, +OneSignal, +PhotoViewer, +ScreenOrientation, +PinDialog, +Screenshot, +SecureStorage, +Shake, +SocialSharing, +Sim, +Splashscreen, +SQLite, +StatusBar, +TouchID, +Transfer, +TextToSpeech, +Vibration, +WebIntent, +Zip } export * from './plugins/plugin'; @@ -209,6 +212,7 @@ window['IonicNative'] = { CameraPreview: CameraPreview, CardIO: CardIO, Clipboard: Clipboard, + CodePush: CodePush, Contacts: Contacts, Crop: Crop, DatePicker: DatePicker, @@ -229,7 +233,7 @@ window['IonicNative'] = { Geolocation: Geolocation, Globalization: Globalization, GooglePlus: GooglePlus, - GoogleMap : GoogleMap, + GoogleMap: GoogleMap, GoogleAnalytics: GoogleAnalytics, Hotspot: Hotspot, Httpd: Httpd, diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts new file mode 100644 index 000000000..bb9da82da --- /dev/null +++ b/src/plugins/code-push.ts @@ -0,0 +1,516 @@ +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + +// below are taken from +// https://raw.githubusercontent.com/Microsoft/cordova-plugin-code-push/master/typings/codePush.d.ts +// and adjusted to remove warnings and access control + +namespace Http { + export const enum Verb { + GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH + } + + export interface Response { + statusCode: number; + body?: string; + } + + export interface Requester { + request(verb: Verb, url: string, callback: Callback): void; + request(verb: Verb, url: string, requestBody: string, callback: Callback): void; + } +} + +/** + * Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app, + * in which case only the appVersion is compulsory. + * + * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! + */ +export interface IPackage { + deploymentKey: string; + description: string; + label: string; + appVersion: string; + isMandatory: boolean; + packageHash: string; + packageSize: number; + failedInstall: boolean; +} + +/** + * Defines a remote package, which represents an update package available for download. + */ +export interface IRemotePackage extends IPackage { + /** + * The URL at which the package is available for download. + */ + downloadUrl: string; + + /** + * Downloads the package update from the CodePush service. + * + * @param downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully. + * @param downloadError Optional callback invoked in case of an error. + * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + */ + download(downloadSuccess: SuccessCallback, downloadError?: ErrorCallback, downloadProgress?: SuccessCallback): void; + + /** + * Aborts the current download session, previously started with download(). + * + * @param abortSuccess Optional callback invoked if the abort operation succeeded. + * @param abortError Optional callback invoked in case of an error. + */ + abortDownload(abortSuccess?: SuccessCallback, abortError?: ErrorCallback): void; +} + +/** + * Defines a local package. + * + * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! + */ +export interface ILocalPackage extends IPackage { + /** + * The local storage path where this package is located. + */ + localPath: string; + + /** + * Indicates if the current application run is the first one after the package was applied. + */ + isFirstRun: boolean; + + /** + * Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded. + * On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success. + * Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run. + * + * @param installSuccess Callback invoked if the install operation succeeded. + * @param installError Optional callback inovoked in case of an error. + * @param installOptions Optional parameter used for customizing the installation behavior. + */ + install(installSuccess: SuccessCallback, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void; +} + +/** + * Decomposed static side of RemotePackage. + * For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics + */ +/* tslint:disable */ +interface RemotePackage_Static { + new (): IRemotePackage; +} +/* tslint:enable */ + +/** + * Decomposed static side of LocalPackage. + * For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics + */ +/* tslint:disable */ +interface LocalPackage_Static { + new (): ILocalPackage; +} +/* tslint:enable */ + +declare var RemotePackage: RemotePackage_Static; +declare var LocalPackage: LocalPackage_Static; + +/** + * Defines the JSON format of the current package information file. + * This file is stored in the local storage of the device and persists between store updates and code-push updates. + * + * !! THIS FILE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! + */ +interface IPackageInfoMetadata extends ILocalPackage { + nativeBuildTime: string; +} + +interface NativeUpdateNotification { + updateAppVersion: boolean; // Always true + appVersion: string; +} + +export interface Callback { (error: Error, parameter: T): void; } +export interface SuccessCallback { (result?: T): void; } +export interface ErrorCallback { (error?: Error): void; } + +interface Configuration { + appVersion: string; + clientUniqueId: string; + deploymentKey: string; + serverUrl: string; + ignoreAppVersion?: boolean; +} + +declare class AcquisitionStatus { + static DeploymentSucceeded: string; + static DeploymentFailed: string; +} + +declare class AcquisitionManager { + constructor(httpRequester: Http.Requester, configuration: Configuration); + public queryUpdateWithCurrentPackage(currentPackage: IPackage, callback?: Callback): void; + public reportStatusDeploy(pkg?: IPackage, status?: string, previousLabelOrAppVersion?: string, previousDeploymentKey?: string, callback?: Callback): void; + public reportStatusDownload(pkg: IPackage, callback?: Callback): void; +} + +interface CodePushCordovaPlugin { + + /** + * Get the current package information. + * + * @param packageSuccess Callback invoked with the currently deployed package information. + * @param packageError Optional callback invoked in case of an error. + */ + getCurrentPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void; + + /** + * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. + * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. + */ + getPendingPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void; + + /** + * Checks with the CodePush server if an update package is available for download. + * + * @param querySuccess Callback invoked in case of a successful response from the server. + * The callback takes one RemotePackage parameter. A non-null package is a valid update. + * A null package means the application is up to date for the current native application version. + * @param queryError Optional callback invoked in case of an error. + * @param deploymentKey Optional deployment key that overrides the config.xml setting. + */ + checkForUpdate(querySuccess: SuccessCallback, queryError?: ErrorCallback, deploymentKey?: string): void; + + /** + * Notifies the plugin that the update operation succeeded and that the application is ready. + * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop. + * If using sync API, calling this function is not required since sync calls it internally. + * + * @param notifySucceeded Optional callback invoked if the plugin was successfully notified. + * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin. + */ + notifyApplicationReady(notifySucceeded?: SuccessCallback, notifyFailed?: ErrorCallback): void; + + /** + * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update + * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application. + */ + restartApplication(installSuccess: SuccessCallback, errorCallback?: ErrorCallback): void; + + /** + * Convenience method for installing updates in one method call. + * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods. + * + * The algorithm of this method is the following: + * - Checks for an update on the CodePush server. + * - If an update is available + * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version. + * The update package will then be downloaded and applied. + * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version. + * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED. + * - Otherwise, the update package will be downloaded and applied with no user interaction. + * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE. + * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR. + * + * @param syncCallback Optional callback to be called with the status of the sync operation. + * The callback will be called only once, and the possible statuses are defined by the SyncStatus enum. + * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation. + * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + * + */ + sync(syncCallback?: SuccessCallback, syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): void; +} + +/** + * Defines the possible result statuses of the window.codePush.sync operation. + */ +export enum SyncStatus { + /** + * The application is up to date. + */ + UP_TO_DATE, + + /** + * An update is available, it has been downloaded, unzipped and copied to the deployment folder. + * After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources. + */ + UPDATE_INSTALLED, + + /** + * An optional update is available, but the user declined to install it. The update was not downloaded. + */ + UPDATE_IGNORED, + + /** + * An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update. + * The console logs should contain more information about what happened. No update has been applied in this case. + */ + ERROR, + + /** + * There is an ongoing sync in progress, so this attempt to sync has been aborted. + */ + IN_PROGRESS, + + /** + * Intermediate status - the plugin is about to check for updates. + */ + CHECKING_FOR_UPDATE, + + /** + * Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled. + */ + AWAITING_USER_ACTION, + + /** + * Intermediate status - the update package is about to be downloaded. + */ + DOWNLOADING_PACKAGE, + + /** + * Intermediate status - the update package is about to be installed. + */ + INSTALLING_UPDATE +} + +/** + * Defines the available install modes for updates. + */ +export enum InstallMode { + /** + * The update will be applied to the running application immediately. The application will be reloaded with the new content immediately. + */ + IMMEDIATE, + + /** + * The update is downloaded but not installed immediately. The new content will be available the next time the application is started. + */ + ON_NEXT_RESTART, + + /** + * The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first. + */ + ON_NEXT_RESUME +} + +/** + * Defines the install operation options. + */ +export interface InstallOptions { + /** + * Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART. + */ + installMode?: InstallMode; + + /** + * If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed. + */ + minimumBackgroundDuration?: number; + + /** + * Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE. + */ + mandatoryInstallMode?: InstallMode; +} + +/** + * Defines the sync operation options. + */ +export interface SyncOptions extends InstallOptions { + /** + * Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true. + */ + ignoreFailedUpdates?: boolean; + + /** + * Used to enable, disable or customize the user interaction during sync. + * If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory. + * To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance. + */ + updateDialog?: boolean | UpdateDialogOptions; + + /** + * Overrides the config.xml deployment key when checking for updates. + */ + deploymentKey?: string; +} + +/** + * Defines the configuration options for the alert or confirmation dialog + */ +export interface UpdateDialogOptions { + /** + * If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update. + * The user will not be able to cancel the operation, since the update is mandatory. + */ + mandatoryUpdateMessage?: string; + + /** + * If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog. + * If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded. + */ + optionalUpdateMessage?: string; + + /** + * The title of the dialog box used for interacting with the user in case of a mandatory or optional update. + * This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set. + */ + updateTitle?: string; + + /** + * The label of the confirmation button in case of an optional update. + */ + optionalInstallButtonLabel?: string; + + /** + * The label of the cancel button in case of an optional update. + */ + optionalIgnoreButtonLabel?: string; + + /** + * The label of the continue button in case of a mandatory update. + */ + mandatoryContinueButtonLabel?: string; + + /** + * Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message. + */ + appendReleaseDescription?: boolean; + + /** + * Optional prefix to add to the release description. + */ + descriptionPrefix?: string; +} + +/** + * Defines the JSON format of the package diff manifest file. + */ +interface IDiffManifest { + deletedFiles: string[]; +} + +/** + * Defines the format of the DownloadProgress object, used to send periodical update notifications on the progress of the update download. + */ +export interface DownloadProgress { + totalBytes: number; + receivedBytes: number; +} + +/** + * @name CodePush + * CodePush plugin for Cordova by Microsoft that supports iOS and Android. + * + * For more info, please see https://github.com/ksachdeva/ionic2-code-push-example + * + * @usage + * ```typescript + * import { CodePush } from 'ionic-native'; + * + * // note - mostly error & completed methods of observable will not fire + * // as syncStatus will contain the current state of the update + * CodePush.sync().subscribe((syncStatus) => console.log(syncStatus)); + * + * const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); } + * CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus)); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-code-push', + pluginRef: 'codePush', + repo: 'https://github.com/Microsoft/cordova-plugin-code-push', + platforms: ['Android', 'iOS'] +}) +export class CodePush { + + /** + * Get the current package information. + * + * @param packageSuccess Callback invoked with the currently deployed package information. + * @param packageError Optional callback invoked in case of an error. + */ + @Cordova() + static getCurrentPackage(): Promise { + return; + } + + /** + * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. + * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. + */ + @Cordova() + static getPendingPackage(): Promise { + return; + } + + /** + * Checks with the CodePush server if an update package is available for download. + * + * @param querySuccess Callback invoked in case of a successful response from the server. + * The callback takes one RemotePackage parameter. A non-null package is a valid update. + * A null package means the application is up to date for the current native application version. + * @param queryError Optional callback invoked in case of an error. + * @param deploymentKey Optional deployment key that overrides the config.xml setting. + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static checkForUpdate(deploymentKey?: string): Promise { + return; + } + + /** + * Notifies the plugin that the update operation succeeded and that the application is ready. + * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop. + * If using sync API, calling this function is not required since sync calls it internally. + * + * @param notifySucceeded Optional callback invoked if the plugin was successfully notified. + * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin. + */ + @Cordova() + static notifyApplicationReady(): Promise { + return; + } + + /** + * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update + * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application. + */ + @Cordova() + static restartApplication(): Promise { + return; + } + + /** + * Convenience method for installing updates in one method call. + * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods. + * + * The algorithm of this method is the following: + * - Checks for an update on the CodePush server. + * - If an update is available + * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version. + * The update package will then be downloaded and applied. + * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version. + * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED. + * - Otherwise, the update package will be downloaded and applied with no user interaction. + * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE. + * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR. + * + * @param syncCallback Optional callback to be called with the status of the sync operation. + * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation. + * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + * + */ + @Cordova({ + observable: true, + successIndex: 0, + errorIndex: 3 // we don't need this, so we set it to a value higher than # of args + }) + static sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): Observable { + return; + } + +} From d26bc886cf5f1ae20fad8f73906498e7266a759a Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 12:20:22 -0400 Subject: [PATCH 057/382] chore(): update contribution guide --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49b776d1e..2bfe91b22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/bl #### There are no rules, but here are a few things to consider: ###### Before you submit an issue: * Do a quick search to see if there are similar issues -* Check that you are using the latest version of `ionic-native` +* **Check that you are using the latest version of** `ionic-native` ###### Still having problems? submit an issue with the following details: * Short description of the issue From c04379af191ca37d2b5b979b08bbbc7e303798a9 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 12:21:38 -0400 Subject: [PATCH 058/382] refractor(geofence): fix tslint issues --- src/plugins/geofence.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index d474687b7..fc3adc515 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -96,7 +96,7 @@ export class Geofence { * @return {Promise} */ @Cordova() - static initialize(): Promise { return }; + static initialize(): Promise { return; }; /** * Adds a new geofence or array of geofences. For geofence object, see above. @@ -104,7 +104,7 @@ export class Geofence { * @return {Promise} */ @Cordova() - static addOrUpdate(geofences: Object | Array): Promise { return }; + static addOrUpdate(geofences: Object | Array): Promise { return; }; /** * Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the @@ -113,7 +113,7 @@ export class Geofence { * @return {Promise} */ @Cordova() - static remove(geofenceId: string | Array): Promise { return }; + static remove(geofenceId: string | Array): Promise { return; }; /** * Removes all geofences. @@ -121,7 +121,7 @@ export class Geofence { * @return {Promise} */ @Cordova() - static removeAll(): Promise { return }; + static removeAll(): Promise { return; }; /** * Returns an array of geofences currently being monitored. @@ -129,7 +129,7 @@ export class Geofence { * @return {Promise>} */ @Cordova() - static getWatched(): Promise { return }; + static getWatched(): Promise { return; }; /** * Called when a geofence is crossed in the direction specified by `TransitType`. From 8b2d47587a221733f9054600dd2c449e465b5deb Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 12:25:11 -0400 Subject: [PATCH 059/382] 1.3.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 653a247ec..fa65f487f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.17", + "version": "1.3.18", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From a4798b81a8a60dfe1239848e24f5c5dfdd890926 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 12:33:28 -0400 Subject: [PATCH 060/382] refracto(): tslint --- src/plugins/diagnostic.ts | 2 +- src/plugins/file.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index fbb031067..8197b2752 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,4 +1,4 @@ -import {Cordova, Plugin, CordovaProperty} from './plugin'; +import {Cordova, Plugin} from './plugin'; /** * @name Diagnostic diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 409127d9a..a2ef0a45d 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -756,7 +756,7 @@ export class File { reader.readAsText(file); }, error => { reject(error); - }) + }); }); }); @@ -800,7 +800,7 @@ export class File { reader.readAsDataURL(file); }, error => { reject(error); - }) + }); }); }); } @@ -840,7 +840,7 @@ export class File { reader.readAsBinaryString(file); }, error => { reject(error); - }) + }); }); }); @@ -881,7 +881,7 @@ export class File { reader.readAsArrayBuffer(file); }, error => { reject(error); - }) + }); }); }); From c7a5f7d02378e7e3a03ae8170d5e5021327d747a Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 13:08:13 -0400 Subject: [PATCH 061/382] docs(): add description tag --- CHANGELOG.md | 17 ++++++++++------- src/plugins/code-push.ts | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91126c6e5..7b634efe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,16 @@ ### Bug Fixes * **facebook:** export interfaces ([c4110ee](https://github.com/driftyco/ionic-native/commit/c4110ee)) +* **File:** fixed readFileAs ([#479](https://github.com/driftyco/ionic-native/issues/479)) ([eff7841](https://github.com/driftyco/ionic-native/commit/eff7841)) * **geofence:** fix event listeners ([efa222f](https://github.com/driftyco/ionic-native/commit/efa222f)) ### Features +* **code-push:** add wrapper for cordova-plugin-code-push ([#420](https://github.com/driftyco/ionic-native/issues/420)) ([905f988](https://github.com/driftyco/ionic-native/commit/905f988)) * **diagnostic:** add full plugin functionality ([#424](https://github.com/driftyco/ionic-native/issues/424)) ([47a9b34](https://github.com/driftyco/ionic-native/commit/47a9b34)), closes [#224](https://github.com/driftyco/ionic-native/issues/224) * **geofence:** Adds geofence plugin ([#442](https://github.com/driftyco/ionic-native/issues/442)) ([a438967](https://github.com/driftyco/ionic-native/commit/a438967)) +* **inAppPurchase:** add inAppPurhcase plugin ([#423](https://github.com/driftyco/ionic-native/issues/423)) ([8526e89](https://github.com/driftyco/ionic-native/commit/8526e89)) * **IsDebug:** add the IsDebug plugin ([#475](https://github.com/driftyco/ionic-native/issues/475)) ([dd39ba8](https://github.com/driftyco/ionic-native/commit/dd39ba8)) @@ -24,7 +27,7 @@ * add the reject function at the expected errorIndex position in the args array ([#436](https://github.com/driftyco/ionic-native/issues/436)) ([4e87ac7](https://github.com/driftyco/ionic-native/commit/4e87ac7)) * **camera-preview:** changes implementation to match Cordova plugin ([#441](https://github.com/driftyco/ionic-native/issues/441)) ([55ba65a](https://github.com/driftyco/ionic-native/commit/55ba65a)) -* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3)), closes [#459](https://github.com/driftyco/ionic-native/issues/459) +* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3)) * **file:** initialize writeFile options ([#468](https://github.com/driftyco/ionic-native/issues/468)) ([16628a4](https://github.com/driftyco/ionic-native/commit/16628a4)) * **nativeaudio:** fix plugin reference ([2510c5f](https://github.com/driftyco/ionic-native/commit/2510c5f)) @@ -90,11 +93,11 @@ ### Bug Fixes -* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)), closes [#331](https://github.com/driftyco/ionic-native/issues/331) -* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)), closes [#413](https://github.com/driftyco/ionic-native/issues/413) [#417](https://github.com/driftyco/ionic-native/issues/417) +* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)) +* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)) * **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866)) * **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0)) -* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)), closes [#357](https://github.com/driftyco/ionic-native/issues/357) +* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)) ### Features @@ -125,7 +128,7 @@ ### 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) +* **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)) @@ -152,7 +155,7 @@ ### 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) +* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70)) ### Features @@ -279,7 +282,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) +* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)) ### Features diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts index bb9da82da..29f253d26 100644 --- a/src/plugins/code-push.ts +++ b/src/plugins/code-push.ts @@ -401,6 +401,7 @@ export interface DownloadProgress { /** * @name CodePush + * @description * CodePush plugin for Cordova by Microsoft that supports iOS and Android. * * For more info, please see https://github.com/ksachdeva/ionic2-code-push-example From 820e4d78bf1979eec2fc305d8a0caf43fa58d028 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 26 Aug 2016 10:09:12 -0700 Subject: [PATCH 062/382] docs(geofence): remove code comments (#483) --- src/plugins/geofence.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index fc3adc515..e7f2fa15e 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -133,7 +133,6 @@ export class Geofence { /** * Called when a geofence is crossed in the direction specified by `TransitType`. - * Commenting out. Not yet implemented in plugin. * * @return {Promise} */ @@ -147,8 +146,7 @@ export class Geofence { } /** - * Called when the user clicks a geofence notification. iOS and Android only. - * Commenting out. Not yet implemented in plugin. + * Called when the user clicks a geofence notification. iOS and Android only. * * @return {Promise} */ From ff64c6e3630996fd32f8c63ee9dc2b5ab2e1ea0e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 26 Aug 2016 13:14:13 -0400 Subject: [PATCH 063/382] docs(diagnostic): add return types to docs --- src/plugins/diagnostic.ts | 57 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 8197b2752..82b4b5b8f 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -103,6 +103,7 @@ export class Diagnostic { /** * Checks if app is able to access device location. + * @returns {Promise} */ @Cordova() static isLocationAvailable(): Promise { return; } @@ -110,6 +111,7 @@ export class Diagnostic { /** * 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. `` + * @returns {Promise} */ @Cordova() static isWifiAvailable(): Promise { return; } @@ -117,6 +119,7 @@ export class Diagnostic { /** * 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. + * @returns {Promise} */ @Cordova() static isCameraAvailable(): Promise { return; } @@ -124,6 +127,7 @@ export class Diagnostic { /** * 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 + * @returns {Promise} */ @Cordova() static isBluetoothAvailable(): Promise { return; } @@ -154,6 +158,7 @@ export class Diagnostic { /** * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()` + * @returns {Promise} */ @Cordova({platforms: ['Android', 'Windows 10']}) static isWifiEnabled(): Promise { return; } @@ -176,6 +181,7 @@ export class Diagnostic { /** * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static isLocationEnabled(): Promise {return; } @@ -183,12 +189,14 @@ export class Diagnostic { /** * 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. + * @returns {Promise} */ @Cordova() static isLocationAuthorized(): Promise { return; } /** * Returns the location authorization status for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static getLocationAuthorizationStatus(): Promise {return; } @@ -198,12 +206,14 @@ export class Diagnostic { * 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. * * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static requestLocationAuthorization(mode?: string): Promise { return; } /** * Checks if camera hardware is present on device. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static isCameraPresent(): Promise { return; } @@ -211,54 +221,63 @@ export class Diagnostic { /** * 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. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static isCameraAuthorized(): Promise { return; } /** * Returns the camera authorization status for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static getCameraAuthorizationStatus(): Promise { return; } /** * Requests camera authorization for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static requestCameraAuthorization(): Promise { return; } /** * Checks if the application is authorized to use the microphone. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static isMicrophoneAuthorized(): Promise { return; } /** * Returns the microphone authorization status for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static getMicrophoneAuthorizationStatus(): Promise { return; } /** * Requests microphone authorization for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static requestMicrophoneAuthorization(): Promise { return; } /** * Checks if the application is authorized to use contacts (address book). + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static isContactsAuthorized(): Promise { return; } /** * Returns the contacts authorization status for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static getContactsAuthroizationStatus(): Promise { return; } /** * Requests contacts authorization for the application. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static requestContactsAuthorization(): Promise { return; } @@ -271,6 +290,7 @@ export class Diagnostic { * * Notes for iOS: * - This relates to Calendar Events (not Calendar Reminders) + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static isCalendarAuthorized(): Promise { return; } @@ -284,6 +304,7 @@ export class Diagnostic { * Notes for iOS: * - This relates to Calendar Events (not Calendar Reminders) * + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static getCalendarAuthorizationStatus(): Promise { return; } @@ -300,6 +321,7 @@ export class Diagnostic { * - This requests permission for `READ_CALENDAR` run-time permission * - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR` * + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static requestCalendarAuthorization(): Promise { return; } @@ -308,12 +330,14 @@ export class Diagnostic { * Opens settings page for this app. * On Android, this opens the "App Info" page in the Settings app. * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static switchToSettings(): Promise {return; } /** * Returns the state of Bluetooth on the device. + * @returns {Promise} */ @Cordova({platforms: ['Android', 'iOS']}) static getBluetoothState(): Promise {return; } @@ -333,7 +357,9 @@ export class Diagnostic { static registerLocationStateChangeHandler(handler: Function): void { } /** - * Checks if high-accuracy locations are available to the app from GPS hardware. Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. + * Checks if high-accuracy locations are available to the app from GPS hardware. + * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static isGpsLocationAvailable(): Promise {return; } @@ -348,7 +374,9 @@ export class Diagnostic { static isGpsLocationEnabled(): Promise { return; } /** - * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location. + * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. + * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location. + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static isNetworkLocationAvailable(): Promise {return; } @@ -358,12 +386,14 @@ export class Diagnostic { * Returns true if Location mode is enabled and is set to either: * - Battery saving = network triangulation and Wifi network IDs (low accuracy) * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static isNetworkLocationEnabled(): Promise { return; } /** * Returns the current location mode setting for the device. + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static getLocationMode(): Promise {return; } @@ -372,6 +402,7 @@ export class Diagnostic { * Returns the current authorisation status for a given permission. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. * @param permission + * @returns {Promise} */ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) static getPermissionAuthorizationStatus(permission: any): Promise {return; } @@ -380,6 +411,7 @@ export class Diagnostic { * Returns the current authorisation status for multiple permissions. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. * @param permissions + * @returns {Promise} */ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) static getPermissionsAuthorizationStatus(permissions: any[]): Promise {return; } @@ -388,6 +420,7 @@ export class Diagnostic { * Requests app to be granted authorisation for a runtime permission. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time. * @param permission + * @returns {Promise} */ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) static requestRuntimePermission(permission: any): Promise {return; } @@ -396,6 +429,7 @@ export class Diagnostic { * Requests app to be granted authorisation for multiple runtime permissions. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. * @param permissions + * @returns {Promise} */ @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) static requestRuntimePermissions(permissions: any[]): Promise {return; } @@ -403,54 +437,65 @@ export class Diagnostic { /** * Checks if the device setting for Bluetooth is switched on. * This requires `BLUETOOTH` permission on Android + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static isBluetoothEnabled(): Promise {return; } /** * Checks if the device has Bluetooth capabilities. + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static hasBluetoothSupport(): Promise {return; } /** * Checks if the device has Bluetooth Low Energy (LE) capabilities. + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static hasBluetoothLESupport(): Promise {return; } /** * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. + * @returns {Promise} */ @Cordova({platforms: ['Android']}) static hasBluetoothLEPeripheralSupport(): Promise {return; } /** * Checks if the application is authorized to use the Camera Roll in Photos app. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static isCameraRollAuthorized(): Promise {return; } /** * Returns the authorization status for the application to use the Camera Roll in Photos app. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static getCameraRollAuthorizationStatus(): Promise {return; } /** - * Requests camera roll authorization for the application. Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect. + * Requests camera roll authorization for the application. + * Should only be called if authorization status is NOT_REQUESTED. + * Calling it when in any other state will have no effect. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static requestCameraRollAuthorization(): Promise {return; } /** * Checks if remote (push) notifications are enabled. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static isRemoteNotificationsEnabled(): Promise {return; } /** * Indicates if the app is registered for remote (push) notifications on the device. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static isRegisteredForRemoteNotifications(): Promise {return; } @@ -458,36 +503,42 @@ export class Diagnostic { /** * Indicates the current setting of notification types for the app in the Settings app. * Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static getRemoteNotificationTypes(): Promise {return; } /** * Checks if the application is authorized to use reminders. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static isRemindersAuthorized(): Promise {return; } /** * Returns the reminders authorization status for the application. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static getRemindersAuthorizationStatus(): Promise {return; } /** * Requests reminders authorization for the application. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static requestRemindersAuthorization(): Promise {return; } /** * Checks if the application is authorized for background refresh. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static isBackgroundRefreshAuthorized(): Promise {return; } /** * Returns the background refresh authorization status for the application. + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static getBackgroundRefreshStatus(): Promise {return; } From 841b242fb949a06b20ea035383750ed729e6a626 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:01:59 -0400 Subject: [PATCH 064/382] feat(streaming-media): add streaming media support (#486) --- src/index.ts | 3 ++ src/plugins/streaming-media.ts | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/plugins/streaming-media.ts diff --git a/src/index.ts b/src/index.ts index fb3cf9ddc..4e22fa5e6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,6 +83,7 @@ import { SpinnerDialog } from './plugins/spinnerdialog'; import { Splashscreen } from './plugins/splashscreen'; import { SQLite } from './plugins/sqlite'; import { StatusBar } from './plugins/statusbar'; +import { StreamingMedia } from './plugins/streaming-media'; import { ThreeDeeTouch } from './plugins/3dtouch'; import { Toast } from './plugins/toast'; import { TouchID } from './plugins/touchid'; @@ -125,6 +126,7 @@ export * from './plugins/push'; export * from './plugins/safari-view-controller'; export * from './plugins/sms'; export * from './plugins/spinnerdialog'; +export * from './plugins/streaming-media'; export * from './plugins/toast'; export * from './plugins/twitter-connect'; export * from './plugins/video-editor'; @@ -269,6 +271,7 @@ window['IonicNative'] = { Splashscreen: Splashscreen, SQLite: SQLite, StatusBar: StatusBar, + StreamingMedia: StreamingMedia, ThreeDeeTouch: ThreeDeeTouch, Toast: Toast, TouchID: TouchID, diff --git a/src/plugins/streaming-media.ts b/src/plugins/streaming-media.ts new file mode 100644 index 000000000..b8a775749 --- /dev/null +++ b/src/plugins/streaming-media.ts @@ -0,0 +1,77 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name StreamingMedia + * @description + * This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android. + * + * @usage + * ``` + * import {StreamingMedia} from 'ionic-native'; + * + * let options: VideoOptions = { + * successCallback: () => { console.log('Video played') }, + * errorCallback: (e) => { console.log('Error streaming') }, + * orientation: 'landscape' + * }; + * + * StreamingMedia.('https://path/to/video/stream', options); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-streaming-media', + pluginRef: 'plugins.streamingMedia', + repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media', + platforms: ['Android', 'iOS'] +}) +export class StreamingMedia { + /** + * Streams a video + * @param videoUrl {string} The URL of the video + * @param options {VideoOptions} Options + */ + @Cordova({sync: true}) + static playVideo(videoUrl: string, options?: VideoOptions): void { } + + /** + * Streams an audio + * @param audioUrl {string} The URL of the audio stream + * @param options {AudioOptions} Options + */ + @Cordova({sync: true}) + static playAudio(audioUrl: string, options?: AudioOptions): void { } + + /** + * Stops streaming audio + */ + @Cordova({sync: true}) + static stopAudio(): void { } + + /** + * Pauses streaming audio + */ + @Cordova({sync: true, platforms: ['iOS']}) + static pauseAudio(): void { } + + /** + * Resumes streaming audio + */ + @Cordova({sync: true, platforms: ['iOS']}) + static resumeAudio(): void { } + +} + +export interface VideoOptions { + successCallback?: Function; + errorCallback?: Function; + orientation?: string; +} + +export interface AudioOptions { + bgColor?: string; + bgImage?: string; + bgImageScale?: string; + initFullscreen?: boolean; + successCallback?: Function; + errorCallback?: Function; +} From 759f8ef910dd9dbd593b6af9066aebca78715d16 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:02:07 -0400 Subject: [PATCH 065/382] feat(call-number): add support for CallNumber plugin (#487) --- src/index.ts | 3 +++ src/plugins/call-number.ts | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/plugins/call-number.ts diff --git a/src/index.ts b/src/index.ts index 4e22fa5e6..34d4d11ab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ import { Brightness } from './plugins/brightness'; import { BLE } from './plugins/ble'; import { BluetoothSerial } from './plugins/bluetoothserial'; import { Calendar } from './plugins/calendar'; +import { CallNumber } from './plugins/call-number'; import { Camera } from './plugins/camera'; import { CameraPreview } from './plugins/camera-preview'; import { CardIO } from './plugins/card-io'; @@ -145,6 +146,7 @@ BatteryStatus, Brightness, BLE, BluetoothSerial, +CallNumber, CameraPreview, Clipboard, CodePush, @@ -210,6 +212,7 @@ window['IonicNative'] = { BLE: BLE, BluetoothSerial: BluetoothSerial, Calendar: Calendar, + CallNumber: CallNumber, Camera: Camera, CameraPreview: CameraPreview, CardIO: CardIO, diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts new file mode 100644 index 000000000..ef5e0e281 --- /dev/null +++ b/src/plugins/call-number.ts @@ -0,0 +1,36 @@ +import { Plugin, Cordova } from './plugin'; + +/** + * @name CallNumber + * @description + * Call a number directly from your Cordova/Ionic application. + * + * @usage + * ``` + * import {CallNumber} from 'ionic-native'; + * + * CallNumber.callNumber(18001010101, true) + * .then(() => console.log('Launched dialer!')) + * .catch(() => console.log('Error launching dialer')); + * + * ``` + */ +@Plugin({ + plugin: 'call-number', + pluginRef: 'plugins.CallNumber', + repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin', + platforms: ['iOS', 'Android'] +}) +export class CallNumber { + /** + * Calls a phone number + * @param numberToCall {number} The phone number to call + * @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static callNumber(numberToCall: number, bypassAppChooser: boolean): Promise { + return; + } +} From 00d87dba983433e415b189c5308d303b39e205f8 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:02:13 -0400 Subject: [PATCH 066/382] feat(native-page-transitions): add support for Native Page Transitions plugin (#488) --- src/index.ts | 3 + src/plugins/native-page-transitions.ts | 86 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 src/plugins/native-page-transitions.ts diff --git a/src/index.ts b/src/index.ts index 34d4d11ab..951d8b9d5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,6 +64,7 @@ import { LaunchNavigator } from './plugins/launchnavigator'; import { LocalNotifications } from './plugins/localnotifications'; import { MediaCapture } from './plugins/media-capture'; import { NativeAudio } from './plugins/native-audio'; +import { NativePageTransitions } from './plugins/native-page-transitions'; import { NativeStorage } from './plugins/nativestorage'; import { MediaPlugin } from './plugins/media'; import { Network } from './plugins/network'; @@ -122,6 +123,7 @@ export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; export * from './plugins/media'; export * from './plugins/media-capture'; +export * from './plugins/native-page-transitions'; export * from './plugins/printer'; export * from './plugins/push'; export * from './plugins/safari-view-controller'; @@ -255,6 +257,7 @@ window['IonicNative'] = { MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, NativeAudio: NativeAudio, + NativePageTransitions: NativePageTransitions, NativeStorage: NativeStorage, Network: Network, Printer: Printer, diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts new file mode 100644 index 000000000..b35f72636 --- /dev/null +++ b/src/plugins/native-page-transitions.ts @@ -0,0 +1,86 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name NativePageTransitions + * @description + * The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction. + * + * @usage + * ``` + * import {NativePageTransitions, TransitionOptions} from 'ionic-native'; + * + * let options: TransitionOptions = { + * direction: 'up', + * duration: 500, + * slowdownfactor: 3, + * slidePixels: 20, + * iosdelay: 100, + * androiddelay: 150, + * winphonedelay: 250, + * fixedPixelsTop: 0, + * fixedPixelsBottom: 60 + * }; + * + * NativePageTransitions.slide(options) + * .then(onSuccess) + * .catch(onError); + * + * ``` + */ +@Plugin({ + plugin: 'com.telerik.plugins.nativepagetransitions', + pluginRef: 'plugins.nativepagetransitions', + repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions', + platforms: ['iOS', 'Android', 'Windows Phone'] +}) +export class NativePageTransitions { + /** + * Perform a slide animation + * @param options {TransitionOptions} Options for the transition + */ + @Cordova() + static slide(options: TransitionOptions): Promise {return; } + + /** + * Perform a flip animation + * @param options {TransitionOptions} Options for the transition + */ + @Cordova() + static flip(options: TransitionOptions): Promise {return; } + + /** + * Perform a fade animation + * @param options {TransitionOptions} Options for the transition + */ + @Cordova({platforms: ['iOS', 'Android']}) + static fade(options: TransitionOptions): Promise {return; } + + + /** + * Perform a slide animation + * @param options {TransitionOptions} Options for the transition + */ + @Cordova({platforms: ['iOS', 'Android']}) + static drawer(options: TransitionOptions): Promise {return; } + + + + /** + * Perform a slide animation + * @param options {TransitionOptions} Options for the transition + */ + @Cordova({platforms: ['iOS']}) + static curl(options: TransitionOptions): Promise {return; } + +} + +export interface TransitionOptions { + direction?: string; + duration?: number; + slowdownfactor?: number; + slidePixels?: number; + iosdelay?: number; + androiddelay?: number; + winphonedelay?: number; + fixedPixelsTops?: number; + fixedPixelsBottom?: number; +} From cd82a5393ec652ab911337a620c26c835feb4f79 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:02:23 -0400 Subject: [PATCH 067/382] feat(power-management): add power management support (#489) --- src/index.ts | 3 ++ src/plugins/power-management.ts | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/plugins/power-management.ts diff --git a/src/index.ts b/src/index.ts index 951d8b9d5..841b0fca0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -72,6 +72,7 @@ import { OneSignal } from './plugins/onesignal'; import { PhotoViewer } from './plugins/photo-viewer'; import { ScreenOrientation } from './plugins/screen-orientation'; import { PinDialog } from './plugins/pin-dialog'; +import { PowerManagement } from './plugins/power-management'; import { Printer } from './plugins/printer'; import { Push } from './plugins/push'; import { SafariViewController } from './plugins/safari-view-controller'; @@ -178,6 +179,7 @@ OneSignal, PhotoViewer, ScreenOrientation, PinDialog, +PowerManagement, Screenshot, SecureStorage, Shake, @@ -266,6 +268,7 @@ window['IonicNative'] = { PhotoViewer: PhotoViewer, ScreenOrientation: ScreenOrientation, PinDialog: PinDialog, + PowerManagement: PowerManagement, SafariViewController: SafariViewController, Screenshot: Screenshot, SecureStorage: SecureStorage, diff --git a/src/plugins/power-management.ts b/src/plugins/power-management.ts new file mode 100644 index 000000000..860733998 --- /dev/null +++ b/src/plugins/power-management.ts @@ -0,0 +1,49 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name PowerManagement + * @description + * The PowerManagement plugin offers access to the devices power-management functionality. + * It should be used for applications which keep running for a long time without any user interaction. + * + * @usage + * ``` + * import {PowerManagement} from 'ionic-native'; + * + * PowerManagement.acquire() + * .then(onSuccess) + * .catch(onError); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-powermanagement-orig', + pluginRef: 'https://github.com/Viras-/cordova-plugin-powermanagement', + repo: 'powerManagement' +}) +export class PowerManagement { + /** + * Acquire a wakelock by calling this. + */ + @Cordova() + static acquire(): Promise {return; } + + /** + * This acquires a partial wakelock, allowing the screen to be dimmed. + */ + @Cordova() + static dim(): Promise {return; } + + /** + * Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain. + */ + @Cordova() + static release(): Promise {return; } + + /** + * By default, the plugin will automatically release a wakelock when your app is paused (e.g. when the screen is turned off, or the user switches to another app). + * It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function. + * @param set {boolean} + */ + @Cordova() + static setReleaseOnPause(set: boolean): Promise {return; } +} From 9bcc4ed80fa61699d035b08e31f7b80428959bac Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:02:30 -0400 Subject: [PATCH 068/382] feat(market): add Market plugin support (#490) --- src/index.ts | 3 +++ src/plugins/market.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/plugins/market.ts diff --git a/src/index.ts b/src/index.ts index 841b0fca0..7f4de613b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,6 +66,7 @@ import { MediaCapture } from './plugins/media-capture'; import { NativeAudio } from './plugins/native-audio'; import { NativePageTransitions } from './plugins/native-page-transitions'; import { NativeStorage } from './plugins/nativestorage'; +import { Market } from './plugins/market'; import { MediaPlugin } from './plugins/media'; import { Network } from './plugins/network'; import { OneSignal } from './plugins/onesignal'; @@ -175,6 +176,7 @@ Keyboard, NativeAudio, NativeStorage, Network, +Market, OneSignal, PhotoViewer, ScreenOrientation, @@ -256,6 +258,7 @@ window['IonicNative'] = { Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, + Market: Market, MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, NativeAudio: NativeAudio, diff --git a/src/plugins/market.ts b/src/plugins/market.ts new file mode 100644 index 000000000..740de6cea --- /dev/null +++ b/src/plugins/market.ts @@ -0,0 +1,29 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name Market + * @description + * Opens an app's page in the market place (Google Play, App Store) + * + * @usage + * ``` + * import {Market} from 'ionic-native'; + * + * Market.open('your.package.name'); + * + * ``` + */ +@Plugin({ + plugin: '', + pluginRef: 'plugins.market', + repo: 'https://github.com/xmartlabs/cordova-plugin-market' +}) +export class Market { + /** + * Opens an app in Google Play / App Store + * @param appId {string} Package name + * @param callbacks {Object} Optional callbacks + */ + @Cordova({sync: true}) + static open(appId: string, callbacks?: {success?: Function, failure?: Function}): void { } + +} From 76aa8a649447ee6e15d4e2cb74f139c80b971ac5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:03:06 -0400 Subject: [PATCH 069/382] feat(nfc): add nfc support (#493) * feat(nfc): add nfc plugin addresses #412 * feat(nfc): add nfc support --- src/index.ts | 3 + src/plugins/nfc.ts | 161 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 src/plugins/nfc.ts diff --git a/src/index.ts b/src/index.ts index 7f4de613b..2399d47bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,6 +69,7 @@ import { NativeStorage } from './plugins/nativestorage'; import { Market } from './plugins/market'; import { MediaPlugin } from './plugins/media'; import { Network } from './plugins/network'; +import { NFC } from './plugins/nfc'; import { OneSignal } from './plugins/onesignal'; import { PhotoViewer } from './plugins/photo-viewer'; import { ScreenOrientation } from './plugins/screen-orientation'; @@ -123,6 +124,7 @@ export * from './plugins/imageresizer'; export * from './plugins/inappbrowser'; export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; +export * from './plugins/nfc'; export * from './plugins/media'; export * from './plugins/media-capture'; export * from './plugins/native-page-transitions'; @@ -265,6 +267,7 @@ window['IonicNative'] = { NativePageTransitions: NativePageTransitions, NativeStorage: NativeStorage, Network: Network, + NFC: NFC, Printer: Printer, Push: Push, OneSignal: OneSignal, diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts new file mode 100644 index 000000000..04d847c15 --- /dev/null +++ b/src/plugins/nfc.ts @@ -0,0 +1,161 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from 'rxjs/Observable'; +/** + * @name NFC + * @description + * The NFC plugin allows you to read and write NFC tags. You can also beam to, and receive from, other NFC enabled devices. + * + * Use to + * - read data from NFC tags + * - write data to NFC tags + * - send data to other NFC enabled devices + * - receive data from NFC devices + * + * This plugin uses NDEF (NFC Data Exchange Format) for maximum compatibilty between NFC devices, tag types, and operating systems. + * + * @usage + * ``` + * import {NFC, Ndef} from 'ionic-native'; + * + * let message = Ndef.textRecord('Hello world'); + * NFC.share([message]).then(onSuccess).catch(onError); + * + * ``` + */ +@Plugin({ + plugin: 'phonegap-nfc', + pluginRef: 'nfc', + repo: 'https://github.com/chariotsolutions/phonegap-nfc' +}) +export class NFC { + /** + * Registers an event listener for any NDEF tag. + * @param onSuccess + * @param onFailure + * @return {Promise} + */ + @Cordova({ + observable: true, + successIndex: 0, + errorIndex: 3, + clearFunction: 'removeNdefListener', + clearWithArgs: true + }) + static addNdefListener(onSuccess?: Function, onFailure?: Function): Observable {return; } + + /** + * Registers an event listener for tags matching any tag type. + * @param mimeType + * @param onSuccess + * @param onFailure + * @return {Promise} + */ + @Cordova({ + observable: true, + successIndex: 1, + errorIndex: 4, + clearFunction: 'removeTagDiscoveredListener', + clearWithArgs: true + }) + static addTagDiscoveredListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable {return; } + + /** + * Registers an event listener for NDEF tags matching a specified MIME type. + * @param onSuccess + * @param onFailure + * @return {Promise} + */ + @Cordova({ + observable: true, + successIndex: 0, + errorIndex: 3, + clearFunction: 'removeMimeTypeListener', + clearWithArgs: true + }) + static addMimeTypeListener(onSuccess?: Function, onFailure?: Function): Observable {return; } + + /** + * Registers an event listener for formatable NDEF tags. + * @param onSuccess + * @param onFailure + * @return {Promise} + */ + @Cordova({ + observable: true, + successIndex: 0, + errorIndex: 3 + }) + static addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable {return; } + + /** + * Qrites an NdefMessage to a NFC tag. + * @param message {any[]} + * @return {Promise} + */ + @Cordova() + static write(message: any[]): Promise {return; } + /** + * Makes a NFC tag read only. **Warning** this is permanent. + * @return {Promise} + */ + @Cordova() + static makeReadyOnly(): Promise {return; } + + /** + * Shares an NDEF Message via peer-to-peer. + * @param message An array of NDEF Records. + * @return {Promise} + */ + @Cordova() + static share(message: any[]): Promise {return; } + + /** + * Stop sharing NDEF data via peer-to-peer. + * @return {Promise} + */ + @Cordova() + static unshare(): Promise {return; } + + /** + * Erase a NDEF tag + */ + @Cordova() + static erase(): Promise {return; } + + /** + * Send a file to another device via NFC handover. + * @param uris A URI as a String, or an array of URIs. + * @return {Promise} + */ + @Cordova() + static handover(uris: string[]): Promise {return; } + + /** + * Stop sharing NDEF data via NFC handover. + * @return {Promise} + */ + @Cordova() + static stopHandover(): Promise {return; } + + /** + * Show the NFC settings on the device. + * @return {Promise} + */ + @Cordova() + static showSettings(): Promise {return; } + + /** + * Check if NFC is available and enabled on this device. + * @return {Promise} + */ + @Cordova() + static enabled(): Promise {return; } + +} + +export declare class Ndef { + uriRecord(uri: string): any; + textRecord(text: string): any; + mimeMediaRecord(mimeType: string, payload: string): any; + androidApplicationRecord(packageName: string): any; +} From 9fe5c196aa307df117abaf302141c7485fa168e3 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:04:11 -0400 Subject: [PATCH 070/382] feat(paypal): add PayPal support (#491) --- src/index.ts | 3 + src/plugins/pay-pal.ts | 178 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 src/plugins/pay-pal.ts diff --git a/src/index.ts b/src/index.ts index 2399d47bb..c0ed45b36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,6 +73,7 @@ import { NFC } from './plugins/nfc'; import { OneSignal } from './plugins/onesignal'; import { PhotoViewer } from './plugins/photo-viewer'; import { ScreenOrientation } from './plugins/screen-orientation'; +import { PayPal } from './plugins/pay-pal'; import { PinDialog } from './plugins/pin-dialog'; import { PowerManagement } from './plugins/power-management'; import { Printer } from './plugins/printer'; @@ -127,6 +128,7 @@ export * from './plugins/localnotifications'; export * from './plugins/nfc'; export * from './plugins/media'; export * from './plugins/media-capture'; +export * from './plugins/pay-pal'; export * from './plugins/native-page-transitions'; export * from './plugins/printer'; export * from './plugins/push'; @@ -267,6 +269,7 @@ window['IonicNative'] = { NativePageTransitions: NativePageTransitions, NativeStorage: NativeStorage, Network: Network, + PayPal: PayPal, NFC: NFC, Printer: Printer, Push: Push, diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts new file mode 100644 index 000000000..4f58613d6 --- /dev/null +++ b/src/plugins/pay-pal.ts @@ -0,0 +1,178 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name PayPal + * @description + * PayPal plugin for Cordova/Ionic Applications + * + * @usage + * ``` + * import {PayPal} from 'ionic-native'; + * + * PayPal.init({ + * "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID", + "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID" + }) + * .then(onSuccess) + * .catch(onError); + * + * ``` + */ +@Plugin({ + plugin: 'com.paypal.cordova.mobilesdk', + pluginRef: 'PayPalMobile', + repo: 'https://github.com/paypal/PayPal-Cordova-Plugin' +}) +export class PayPal { + /** + * You must preconnect to PayPal to prepare the device for processing payments. + * This improves the user experience, by making the presentation of the + * UI faster. The preconnect is valid for a limited time, so + * the recommended time to preconnect is on page load. + * + * @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox" + * @param {PayPalConfiguration} configuration: For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set + */ + @Cordova() + static init(environment: PayPalEnvironment, configuration?: PayPalConfiguration): Promise {return; } + + /** + * Retreive the version of PayPal iOS SDK Library. + */ + @Cordova() + static version(): Promise {return; } + + /** + * Start PayPal UI to collect payment from the user. + * See https://developer.paypal.com/webapps/developer/docs/integration/mobile/ios-integration-guide/ + * for more documentation of the params. + * + * @param {PayPalPayment} payment: PayPalPayment object + */ + @Cordova() + static renderSinglePaymentUI(payment: PayPalPayment): Promise {return; } + + /** + * Once a user has consented to future payments, when the user subsequently initiates a PayPal payment + * from their device to be completed by your server, PayPal uses a Correlation ID to verify that the + * payment is originating from a valid, user-consented device+application. + * This helps reduce fraud and decrease declines. + * This method MUST be called prior to initiating a pre-consented payment (a "future payment") from a mobile device. + * Pass the result to your server, to include in the payment request sent to PayPal. + * Do not otherwise cache or store this value. + */ + @Cordova() + static clientMetadataID(): Promise {return; } + + /** + * Please Read Docs on Future Payments at https://github.com/paypal/PayPal-iOS-SDK#future-payments + */ + @Cordova() + static renderFuturePaymentUI(): Promise {return; } + + /** + * Please Read Docs on Profile Sharing at https://github.com/paypal/PayPal-iOS-SDK#profile-sharing + * + * @param {Array} scopes: scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes + * See https://developer.paypal.com/docs/integration/direct/identity/attributes/ for more details + **/ + @Cordova() + static renderProfileSharingUI(scopes: string[]): Promise {return; } + +} + +export interface PayPalEnvironment { + PayPalEnvironmentProduction: string; + PayPalEnvironmentSandbox: string; +} + +export declare class PayPalPayment { + /** + * Convenience constructor. + * Returns a PayPalPayment with the specified amount, currency code, and short description. + * @param {String} amount: The amount of the payment. + * @param {String} currencyCode: The ISO 4217 currency for the payment. + * @param {String} shortDescription: A short descripton of the payment. + * @param {String} intent: "Sale" for an immediate payment. + */ + new(amount: string, currencyCode: string, shortDescription: string, intent: string); + + /** + * Optional invoice number, for your tracking purposes. (up to 256 characters) + * @param {String} invoiceNumber: The invoice number for the payment. + */ + invoiceNumber(invoiceNumber: string): void; + + /** + * Optional text, for your tracking purposes. (up to 256 characters) + * @param {String} custom: The custom text for the payment. + */ + custom(custom: string): void; + + /** + * Optional text which will appear on the customer's credit card statement. (up to 22 characters) + * @param {String} softDescriptor: credit card text for payment + */ + softDescriptor(softDescriptor: string): void; + + /** + * Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com, + * for your tracking purposes. + * @param {String} bnCode: bnCode for payment + */ + bnCode(bnCode: string): void; + + /** + * Optional array of PayPalItem objects. @see PayPalItem + * @note If you provide one or more items, be sure that the various prices correctly + * sum to the payment `amount` or to `paymentDetails.subtotal`. + * @param items {Array} Optional + */ + items(items?: any): void; + + /** + * Optional customer shipping address, if your app wishes to provide this to the SDK. + * @note make sure to set `payPalShippingAddressOption` in PayPalConfiguration to 1 or 3. + * @param {PayPalShippingAddress} shippingAddress: PayPalShippingAddress object + */ + shippingAddress(shippingAddress: PayPalShippingAddress): void; +} + +export interface PayPalConfigurationOptions { + defaultUserEmail?: string; + defaultUserPhoneCountryCode?: string; + defaultUserPhoneNumber?: string; + merchantName?: string; + merchantPrivacyPolicyUrl?: string; + merchantUserAgreementUrl?: string; + acceptCreditCards?: boolean; + payPalShippingAddressOption?: number; + rememberUser?: boolean; + languageOrLocale?: string; + disableBlurWhenBackgrounding?: boolean; + presentingInPopover?: boolean; + forceDefaultsInSandbox?: boolean; + sandboxUserPAssword?: string; + sandboxUserPin?: string; +} + +export declare class PayPalConfiguration { + /** + * You use a PayPalConfiguration object to configure many aspects of how the SDK behaves. + * see defaults for options available + */ + new(options: PayPalConfigurationOptions); +} + +export declare class PayPalShippingAddress { + /** + * See the documentation of the individual properties for more detail. + * @param {String} recipientName: Name of the recipient at this address. 50 characters max. + * @param {String} line1: Line 1 of the address (e.g., Number, street, etc). 100 characters max. + * @param {String} Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional. + * @param {String} city: City name. 50 characters max. + * @param {String} state: 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries. + * @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries. + * @param {String} countryCode: 2-letter country code. 2 characters max. + */ + new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string); +} From cf8e3420c03eaf01696b284713422d34f642f77c Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:05:35 -0400 Subject: [PATCH 071/382] feat(mixpanel): add mixpanel support (#492) --- src/index.ts | 3 ++ src/plugins/mixpanel.ts | 105 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 src/plugins/mixpanel.ts diff --git a/src/index.ts b/src/index.ts index c0ed45b36..f00e64be6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -68,6 +68,7 @@ import { NativePageTransitions } from './plugins/native-page-transitions'; import { NativeStorage } from './plugins/nativestorage'; import { Market } from './plugins/market'; import { MediaPlugin } from './plugins/media'; +import { Mixpanel } from './plugins/mixpanel'; import { Network } from './plugins/network'; import { NFC } from './plugins/nfc'; import { OneSignal } from './plugins/onesignal'; @@ -128,6 +129,7 @@ export * from './plugins/localnotifications'; export * from './plugins/nfc'; export * from './plugins/media'; export * from './plugins/media-capture'; +export * from './plugins/mixpanel'; export * from './plugins/pay-pal'; export * from './plugins/native-page-transitions'; export * from './plugins/printer'; @@ -265,6 +267,7 @@ window['IonicNative'] = { Market: Market, MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, + Mixpanel: Mixpanel, NativeAudio: NativeAudio, NativePageTransitions: NativePageTransitions, NativeStorage: NativeStorage, diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts new file mode 100644 index 000000000..c876b7203 --- /dev/null +++ b/src/plugins/mixpanel.ts @@ -0,0 +1,105 @@ +import {Plugin, Cordova, CordovaProperty} from './plugin'; +/** + * @name Mixpanel + * @description + * Cordova Plugin that wraps Mixpanel SDK for Android and iOS + * + * @usage + * ``` + * import {Mixpanel} from 'ionic-native'; + * + * Mixpanel.init(token) + * .then(onSuccess) + * .catch(onError); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-mixpanel', + pluginRef: 'mixpanel', + repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' +}) +export class Mixpanel { + /** + * + * @param aliasId {string} + * @param originalId {string} + * @returns {Promise} + */ + @Cordova() + static alias(aliasId: string, originalId: string): Promise {return; } + + /** + * + * @returns {Promise} + */ + @Cordova() + static distinctId(): Promise {return; } + + /** + * + */ + @Cordova() + static flush(): Promise {return; } + + /** + * + * @param distinctId {string} + * @returns {Promise} + */ + @Cordova() + static identify(distinctId): Promise {return; } + + /** + * + * @param token {string} + * @returns {Promise} + */ + @Cordova() + static init(token: string): Promise {return; } + + /** + * + * @param superProperties + * @returns {Promise} + */ + @Cordova() + static registerSuperProperties(superProperties: any): Promise {return; } + + /** + * + * @returns {Promise} + */ + @Cordova() + static reset(): Promise {return; } + + /** + * + * @param eventName + * @param eventProperties + */ + @Cordova() + static track(eventName: string, eventProperties: any): Promise {return; } + + /** + * + * @returns {Promise} + */ + @Cordova() + static showSurvey(): Promise {return; } + + /** + * + * @returns {MixpanelPeople} + */ + @CordovaProperty + static people: MixpanelPeople; + +} +export declare class MixpanelPeople { + static identify(distinctId: string, onSuccess?: Function, onFail?: Function): void; + static increment(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; + static setPushId(pushId: string, onSuccess?: Function, onFail?: Function): void; + static set(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; + static setOnce(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; +} From 661276467c98f386d6980829d1b9a626623bd4c2 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:08:16 -0400 Subject: [PATCH 072/382] refractor(streaming-media): refractor to resolve duplicate --- src/plugins/streaming-media.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/streaming-media.ts b/src/plugins/streaming-media.ts index b8a775749..3fb176e62 100644 --- a/src/plugins/streaming-media.ts +++ b/src/plugins/streaming-media.ts @@ -6,9 +6,9 @@ import {Plugin, Cordova} from './plugin'; * * @usage * ``` - * import {StreamingMedia} from 'ionic-native'; + * import {StreamingMedia, StreamingVideoOptions} from 'ionic-native'; * - * let options: VideoOptions = { + * let options: StreamingVideoOptions = { * successCallback: () => { console.log('Video played') }, * errorCallback: (e) => { console.log('Error streaming') }, * orientation: 'landscape' @@ -28,18 +28,18 @@ export class StreamingMedia { /** * Streams a video * @param videoUrl {string} The URL of the video - * @param options {VideoOptions} Options + * @param options {StreamingVideoOptions} Options */ @Cordova({sync: true}) - static playVideo(videoUrl: string, options?: VideoOptions): void { } + static playVideo(videoUrl: string, options?: StreamingVideoOptions): void { } /** * Streams an audio * @param audioUrl {string} The URL of the audio stream - * @param options {AudioOptions} Options + * @param options {StreamingAudioOptions} Options */ @Cordova({sync: true}) - static playAudio(audioUrl: string, options?: AudioOptions): void { } + static playAudio(audioUrl: string, options?: StreamingAudioOptions): void { } /** * Stops streaming audio @@ -61,13 +61,13 @@ export class StreamingMedia { } -export interface VideoOptions { +export interface StreamingVideoOptions { successCallback?: Function; errorCallback?: Function; orientation?: string; } -export interface AudioOptions { +export interface StreamingAudioOptions { bgColor?: string; bgImage?: string; bgImageScale?: string; From dd0c9baffdf219cb737a6bbb5b1b20e39054f2a4 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:10:50 -0400 Subject: [PATCH 073/382] fix(mixpanel): implement CordovaProperty correctly --- src/plugins/mixpanel.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index c876b7203..f5cbbcf33 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -1,4 +1,5 @@ import {Plugin, Cordova, CordovaProperty} from './plugin'; +declare var mixpanel: any; /** * @name Mixpanel * @description @@ -93,7 +94,7 @@ export class Mixpanel { * @returns {MixpanelPeople} */ @CordovaProperty - static people: MixpanelPeople; + static get people(): MixpanelPeople {return mixpanel.people; }; } export declare class MixpanelPeople { From c93d95132d0f547beb3dcb267fc02e071693ca4a Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:11:09 -0400 Subject: [PATCH 074/382] 1.3.19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fa65f487f..d7284beb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.18", + "version": "1.3.19", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From a006cdb77b8e70d50f45fddfe2b575231d74fbab Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 02:12:47 -0400 Subject: [PATCH 075/382] chore(): update changelog --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b634efe8..aae3f6e45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ + +## [1.3.19](https://github.com/driftyco/ionic-native/compare/v1.3.18...v1.3.19) (2016-08-27) + + +### Bug Fixes + +* **mixpanel:** implement CordovaProperty correctly ([dd0c9ba](https://github.com/driftyco/ionic-native/commit/dd0c9ba)) + + +### Features + +* **call-number:** add support for CallNumber plugin ([#487](https://github.com/driftyco/ionic-native/issues/487)) ([759f8ef](https://github.com/driftyco/ionic-native/commit/759f8ef)) +* **market:** add Market plugin support ([#490](https://github.com/driftyco/ionic-native/issues/490)) ([9bcc4ed](https://github.com/driftyco/ionic-native/commit/9bcc4ed)) +* **mixpanel:** add mixpanel support ([#492](https://github.com/driftyco/ionic-native/issues/492)) ([cf8e342](https://github.com/driftyco/ionic-native/commit/cf8e342)) +* **native-page-transitions:** add support for Native Page Transitions plugin ([#488](https://github.com/driftyco/ionic-native/issues/488)) ([00d87db](https://github.com/driftyco/ionic-native/commit/00d87db)) +* **nfc:** add nfc support ([#493](https://github.com/driftyco/ionic-native/issues/493)) ([76aa8a6](https://github.com/driftyco/ionic-native/commit/76aa8a6)) +* **paypal:** add PayPal support ([#491](https://github.com/driftyco/ionic-native/issues/491)) ([9fe5c19](https://github.com/driftyco/ionic-native/commit/9fe5c19)) +* **power-management:** add power management support ([#489](https://github.com/driftyco/ionic-native/issues/489)) ([cd82a53](https://github.com/driftyco/ionic-native/commit/cd82a53)) +* **streaming-media:** add streaming media support ([#486](https://github.com/driftyco/ionic-native/issues/486)) ([841b242](https://github.com/driftyco/ionic-native/commit/841b242)) + + + ## [1.3.18](https://github.com/driftyco/ionic-native/compare/v1.3.17...v1.3.18) (2016-08-26) From b91740a91a56b9729469cedc9afd34f3a837682e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 12:33:02 -0400 Subject: [PATCH 076/382] docs(): add private to extra classes --- src/plugins/mixpanel.ts | 3 +++ src/plugins/nfc.ts | 12 +++++++----- src/plugins/pay-pal.ts | 12 +++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index f5cbbcf33..256e1334a 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -97,6 +97,9 @@ export class Mixpanel { static get people(): MixpanelPeople {return mixpanel.people; }; } +/** + * @private + */ export declare class MixpanelPeople { static identify(distinctId: string, onSuccess?: Function, onFail?: Function): void; static increment(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 04d847c15..809dea96e 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -152,10 +152,12 @@ export class NFC { static enabled(): Promise {return; } } - +/** + * @private + */ export declare class Ndef { - uriRecord(uri: string): any; - textRecord(text: string): any; - mimeMediaRecord(mimeType: string, payload: string): any; - androidApplicationRecord(packageName: string): any; + static uriRecord(uri: string): any; + static textRecord(text: string): any; + static mimeMediaRecord(mimeType: string, payload: string): any; + static androidApplicationRecord(packageName: string): any; } diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 4f58613d6..810ea39d6 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -84,7 +84,9 @@ export interface PayPalEnvironment { PayPalEnvironmentProduction: string; PayPalEnvironmentSandbox: string; } - +/** + * @private + */ export declare class PayPalPayment { /** * Convenience constructor. @@ -154,7 +156,9 @@ export interface PayPalConfigurationOptions { sandboxUserPAssword?: string; sandboxUserPin?: string; } - +/** + * @private + */ export declare class PayPalConfiguration { /** * You use a PayPalConfiguration object to configure many aspects of how the SDK behaves. @@ -162,7 +166,9 @@ export declare class PayPalConfiguration { */ new(options: PayPalConfigurationOptions); } - +/** + * @private + */ export declare class PayPalShippingAddress { /** * See the documentation of the individual properties for more detail. From f2cf1d4e038143c637de681c27b95b7d12cd7a02 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 13:03:39 -0400 Subject: [PATCH 077/382] chore(): add minimal template --- TEMPLATE-MIN | 19 +++++++++++++++++++ gulpfile.js | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 TEMPLATE-MIN diff --git a/TEMPLATE-MIN b/TEMPLATE-MIN new file mode 100644 index 000000000..052eac55b --- /dev/null +++ b/TEMPLATE-MIN @@ -0,0 +1,19 @@ +import {Plugin} from './plugin'; +/** + * @name PluginName + * @description + * + * @usage + * ``` + * import {PluginName} from 'ionic-native'; + * + * + * ``` + */ +@Plugin({ + plugin: '', + pluginRef: '', + repo: '' +}) +export class PluginName { +} diff --git a/gulpfile.js b/gulpfile.js index eaaf8e872..03ed13d27 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,7 +33,8 @@ gulp.task('lint', function() { gulp.task('plugin:create', function(){ if(flags.n && flags.n !== ''){ - return gulp.src('./TEMPLATE') + var src = flags.m?'./TEMPLATE-MIN':'./TEMPLATE'; + return gulp.src() .pipe(replace('PluginName', flags.n)) .pipe(rename(decamelize(flags.n, '-') + '.ts')) .pipe(gulp.dest('./src/plugins/')); From f4acc35cba6538ae22ea1b17ea0f9e173cd08b7f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:02:29 -0400 Subject: [PATCH 078/382] chore(): fix plugin:create --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 03ed13d27..863bcfbf5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,7 +34,7 @@ gulp.task('lint', function() { gulp.task('plugin:create', function(){ if(flags.n && flags.n !== ''){ var src = flags.m?'./TEMPLATE-MIN':'./TEMPLATE'; - return gulp.src() + return gulp.src(src) .pipe(replace('PluginName', flags.n)) .pipe(rename(decamelize(flags.n, '-') + '.ts')) .pipe(gulp.dest('./src/plugins/')); From ad57733dafd324e4cb3996ff35ac26f265869e9d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:15:15 -0400 Subject: [PATCH 079/382] feat(canvas-camera): add CanvasCamera support --- src/index.ts | 3 ++ src/plugins/canvas-camera.ts | 98 ++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/plugins/canvas-camera.ts diff --git a/src/index.ts b/src/index.ts index f00e64be6..3b7fe0779 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,7 @@ import { BLE } from './plugins/ble'; import { BluetoothSerial } from './plugins/bluetoothserial'; import { Calendar } from './plugins/calendar'; import { CallNumber } from './plugins/call-number'; +import { CanvasCamera } from './plugins/canvas-camera'; import { Camera } from './plugins/camera'; import { CameraPreview } from './plugins/camera-preview'; import { CardIO } from './plugins/card-io'; @@ -157,6 +158,7 @@ Brightness, BLE, BluetoothSerial, CallNumber, +CanvasCamera, CameraPreview, Clipboard, CodePush, @@ -225,6 +227,7 @@ window['IonicNative'] = { BluetoothSerial: BluetoothSerial, Calendar: Calendar, CallNumber: CallNumber, + CanvasCamera: CanvasCamera, Camera: Camera, CameraPreview: CameraPreview, CardIO: CardIO, diff --git a/src/plugins/canvas-camera.ts b/src/plugins/canvas-camera.ts new file mode 100644 index 000000000..d5c1cf515 --- /dev/null +++ b/src/plugins/canvas-camera.ts @@ -0,0 +1,98 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name CanvasCamera + * @description + * + * @usage + * ``` + * import {CanvasCamera} from 'ionic-native'; + * + * let object = document.getElementById('myDiv'); + * // or + * @ViewChild('myDiv') object; + * + * CanvasCamera.initialize(object); + * + * CanvasCamera.start(); + * + * CanvasCamera.takePicture().then(picture => { }); + * + * ``` + */ +@Plugin({ + plugin: 'com.keith.cordova.plugin.canvascamera', + pluginRef: 'CanvasCamera', + repo: 'https://github.com/donaldp24/CanvasCameraPlugin' +}) +export class CanvasCamera { + static DestinationType = { + DATA_URL: 0, + FILE_URI: 1 + }; + static PictureSourceType = { + PHOTOLIBRARY : 0, + CAMERA : 1, + SAVEDPHOTOALBUM : 2 + }; + static EncodingType = { + JPEG : 0, + PNG : 1 + }; + static CameraPosition = { + BACK : 0, + FRONT : 1 + }; + static CameraPosition = { + BACK : 1, + FRONT : 2 + }; + static FlashMode = { + OFF : 0, + ON : 1, + AUTO : 2 + }; + /** + * Initialize the Camera + * @param htmlElement {HTMLElement} The HTML Element to preview the camera in + */ + @Cordova({sync: true}) + static initialize(htmlElement: HTMLElement): void { } + + /** + * Start capture video as images from camera to preview camera on web page. + * @param options + */ + @Cordova({sync: true}) + static start(options?: { + quality?: number; + sourceType?: number; + destinationType?: number; + allowEdit?: boolean; + correctOrientation?: boolean; + saveToPhotoAlbum?: boolean; + encodingType?: number; + width?: number; + height?: number; + }): void { } + + /** + * Takes a photo + * @returns {Promise} + */ + @Cordova() + static takePicture(): Promise {return; } + + /** + * Sets the flash mode + * @param flashMode {number} Flash mode, use CanvasCamera.FlashMode constant to set + */ + @Cordova({sync: true}) + static setFlashMode(flashMode: number): void { } + + /** + * Set camera position + * @param cameraPosition {number} Camera Position, use CanvasCamera.CameraPosition constant + */ + @Cordova({sync: true}) + static setCameraPosition(cameraPosition: number): void {} +} From 4e9bc95fffd1c7d3921100d3cfd94ff8da6a29cf Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:35:06 -0400 Subject: [PATCH 080/382] feat(music-controls): add music controls plugin support (#494) --- src/index.ts | 3 + src/plugins/music-controls.ts | 128 ++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 src/plugins/music-controls.ts diff --git a/src/index.ts b/src/index.ts index 3b7fe0779..752babfc2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -70,6 +70,7 @@ import { NativeStorage } from './plugins/nativestorage'; import { Market } from './plugins/market'; import { MediaPlugin } from './plugins/media'; import { Mixpanel } from './plugins/mixpanel'; +import { MusicControls } from './plugins/music-controls'; import { Network } from './plugins/network'; import { NFC } from './plugins/nfc'; import { OneSignal } from './plugins/onesignal'; @@ -181,6 +182,7 @@ InAppPurchase, Insomnia, Instagram, Keyboard, +MusicControls, NativeAudio, NativeStorage, Network, @@ -271,6 +273,7 @@ window['IonicNative'] = { MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, Mixpanel: Mixpanel, + MusicControls: MusicControls, NativeAudio: NativeAudio, NativePageTransitions: NativePageTransitions, NativeStorage: NativeStorage, diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts new file mode 100644 index 000000000..2cdcb40e5 --- /dev/null +++ b/src/plugins/music-controls.ts @@ -0,0 +1,128 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from 'rxjs/Observable'; +/** + * @name MusicControls + * @description + * Music controls for Cordova applications. + * Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play. + * Handle also headset event (plug, unplug, headset button). + * + * @usage + * ``` + * import {MusicControls} from 'ionic-native'; + * + * MusicControls.create({ + * track : 'Time is Running Out', // optional, default : '' + * artist : 'Muse', // optional, default : '' + * cover : 'albums/absolution.jpg', // optional, default : nothing + * // cover can be a local path (use fullpath 'file:///storage/emulated/...', or only 'my_image.jpg' if my_image.jpg is in the www folder of your app) + * // or a remote url ('http://...', 'https://...', 'ftp://...') + * isPlaying : true, // optional, default : true + * dismissable : true, // optional, default : false + * + * // hide previous/next/close buttons: + * hasPrev : false, // show previous button, optional, default: true + * hasNext : false, // show next button, optional, default: true + * hasClose : true, // show close button, optional, default: false + * + * // Android only, optional + * // text displayed in the status bar when the notification (and the ticker) are updated + * ticker : 'Now playing "Time is Running Out"' + * }); + * + * MusicControls.subscribe().subscribe(action => { + * + * switch(action) { + * case 'music-controls-next': + * // Do something + * break; + * case 'music-controls-previous': + * // Do something + * break; + * case 'music-controls-pause': + * // Do something + * break; + * case 'music-controls-play': + * // Do something + * break; + * case 'music-controls-destroy': + * // Do something + * break; + * + * // Headset events (Android only) + * case 'music-controls-media-button' : + * // Do something + * break; + * case 'music-controls-headset-unplugged': + * // Do something + * break; + * case 'music-controls-headset-plugged': + * // Do something + * break; + * default: + * break; + * } + * + * }); + * + * MusicControls.listen(); // activates the observable above + * + * MusicControls.updateIsPlaying(true); + * + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-music-controls', + pluginRef: 'MusicControls', + repo: 'https://github.com/homerours/cordova-music-controls-plugin' +}) +export class MusicControls { + /** + * Create the media controls + * @param options {MusicControlsOptions} + * @returns {Promise} + */ + @Cordova() + static create(options: MusicControlsOptions): Promise {return; } + + /** + * Destroy the media controller + * @returns {Promise} + */ + @Cordova() + static destroy(): Promise {return; } + + /** + * Subscribe to the events of the media controller + * @returns {Observable} + */ + @Cordova({ + observable: true + }) + static subscribe(): Observable {return; } + + /** + * Start listening for events, this enables the Observable from the subscribe method + */ + @Cordova({sync: true}) + static listen(): void {} + + /** + * Toggle play/pause: + * @param isPlaying {boolean} + */ + @Cordova({sync: true}) + static updateIsPlaying(isPlaying: boolean): void {} +} +export interface MusicControlsOptions { + track: string; + artist: string; + cover: string; + isPlaying: boolean; + dismissable: boolean; + hasPrev: boolean; + hasNext: boolean; + hasClose: boolean; + ticker: string; +} From 94a7dae863f703388d493f134895bbc6fdfb0ed8 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:35:12 -0400 Subject: [PATCH 081/382] feat(file-chooser): add file chooser plugin support (#495) --- src/index.ts | 3 +++ src/plugins/file-chooser.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/plugins/file-chooser.ts diff --git a/src/index.ts b/src/index.ts index 752babfc2..c9cc4d563 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,6 +42,7 @@ import { EmailComposer } from './plugins/emailcomposer'; import { EstimoteBeacons } from './plugins/estimote-beacons'; import { Facebook } from './plugins/facebook'; import { File } from './plugins/file'; +import { FileChooser } from './plugins/file-chooser'; import { Transfer } from './plugins/filetransfer'; import { Flashlight } from './plugins/flashlight'; import { Geofence } from './plugins/geofence'; @@ -172,6 +173,7 @@ Diagnostic, EmailComposer, EstimoteBeacons, File, +FileChooser, Flashlight, Geofence, Globalization, @@ -250,6 +252,7 @@ window['IonicNative'] = { EstimoteBeacons: EstimoteBeacons, Facebook: Facebook, File: File, + FileChooser: FileChooser, Flashlight: Flashlight, Geofence: Geofence, Geolocation: Geolocation, diff --git a/src/plugins/file-chooser.ts b/src/plugins/file-chooser.ts new file mode 100644 index 000000000..f3c375003 --- /dev/null +++ b/src/plugins/file-chooser.ts @@ -0,0 +1,30 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name FileChooser + * @description + * + * Opens the file picker on Android for the user to select a file, returns a file URI. + * + * @usage + * ``` + * import {FileChooser} from 'ionic-native'; + * + * FileChooser.open() + * .then(uri => console.log(uri); + * .catch(e => console.log(e); + * + * ``` + */ +@Plugin({ + plugin: 'http://github.com/don/cordova-filechooser.git', + pluginRef: 'fileChooser', + repo: 'https://github.com/don/cordova-filechooser', + platforms: ['Android'] +}) +export class FileChooser { + /** + * Open a file + */ + @Cordova() + static open(): Promise {return; } +} From 0cf7d6aca1df9ebafa45b5dc00acbd7d2fc2d063 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:35:18 -0400 Subject: [PATCH 082/382] feat(youtube): add Youtube video player plugin support (#496) --- src/index.ts | 3 +++ src/plugins/youtube-video-player.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/plugins/youtube-video-player.ts diff --git a/src/index.ts b/src/index.ts index c9cc4d563..aac1fd5ae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -103,6 +103,7 @@ import { Vibration } from './plugins/vibration'; import { VideoEditor } from './plugins/video-editor'; import { VideoPlayer } from './plugins/video-player'; import { WebIntent } from './plugins/webintent'; +import { YoutubeVideoPlayer } from './plugins/youtube-video-player'; import { Zip } from './plugins/zip'; export * from './plugins/3dtouch'; export * from './plugins/background-geolocation'; @@ -207,6 +208,7 @@ Transfer, TextToSpeech, Vibration, WebIntent, +YoutubeVideoPlayer, Zip } @@ -312,6 +314,7 @@ window['IonicNative'] = { VideoPlayer: VideoPlayer, Vibration: Vibration, WebIntent: WebIntent, + YoutubeVideoPlayer: YoutubeVideoPlayer, Zip: Zip }; diff --git a/src/plugins/youtube-video-player.ts b/src/plugins/youtube-video-player.ts new file mode 100644 index 000000000..bf2ac46ff --- /dev/null +++ b/src/plugins/youtube-video-player.ts @@ -0,0 +1,28 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name YoutubeVideoPlayer + * @description + * Plays YouTube videos in Native YouTube App + * + * @usage + * ``` + * import {YoutubeVideoPlayer} from 'ionic-native'; + * + * YouTubeVideoPlayer.openVideo('myvideoid'); + * + * ``` + */ +@Plugin({ + plugin: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git', + pluginRef: 'YoutubeVideoPlayer', + repo: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer', + platforms: ['Android', 'iOS'] +}) +export class YoutubeVideoPlayer { + /** + * Plays a YouTube video + * @param videoId {string} Video ID + */ + @Cordova({sync: true}) + static openVideo(videoId: string): void { } +} From 21d812225725c0d67b39b8e2860bf5e0e246a367 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:43:57 -0400 Subject: [PATCH 083/382] feat(file-opener): add file opener support (#497) closes #295 --- src/index.ts | 3 +++ src/plugins/file-opener.ts | 54 ++++++++++++++++++++++++++++++++++++++ src/plugins/plugin.ts | 5 ++++ 3 files changed, 62 insertions(+) create mode 100644 src/plugins/file-opener.ts diff --git a/src/index.ts b/src/index.ts index aac1fd5ae..090a095cc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,6 +43,7 @@ import { EstimoteBeacons } from './plugins/estimote-beacons'; import { Facebook } from './plugins/facebook'; import { File } from './plugins/file'; import { FileChooser } from './plugins/file-chooser'; +import { FileOpener } from './plugins/file-opener'; import { Transfer } from './plugins/filetransfer'; import { Flashlight } from './plugins/flashlight'; import { Geofence } from './plugins/geofence'; @@ -175,6 +176,7 @@ EmailComposer, EstimoteBeacons, File, FileChooser, +FileOpener, Flashlight, Geofence, Globalization, @@ -255,6 +257,7 @@ window['IonicNative'] = { Facebook: Facebook, File: File, FileChooser: FileChooser, + FileOpener: FileOpener, Flashlight: Flashlight, Geofence: Geofence, Geolocation: Geolocation, diff --git a/src/plugins/file-opener.ts b/src/plugins/file-opener.ts new file mode 100644 index 000000000..b53fb0f08 --- /dev/null +++ b/src/plugins/file-opener.ts @@ -0,0 +1,54 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name FileOpener + * @description + * This plugin will open a file on your device file system with its default application. + * + * @usage + * ``` + * import {FileOpener} from 'ionic-native'; + * + * + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-file-opener2', + pluginRef: 'cordova.plugins.fileOpener2', + repo: 'https://github.com/pwlin/cordova-plugin-file-opener2' +}) +export class FileOpener { + /** + * Open an file + * @param filePath {string} File Path + * @param fileMIMEType {string} File MIME Type + */ + @Cordova({ + callbackStyle: 'object', + successName: 'success', + errorName: 'error' + }) + static open(filePath: string, fileMIMEType: string): Promise {return; } + + /** + * Uninstalls a package + * @param packageId {string} Package ID + */ + @Cordova({ + callbackStyle: 'object', + successName: 'success', + errorName: 'error' + }) + static uninstall(packageId: string): Promise {return; } + + /** + * Check if an app is already installed + * @param packageId {string} Package ID + */ + @Cordova({ + callbackStyle: 'object', + successName: 'success', + errorName: 'error' + }) + static appIsInstalled(packageId: string): Promise {return; } +} diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 0ea2ae7fb..305aa57fc 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -56,6 +56,11 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func resolve(result); } }); + } else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) { + let obj: any = {}; + obj[opts.successName] = resolve; + obj[opts.errorName] = reject; + args.push(obj); } else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') { // If we've specified a success/error index args.splice(opts.successIndex, 0, resolve); From f37a40e13878a72610560ed3b7ed5041a25a4a2f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:46:05 -0400 Subject: [PATCH 084/382] remove duplicate identifier --- src/plugins/canvas-camera.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/canvas-camera.ts b/src/plugins/canvas-camera.ts index d5c1cf515..a5d168b4c 100644 --- a/src/plugins/canvas-camera.ts +++ b/src/plugins/canvas-camera.ts @@ -42,10 +42,6 @@ export class CanvasCamera { BACK : 0, FRONT : 1 }; - static CameraPosition = { - BACK : 1, - FRONT : 2 - }; static FlashMode = { OFF : 0, ON : 1, From f6d5ac46210b449a0e64825fc2c30fa84c55cfb4 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Sat, 27 Aug 2016 20:50:49 +0200 Subject: [PATCH 085/382] fix(GoogleMaps): Fixes #452 (#498) --- 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 a6faa97d2..4f66c0842 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -355,7 +355,7 @@ export class GoogleMap { * @private */ export interface AnimateCameraOptions { - target?: GoogleMapsLatLng; + target?: GoogleMapsLatLng | Array | GoogleMapsLatLngBounds; tilt?: number; zoom?: number; bearing?: number; From e8bfb77b3df00371db2524497ead22d2142e10e5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 15:09:19 -0400 Subject: [PATCH 086/382] 1.3.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7284beb5..b0c46e442 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.19", + "version": "1.3.20", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 9c8321d3b4c6f2bd22662e312a13064aceb8171b Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 15:09:38 -0400 Subject: [PATCH 087/382] chore(): update changelog --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aae3f6e45..5276d2636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ + +## [1.3.20](https://github.com/driftyco/ionic-native/compare/v1.3.19...v1.3.20) (2016-08-27) + + +### Bug Fixes + +* **GoogleMaps:** Fixes [#452](https://github.com/driftyco/ionic-native/issues/452) ([#498](https://github.com/driftyco/ionic-native/issues/498)) ([f6d5ac4](https://github.com/driftyco/ionic-native/commit/f6d5ac4)) + + +### Features + +* **canvas-camera:** add CanvasCamera support ([ad57733](https://github.com/driftyco/ionic-native/commit/ad57733)) +* **file-chooser:** add file chooser plugin support ([#495](https://github.com/driftyco/ionic-native/issues/495)) ([94a7dae](https://github.com/driftyco/ionic-native/commit/94a7dae)) +* **file-opener:** add file opener support ([#497](https://github.com/driftyco/ionic-native/issues/497)) ([21d8122](https://github.com/driftyco/ionic-native/commit/21d8122)), closes [#295](https://github.com/driftyco/ionic-native/issues/295) +* **music-controls:** add music controls plugin support ([#494](https://github.com/driftyco/ionic-native/issues/494)) ([4e9bc95](https://github.com/driftyco/ionic-native/commit/4e9bc95)) +* **youtube:** add Youtube video player plugin support ([#496](https://github.com/driftyco/ionic-native/issues/496)) ([0cf7d6a](https://github.com/driftyco/ionic-native/commit/0cf7d6a)) + + + ## [1.3.19](https://github.com/driftyco/ionic-native/compare/v1.3.18...v1.3.19) (2016-08-27) From 877ac27868d0d96c70a21f352fe9396978d53855 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Sat, 27 Aug 2016 21:20:51 +0200 Subject: [PATCH 088/382] fix(install-instructions): This fixes install instructions for deeplinks, facebook and googlemaps (#499) --- src/plugins/deeplinks.ts | 3 ++- src/plugins/facebook.ts | 2 +- src/plugins/googlemaps.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index c394150ba..9cc043016 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -36,7 +36,8 @@ export interface DeeplinkMatch { plugin: 'ionic-plugin-deeplinks', pluginRef: 'IonicDeeplink', repo: 'https://github.com/driftyco/ionic-plugin-deeplinks', - platforms: ['iOS', 'Android'] + platforms: ['iOS', 'Android'], + install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/' }) export class Deeplinks { diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index f236b0c4f..d6fe83b42 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -81,7 +81,7 @@ import { Cordova, Plugin } from './plugin'; plugin: 'cordova-plugin-facebook4', pluginRef: 'facebookConnectPlugin', repo: 'https://github.com/jeduan/cordova-plugin-facebook4', - install: 'cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"' + install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"' }) export class Facebook { diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 4f66c0842..3b7eb1c33 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -61,7 +61,8 @@ export const GoogleMapsAnimation = { @Plugin({ pluginRef: 'plugin.google.maps.Map', plugin: 'cordova-plugin-googlemaps', - repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps' + repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', + install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"' }) export class GoogleMap { _objectInstance: any; From 9d573a92cec05922ee69db9e6b390a36e973f148 Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 29 Aug 2016 14:59:43 +0200 Subject: [PATCH 089/382] fix(diagnostic): Add DENIED_ALWAYS to permissionStatus, also some code formatting --- src/plugins/diagnostic.ts | 253 +++++++++++++++++++------------------- 1 file changed, 127 insertions(+), 126 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 82b4b5b8f..cd708cd0e 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,4 +1,4 @@ -import {Cordova, Plugin} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Diagnostic @@ -19,7 +19,7 @@ import {Cordova, Plugin} from './plugin'; * * Diagnostic.getBluetoothState() * .then((state) => { - * if(state == Diagnostic.bluetoothStates.POWERED_ON){ + * if (state == Diagnostic.bluetoothStates.POWERED_ON){ * // do something * } else { * // do something else @@ -36,68 +36,69 @@ import {Cordova, Plugin} from './plugin'; export class Diagnostic { static permission = { - 'READ_CALENDAR': 'READ_CALENDAR', - 'WRITE_CALENDAR': 'WRITE_CALENDAR', - 'CAMERA': 'CAMERA', - 'READ_CONTACTS': 'READ_CONTACTS', - 'WRITE_CONTACTS': 'WRITE_CONTACTS', - 'GET_ACCOUNTS': 'GET_ACCOUNTS', - 'ACCESS_FINE_LOCATION': 'ACCESS_FINE_LOCATION', - 'ACCESS_COARSE_LOCATION': 'ACCESS_COARSE_LOCATION', - 'RECORD_AUDIO': 'RECORD_AUDIO', - 'READ_PHONE_STATE': 'READ_PHONE_STATE', - 'CALL_PHONE': 'CALL_PHONE', - 'ADD_VOICEMAIL': 'ADD_VOICEMAIL', - 'USE_SIP': 'USE_SIP', - 'PROCESS_OUTGOING_CALLS': 'PROCESS_OUTGOING_CALLS', - 'READ_CALL_LOG': 'READ_CALL_LOG', - 'WRITE_CALL_LOG': 'WRITE_CALL_LOG', - 'SEND_SMS': 'SEND_SMS', - 'RECEIVE_SMS': 'RECEIVE_SMS', - 'READ_SMS': 'READ_SMS', - 'RECEIVE_WAP_PUSH': 'RECEIVE_WAP_PUSH', - 'RECEIVE_MMS': 'RECEIVE_MMS', - 'WRITE_EXTERNAL_STORAGE': 'WRITE_EXTERNAL_STORAGE', - 'READ_EXTERNAL_STORAGE': 'READ_EXTERNAL_STORAGE', - 'BODY_SENSORS': 'BODY_SENSORS' + READ_CALENDAR: 'READ_CALENDAR', + WRITE_CALENDAR: 'WRITE_CALENDAR', + CAMERA: 'CAMERA', + READ_CONTACTS: 'READ_CONTACTS', + WRITE_CONTACTS: 'WRITE_CONTACTS', + GET_ACCOUNTS: 'GET_ACCOUNTS', + ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION', + ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION', + RECORD_AUDIO: 'RECORD_AUDIO', + READ_PHONE_STATE: 'READ_PHONE_STATE', + CALL_PHONE: 'CALL_PHONE', + ADD_VOICEMAIL: 'ADD_VOICEMAIL', + USE_SIP: 'USE_SIP', + PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS', + READ_CALL_LOG: 'READ_CALL_LOG', + WRITE_CALL_LOG: 'WRITE_CALL_LOG', + SEND_SMS: 'SEND_SMS', + RECEIVE_SMS: 'RECEIVE_SMS', + READ_SMS: 'READ_SMS', + RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH', + RECEIVE_MMS: 'RECEIVE_MMS', + WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE', + READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE', + BODY_SENSORS: 'BODY_SENSORS' }; static permissionStatus = { - 'NOT_REQUESTED': 'not_determined', - 'DENIED': 'denied', - 'RESTRICTED': 'restricted', - 'GRANTED': 'authorized', - 'GRANTED_WHEN_IN_USE': 'authorized_when_in_use' + GRANTED: 'authorized', + GRANTED_WHEN_IN_USE: 'authorized_when_in_use', // iOS + RESTRICTED: 'restricted', // iOS + DENIED: 'denied', + DENIED_ALWAYS: 'denied_always', // android + NOT_REQUESTED: 'not_determined' }; static locationAuthorizationMode = { - 'ALWAYS': 'always', - 'WHEN_IN_USE': 'when_in_use' + ALWAYS: 'always', + WHEN_IN_USE: 'when_in_use' }; static permissionGroups = { - 'GRANTED': 'GRANTED', - 'DENIED': 'DENIED', - 'NOT_REQUESTED': 'NOT_REQUESTED', - 'DENIED_ALWAYS': 'DENIED_ALWAYS' + GRANTED: 'GRANTED', + DENIED: 'DENIED', + NOT_REQUESTED: 'NOT_REQUESTED', + DENIED_ALWAYS: 'DENIED_ALWAYS' }; static locationMode = { - 'HIGH_ACCURACY': 'high_accuracy', - 'DEVICE_ONLY': 'device_only', - 'BATTERY_SAVING': 'battery_saving', - 'LOCATION_OFF': 'location_off' + HIGH_ACCURACY: 'high_accuracy', + DEVICE_ONLY: 'device_only', + BATTERY_SAVING: 'battery_saving', + LOCATION_OFF: 'location_off' }; static bluetoothState = { - 'UNKNOWN': 'unknown', - 'RESETTING': 'resetting', // iOS - 'UNSUPPORTED': 'unsupported', // iOS - 'UNAUTHORIZED': 'unauthorized', // iOS - 'POWERED_OFF': 'powered_off', - 'POWERED_ON': 'powered_on', - 'POWERING_OFF': 'powering_off', - 'POWERING_ON': 'powering_on' + UNKNOWN: 'unknown', + RESETTING: 'resetting', // iOS + UNSUPPORTED: 'unsupported', // iOS + UNAUTHORIZED: 'unauthorized', // iOS + POWERED_OFF: 'powered_off', + POWERED_ON: 'powered_on', + POWERING_OFF: 'powering_off', + POWERING_ON: 'powering_on' }; @@ -135,32 +136,32 @@ export class Diagnostic { /** * Displays the device location settings to allow user to enable location services/change location mode. */ - @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) static switchToLocationSettings(): void { } /** * Displays mobile settings to allow user to enable mobile data. */ - @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) static switchToMobileDataSettings(): void { } /** * Displays Bluetooth settings to allow user to enable Bluetooth. */ - @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) static switchToBluetoothSettings(): void { } /** * Displays WiFi settings to allow user to enable WiFi. */ - @Cordova({sync: true, platforms: ['Android', 'Windows 10']}) + @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) static switchToWifiSettings(): void { } /** * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()` * @returns {Promise} */ - @Cordova({platforms: ['Android', 'Windows 10']}) + @Cordova({ platforms: ['Android', 'Windows 10'] }) static isWifiEnabled(): Promise { return; } /** @@ -168,7 +169,7 @@ export class Diagnostic { * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android * @param state {boolean} */ - @Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']}) + @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) static setWifiState(state: boolean): Promise { return; } /** @@ -176,15 +177,15 @@ export class Diagnostic { * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android * @param state {boolean} */ - @Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']}) + @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) static setBluetoothState(state: boolean): Promise { return; } /** * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) - static isLocationEnabled(): Promise {return; } + @Cordova({ platforms: ['Android', 'iOS'] }) + static isLocationEnabled(): Promise { return; } /** * Checks if the application is authorized to use location. @@ -198,8 +199,8 @@ export class Diagnostic { * Returns the location authorization status for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) - static getLocationAuthorizationStatus(): Promise {return; } + @Cordova({ platforms: ['Android', 'iOS'] }) + static getLocationAuthorizationStatus(): Promise { return; } /** * Returns the location authorization status for the application. @@ -208,14 +209,14 @@ export class Diagnostic { * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static requestLocationAuthorization(mode?: string): Promise { return; } /** * Checks if camera hardware is present on device. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static isCameraPresent(): Promise { return; } /** @@ -223,63 +224,63 @@ export class Diagnostic { * 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. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static isCameraAuthorized(): Promise { return; } /** * Returns the camera authorization status for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static getCameraAuthorizationStatus(): Promise { return; } /** * Requests camera authorization for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static requestCameraAuthorization(): Promise { return; } /** * Checks if the application is authorized to use the microphone. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static isMicrophoneAuthorized(): Promise { return; } /** * Returns the microphone authorization status for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static getMicrophoneAuthorizationStatus(): Promise { return; } /** * Requests microphone authorization for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static requestMicrophoneAuthorization(): Promise { return; } /** * Checks if the application is authorized to use contacts (address book). * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static isContactsAuthorized(): Promise { return; } /** * Returns the contacts authorization status for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static getContactsAuthroizationStatus(): Promise { return; } /** * Requests contacts authorization for the application. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static requestContactsAuthorization(): Promise { return; } /** @@ -292,7 +293,7 @@ export class Diagnostic { * - This relates to Calendar Events (not Calendar Reminders) * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static isCalendarAuthorized(): Promise { return; } /** @@ -306,7 +307,7 @@ export class Diagnostic { * * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static getCalendarAuthorizationStatus(): Promise { return; } /** @@ -323,7 +324,7 @@ export class Diagnostic { * * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) + @Cordova({ platforms: ['Android', 'iOS'] }) static requestCalendarAuthorization(): Promise { return; } /** @@ -332,28 +333,28 @@ export class Diagnostic { * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) - static switchToSettings(): Promise {return; } + @Cordova({ platforms: ['Android', 'iOS'] }) + static switchToSettings(): Promise { return; } /** * Returns the state of Bluetooth on the device. * @returns {Promise} */ - @Cordova({platforms: ['Android', 'iOS']}) - static getBluetoothState(): Promise {return; } + @Cordova({ platforms: ['Android', 'iOS'] }) + static getBluetoothState(): Promise { return; } /** * Registers a function to be called when a change in Bluetooth state occurs. * @param handler */ - @Cordova({platforms: ['Android', 'iOS'], sync: true}) + @Cordova({ platforms: ['Android', 'iOS'], sync: true }) static registerBluetoothStateChangeHandler(handler: Function): void { } /** * Registers a function to be called when a change in Location state occurs. * @param handler */ - @Cordova({platforms: ['Android', 'iOS'], sync: true}) + @Cordova({ platforms: ['Android', 'iOS'], sync: true }) static registerLocationStateChangeHandler(handler: Function): void { } /** @@ -361,8 +362,8 @@ export class Diagnostic { * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static isGpsLocationAvailable(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static isGpsLocationAvailable(): Promise { return; } /** * Checks if location mode is set to return high-accuracy locations from GPS hardware. @@ -370,7 +371,7 @@ export class Diagnostic { * - Device only = GPS hardware only (high accuracy) * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) */ - @Cordova({platforms: ['Android']}) + @Cordova({ platforms: ['Android'] }) static isGpsLocationEnabled(): Promise { return; } /** @@ -378,8 +379,8 @@ export class Diagnostic { * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location. * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static isNetworkLocationAvailable(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static isNetworkLocationAvailable(): Promise { return; } /** * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points. @@ -388,15 +389,15 @@ export class Diagnostic { * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) * @returns {Promise} */ - @Cordova({platforms: ['Android']}) + @Cordova({ platforms: ['Android'] }) static isNetworkLocationEnabled(): Promise { return; } /** * Returns the current location mode setting for the device. * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static getLocationMode(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static getLocationMode(): Promise { return; } /** * Returns the current authorisation status for a given permission. @@ -404,8 +405,8 @@ export class Diagnostic { * @param permission * @returns {Promise} */ - @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) - static getPermissionAuthorizationStatus(permission: any): Promise {return; } + @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) + static getPermissionAuthorizationStatus(permission: any): Promise { return; } /** * Returns the current authorisation status for multiple permissions. @@ -413,8 +414,8 @@ export class Diagnostic { * @param permissions * @returns {Promise} */ - @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) - static getPermissionsAuthorizationStatus(permissions: any[]): Promise {return; } + @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) + static getPermissionsAuthorizationStatus(permissions: any[]): Promise { return; } /** * Requests app to be granted authorisation for a runtime permission. @@ -422,8 +423,8 @@ export class Diagnostic { * @param permission * @returns {Promise} */ - @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) - static requestRuntimePermission(permission: any): Promise {return; } + @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) + static requestRuntimePermission(permission: any): Promise { return; } /** * Requests app to be granted authorisation for multiple runtime permissions. @@ -431,51 +432,51 @@ export class Diagnostic { * @param permissions * @returns {Promise} */ - @Cordova({platforms: ['Android'], callbackOrder: 'reverse'}) - static requestRuntimePermissions(permissions: any[]): Promise {return; } + @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) + static requestRuntimePermissions(permissions: any[]): Promise { return; } /** * Checks if the device setting for Bluetooth is switched on. * This requires `BLUETOOTH` permission on Android * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static isBluetoothEnabled(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static isBluetoothEnabled(): Promise { return; } /** * Checks if the device has Bluetooth capabilities. * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static hasBluetoothSupport(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static hasBluetoothSupport(): Promise { return; } /** * Checks if the device has Bluetooth Low Energy (LE) capabilities. * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static hasBluetoothLESupport(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static hasBluetoothLESupport(): Promise { return; } /** * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. * @returns {Promise} */ - @Cordova({platforms: ['Android']}) - static hasBluetoothLEPeripheralSupport(): Promise {return; } + @Cordova({ platforms: ['Android'] }) + static hasBluetoothLEPeripheralSupport(): Promise { return; } /** * Checks if the application is authorized to use the Camera Roll in Photos app. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static isCameraRollAuthorized(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static isCameraRollAuthorized(): Promise { return; } /** * Returns the authorization status for the application to use the Camera Roll in Photos app. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static getCameraRollAuthorizationStatus(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static getCameraRollAuthorizationStatus(): Promise { return; } /** * Requests camera roll authorization for the application. @@ -483,64 +484,64 @@ export class Diagnostic { * Calling it when in any other state will have no effect. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static requestCameraRollAuthorization(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static requestCameraRollAuthorization(): Promise { return; } /** * Checks if remote (push) notifications are enabled. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static isRemoteNotificationsEnabled(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static isRemoteNotificationsEnabled(): Promise { return; } /** * Indicates if the app is registered for remote (push) notifications on the device. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static isRegisteredForRemoteNotifications(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static isRegisteredForRemoteNotifications(): Promise { return; } /** * Indicates the current setting of notification types for the app in the Settings app. * Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static getRemoteNotificationTypes(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static getRemoteNotificationTypes(): Promise { return; } /** * Checks if the application is authorized to use reminders. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static isRemindersAuthorized(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static isRemindersAuthorized(): Promise { return; } /** * Returns the reminders authorization status for the application. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static getRemindersAuthorizationStatus(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static getRemindersAuthorizationStatus(): Promise { return; } /** * Requests reminders authorization for the application. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static requestRemindersAuthorization(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static requestRemindersAuthorization(): Promise { return; } /** * Checks if the application is authorized for background refresh. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static isBackgroundRefreshAuthorized(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static isBackgroundRefreshAuthorized(): Promise { return; } /** * Returns the background refresh authorization status for the application. * @returns {Promise} */ - @Cordova({platforms: ['iOS']}) - static getBackgroundRefreshStatus(): Promise {return; } + @Cordova({ platforms: ['iOS'] }) + static getBackgroundRefreshStatus(): Promise { return; } } From cb176aae90fb3d5caea3d7cc43bb089c0fb7d5b7 Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 29 Aug 2016 16:50:28 +0200 Subject: [PATCH 090/382] fix(diagnostic): Fix diagnostic objects --- src/plugins/diagnostic.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index cd708cd0e..97a10331b 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -63,24 +63,29 @@ export class Diagnostic { }; static permissionStatus = { - GRANTED: 'authorized', - GRANTED_WHEN_IN_USE: 'authorized_when_in_use', // iOS - RESTRICTED: 'restricted', // iOS - DENIED: 'denied', - DENIED_ALWAYS: 'denied_always', // android + GRANTED: 'GRANTED', + GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS + RESTRICTED: 'RESTRICTED', // iOS + DENIED: 'DENIED', + DENIED_ALWAYS: 'NOT_REQUESTED', // android NOT_REQUESTED: 'not_determined' }; static locationAuthorizationMode = { - ALWAYS: 'always', - WHEN_IN_USE: 'when_in_use' + ALWAYS: 'ALWAYS', + WHEN_IN_USE: 'WHEN_IN_USE' }; static permissionGroups = { - GRANTED: 'GRANTED', - DENIED: 'DENIED', - NOT_REQUESTED: 'NOT_REQUESTED', - DENIED_ALWAYS: 'DENIED_ALWAYS' + CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'], + CAMERA: ['CAMERA'], + CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'], + LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'], + MICROPHONE: ['RECORD_AUDIO'], + PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'], + SENSEORS: ['BODY_SENSORS'], + SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'], + STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE'] }; static locationMode = { From 51364f8edde821164778a525415258e5b4227527 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Mon, 29 Aug 2016 16:58:00 +0200 Subject: [PATCH 091/382] fix(mixpanel): Make eventProperties optional (#501) * fix(mixpanel): Make eventProperties optional * style(mixpanel): Match editorconfig --- src/plugins/mixpanel.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index 256e1334a..f57303a8f 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -1,5 +1,8 @@ -import {Plugin, Cordova, CordovaProperty} from './plugin'; +import { Cordova, CordovaProperty, Plugin } from './plugin'; + declare var mixpanel: any; + + /** * @name Mixpanel * @description @@ -28,20 +31,20 @@ export class Mixpanel { * @returns {Promise} */ @Cordova() - static alias(aliasId: string, originalId: string): Promise {return; } + static alias(aliasId: string, originalId: string): Promise { return; } /** * * @returns {Promise} */ @Cordova() - static distinctId(): Promise {return; } + static distinctId(): Promise { return; } /** * */ @Cordova() - static flush(): Promise {return; } + static flush(): Promise { return; } /** * @@ -49,7 +52,7 @@ export class Mixpanel { * @returns {Promise} */ @Cordova() - static identify(distinctId): Promise {return; } + static identify(distinctId): Promise { return; } /** * @@ -57,7 +60,7 @@ export class Mixpanel { * @returns {Promise} */ @Cordova() - static init(token: string): Promise {return; } + static init(token: string): Promise { return; } /** * @@ -65,14 +68,14 @@ export class Mixpanel { * @returns {Promise} */ @Cordova() - static registerSuperProperties(superProperties: any): Promise {return; } + static registerSuperProperties(superProperties: any): Promise { return; } /** * * @returns {Promise} */ @Cordova() - static reset(): Promise {return; } + static reset(): Promise { return; } /** * @@ -80,21 +83,21 @@ export class Mixpanel { * @param eventProperties */ @Cordova() - static track(eventName: string, eventProperties: any): Promise {return; } + static track(eventName: string, eventProperties?: any): Promise { return; } /** * * @returns {Promise} */ @Cordova() - static showSurvey(): Promise {return; } + static showSurvey(): Promise { return; } /** * * @returns {MixpanelPeople} */ @CordovaProperty - static get people(): MixpanelPeople {return mixpanel.people; }; + static get people(): MixpanelPeople { return mixpanel.people; }; } /** From 8f3d36f4bc701623f649ab52b4bbd16ba171b9d5 Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 29 Aug 2016 16:58:58 +0200 Subject: [PATCH 092/382] fix(diagnostic): Fix permissionStatus object --- src/plugins/diagnostic.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 97a10331b..11a157136 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -67,8 +67,8 @@ export class Diagnostic { GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE', // iOS RESTRICTED: 'RESTRICTED', // iOS DENIED: 'DENIED', - DENIED_ALWAYS: 'NOT_REQUESTED', // android - NOT_REQUESTED: 'not_determined' + DENIED_ALWAYS: 'DENIED_ALWAYS', // android + NOT_REQUESTED: 'NOT_REQUESTED' }; static locationAuthorizationMode = { From f93f958d66c363360b6fb813d09e638684c3761f Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 29 Aug 2016 23:18:24 +0200 Subject: [PATCH 093/382] fix(diagnostic): Fix typo --- src/plugins/diagnostic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 11a157136..d2ee0519c 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -83,7 +83,7 @@ export class Diagnostic { LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'], MICROPHONE: ['RECORD_AUDIO'], PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'], - SENSEORS: ['BODY_SENSORS'], + SENSORS: ['BODY_SENSORS'], SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'], STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE'] }; From ea36333497161ab55118f4e0a1c578043b32f9e2 Mon Sep 17 00:00:00 2001 From: Ramon Ornelas Date: Tue, 30 Aug 2016 14:29:17 -0300 Subject: [PATCH 094/382] docs(contacts): add docs basic create() --- src/plugins/contacts.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index ee5335c4d..71ab50df9 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -277,6 +277,10 @@ export class ContactFindOptions implements IContactFindOptions { repo: 'https://github.com/apache/cordova-plugin-contacts' }) export class Contacts { + /** + * Create a single contact. + * @return Returns a object Contact + */ static create(): Contact { return new Contact(); } From e34c25b49006d9c64d75616eee8d62ee1e8b15f2 Mon Sep 17 00:00:00 2001 From: Ramon Ornelas Date: Tue, 30 Aug 2016 14:45:52 -0300 Subject: [PATCH 095/382] docs(file): fix methods private exposed --- src/plugins/file.ts | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index a2ef0a45d..50044db2e 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -950,11 +950,16 @@ export class File { // these private methods help avoid cascading error handling // in the public ones, primarily simply wrapping callback // operations to return Promises that can then be chained. - + /** + * @private + */ private static fillErrorMessage(err: FileError): void { err.message = File.cordovaFileError[err.code]; } + /** + * @private + */ private static resolveLocalFilesystemUrl(furl: string): Promise { return new Promise((resolve, reject) => { try { @@ -971,6 +976,9 @@ export class File { }); } + /** + * @private + */ private static resolveDirectoryUrl(durl: string): Promise { return File.resolveLocalFilesystemUrl(durl) .then((de) => { @@ -984,6 +992,9 @@ export class File { }); } + /** + * @private + */ private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { @@ -1000,6 +1011,9 @@ export class File { }); } + /** + * @private + */ private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { @@ -1016,6 +1030,9 @@ export class File { }); } + /** + * @private + */ private static remove(fe: Entry): Promise { return new Promise((resolve, reject) => { fe.remove(() => { @@ -1027,6 +1044,9 @@ export class File { }); } + /** + * @private + */ private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { return new Promise((resolve, reject) => { srce.moveTo(destdir, newName, (deste) => { @@ -1038,6 +1058,9 @@ export class File { }); } + /** + * @private + */ private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { return new Promise((resolve, reject) => { srce.copyTo(destdir, newName, (deste) => { @@ -1049,6 +1072,9 @@ export class File { }); } + /** + * @private + */ private static readEntries(dr: DirectoryReader): Promise { return new Promise((resolve, reject) => { dr.readEntries((entries) => { @@ -1060,6 +1086,9 @@ export class File { }); } + /** + * @private + */ private static rimraf(de: DirectoryEntry): Promise { return new Promise((resolve, reject) => { de.removeRecursively(() => { @@ -1071,6 +1100,9 @@ export class File { }); } + /** + * @private + */ private static createWriter(fe: FileEntry): Promise { return new Promise((resolve, reject) => { fe.createWriter((writer) => { @@ -1082,6 +1114,9 @@ export class File { }); } + /** + * @private + */ private static write(writer: FileWriter, gu: string | Blob): Promise { return new Promise((resolve, reject) => { writer.onwriteend = (evt) => { From 3917a3f7b974d394f43115652fdff83303b4162a Mon Sep 17 00:00:00 2001 From: Dominique Rau Date: Wed, 31 Aug 2016 22:59:41 +0200 Subject: [PATCH 096/382] docs(tts): fix plugin name (#514) --- src/plugins/text-to-speech.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/text-to-speech.ts b/src/plugins/text-to-speech.ts index 420b96018..41a16025e 100644 --- a/src/plugins/text-to-speech.ts +++ b/src/plugins/text-to-speech.ts @@ -10,15 +10,15 @@ export interface TTSOptions { } /** - * @name TTS + * @name TextToSpeech * @description * Text to Speech plugin * * @usage * ``` - * import {TTS} from 'ionic-native'; + * import {TextToSpeech} from 'ionic-native'; * - * TTS.speak('Hello World') + * TextToSpeech.speak('Hello World') * .then(() => console.log('Success')) * .catch((reason: any) => console.log(reason)); * From 1db13742260c18ceff79c12852fb16fdc8b22492 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 31 Aug 2016 18:01:50 -0300 Subject: [PATCH 097/382] fix(base64togallery): fixes callbacks (#513) --- src/plugins/base64togallery.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index 6e5f63365..61d55dca1 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -27,7 +27,10 @@ export class Base64ToGallery { * @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS. * @returns {Promise} returns a promise that resolves when the image is saved. */ - @Cordova() + @Cordova({ + successIndex: 2, + errorIndex: 3 + }) static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise { return; } From 54460e23626ea625ca156ea9cf1d4b37d58e519f Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 31 Aug 2016 18:02:15 -0300 Subject: [PATCH 098/382] style(): fix angular styles (#512) * style(canva-camera): fix angular style * style(crop): fix angular style * style(file-chooser): fix angular style * style(file-opener): fix angular style * style(file): fix angular style * style(inappbrowser): fix angular style * style(instagram): fix angular style * style(is-debug): fix angular style * style(native-page-transitions): fix angular style * style(market): fix angular style * style(music-controls): fix angular style * style(nfc): fix angular style * style(pay-pal): fix angular style * style(power-management): fix angular style * style(securestorage): fix angular style * style(streaming-media): fix angular style * style(video-editor): fix angular style * style(youtube-video-player): fix angular style --- src/plugins/canvas-camera.ts | 4 ++-- src/plugins/crop.ts | 4 ++-- src/plugins/file-chooser.ts | 4 ++-- src/plugins/file-opener.ts | 2 +- src/plugins/file.ts | 3 ++- src/plugins/inappbrowser.ts | 1 + src/plugins/instagram.ts | 2 +- src/plugins/is-debug.ts | 2 +- src/plugins/market.ts | 2 +- src/plugins/music-controls.ts | 4 ++-- src/plugins/native-page-transitions.ts | 12 ++++++------ src/plugins/nfc.ts | 4 ++-- src/plugins/pay-pal.ts | 2 +- src/plugins/power-management.ts | 2 +- src/plugins/securestorage.ts | 1 + src/plugins/streaming-media.ts | 2 +- src/plugins/video-editor.ts | 2 +- src/plugins/youtube-video-player.ts | 2 +- 18 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/plugins/canvas-camera.ts b/src/plugins/canvas-camera.ts index a5d168b4c..972a1195d 100644 --- a/src/plugins/canvas-camera.ts +++ b/src/plugins/canvas-camera.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name CanvasCamera * @description @@ -76,7 +76,7 @@ export class CanvasCamera { * @returns {Promise} */ @Cordova() - static takePicture(): Promise {return; } + static takePicture(): Promise { return; } /** * Sets the flash mode diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts index 92f42d000..29f89554a 100644 --- a/src/plugins/crop.ts +++ b/src/plugins/crop.ts @@ -1,4 +1,4 @@ -import {Cordova, Plugin} from './plugin'; +import { Cordova, Plugin } from './plugin'; /** * @name Crop * @description Crops images @@ -30,5 +30,5 @@ export class Crop { @Cordova({ callbackOrder: 'reverse' }) - static crop(pathToImage: string, options?: {quality: number}): Promise {return; } + static crop(pathToImage: string, options?: {quality: number}): Promise { return; } } diff --git a/src/plugins/file-chooser.ts b/src/plugins/file-chooser.ts index f3c375003..3f1066d91 100644 --- a/src/plugins/file-chooser.ts +++ b/src/plugins/file-chooser.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name FileChooser * @description @@ -26,5 +26,5 @@ export class FileChooser { * Open a file */ @Cordova() - static open(): Promise {return; } + static open(): Promise { return; } } diff --git a/src/plugins/file-opener.ts b/src/plugins/file-opener.ts index b53fb0f08..638e36358 100644 --- a/src/plugins/file-opener.ts +++ b/src/plugins/file-opener.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name FileOpener * @description diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 50044db2e..7c2fd28a6 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1,4 +1,5 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; + declare var window: any; declare var cordova: any; diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index 0dccb7530..b088c9b58 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -1,5 +1,6 @@ import { Plugin, CordovaInstance } from './plugin'; import { Observable } from 'rxjs/Observable'; + declare var cordova: any; export interface InAppBrowserEvent extends Event { diff --git a/src/plugins/instagram.ts b/src/plugins/instagram.ts index 743d979a6..9334a7255 100644 --- a/src/plugins/instagram.ts +++ b/src/plugins/instagram.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name Instagram diff --git a/src/plugins/is-debug.ts b/src/plugins/is-debug.ts index af478722d..c842a3c15 100644 --- a/src/plugins/is-debug.ts +++ b/src/plugins/is-debug.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name IsDebug diff --git a/src/plugins/market.ts b/src/plugins/market.ts index 740de6cea..edb97697b 100644 --- a/src/plugins/market.ts +++ b/src/plugins/market.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name Market * @description diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts index 2cdcb40e5..c091af332 100644 --- a/src/plugins/music-controls.ts +++ b/src/plugins/music-controls.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Plugin, Cordova } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name MusicControls * @description diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts index b35f72636..ef66f9c23 100644 --- a/src/plugins/native-page-transitions.ts +++ b/src/plugins/native-page-transitions.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name NativePageTransitions * @description @@ -38,21 +38,21 @@ export class NativePageTransitions { * @param options {TransitionOptions} Options for the transition */ @Cordova() - static slide(options: TransitionOptions): Promise {return; } + static slide(options: TransitionOptions): Promise { return; } /** * Perform a flip animation * @param options {TransitionOptions} Options for the transition */ @Cordova() - static flip(options: TransitionOptions): Promise {return; } + static flip(options: TransitionOptions): Promise { return; } /** * Perform a fade animation * @param options {TransitionOptions} Options for the transition */ @Cordova({platforms: ['iOS', 'Android']}) - static fade(options: TransitionOptions): Promise {return; } + static fade(options: TransitionOptions): Promise { return; } /** @@ -60,7 +60,7 @@ export class NativePageTransitions { * @param options {TransitionOptions} Options for the transition */ @Cordova({platforms: ['iOS', 'Android']}) - static drawer(options: TransitionOptions): Promise {return; } + static drawer(options: TransitionOptions): Promise { return; } @@ -69,7 +69,7 @@ export class NativePageTransitions { * @param options {TransitionOptions} Options for the transition */ @Cordova({platforms: ['iOS']}) - static curl(options: TransitionOptions): Promise {return; } + static curl(options: TransitionOptions): Promise { return; } } diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 809dea96e..1159b97a9 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -1,5 +1,5 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Plugin, Cordova } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name NFC * @description diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 810ea39d6..32c70fe8b 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name PayPal * @description diff --git a/src/plugins/power-management.ts b/src/plugins/power-management.ts index 860733998..5d9e1d6d9 100644 --- a/src/plugins/power-management.ts +++ b/src/plugins/power-management.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name PowerManagement * @description diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts index 7344bd39b..09c766a8a 100644 --- a/src/plugins/securestorage.ts +++ b/src/plugins/securestorage.ts @@ -1,4 +1,5 @@ import { CordovaInstance, Plugin } from './plugin'; + declare var cordova: any; /** * @name Secure Storage diff --git a/src/plugins/streaming-media.ts b/src/plugins/streaming-media.ts index 3fb176e62..86cdf26be 100644 --- a/src/plugins/streaming-media.ts +++ b/src/plugins/streaming-media.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name StreamingMedia * @description diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts index 92e59d734..17a1ea9d9 100644 --- a/src/plugins/video-editor.ts +++ b/src/plugins/video-editor.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; export interface TranscodeOptions { diff --git a/src/plugins/youtube-video-player.ts b/src/plugins/youtube-video-player.ts index bf2ac46ff..27511bfba 100644 --- a/src/plugins/youtube-video-player.ts +++ b/src/plugins/youtube-video-player.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name YoutubeVideoPlayer * @description From 2f706deb26be2770d8d4cf3f13e152a9cd3c156e Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Thu, 1 Sep 2016 02:32:14 -0300 Subject: [PATCH 099/382] style(): fix Angular style TEMPLATE (#517) * style(TEMPLATE): fix angular style * docs(TEMPLATE): fix angular style docs template --- TEMPLATE | 6 +++--- TEMPLATE-MIN | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TEMPLATE b/TEMPLATE index 4b8667d0b..b80894b4b 100644 --- a/TEMPLATE +++ b/TEMPLATE @@ -10,8 +10,8 @@ * - Remove this note * */ -import {Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty } from './plugin'; +import { Observable } from 'rxjs/Observable'; /** * @name PluginName @@ -20,7 +20,7 @@ import {Observable} from 'rxjs/Observable'; * * @usage * ``` - * import {PluginName} from 'ionic-native'; + * import { PluginName } from 'ionic-native'; * * PluginName.functionName('Hello', 123) * .then((something: any) => doSomething(something)) diff --git a/TEMPLATE-MIN b/TEMPLATE-MIN index 052eac55b..733c35cd2 100644 --- a/TEMPLATE-MIN +++ b/TEMPLATE-MIN @@ -1,11 +1,11 @@ -import {Plugin} from './plugin'; +import { Plugin } from './plugin'; /** * @name PluginName * @description * * @usage * ``` - * import {PluginName} from 'ionic-native'; + * import { PluginName } from 'ionic-native'; * * * ``` From 2dc68a4785b7d9218a0d5bb936efd35cbb554e1b Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 1 Sep 2016 13:37:43 -0500 Subject: [PATCH 100/382] fix(ng1): grab injector from app. #451 --- src/plugins/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 305aa57fc..e0eaa1587 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -108,7 +108,7 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts function getPromise(cb) { if (window.angular) { - let $q = window.angular.injector(['ng']).get('$q'); + let $q = window.angular.element(document.body).injector().get('$q'); return $q((resolve, reject) => { cb(resolve, reject); }); From d135dc26e2a710daa4a692a769ba68f1392331b2 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Fri, 2 Sep 2016 18:16:57 +0100 Subject: [PATCH 101/382] fix(ng1): fail gracefully when angular 1 promises can't be retrieved --- src/plugins/plugin.ts | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index e0eaa1587..a0085fab2 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -107,17 +107,30 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts } function getPromise(cb) { + + const tryNativePromise = () => { + 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.'); + } + }; + if (window.angular) { - let $q = window.angular.element(document.body).injector().get('$q'); - return $q((resolve, reject) => { - cb(resolve, reject); - }); - } else if (window.Promise) { - return new Promise((resolve, reject) => { - cb(resolve, reject); - }); + let injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector(); + if (injector) { + let $q = injector.get('$q'); + return $q((resolve, reject) => { + cb(resolve, reject); + }); + } else { + console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.'); + return tryNativePromise(); + } } 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.'); + return tryNativePromise(); } } From d5513db9bb60b1f262a519b4c40b158c1ab0608c Mon Sep 17 00:00:00 2001 From: mhartington Date: Tue, 6 Sep 2016 15:48:53 -0400 Subject: [PATCH 102/382] doc(media): improve docs --- src/plugins/media.ts | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index cd939f084..23cb9ce63 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -77,16 +77,43 @@ export interface MediaError { export class MediaPlugin { // Constants + /** + * @private + */ static MEDIA_NONE: number = 0; + /** + * @private + */ static MEDIA_STARTING: number = 1; + /** + * @private + */ static MEDIA_RUNNING: number = 2; + /** + * @private + */ static MEDIA_PAUSED: number = 3; + /** + * @private + */ static MEDIA_STOPPED: number = 4; // error codes + /** + * @private + */ static MEDIA_ERR_ABORTED: number = 1; + /** + * @private + */ static MEDIA_ERR_NETWORK: number = 2; + /** + * @private + */ static MEDIA_ERR_DECODE: number = 3; + /** + * @private + */ static MEDIA_ERR_NONE_SUPPORTED: number = 4; // Properties @@ -109,19 +136,22 @@ export class MediaPlugin { } /** - * Returns the current amplitude of the current recording. + * Get the current amplitude of the current recording. + * @returns {Promise} Returns a promise with the amplitude of the current recording */ @CordovaInstance() getCurrentAmplitude(): Promise { return; } /** - * Returns the current position within an audio file. Also updates the Media object's position parameter. + * Get the current position within an audio file. Also updates the Media object's position parameter. + * @returns {Promise} Returns a promise with the position of the current recording */ @CordovaInstance() getCurrentPosition(): Promise { return; } /** - * Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. + * Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. + * @returns {Promise} Returns a promise with the duration of the current recording */ @CordovaInstance({ sync: true @@ -157,7 +187,7 @@ export class MediaPlugin { /** * Sets the current position within an audio file. - * @param milliseconds + * @param {number} milliseconds The time position you want to set for the current audio file */ @CordovaInstance({ sync: true From 1facde3966ea8e7e5d4994c9f4f5779e2d9aad47 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Wed, 7 Sep 2016 02:42:29 +0100 Subject: [PATCH 103/382] test(): add initial test suite (#523) --- circle.yml | 2 +- karma.conf.ts | 60 ++++ package.json | 14 +- src/ng1.ts | 5 +- src/plugins/plugin.ts | 2 - test/plugin.spec.ts | 141 ++++++++ tsconfig.json | 3 +- typings.json | 5 + typings/globals/jasmine/index.d.ts | 502 +++++++++++++++++++++++++++ typings/globals/jasmine/typings.json | 8 + typings/index.d.ts | 1 + 11 files changed, 735 insertions(+), 8 deletions(-) create mode 100644 karma.conf.ts create mode 100644 test/plugin.spec.ts create mode 100644 typings.json create mode 100644 typings/globals/jasmine/index.d.ts create mode 100644 typings/globals/jasmine/typings.json create mode 100644 typings/index.d.ts diff --git a/circle.yml b/circle.yml index 599249d25..331652216 100644 --- a/circle.yml +++ b/circle.yml @@ -17,7 +17,7 @@ dependencies: test: override: - - echo "No tests are written at the moment. But we will attempt to build the library with the latest changes." + - npm test - npm run build deployment: diff --git a/karma.conf.ts b/karma.conf.ts new file mode 100644 index 000000000..da215d038 --- /dev/null +++ b/karma.conf.ts @@ -0,0 +1,60 @@ +const WATCH = process.argv.indexOf('--watch') > -1; + +module.exports = config => { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: './', + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine', 'browserify'], + + // list of files / patterns to load in the browser + files: [ + 'test/**/*.spec.ts' + ], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + 'test/**/*.spec.ts': ['browserify'] + }, + + browserify: { + plugin: [ 'tsify' ], + extensions: ['.js', '.ts'] + }, + + phantomjsLauncher: { + // Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom) + exitOnResourceError: true + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['dots'], + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: WATCH, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: !WATCH + }); +}; diff --git a/package.json b/package.json index b0c46e442..feac39459 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "decamelize": "^1.2.0", "dgeni": "^0.4.2", "dgeni-packages": "^0.10.18", + "es6-shim": "~0.35.1", "glob": "^6.0.4", "gulp": "^3.9.1", "gulp-rename": "^1.2.2", @@ -26,18 +27,27 @@ "gulp-tslint": "^5.0.0", "gulp-uglify": "^1.5.4", "ionic-gulp-tslint": "^1.0.0", + "jasmine-core": "~2.5.0", + "karma": "~1.2.0", + "karma-browserify": "~5.1.0", + "karma-jasmine": "~1.0.2", + "karma-phantomjs-launcher": "~1.0.2", "lodash": "3.10.1", "minimist": "^1.1.3", "mkdirp": "^0.5.1", "node-html-encoder": "0.0.2", "q": "1.4.1", "semver": "^5.0.1", + "tsify": "~1.0.4", "tslint": "^3.8.1", "tslint-ionic-rules": "0.0.5", - "typescript": "^1.8.10" + "typescript": "^1.8.10", + "watchify": "~3.7.0" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "karma start", + "test:watch": "npm test -- --watch", + "start": "npm run test:watch", "lint": "./node_modules/.bin/gulp lint", "watch": "./node_modules/.bin/tsc -w", "build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify", diff --git a/src/ng1.ts b/src/ng1.ts index 384bd02f8..615b3f6ae 100644 --- a/src/ng1.ts +++ b/src/ng1.ts @@ -7,14 +7,15 @@ declare var window; */ export function initAngular1(plugins) { if (window.angular) { - window.angular.module('ionic.native', []); + + const ngModule = window.angular.module('ionic.native', []); for (var name in plugins) { let serviceName = '$cordova' + name; let cls = plugins[name]; (function(serviceName, cls, name) { - window.angular.module('ionic.native').service(serviceName, [function() { + ngModule.service(serviceName, [function() { var funcs = window.angular.copy(cls); funcs.prototype['name'] = name; return funcs; diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index e0eaa1587..810c9fcc2 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -3,8 +3,6 @@ import { Observable } from 'rxjs/Observable'; declare var window; declare var Promise; -declare var $q; - /** * @private diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts new file mode 100644 index 000000000..3fd61f159 --- /dev/null +++ b/test/plugin.spec.ts @@ -0,0 +1,141 @@ +/// + +import 'es6-shim'; +import {Plugin, Cordova} from './../src/plugins/plugin'; + +declare const window: any; +window.plugins = { + test: {} +}; + +const testPluginMeta = { + plugin: 'cordova-plugin-test', + pluginRef: 'plugins.test', + repo: 'https://github.com/apache/cordova-plugin-test', + platforms: ['Android', 'iOS'] +}; + +describe('plugin', () => { + + it('sync method', () => { + + window.plugins.test.syncMethod = () => { + return 'syncResult'; + }; + + @Plugin(testPluginMeta) + class Test { + + @Cordova({ + sync: true + }) + static syncMethod(arg: any): boolean { return; }; + + } + + const spy = spyOn(window.plugins.test, 'syncMethod').and.callThrough(); + const result = Test.syncMethod('foo'); + expect(result).toEqual('syncResult'); + expect(spy).toHaveBeenCalledWith('foo', undefined, undefined); + + }); + + it('normal order callback', done => { + + window.plugins.test.normalOrderCallback = (args, success, error) => { + success('normalOrderCallback'); + }; + + @Plugin(testPluginMeta) + class Test { + @Cordova() + static normalOrderCallback(args: any): Promise { return; } + } + + const spy = spyOn(window.plugins.test, 'normalOrderCallback').and.callThrough(); + Test.normalOrderCallback('foo').then(result => { + expect(result).toEqual('normalOrderCallback'); + done(); + }); + expect(spy.calls.mostRecent().args[0]).toEqual('foo'); + + }); + + it('reverse order callback', done => { + + window.plugins.test.reverseOrderCallback = (success, error, args) => { + success('reverseOrderCallback'); + }; + + @Plugin(testPluginMeta) + class Test { + + @Cordova({ + callbackOrder: 'reverse' + }) + static reverseOrderCallback(args: any): Promise { return; } + + } + + const spy = spyOn(window.plugins.test, 'reverseOrderCallback').and.callThrough(); + Test.reverseOrderCallback('foo').then(result => { + expect(result).toEqual('reverseOrderCallback'); + done(); + }); + expect(spy.calls.mostRecent().args[2]).toEqual('foo'); + + }); + + it('node style callback', done => { + + window.plugins.test.nodeStyleCallback = (args, done) => { + done(null, 'nodeStyleCallback'); + }; + + @Plugin(testPluginMeta) + class Test { + + @Cordova({ + callbackStyle: 'node' + }) + static nodeStyleCallback(args: any): Promise { return; } + + } + + const spy = spyOn(window.plugins.test, 'nodeStyleCallback').and.callThrough(); + Test.nodeStyleCallback('foo').then(result => { + expect(result).toEqual('nodeStyleCallback'); + done(); + }); + expect(spy.calls.mostRecent().args[0]).toEqual('foo'); + + }); + + it('object style callback', done => { + + window.plugins.test.objectStyleCallback = (args, {success}) => { + success('objectStyleCallback'); + }; + + @Plugin(testPluginMeta) + class Test { + + @Cordova({ + callbackStyle: 'object', + successName: 'success', + errorName: 'error' + }) + static objectStyleCallback(args: any): Promise { return; } + + } + + const spy = spyOn(window.plugins.test, 'objectStyleCallback').and.callThrough(); + Test.objectStyleCallback('foo').then(result => { + expect(result).toEqual('objectStyleCallback'); + done(); + }); + expect(spy.calls.mostRecent().args[0]).toEqual('foo'); + + }); + +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index fc1c52225..be48d5b1b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,8 @@ "sourceMap": true, "declaration": true, "experimentalDecorators": true, - "outDir": "dist" + "outDir": "dist", + "moduleResolution": "node" }, "files": [ "typings/es6-shim/es6-shim.d.ts", diff --git a/typings.json b/typings.json new file mode 100644 index 000000000..dbbc9d62f --- /dev/null +++ b/typings.json @@ -0,0 +1,5 @@ +{ + "globalDevDependencies": { + "jasmine": "registry:dt/jasmine#2.2.0+20160621224255" + } +} diff --git a/typings/globals/jasmine/index.d.ts b/typings/globals/jasmine/index.d.ts new file mode 100644 index 000000000..e81f5ace5 --- /dev/null +++ b/typings/globals/jasmine/index.d.ts @@ -0,0 +1,502 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts +declare function describe(description: string, specDefinitions: () => void): void; +declare function fdescribe(description: string, specDefinitions: () => void): void; +declare function xdescribe(description: string, specDefinitions: () => void): void; + +declare function it(expectation: string, assertion?: () => void, timeout?: number): void; +declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; +declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; +declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; +declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; +declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; + +/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ +declare function pending(reason?: string): void; + +declare function beforeEach(action: () => void, timeout?: number): void; +declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; +declare function afterEach(action: () => void, timeout?: number): void; +declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; + +declare function beforeAll(action: () => void, timeout?: number): void; +declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; +declare function afterAll(action: () => void, timeout?: number): void; +declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; + +declare function expect(spy: Function): jasmine.Matchers; +declare function expect(actual: any): jasmine.Matchers; + +declare function fail(e?: any): void; +/** Action method that should be called when the async work is complete */ +interface DoneFn extends Function { + (): void; + + /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ + fail: (message?: Error|string) => void; +} + +declare function spyOn(object: any, method: string): jasmine.Spy; + +declare function runs(asyncMethod: Function): void; +declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; +declare function waits(timeout?: number): void; + +declare namespace jasmine { + + var clock: () => Clock; + + function any(aclass: any): Any; + function anything(): Any; + function arrayContaining(sample: any[]): ArrayContaining; + function objectContaining(sample: any): ObjectContaining; + function createSpy(name: string, originalFn?: Function): Spy; + function createSpyObj(baseName: string, methodNames: any[]): any; + function createSpyObj(baseName: string, methodNames: any[]): T; + function pp(value: any): string; + function getEnv(): Env; + function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + function addMatchers(matchers: CustomMatcherFactories): void; + function stringMatching(str: string): Any; + function stringMatching(str: RegExp): Any; + + interface Any { + + new (expectedClass: any): any; + + jasmineMatches(other: any): boolean; + jasmineToString(): string; + } + + // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() + interface ArrayLike { + length: number; + [n: number]: T; + } + + interface ArrayContaining { + new (sample: any[]): any; + + asymmetricMatch(other: any): boolean; + jasmineToString(): string; + } + + interface ObjectContaining { + new (sample: any): any; + + jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; + jasmineToString(): string; + } + + interface Block { + + new (env: Env, func: SpecFunction, spec: Spec): any; + + execute(onComplete: () => void): void; + } + + interface WaitsBlock extends Block { + new (env: Env, timeout: number, spec: Spec): any; + } + + interface WaitsForBlock extends Block { + new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any; + } + + interface Clock { + install(): void; + uninstall(): void; + /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ + tick(ms: number): void; + mockDate(date?: Date): void; + } + + interface CustomEqualityTester { + (first: any, second: any): boolean; + } + + interface CustomMatcher { + compare(actual: T, expected: T): CustomMatcherResult; + compare(actual: any, expected: any): CustomMatcherResult; + } + + interface CustomMatcherFactory { + (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; + } + + interface CustomMatcherFactories { + [index: string]: CustomMatcherFactory; + } + + interface CustomMatcherResult { + pass: boolean; + message?: string; + } + + interface MatchersUtil { + equals(a: any, b: any, customTesters?: Array): boolean; + contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; + buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; + } + + interface Env { + setTimeout: any; + clearTimeout: void; + setInterval: any; + clearInterval: void; + updateInterval: number; + + currentSpec: Spec; + + matchersClass: Matchers; + + version(): any; + versionString(): string; + nextSpecId(): number; + addReporter(reporter: Reporter): void; + execute(): void; + describe(description: string, specDefinitions: () => void): Suite; + // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these + beforeEach(beforeEachFunction: () => void): void; + beforeAll(beforeAllFunction: () => void): void; + currentRunner(): Runner; + afterEach(afterEachFunction: () => void): void; + afterAll(afterAllFunction: () => void): void; + xdescribe(desc: string, specDefinitions: () => void): XSuite; + it(description: string, func: () => void): Spec; + // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these + xit(desc: string, func: () => void): XSpec; + compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean; + compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; + equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; + contains_(haystack: any, needle: any): boolean; + addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + addMatchers(matchers: CustomMatcherFactories): void; + specFilter(spec: Spec): boolean; + throwOnExpectationFailure(value: boolean): void; + } + + interface FakeTimer { + + new (): any; + + reset(): void; + tick(millis: number): void; + runFunctionsWithinRange(oldMillis: number, nowMillis: number): void; + scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void; + } + + interface HtmlReporter { + new (): any; + } + + interface HtmlSpecFilter { + new (): any; + } + + interface Result { + type: string; + } + + interface NestedResults extends Result { + description: string; + + totalCount: number; + passedCount: number; + failedCount: number; + + skipped: boolean; + + rollupCounts(result: NestedResults): void; + log(values: any): void; + getItems(): Result[]; + addResult(result: Result): void; + passed(): boolean; + } + + interface MessageResult extends Result { + values: any; + trace: Trace; + } + + interface ExpectationResult extends Result { + matcherName: string; + passed(): boolean; + expected: any; + actual: any; + message: string; + trace: Trace; + } + + interface Trace { + name: string; + message: string; + stack: any; + } + + interface PrettyPrinter { + + new (): any; + + format(value: any): void; + iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void; + emitScalar(value: any): void; + emitString(value: string): void; + emitArray(array: any[]): void; + emitObject(obj: any): void; + append(value: any): void; + } + + interface StringPrettyPrinter extends PrettyPrinter { + } + + interface Queue { + + new (env: any): any; + + env: Env; + ensured: boolean[]; + blocks: Block[]; + running: boolean; + index: number; + offset: number; + abort: boolean; + + addBefore(block: Block, ensure?: boolean): void; + add(block: any, ensure?: boolean): void; + insertNext(block: any, ensure?: boolean): void; + start(onComplete?: () => void): void; + isRunning(): boolean; + next_(): void; + results(): NestedResults; + } + + interface Matchers { + + new (env: Env, actual: any, spec: Env, isNot?: boolean): any; + + env: Env; + actual: any; + spec: Env; + isNot?: boolean; + message(): any; + + toBe(expected: any, expectationFailOutput?: any): boolean; + toEqual(expected: any, expectationFailOutput?: any): boolean; + toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; + toBeDefined(expectationFailOutput?: any): boolean; + toBeUndefined(expectationFailOutput?: any): boolean; + toBeNull(expectationFailOutput?: any): boolean; + toBeNaN(): boolean; + toBeTruthy(expectationFailOutput?: any): boolean; + toBeFalsy(expectationFailOutput?: any): boolean; + toHaveBeenCalled(): boolean; + toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledTimes(expected: number): boolean; + toContain(expected: any, expectationFailOutput?: any): boolean; + toBeLessThan(expected: number, expectationFailOutput?: any): boolean; + toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; + toBeCloseTo(expected: number, precision?: any, expectationFailOutput?: any): boolean; + toThrow(expected?: any): boolean; + toThrowError(message?: string | RegExp): boolean; + toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; + not: Matchers; + + Any: Any; + } + + interface Reporter { + reportRunnerStarting(runner: Runner): void; + reportRunnerResults(runner: Runner): void; + reportSuiteResults(suite: Suite): void; + reportSpecStarting(spec: Spec): void; + reportSpecResults(spec: Spec): void; + log(str: string): void; + } + + interface MultiReporter extends Reporter { + addReporter(reporter: Reporter): void; + } + + interface Runner { + + new (env: Env): any; + + execute(): void; + beforeEach(beforeEachFunction: SpecFunction): void; + afterEach(afterEachFunction: SpecFunction): void; + beforeAll(beforeAllFunction: SpecFunction): void; + afterAll(afterAllFunction: SpecFunction): void; + finishCallback(): void; + addSuite(suite: Suite): void; + add(block: Block): void; + specs(): Spec[]; + suites(): Suite[]; + topLevelSuites(): Suite[]; + results(): NestedResults; + } + + interface SpecFunction { + (spec?: Spec): void; + } + + interface SuiteOrSpec { + id: number; + env: Env; + description: string; + queue: Queue; + } + + interface Spec extends SuiteOrSpec { + + new (env: Env, suite: Suite, description: string): any; + + suite: Suite; + + afterCallbacks: SpecFunction[]; + spies_: Spy[]; + + results_: NestedResults; + matchersClass: Matchers; + + getFullName(): string; + results(): NestedResults; + log(arguments: any): any; + runs(func: SpecFunction): Spec; + addToQueue(block: Block): void; + addMatcherResult(result: Result): void; + expect(actual: any): any; + waits(timeout: number): Spec; + waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; + fail(e?: any): void; + getMatchersClass_(): Matchers; + addMatchers(matchersPrototype: CustomMatcherFactories): void; + finishCallback(): void; + finish(onComplete?: () => void): void; + after(doAfter: SpecFunction): void; + execute(onComplete?: () => void): any; + addBeforesAndAftersToQueue(): void; + explodes(): void; + spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; + removeAllSpies(): void; + } + + interface XSpec { + id: number; + runs(): void; + } + + interface Suite extends SuiteOrSpec { + + new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any; + + parentSuite: Suite; + + getFullName(): string; + finish(onComplete?: () => void): void; + beforeEach(beforeEachFunction: SpecFunction): void; + afterEach(afterEachFunction: SpecFunction): void; + beforeAll(beforeAllFunction: SpecFunction): void; + afterAll(afterAllFunction: SpecFunction): void; + results(): NestedResults; + add(suiteOrSpec: SuiteOrSpec): void; + specs(): Spec[]; + suites(): Suite[]; + children(): any[]; + execute(onComplete?: () => void): void; + } + + interface XSuite { + execute(): void; + } + + interface Spy { + (...params: any[]): any; + + identity: string; + and: SpyAnd; + calls: Calls; + mostRecentCall: { args: any[]; }; + argsForCall: any[]; + wasCalled: boolean; + } + + interface SpyAnd { + /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ + callThrough(): Spy; + /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ + returnValue(val: any): Spy; + /** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */ + returnValues(...values: any[]): Spy; + /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ + callFake(fn: Function): Spy; + /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ + throwError(msg: string): Spy; + /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ + stub(): Spy; + } + + interface Calls { + /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/ + any(): boolean; + /** By chaining the spy with calls.count(), will return the number of times the spy was called **/ + count(): number; + /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/ + argsFor(index: number): any[]; + /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/ + allArgs(): any[]; + /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/ + all(): CallInfo[]; + /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/ + mostRecent(): CallInfo; + /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/ + first(): CallInfo; + /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ + reset(): void; + } + + interface CallInfo { + /** The context (the this) for the call */ + object: any; + /** All arguments passed to the call */ + args: any[]; + /** The return value of the call */ + returnValue: any; + } + + interface Util { + inherit(childClass: Function, parentClass: Function): any; + formatException(e: any): any; + htmlEscape(str: string): string; + argsToArray(args: any): any; + extend(destination: any, source: any): any; + } + + interface JsApiReporter extends Reporter { + + started: boolean; + finished: boolean; + result: any; + messages: any; + + new (): any; + + suites(): Suite[]; + summarize_(suiteOrSpec: SuiteOrSpec): any; + results(): any; + resultsForSpec(specId: any): any; + log(str: any): any; + resultsForSpecs(specIds: any): any; + summarizeResult_(result: any): any; + } + + interface Jasmine { + Spec: Spec; + clock: Clock; + util: Util; + } + + export var HtmlReporter: HtmlReporter; + export var HtmlSpecFilter: HtmlSpecFilter; + export var DEFAULT_TIMEOUT_INTERVAL: number; +} \ No newline at end of file diff --git a/typings/globals/jasmine/typings.json b/typings/globals/jasmine/typings.json new file mode 100644 index 000000000..3fb336cf1 --- /dev/null +++ b/typings/globals/jasmine/typings.json @@ -0,0 +1,8 @@ +{ + "resolution": "main", + "tree": { + "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts", + "raw": "registry:dt/jasmine#2.2.0+20160621224255", + "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts" + } +} diff --git a/typings/index.d.ts b/typings/index.d.ts new file mode 100644 index 000000000..7cf8a3f75 --- /dev/null +++ b/typings/index.d.ts @@ -0,0 +1 @@ +/// From 26dead93ffb969d1851749a9437828630d06fa15 Mon Sep 17 00:00:00 2001 From: Barry Rowe Date: Tue, 6 Sep 2016 21:52:43 -0400 Subject: [PATCH 104/382] fix(geolocation): retain Observable even during an error condition (#532) The way this was setup previously, if an error occurred on the watchPosition observable, the observer was sent an error, which would have to be caught. This also has the side effect of completing the observable, which means anything down stream that would be subscribed would be unsubscribed and no longer receive updates. Instead of using binding the error callback to ```observer.error``` this change just binds the error callback to ```observer.next``` and lets the subscriber filter out results that match ```PositionError``` rather than having to manage re-subscribing (which could just immediately fail and enter a loop of catch/retry) --- src/plugins/geolocation.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 795f0be12..6fffeea6d 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -62,6 +62,18 @@ export interface Geoposition { timestamp: number; } +export interface PositionError { + /** + * A code that indicates the error that occurred + */ + code: number; + + /** + * A message that can describe the error that occurred + */ + message: string; +} + export interface GeolocationOptions { /** * Is a positive long value indicating the maximum age in milliseconds of a @@ -140,7 +152,9 @@ export class Geolocation { * Observable changes. * * ```typescript - * var subscription = Geolocation.watchPosition().subscribe(position => { + * var subscription = Geolocation.watchPosition() + * .filter((p) => p.code === undefined) //Filter Out Errors + * .subscribe(position => { * console.log(position.coords.longitude + ' ' + position.coords.latitude); * }); * @@ -151,10 +165,10 @@ export class Geolocation { * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). * @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors. */ - static watchPosition(options?: GeolocationOptions): Observable { + static watchPosition(options?: GeolocationOptions): Observable { return new Observable( (observer: any) => { - let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.error.bind(observer), options); + let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options); return () => navigator.geolocation.clearWatch(watchId); } ); From bbbd0d52e9944b1832c19c4c88cf86b81672fd49 Mon Sep 17 00:00:00 2001 From: Sergii Stotskyi Date: Wed, 7 Sep 2016 04:53:42 +0300 Subject: [PATCH 105/382] feat(file): adds chunked blob writing (#529) This prevents devices crashing when user picks a big file to write --- src/plugins/file.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 7c2fd28a6..2ad7defa2 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1119,6 +1119,10 @@ export class File { * @private */ private static write(writer: FileWriter, gu: string | Blob): Promise { + if (gu instanceof Blob) { + return this.writeFileInChunks(writer, gu); + } + return new Promise((resolve, reject) => { writer.onwriteend = (evt) => { if (writer.error) { @@ -1130,4 +1134,32 @@ export class File { writer.write(gu); }); } + + /** + * @private + */ + private static writeFileInChunks(writer: FileWriter, file: Blob) { + const BLOCK_SIZE = 1024 * 1024; + let writtenSize = 0; + + function writeNextChunk() { + const size = Math.min(BLOCK_SIZE, file.size - writtenSize); + const chunk = file.slice(writtenSize, writtenSize + size); + + writtenSize += size; + writer.write(chunk); + } + + return new Promise((resolve, reject) => { + writer.onerror = reject; + writer.onwrite = () => { + if (writtenSize < file.size) { + writeNextChunk(); + } else { + resolve(); + } + }; + writeNextChunk(); + }); + } } From 393e9d0e00c3f2f41f3804abca4ca77d1bc5d41e Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 6 Sep 2016 22:54:35 -0300 Subject: [PATCH 106/382] feat(file): allows writeFile and writeExistingFile to accept Blob (#527) --- src/plugins/file.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 2ad7defa2..1a1e8e71c 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -658,12 +658,12 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName path relative to base path - * @param {string} text content to write + * @param {string | Blob} text content or blob to write * @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information. * @returns {Promise} Returns a Promise that resolves or rejects with an error. */ static writeFile(path: string, fileName: string, - text: string, replaceOrOptions: boolean | WriteOptions): Promise { + text: string | Blob, replaceOrOptions: boolean | WriteOptions): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; @@ -701,10 +701,10 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName path relative to base path - * @param {string} text content to write + * @param {string | Blob} text content or blob to write * @returns {Promise} Returns a Promise that resolves or rejects with an error. */ - static writeExistingFile(path: string, fileName: string, text: string): Promise { + static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; From caf2d6744385d27a1b12939360499b4b1f542098 Mon Sep 17 00:00:00 2001 From: Nicolas Perraut Date: Wed, 7 Sep 2016 03:54:57 +0200 Subject: [PATCH 107/382] docs(statusbar): fix typo (#526) --- 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 f7d56380e..2628d9205 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -15,7 +15,7 @@ declare var window; * import { StatusBar } from 'ionic-native'; * * - * StatusBar.overlaysWebView(true); // let status var overlay webview + * StatusBar.overlaysWebView(true); // let status bar overlay webview * * StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white * ``` From 4f9716415b17737170ba11d815d54f4a7b9067bc Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 6 Sep 2016 22:58:04 -0300 Subject: [PATCH 108/382] fix(social-sharing): various fixes (#520) * feat(socialsharing): add method shareVia() * docs(socialsharing): fix docs params Types * docs(socialsharing): fix docs param Type method canShareVia * docs(socialsharing): shareVia() * fix(socialsharing): fix order callback, because params is optional * feat(socialsharing): add params optionals canShareVia() * docs(socialsharing): add returns Promise --- src/plugins/socialsharing.ts | 53 ++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index d194b221b..26118bd9a 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -37,6 +37,7 @@ export class SocialSharing { * @param subject {string} The subject * @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 + * @returns {Promise} */ @Cordova() static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise { return; } @@ -44,6 +45,7 @@ export class SocialSharing { /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) * @param options {object} The options object with the message, subject, files, url and chooserTitle properties. + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -52,20 +54,30 @@ export class SocialSharing { /** * Checks if you can share via a specific app. - * @param appName App name or package name. Examples: instagram or com.apple.social.facebook + * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook + * @param message {string} + * @param subject {string} + * @param image {string} + * @param url {string} + * @returns {Promise} */ @Cordova({ + successIndex: 5, + errorIndex: 6 platforms: ['iOS', 'Android'] }) - static canShareVia(appName: string): Promise { return; } + static canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise { return; } /** * Shares directly to Twitter - * @param message - * @param image - * @param url + * @param message {string} + * @param image {string} + * @param url {string} + * @returns {Promise} */ @Cordova({ + successIndex: 3, + errorIndex: 4 platforms: ['iOS', 'Android'] }) static shareViaTwitter(message: string, image?: string, url?: string): Promise { return; } @@ -75,8 +87,11 @@ export class SocialSharing { * @param message {string} * @param image {string} * @param url {string} + * @returns {Promise} */ @Cordova({ + successIndex: 3, + errorIndex: 4 platforms: ['iOS', 'Android'] }) static shareViaFacebook(message: string, image?: string, url?: string): Promise { return; } @@ -88,8 +103,11 @@ export class SocialSharing { * @param image {string} * @param url {string} * @param pasteMessageHint {string} + * @returns {Promise} */ @Cordova({ + successIndex: 4, + errorIndex: 5 platforms: ['iOS', 'Android'] }) static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise { return; } @@ -98,6 +116,7 @@ export class SocialSharing { * Shares directly to Instagram * @param message {string} * @param image {string} + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -109,8 +128,11 @@ export class SocialSharing { * @param message {string} * @param image {string} * @param url {string} + * @returns {Promise} */ @Cordova({ + successIndex: 3, + errorIndex: 4 platforms: ['iOS', 'Android'] }) static shareViaWhatsApp(message: string, image?: string, url?: string): Promise { return; } @@ -121,8 +143,11 @@ export class SocialSharing { * @param message {string} Message to send * @param image {string} Image to send (does not work on iOS * @param url {string} Link to send + * @returns {Promise} */ @Cordova({ + successIndex: 4, + errorIndex: 5 platforms: ['iOS', 'Android'] }) static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise { return; } @@ -131,6 +156,7 @@ export class SocialSharing { * Share via SMS * @param messge {string} message to send * @param phoneNumber {string} Number or multiple numbers seperated by commas + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -139,6 +165,7 @@ export class SocialSharing { /** * Checks if you can share via email + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -153,10 +180,26 @@ export class SocialSharing { * @param cc {string[]} * @param bcc {string[]} * @param files {string|string[]} URL or local path to file(s) to attach + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] }) static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise { return; } + /** + * Share via AppName + * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook + * @param message {string} + * @param subject {string} + * @param image {string} + * @param url {string} + * @returns {Promise} + */ + @Cordova({ + successIndex: 5, + errorIndex: 6 + platforms: ['iOS', 'Android'] + }) + static shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise { return; } } From ddae67913d174249cdc8b48d8ee190a29f7bfa39 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 21:59:58 -0400 Subject: [PATCH 109/382] chore(): lint --- 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 6fffeea6d..289a1caec 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -67,7 +67,7 @@ export interface PositionError { * A code that indicates the error that occurred */ code: number; - + /** * A message that can describe the error that occurred */ From c76de34b9718144a76ee48919bb94bda956a1902 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 22:22:38 -0400 Subject: [PATCH 110/382] fix(social-sharing): shareViaEmail now resolves/rejects when not providing optional args --- src/plugins/socialsharing.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index 26118bd9a..058e968c5 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -63,7 +63,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 5, - errorIndex: 6 + errorIndex: 6, platforms: ['iOS', 'Android'] }) static canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise { return; } @@ -77,7 +77,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 3, - errorIndex: 4 + errorIndex: 4, platforms: ['iOS', 'Android'] }) static shareViaTwitter(message: string, image?: string, url?: string): Promise { return; } @@ -91,7 +91,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 3, - errorIndex: 4 + errorIndex: 4, platforms: ['iOS', 'Android'] }) static shareViaFacebook(message: string, image?: string, url?: string): Promise { return; } @@ -107,7 +107,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 4, - errorIndex: 5 + errorIndex: 5, platforms: ['iOS', 'Android'] }) static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise { return; } @@ -132,7 +132,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 3, - errorIndex: 4 + errorIndex: 4, platforms: ['iOS', 'Android'] }) static shareViaWhatsApp(message: string, image?: string, url?: string): Promise { return; } @@ -147,7 +147,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 4, - errorIndex: 5 + errorIndex: 5, platforms: ['iOS', 'Android'] }) static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise { return; } @@ -177,15 +177,17 @@ export class SocialSharing { * @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 + * @param cc {string[]} Optional + * @param bcc {string[]} Optional + * @param files {string|string[]} Optional URL or local path to file(s) to attach * @returns {Promise} */ @Cordova({ - platforms: ['iOS', 'Android'] + platforms: ['iOS', 'Android'], + successIndex: 6, + errorIndex: 7 }) - static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise { return; } + static shareViaEmail(message: string, subject: string, to: string[], cc?: string[], bcc?: string[], files?: string|string[]): Promise { return; } /** * Share via AppName @@ -198,7 +200,7 @@ export class SocialSharing { */ @Cordova({ successIndex: 5, - errorIndex: 6 + errorIndex: 6, platforms: ['iOS', 'Android'] }) static shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise { return; } From 7910493a6cbe00295bac916617e263f6e60a07a5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 22:24:34 -0400 Subject: [PATCH 111/382] fix(file): set exclusive to true when replace is false closes #516 --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 1a1e8e71c..27e2675c6 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -430,7 +430,7 @@ export class File { create: true }; - if (replace) { + if (!replace) { options.exclusive = true; } From d03d70ff0b824b792665ac60bf181024183912b9 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 22:28:56 -0400 Subject: [PATCH 112/382] fix(googlemaps): moveCamera and animateCamera now return a Promise closes #511 --- src/plugins/googlemaps.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 3b7eb1c33..2945fc1f4 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -173,13 +173,11 @@ export class GoogleMap { setTilt(tiltLevel: number): void { } - @CordovaInstance({ sync: true }) - animateCamera(animateCameraOptions: AnimateCameraOptions): void { - } + @CordovaInstance() + animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } - @CordovaInstance({ sync: true }) - moveCamera(cameraPosition: CameraPosition): void { - } + @CordovaInstance() + moveCamera(cameraPosition: CameraPosition): Promise { return; } @CordovaInstance({ sync: true }) setMyLocationEnabled(enabled: boolean): void { From a566240266a077be0964c879a0e1ffea746aa9dd Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:02:46 -0400 Subject: [PATCH 113/382] fix(media): nest the constructor logic --- src/plugins/media.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index 23cb9ce63..5ef39307d 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -127,12 +127,11 @@ export class MediaPlugin { * @param src {string} A URI containing the audio content. */ constructor(src: string) { - let res, rej, next; - this.init = new Promise((resolve, reject) => { res = resolve; rej = reject; }); - this.status = new Observable((observer) => { - next = data => observer.next(data); + this.init = new Promise((resolve, reject) => { + this.status = new Observable((observer) => { + this._objectInstance = new Media(src, resolve, reject, observer.next.bind(observer)); + }); }); - this._objectInstance = new Media(src, res, rej, next); } /** From c75f89894ae245cc239e0f6e36cb52869ec847bf Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:04:53 -0400 Subject: [PATCH 114/382] fix(): remove CanvasCamera plugin --- src/index.ts | 3 -- src/plugins/canvas-camera.ts | 94 ------------------------------------ 2 files changed, 97 deletions(-) delete mode 100644 src/plugins/canvas-camera.ts diff --git a/src/index.ts b/src/index.ts index b04a140db..055e91bed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,7 +21,6 @@ import { BLE } from './plugins/ble'; import { BluetoothSerial } from './plugins/bluetoothserial'; import { Calendar } from './plugins/calendar'; import { CallNumber } from './plugins/call-number'; -import { CanvasCamera } from './plugins/canvas-camera'; import { Camera } from './plugins/camera'; import { CameraPreview } from './plugins/camera-preview'; import { CardIO } from './plugins/card-io'; @@ -162,7 +161,6 @@ Brightness, BLE, BluetoothSerial, CallNumber, -CanvasCamera, CameraPreview, Clipboard, CodePush, @@ -235,7 +233,6 @@ window['IonicNative'] = { BluetoothSerial, Calendar, CallNumber, - CanvasCamera, Camera, CameraPreview, CardIO, diff --git a/src/plugins/canvas-camera.ts b/src/plugins/canvas-camera.ts deleted file mode 100644 index 972a1195d..000000000 --- a/src/plugins/canvas-camera.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { Plugin, Cordova } from './plugin'; -/** - * @name CanvasCamera - * @description - * - * @usage - * ``` - * import {CanvasCamera} from 'ionic-native'; - * - * let object = document.getElementById('myDiv'); - * // or - * @ViewChild('myDiv') object; - * - * CanvasCamera.initialize(object); - * - * CanvasCamera.start(); - * - * CanvasCamera.takePicture().then(picture => { }); - * - * ``` - */ -@Plugin({ - plugin: 'com.keith.cordova.plugin.canvascamera', - pluginRef: 'CanvasCamera', - repo: 'https://github.com/donaldp24/CanvasCameraPlugin' -}) -export class CanvasCamera { - static DestinationType = { - DATA_URL: 0, - FILE_URI: 1 - }; - static PictureSourceType = { - PHOTOLIBRARY : 0, - CAMERA : 1, - SAVEDPHOTOALBUM : 2 - }; - static EncodingType = { - JPEG : 0, - PNG : 1 - }; - static CameraPosition = { - BACK : 0, - FRONT : 1 - }; - static FlashMode = { - OFF : 0, - ON : 1, - AUTO : 2 - }; - /** - * Initialize the Camera - * @param htmlElement {HTMLElement} The HTML Element to preview the camera in - */ - @Cordova({sync: true}) - static initialize(htmlElement: HTMLElement): void { } - - /** - * Start capture video as images from camera to preview camera on web page. - * @param options - */ - @Cordova({sync: true}) - static start(options?: { - quality?: number; - sourceType?: number; - destinationType?: number; - allowEdit?: boolean; - correctOrientation?: boolean; - saveToPhotoAlbum?: boolean; - encodingType?: number; - width?: number; - height?: number; - }): void { } - - /** - * Takes a photo - * @returns {Promise} - */ - @Cordova() - static takePicture(): Promise { return; } - - /** - * Sets the flash mode - * @param flashMode {number} Flash mode, use CanvasCamera.FlashMode constant to set - */ - @Cordova({sync: true}) - static setFlashMode(flashMode: number): void { } - - /** - * Set camera position - * @param cameraPosition {number} Camera Position, use CanvasCamera.CameraPosition constant - */ - @Cordova({sync: true}) - static setCameraPosition(cameraPosition: number): void {} -} From 58c9439a323197486e5fd44e2c004e48a5bfc548 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:12:35 -0400 Subject: [PATCH 115/382] docs(camera-preview): add usage closes #363 --- src/plugins/camera-preview.ts | 50 ++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index af0499f38..a9edfc5bc 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -21,6 +21,52 @@ export interface CameraPreviewSize { * * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview). * + * @usage + * ``` + * import { CameraPreview } from 'ionic-native'; + * + * // camera options (Size and location) + * let cameraRect: CameraPreviewRect = { + * x: 100, + * y: 100, + * width: 200, + * height: 200 + * }; + * + * + * // start camera + * CameraPreview.startCamera( + * cameraRect, // position and size of preview + * 'front', // default camera + * true, // tape to take picture + * false, // disable drag + * true // send the preview to the back of the screen so we can add overlaying elements + * ); + * + * // Set the handler to run every time we take a picture + * CameraPreview.setOnPictureTakenHandler().subscribe((result) => { + * console.log(result); + * // do something with the result + * }); + * + * + * // take a picture + * CameraPreview.takePicture({ + * maxWidth: 640, + * maxHeight: 640 + * }); + * + * // Switch camera + * CameraPreview.switchCamera(); + * + * // set color effect to negative + * CameraPreview.setColorEffect('negative'); + * + * // Stop the camera preview + * CameraPreview.stopCamera(); + * + * ``` + * */ @Plugin({ plugin: 'cordova-plugin-camera-preview', @@ -42,9 +88,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { - - }; + static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }; /** * Stops the camera preview instance. From c407b6d4f0e902366d19000588d7a2e56adaf2b5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:21:29 -0400 Subject: [PATCH 116/382] docs(googlemaps): improve usage --- src/plugins/googlemaps.ts | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 2945fc1f4..ac61fbff3 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -48,14 +48,44 @@ export const GoogleMapsAnimation = { * ``` * import { GoogleMap, GoogleMapsEvent } from 'ionic-native'; * - * ... + * // create a new map using element ID + * let map = new GoogleMap('elementID'); * - * // somewhere in your component - * let map = new GoogleMap('elementID', { - * // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions - }); + * // or create a new map by passing HTMLElement + * let element: HTMLElement = document.getElementById('elementID'); * + * // In Angular 2 or Ionic 2, if we have this element in html:
+ * // then we can use @ViewChild to find the element and pass it to GoogleMaps + * @ViewChild('map') mapElement; + * let map = new GoogleMap(mapElement); + * + * // listen to MAP_READY event * map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); + * + * + * // create LatLng object + * let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802); + * + * // create CameraPosition + * let position: CameraPosition = { + * target: ionic, + * zoom: 18, + * tilt: 30 + * }; + * + * // move the map's camera to position + * map.moveCamera(position); + * + * // create new marker + * let markerOptions: GoogleMapsMarkerOptions = { + * position: ionic, + * title: 'Ionic' + * }; + * + * map.addMarker(markerOptions) + * .then((marker: GoogleMapsMarker) => { + * marker.showInfoWindow(); + * }); * ``` */ @Plugin({ From dff034a5b682b200d9ba3b02d20e9aa1b6d2f215 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:23:06 -0400 Subject: [PATCH 117/382] feat(googlemaps): can pass HTMLElement to constructor --- 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 ac61fbff3..482d91f34 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -107,8 +107,9 @@ export class GoogleMap { return; } - constructor(elementId: string, options?: any) { - this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options); + constructor(element: string|HTMLElement, options?: any) { + if (typeof element === 'string') element = document.getElementById(element); + this._objectInstance = plugin.google.maps.Map.getMap(element, options); } /** From 2aa998f66ffdd5b3e12f7b8d477036adc8f0392a Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:23:51 -0400 Subject: [PATCH 118/382] docs(googlemaps): improve usage --- 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 482d91f34..8cf306326 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -60,7 +60,7 @@ export const GoogleMapsAnimation = { * let map = new GoogleMap(mapElement); * * // listen to MAP_READY event - * map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); + * map.one(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); * * * // create LatLng object From 550b8289c9a6ec64bbdd23d548682f37f87c933c Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:33:51 -0400 Subject: [PATCH 119/382] reafractor(file): add types to promises --- src/plugins/file.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 27e2675c6..59c0ccea2 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -743,7 +743,7 @@ export class File { }) .then((fe) => { let reader = new FileReader(); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { reader.onloadend = () => { if (reader.result !== undefined || reader.result !== null) { resolve(reader.result); @@ -784,7 +784,7 @@ export class File { }) .then((fe) => { let reader = new FileReader(); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { reader.onloadend = () => { if (reader.result !== undefined || reader.result !== null) { resolve(reader.result); @@ -826,7 +826,7 @@ export class File { }) .then((fe) => { let reader = new FileReader(); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { reader.onloadend = () => { if (reader.result !== undefined || reader.result !== null) { resolve(reader.result); @@ -867,7 +867,7 @@ export class File { }) .then((fe) => { let reader = new FileReader(); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { reader.onloadend = () => { if (reader.result !== undefined || reader.result !== null) { resolve(reader.result); @@ -962,7 +962,7 @@ export class File { * @private */ private static resolveLocalFilesystemUrl(furl: string): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { try { window.resolveLocalFileSystemURL(furl, (entry) => { resolve(entry); @@ -997,7 +997,7 @@ export class File { * @private */ private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { try { fse.getDirectory(dn, flags, (de) => { resolve(de); @@ -1016,7 +1016,7 @@ export class File { * @private */ private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { try { fse.getFile(fn, flags, (fe) => { resolve(fe); @@ -1035,7 +1035,7 @@ export class File { * @private */ private static remove(fe: Entry): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { fe.remove(() => { resolve({success: true, fileRemoved: fe}); }, (err) => { @@ -1049,7 +1049,7 @@ export class File { * @private */ private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { srce.moveTo(destdir, newName, (deste) => { resolve(deste); }, (err) => { @@ -1063,7 +1063,7 @@ export class File { * @private */ private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { srce.copyTo(destdir, newName, (deste) => { resolve(deste); }, (err) => { @@ -1077,7 +1077,7 @@ export class File { * @private */ private static readEntries(dr: DirectoryReader): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { dr.readEntries((entries) => { resolve(entries); }, (err) => { @@ -1091,7 +1091,7 @@ export class File { * @private */ private static rimraf(de: DirectoryEntry): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { de.removeRecursively(() => { resolve({success: true, fileRemoved: de}); }, (err) => { @@ -1105,7 +1105,7 @@ export class File { * @private */ private static createWriter(fe: FileEntry): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { fe.createWriter((writer) => { resolve(writer); }, (err) => { @@ -1118,7 +1118,7 @@ export class File { /** * @private */ - private static write(writer: FileWriter, gu: string | Blob): Promise { + private static write(writer: FileWriter, gu: string | Blob): Promise { if (gu instanceof Blob) { return this.writeFileInChunks(writer, gu); } @@ -1150,7 +1150,7 @@ export class File { writer.write(chunk); } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { writer.onerror = reject; writer.onwrite = () => { if (writtenSize < file.size) { From 3385a46648686d14a3745ea863255526c1bd78cc Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:37:58 -0400 Subject: [PATCH 120/382] 1.3.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index feac39459..a5bc56c50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.20", + "version": "1.3.21", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From c36b0a6b3f6f6f18e7197fb4cb8f6cf1bf66012e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 6 Sep 2016 23:38:15 -0400 Subject: [PATCH 121/382] chore(): update changelog --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5276d2636..fd8d9d220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ + +## [1.3.21](https://github.com/driftyco/ionic-native/compare/v1.3.20...v1.3.21) (2016-09-07) + + +### Bug Fixes + +* **base64togallery:** fixes callbacks ([#513](https://github.com/driftyco/ionic-native/issues/513)) ([1db1374](https://github.com/driftyco/ionic-native/commit/1db1374)) +* **diagnostic:** Add DENIED_ALWAYS to permissionStatus, also some code formatting ([9d573a9](https://github.com/driftyco/ionic-native/commit/9d573a9)) +* **diagnostic:** Fix diagnostic objects ([cb176aa](https://github.com/driftyco/ionic-native/commit/cb176aa)) +* **diagnostic:** Fix permissionStatus object ([8f3d36f](https://github.com/driftyco/ionic-native/commit/8f3d36f)) +* **diagnostic:** Fix typo ([f93f958](https://github.com/driftyco/ionic-native/commit/f93f958)) +* **file:** set exclusive to true when replace is false ([7910493](https://github.com/driftyco/ionic-native/commit/7910493)), closes [#516](https://github.com/driftyco/ionic-native/issues/516) +* **geolocation:** retain Observable even during an error condition ([#532](https://github.com/driftyco/ionic-native/issues/532)) ([26dead9](https://github.com/driftyco/ionic-native/commit/26dead9)) +* **googlemaps:** moveCamera and animateCamera now return a Promise ([d03d70f](https://github.com/driftyco/ionic-native/commit/d03d70f)), closes [#511](https://github.com/driftyco/ionic-native/issues/511) +* **install-instructions:** This fixes install instructions for deeplinks, facebook and googlemaps ([#499](https://github.com/driftyco/ionic-native/issues/499)) ([877ac27](https://github.com/driftyco/ionic-native/commit/877ac27)) +* **media:** nest the constructor logic ([a566240](https://github.com/driftyco/ionic-native/commit/a566240)) +* **mixpanel:** Make eventProperties optional ([#501](https://github.com/driftyco/ionic-native/issues/501)) ([51364f8](https://github.com/driftyco/ionic-native/commit/51364f8)) +* **ng1:** grab injector from app. [#451](https://github.com/driftyco/ionic-native/issues/451) ([2dc68a4](https://github.com/driftyco/ionic-native/commit/2dc68a4)) +* remove CanvasCamera plugin ([c75f898](https://github.com/driftyco/ionic-native/commit/c75f898)) +* **social-sharing:** shareViaEmail now resolves/rejects when not providing optional args ([c76de34](https://github.com/driftyco/ionic-native/commit/c76de34)) +* **social-sharing:** various fixes ([#520](https://github.com/driftyco/ionic-native/issues/520)) ([4f97164](https://github.com/driftyco/ionic-native/commit/4f97164)) + + +### Features + +* **file:** adds chunked blob writing ([#529](https://github.com/driftyco/ionic-native/issues/529)) ([bbbd0d5](https://github.com/driftyco/ionic-native/commit/bbbd0d5)) +* **file:** allows writeFile and writeExistingFile to accept Blob ([#527](https://github.com/driftyco/ionic-native/issues/527)) ([393e9d0](https://github.com/driftyco/ionic-native/commit/393e9d0)) +* **googlemaps:** can pass HTMLElement to constructor ([dff034a](https://github.com/driftyco/ionic-native/commit/dff034a)) + + + ## [1.3.20](https://github.com/driftyco/ionic-native/compare/v1.3.19...v1.3.20) (2016-08-27) From 410b3d261f2673d297c4456c868e3557b509a8e6 Mon Sep 17 00:00:00 2001 From: mhartington Date: Wed, 7 Sep 2016 12:44:35 -0400 Subject: [PATCH 122/382] docs(localNotification): update docs --- src/plugins/localnotifications.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 8c763dfe1..389d907b9 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -72,12 +72,14 @@ export class LocalNotifications { /** * Clears single or multiple notifications * @param notificationId A single notification id, or an array of notification ids. + * @returns {Promise} Returns a promise when the notification had been cleared */ @Cordova() static clear(notificationId: any): Promise { return; } /** * Clears all notifications + * @returns {Promise} Returns a promise when all notifications have cleared */ @Cordova({ successIndex: 0, @@ -88,12 +90,14 @@ export class LocalNotifications { /** * Cancels single or multiple notifications * @param notificationId A single notification id, or an array of notification ids. + * @returns {Promise} Returns a promise when the notification is canceled */ @Cordova() static cancel(notificationId: any): Promise { return; } /** * Cancels all notifications + * @returns {Promise} Returns a promise when all notifications are canceled */ @Cordova({ successIndex: 0, @@ -104,6 +108,7 @@ export class LocalNotifications { /** * Checks presence of a notification * @param notificationId + * @returns {Promise} Returns a promise */ @Cordova() static isPresent(notificationId: number): Promise { return; } @@ -111,6 +116,7 @@ export class LocalNotifications { /** * Checks is a notification is scheduled * @param notificationId + * @returns {Promise} Returns a promise */ @Cordova() static isScheduled(notificationId: number): Promise { return; } @@ -118,24 +124,28 @@ export class LocalNotifications { /** * Checks if a notification is triggered * @param notificationId + * @returns {Promise} Returns a promise */ @Cordova() static isTriggered(notificationId: number): Promise { return; } /** * Get all the notification ids + * @returns {Promise} Returns a promise */ @Cordova() static getAllIds(): Promise> { return; } /** * Get the ids of triggered notifications + * @returns {Promise} Returns a promise */ @Cordova() static getTriggeredIds(): Promise> { return; } /** * Get the ids of scheduled notifications + * @returns {Promise} Returns a promise */ @Cordova() static getScheduledIds(): Promise> { return; } @@ -143,6 +153,7 @@ export class LocalNotifications { /** * Get a notification object * @param notificationId The id of the notification to get + * @returns {Promise} Returns a promise */ @Cordova() static get(notificationId: any): Promise { return; } @@ -150,6 +161,7 @@ export class LocalNotifications { /** * Get a scheduled notification object * @param notificationId The id of the notification to get + * @returns {Promise} Returns a promise */ @Cordova() static getScheduled(notificationId: any): Promise { return; } @@ -157,24 +169,28 @@ export class LocalNotifications { /** * Get a triggered notification object * @param notificationId The id of the notification to get + * @returns {Promise} Returns a promise */ @Cordova() static getTriggered(notificationId: any): Promise { return; } /** * Get all notification objects + * @returns {Promise} Returns a promise */ @Cordova() static getAll(): Promise> { return; } /** * Get all scheduled notification objects + * @returns {Promise} Returns a promise */ @Cordova() static getAllScheduled(): Promise> { return; } /** * Get all triggered notification objects + * @returns {Promise} Returns a promise */ @Cordova() static getAllTriggered(): Promise> { return; } From 7f77b8f06944a887c4b6e33593fdf5ef7fcfb3f4 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Fri, 9 Sep 2016 09:50:13 -0500 Subject: [PATCH 123/382] Package --- package.json | 8 +++++--- tsconfig-esm.json | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 tsconfig-esm.json diff --git a/package.json b/package.json index a5bc56c50..62e2c7a4c 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,12 @@ "version": "1.3.21", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", + "module": "dist/esm/index.js", "files": [ "dist" ], "dependencies": { - "rxjs": "^5.0.0-beta.6" + "@reactivex/rxjs": "^5.0.0-beta.11" }, "devDependencies": { "browserify": "^13.0.1", @@ -41,7 +42,7 @@ "tsify": "~1.0.4", "tslint": "^3.8.1", "tslint-ionic-rules": "0.0.5", - "typescript": "^1.8.10", + "typescript": "^2.0.2", "watchify": "~3.7.0" }, "scripts": { @@ -50,8 +51,9 @@ "start": "npm run test:watch", "lint": "./node_modules/.bin/gulp lint", "watch": "./node_modules/.bin/tsc -w", - "build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify", + "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", "build:js": "./node_modules/.bin/tsc", + "build:esm": "./node_modules/.bin/tsc -p ./tsconfig-esm.json", "build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js", "build:minify": "./node_modules/.bin/gulp minify:dist", "changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0", diff --git a/tsconfig-esm.json b/tsconfig-esm.json new file mode 100644 index 000000000..7fb860b6c --- /dev/null +++ b/tsconfig-esm.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "es2015", + "target": "ES5", + "sourceMap": true, + "declaration": true, + "experimentalDecorators": true, + "outDir": "dist/esm", + "moduleResolution": "node" + }, + "files": [ + "typings/es6-shim/es6-shim.d.ts", + "src/index.ts" + ] +} From 9d35567cb5ac6cc37e17753130f67f6d2d416269 Mon Sep 17 00:00:00 2001 From: Daniel Imhoff Date: Fri, 9 Sep 2016 14:45:24 -0500 Subject: [PATCH 124/382] Fix import to use @reactivex/rxjs --- src/plugins/3dtouch.ts | 2 +- src/plugins/admob.ts | 2 +- src/plugins/batterystatus.ts | 2 +- src/plugins/ble.ts | 2 +- src/plugins/bluetoothserial.ts | 2 +- src/plugins/camera-preview.ts | 2 +- src/plugins/code-push.ts | 2 +- src/plugins/dbmeter.ts | 2 +- src/plugins/deeplinks.ts | 2 +- src/plugins/devicemotion.ts | 2 +- src/plugins/deviceorientation.ts | 2 +- src/plugins/estimote-beacons.ts | 2 +- src/plugins/geofence.ts | 2 +- src/plugins/geolocation.ts | 2 +- src/plugins/googlemaps.ts | 2 +- src/plugins/httpd.ts | 2 +- src/plugins/ibeacon.ts | 2 +- src/plugins/inappbrowser.ts | 2 +- src/plugins/keyboard.ts | 2 +- src/plugins/media-capture.ts | 2 +- src/plugins/media.ts | 2 +- src/plugins/music-controls.ts | 2 +- src/plugins/network.ts | 2 +- src/plugins/nfc.ts | 2 +- src/plugins/onesignal.ts | 2 +- src/plugins/plugin.ts | 2 +- src/plugins/shake.ts | 2 +- src/plugins/toast.ts | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 0288a28df..3147d1809 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var window: any; diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index 1c825b305..a8c748d84 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name AdMob diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index c70beae60..caaf8467c 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name Battery Status diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 6df9f2f6d..641dc6965 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name BLE diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index 069fed3f3..475437571 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name Bluetooth Serial diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index a9edfc5bc..1f06c991a 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; export interface CameraPreviewRect { diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts index 29f253d26..d656581cb 100644 --- a/src/plugins/code-push.ts +++ b/src/plugins/code-push.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; // below are taken from // https://raw.githubusercontent.com/Microsoft/cordova-plugin-code-push/master/typings/codePush.d.ts diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index 138ee643a..fa3e9659d 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 9cc043016..8b581e285 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; export interface DeeplinkMatch { diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index b3a67bcfd..14f90f277 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; export interface AccelerationData { diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 431b9aa20..f9f987dc9 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; export interface CompassHeading { diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index 2896120c1..58b7fd496 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name EstimoteBeacons diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index e7f2fa15e..605166fa8 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name Geofence * @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence. diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 289a1caec..fd4136eb4 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var navigator: any; diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 8cf306326..764478b91 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1,5 +1,5 @@ import { Cordova, CordovaInstance, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index 5d11b3941..8716de391 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index c310f603e..d37d9aa02 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var cordova: any; diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index b088c9b58..a7f0590cd 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -1,5 +1,5 @@ import { Plugin, CordovaInstance } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var cordova: any; diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index 07ecad051..afa07a0a7 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 8366a7c93..2b1ddcd49 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -1,5 +1,5 @@ import { Cordova, CordovaProperty, Plugin } from './plugin'; -import { Observable } from 'rxjs/Rx'; +import { Observable } from '@reactivex/rxjs'; declare var navigator: any; diff --git a/src/plugins/media.ts b/src/plugins/media.ts index 5ef39307d..b662f4d6a 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -1,5 +1,5 @@ import { CordovaInstance, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var Media: any; diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts index c091af332..0564fea62 100644 --- a/src/plugins/music-controls.ts +++ b/src/plugins/music-controls.ts @@ -1,5 +1,5 @@ import { Plugin, Cordova } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name MusicControls * @description diff --git a/src/plugins/network.ts b/src/plugins/network.ts index 4b238ca11..d1903a119 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -1,5 +1,5 @@ import { Cordova, CordovaProperty, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var navigator: any; diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 1159b97a9..f7ad96c11 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -1,5 +1,5 @@ import { Plugin, Cordova } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name NFC * @description diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index cf6f14674..4ad724098 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 55b3ff0c1..f0460fbce 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -1,5 +1,5 @@ import { get } from '../util'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; declare var window; declare var Promise; diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts index 4e5208f03..26a5e0fac 100644 --- a/src/plugins/shake.ts +++ b/src/plugins/shake.ts @@ -1,5 +1,5 @@ import { Plugin, Cordova } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; /** * @name Shake * @description Handles shake gesture diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 0b0ccc16c..d5b279a58 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from '@reactivex/rxjs'; export interface ToastOptions { From 23fc908eb659181a46f56bf307bc3d0db27e3aaa Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 13 Sep 2016 06:17:07 -0400 Subject: [PATCH 125/382] fix(googlemaps): CameraPosition target can now be LatLngBounds closes #547 --- 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 764478b91..f6058527c 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -396,7 +396,7 @@ export interface AnimateCameraOptions { * @private */ export interface CameraPosition { - target?: GoogleMapsLatLng; + target?: GoogleMapsLatLng | GoogleMapsLatLngBounds; zoom?: number; tilt?: number; bearing?: number; From c83b0437fa0c7587d20b74bf47e76de870d6be21 Mon Sep 17 00:00:00 2001 From: Andrew Mitchell Date: Tue, 13 Sep 2016 07:10:14 -0500 Subject: [PATCH 126/382] feat(localNotifications): added register and has permission functions (#536) --- src/plugins/localnotifications.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 389d907b9..7912e7fa4 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -195,6 +195,20 @@ export class LocalNotifications { @Cordova() static getAllTriggered(): Promise> { return; } + /** + * Register permission to show notifications if not already granted. + * @returns {Promise} Returns a promise + */ + @Cordova() + static registerPermission(): Promise { return; } + + /** + * Informs if the app has the permission to show notifications. + * @returns {Promise} Returns a promise + */ + @Cordova() + static hasPermission(): Promise { return; } + /** * Sets a callback for a specific event From abf3335415e137fe865bfe0e0900812796628e7b Mon Sep 17 00:00:00 2001 From: Daniel Imhoff Date: Wed, 14 Sep 2016 13:25:50 -0500 Subject: [PATCH 127/382] 'npm run' runs with node_modules/.bin in path --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 62e2c7a4c..745cd0b05 100644 --- a/package.json +++ b/package.json @@ -49,14 +49,14 @@ "test": "karma start", "test:watch": "npm test -- --watch", "start": "npm run test:watch", - "lint": "./node_modules/.bin/gulp lint", - "watch": "./node_modules/.bin/tsc -w", + "lint": "gulp lint", + "watch": "tsc -w", "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", - "build:js": "./node_modules/.bin/tsc", - "build:esm": "./node_modules/.bin/tsc -p ./tsconfig-esm.json", - "build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js", - "build:minify": "./node_modules/.bin/gulp minify:dist", - "changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0", + "build:js": "tsc", + "build:esm": "tsc -p tsconfig-esm.json", + "build:bundle": "browserify dist/index.js > dist/ionic.native.js", + "build:minify": "gulp minify:dist", + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "plugin:create": "gulp plugin:create" }, "repository": { From efbd11676f97aa66033fc0a616ac64032ca348f2 Mon Sep 17 00:00:00 2001 From: Daniel Imhoff Date: Wed, 14 Sep 2016 13:35:45 -0500 Subject: [PATCH 128/382] put tsc output into dist/es5, not just dist/ --- package.json | 6 +++--- tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 745cd0b05..585339c67 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "ionic-native", "version": "1.3.21", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", - "main": "dist/index.js", + "main": "dist/es5/index.js", + "typings": "dist/es5/index.d.ts", "module": "dist/esm/index.js", "files": [ "dist" @@ -54,7 +55,7 @@ "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", "build:js": "tsc", "build:esm": "tsc -p tsconfig-esm.json", - "build:bundle": "browserify dist/index.js > dist/ionic.native.js", + "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", "build:minify": "gulp minify:dist", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "plugin:create": "gulp plugin:create" @@ -68,7 +69,6 @@ "url": "https://github.com/driftyco/ionic-native/issues" }, "homepage": "https://github.com/driftyco/ionic-native", - "typings": "./dist/index.d.ts", "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog" diff --git a/tsconfig.json b/tsconfig.json index be48d5b1b..a4f31bdca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "sourceMap": true, "declaration": true, "experimentalDecorators": true, - "outDir": "dist", + "outDir": "dist/es5", "moduleResolution": "node" }, "files": [ From 35c37c2d9e8da6b64c5529d9bc38fd0a874d2c33 Mon Sep 17 00:00:00 2001 From: Daniel Imhoff Date: Wed, 14 Sep 2016 14:13:14 -0500 Subject: [PATCH 129/382] chore(build): rename to more explicit tsconfig-es5.json --- package.json | 2 +- tsconfig.json => tsconfig-es5.json | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tsconfig.json => tsconfig-es5.json (100%) diff --git a/package.json b/package.json index 585339c67..14954f50e 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "lint": "gulp lint", "watch": "tsc -w", "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", - "build:js": "tsc", + "build:js": "tsc -p tsconfig-es5.json", "build:esm": "tsc -p tsconfig-esm.json", "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", "build:minify": "gulp minify:dist", diff --git a/tsconfig.json b/tsconfig-es5.json similarity index 100% rename from tsconfig.json rename to tsconfig-es5.json From 505ff189d9cc28c1e588f66b03dd2f4dc7ec77e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20Ol=C3=A1h?= Date: Mon, 19 Sep 2016 23:58:37 +0200 Subject: [PATCH 130/382] chore(market): add missing plugin name (#557) --- src/plugins/market.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/market.ts b/src/plugins/market.ts index edb97697b..1e63ce6fe 100644 --- a/src/plugins/market.ts +++ b/src/plugins/market.ts @@ -13,7 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - plugin: '', + plugin: 'cordova-plugin-market', pluginRef: 'plugins.market', repo: 'https://github.com/xmartlabs/cordova-plugin-market' }) From a28667e751c9441a5b838deeea3560b1435a9446 Mon Sep 17 00:00:00 2001 From: Jay Cambron Date: Mon, 19 Sep 2016 18:00:58 -0400 Subject: [PATCH 131/382] docs(background-geolocation): add notice (#534) --- src/plugins/background-geolocation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index c7100a618..d9baa48ab 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -168,7 +168,8 @@ export interface Config { * * // When device is ready : * platform.ready().then(() => { - * + * // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission. + * * // BackgroundGeolocation is highly configurable. See platform specific configuration options * let config = { * desiredAccuracy: 10, From 42d1bbc7a806dc6b529771588005600310635cfb Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 19 Sep 2016 18:14:51 -0400 Subject: [PATCH 132/382] docs(camera): add return type to cleanup closes #550 --- src/plugins/camera.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 9f94df66c..12e61530d 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -204,6 +204,6 @@ export class Camera { @Cordova({ platforms: ['iOS'] }) - static cleanup() { }; + static cleanup(): Promise { return; }; } From 281575b961c6c5cc7778accf15129a78565b6540 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 19 Sep 2016 18:18:53 -0400 Subject: [PATCH 133/382] feat(background-geolocation): add showAppSettings function closes #548 --- src/plugins/background-geolocation.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index d9baa48ab..2b2812365 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -287,11 +287,17 @@ export class BackgroundGeolocation { @Cordova() static isLocationEnabled(): Promise { return; } + /** + * Display app settings to change permissions + */ + @Cordova({ sync: true }) + static showAppSettings(): void { } + /** * Display device location settings */ - @Cordova() - static showLocationSettings() { } + @Cordova({ sync: true }) + static showLocationSettings(): void { } /** * Method can be used to detect user changes in location services settings. From 763ad1bdb0c3578993c0b2fc29fa286be38dc24f Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 19 Sep 2016 18:20:51 -0400 Subject: [PATCH 134/382] fix(call-number): number should be a string closes #545 --- src/plugins/call-number.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts index ef5e0e281..fc305d1b6 100644 --- a/src/plugins/call-number.ts +++ b/src/plugins/call-number.ts @@ -24,13 +24,13 @@ import { Plugin, Cordova } from './plugin'; export class CallNumber { /** * Calls a phone number - * @param numberToCall {number} The phone number to call + * @param numberToCall {string} The phone number to call as a string * @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer */ @Cordova({ callbackOrder: 'reverse' }) - static callNumber(numberToCall: number, bypassAppChooser: boolean): Promise { + static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise { return; } } From 919e8dae30dcb3d35dbba4c6f2730d178b8f1e9d Mon Sep 17 00:00:00 2001 From: Christian Roring Date: Tue, 20 Sep 2016 12:36:56 +0200 Subject: [PATCH 135/382] feat(BackgroundGeolocation): Update to the latest version --- src/plugins/background-geolocation.ts | 239 ++++++++++++++++++++++---- 1 file changed, 207 insertions(+), 32 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 2b2812365..dc3d90d6e 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -1,8 +1,7 @@ -import { Cordova, Plugin } from './plugin'; +import {Cordova, Plugin} from './plugin'; declare var window; - export interface Location { /** @@ -104,6 +103,22 @@ export interface Config { */ stopOnTerminate?: boolean; + /**
 + * ANDROID ONLY
 + * Start background service on device boot.
 + * + * Defaults to false
 + */ + startOnBoot?: boolean; + + /**
 + * ANDROID ONLY
 + * If false location service will not be started in foreground and no notification will be shown. + * + * Defaults to true
 + */ + startForeground?: boolean; + /** * ANDROID, WP8 ONLY * The minimum time interval between location updates in seconds. @@ -131,12 +146,19 @@ export interface Config { */ notificationIconColor?: string; - /** - * ANDROID ONLY - * The filename of a custom notification icon. See android quirks. - * NOTE: Only available for API Level >=21. + /**
 + * ANDROID ONLY
 + * The filename of a custom notification icon. See android quirks.
 + * NOTE: Only available for API Level >=21.
 */ - notificationIcon?: string; + notificationIconLarge?: string; + + /**
 + * ANDROID ONLY
 + * The filename of a custom notification icon. See android quirks.
 + * NOTE: Only available for API Level >=21.
 + */ + notificationIconSmall?: string; /** * ANDROID ONLY @@ -152,6 +174,52 @@ export interface Config { */ activityType?: string; + /**
 + * IOS ONLY
 + * Pauses location updates when app is paused
 + * + * Defaults to true
 + */ + pauseLocationUpdates?: boolean; + + /**
 + * Server url where to send HTTP POST with recorded locations
 + * @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
 + */ + url?: string; + + /**
 + * Server url where to send fail to post locations
 + * @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
 + */ + syncUrl?: string; + + /** + * Specifies how many previously failed locations will be sent to server at once
 + * + * Defaults to 100
 + */ + syncThreshold?: number; + + /**
 + * Optional HTTP headers sent along in HTTP request
 + */ + httpHeaders?: any; + + /** + * IOS ONLY
 + * Switch to less accurate significant changes and region monitory when in background (default) + * + * Defaults to 100
 + */ + saveBatteryOnBackground?: boolean; + + /**
 + * Limit maximum number of locations stored into db
 + * + * Defaults to 10000
 + */ + maxLocations?: number; } /** @@ -208,13 +276,61 @@ export interface Config { }) export class BackgroundGeolocation { + /**
 + * Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
 + * + * Possible values: + * ANDROID_DISTANCE_FILTER_PROVIDER: 0,
 + * ANDROID_ACTIVITY_PROVIDER: 1
 + * + * @enum {number}
 + */ + static LocationProvider: { + ANDROID_DISTANCE_FILTER_PROVIDER: number, + ANDROID_ACTIVITY_PROVIDER: number + }; + + /** + * Desired accuracy in meters. Possible values [0, 10, 100, 1000].
 + * The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
 + * 1000 results in lowest power drain and least accurate readings.
 + * + * Possible values: + * HIGH: 0
 + * MEDIUM: 10
 + * LOW: 100
 + * PASSIVE: 1000 + * + * enum {number}
 + */ + static Accuracy: { + HIGH: number, + MEDIUM: number, + LOW: number, + PASSIVE: number + }; + + /**
 + * Used in the switchMode function
 + * + * Possible values: + * BACKGROUND: 0 + * FOREGROUND: 1
 + * + * @enum {number}
 + */ + static Mode: { + BACKGROUND: number, + FOREGROUND: number + }; + /** * Configure the plugin. - * + * * @param {Function} Success callback will be called when background location is determined. * @param {Function} Fail callback to be executed every time a geolocation error occurs. * @param {Object} An object of type Config - * + * * @return Location object, which tries to mimic w3c Coordinates interface. * See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface * Callback to be executed every time a geolocation is recorded in the background. @@ -222,39 +338,42 @@ export class BackgroundGeolocation { @Cordova({ sync: true }) - static configure(callback: Function, errorCallback: Function, options: Config): void { return; } - + static configure(callback: Function, errorCallback: Function, options: Config): void { + return; + } /** * Turn ON the background-geolocation system. * The user will be tracked whenever they suspend the app. */ @Cordova() - static start(): Promise { return; } - + static start(): Promise { + return; + } /** * Turn OFF background-tracking */ @Cordova() - static stop(): Promise { return; } - + static stop(): Promise { + return; + } /** * Inform the native plugin that you're finished, the background-task may be completed * NOTE: IOS, WP only */ @Cordova() - static finish() { } - + static finish() { + } /** * Force the plugin to enter "moving" or "stationary" state * NOTE: IOS, WP only */ @Cordova() - static changePace(isMoving: boolean) { } - + static changePace(isMoving: boolean) { + } /** * Setup configuration @@ -262,14 +381,18 @@ export class BackgroundGeolocation { @Cordova({ callbackOrder: 'reverse' }) - static setConfig(options: Config): Promise { return; } + static setConfig(options: Config): Promise { + return; + } /** * Returns current stationaryLocation if available. null if not * NOTE: IOS, WP only */ @Cordova() - static getStationaryLocation(): Promise { return; } + static getStationaryLocation(): Promise { + return; + } /** * Add a stationary-region listener. Whenever the devices enters "stationary-mode", @@ -277,7 +400,9 @@ export class BackgroundGeolocation { * NOTE: IOS, WP only */ @Cordova() - static onStationary(): Promise { return; } + static onStationary(): Promise { + return; + } /** * Check if location is enabled on the device @@ -285,19 +410,23 @@ export class BackgroundGeolocation { * NOTE: ANDROID only */ @Cordova() - static isLocationEnabled(): Promise { return; } + static isLocationEnabled(): Promise { + return; + } /** * Display app settings to change permissions */ - @Cordova({ sync: true }) - static showAppSettings(): void { } + @Cordova({sync: true}) + static showAppSettings(): void { + } /** * Display device location settings */ - @Cordova({ sync: true }) - static showLocationSettings(): void { } + @Cordova({sync: true}) + static showLocationSettings(): void { + } /** * Method can be used to detect user changes in location services settings. @@ -306,14 +435,17 @@ export class BackgroundGeolocation { * NOTE: ANDROID only */ @Cordova() - static watchLocationMode(): Promise { return; } + static watchLocationMode(): Promise { + return; + } /** * Stop watching for location mode changes. * NOTE: ANDROID only */ @Cordova() - static stopWatchingLocationMode() { } + static stopWatchingLocationMode() { + } /** * Method will return all stored locations. @@ -325,20 +457,63 @@ export class BackgroundGeolocation { * NOTE: ANDROID only */ @Cordova() - static getLocations(): Promise { return; } + static getLocations(): Promise { + return; + } + + /**
 + * Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
 + */ + @Cordova() + static getValidLocations(): Promise { + return; + } /** * Delete stored location by given locationId. * NOTE: ANDROID only */ @Cordova() - static deleteLocation(locationId: number): Promise { return; } + static deleteLocation(locationId: number): Promise { + return; + } /** * Delete all stored locations. * NOTE: ANDROID only */ @Cordova() - static deleteAllLocations(): Promise { return; } + static deleteAllLocations(): Promise { + return; + } + /** + * Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself. + * Calling switchMode you can override plugin behavior and force plugin to switch into other mode. + * + * In FOREGROUND mode plugin uses iOS local manager to receive locations and behavior is affected by option.desiredAccuracy and option.distanceFilter. + * In BACKGROUND mode plugin uses significant changes and region monitoring to receive locations and uses option.stationaryRadius only.
 + * + * BackgroundGeolocation.Mode.FOREGROUND + * BackgroundGeolocation.Mode.BACKGROUND
 + * + * NOTE: iOS only + * + * @param {number} See above.
 + */ + @Cordova() + static switchMode(modeId: number): Promise { + return; + } + + /**
 + * Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
 + * @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
 + * + * @param {number} Limits the number of entries
 + */ + @Cordova() + static getLogEntries(limit: number): Promise { + return; + } } From 808a75e41c9322de67840b725684be7fcd7de929 Mon Sep 17 00:00:00 2001 From: Christian Roring Date: Tue, 20 Sep 2016 13:07:01 +0200 Subject: [PATCH 136/382] feat(BackgroundGeolocation): Update to the latest version --- src/plugins/background-geolocation.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index dc3d90d6e..74e57cd05 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -285,9 +285,9 @@ export class BackgroundGeolocation { * * @enum {number}
 */ - static LocationProvider: { - ANDROID_DISTANCE_FILTER_PROVIDER: number, - ANDROID_ACTIVITY_PROVIDER: number + static LocationProvider: any = { + ANDROID_DISTANCE_FILTER_PROVIDER: 0, + ANDROID_ACTIVITY_PROVIDER: 1 }; /** @@ -303,11 +303,11 @@ export class BackgroundGeolocation { * * enum {number}
 */ - static Accuracy: { - HIGH: number, - MEDIUM: number, - LOW: number, - PASSIVE: number + static Accuracy: any = { + HIGH: 0, + MEDIUM: 10, + LOW: 100, + PASSIVE: 1000 }; /**
 @@ -319,9 +319,9 @@ export class BackgroundGeolocation { * * @enum {number}
 */ - static Mode: { - BACKGROUND: number, - FOREGROUND: number + static Mode: any = { + BACKGROUND: 0, + FOREGROUND: 1 }; /** From 31706867c7a0e9ebd01829743df311b1b0749f49 Mon Sep 17 00:00:00 2001 From: Christian Roring Date: Tue, 20 Sep 2016 14:00:57 +0200 Subject: [PATCH 137/382] feat(BackgroundGeolocation): code cleanup --- src/plugins/background-geolocation.ts | 71 +++++++-------------------- 1 file changed, 19 insertions(+), 52 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 74e57cd05..0179f14e6 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -338,42 +338,34 @@ export class BackgroundGeolocation { @Cordova({ sync: true }) - static configure(callback: Function, errorCallback: Function, options: Config): void { - return; - } + static configure(callback: Function, errorCallback: Function, options: Config): void { return; } /** * Turn ON the background-geolocation system. * The user will be tracked whenever they suspend the app. */ @Cordova() - static start(): Promise { - return; - } + static start(): Promise { return; } /** * Turn OFF background-tracking */ @Cordova() - static stop(): Promise { - return; - } + static stop(): Promise { return; } /** * Inform the native plugin that you're finished, the background-task may be completed * NOTE: IOS, WP only */ @Cordova() - static finish() { - } + static finish() { } /** * Force the plugin to enter "moving" or "stationary" state * NOTE: IOS, WP only */ @Cordova() - static changePace(isMoving: boolean) { - } + static changePace(isMoving: boolean) { } /** * Setup configuration @@ -381,18 +373,14 @@ export class BackgroundGeolocation { @Cordova({ callbackOrder: 'reverse' }) - static setConfig(options: Config): Promise { - return; - } + static setConfig(options: Config): Promise { return; } /** * Returns current stationaryLocation if available. null if not * NOTE: IOS, WP only */ @Cordova() - static getStationaryLocation(): Promise { - return; - } + static getStationaryLocation(): Promise { return; } /** * Add a stationary-region listener. Whenever the devices enters "stationary-mode", @@ -400,9 +388,7 @@ export class BackgroundGeolocation { * NOTE: IOS, WP only */ @Cordova() - static onStationary(): Promise { - return; - } + static onStationary(): Promise { return; } /** * Check if location is enabled on the device @@ -410,23 +396,19 @@ export class BackgroundGeolocation { * NOTE: ANDROID only */ @Cordova() - static isLocationEnabled(): Promise { - return; - } + static isLocationEnabled(): Promise { return; } /** * Display app settings to change permissions */ @Cordova({sync: true}) - static showAppSettings(): void { - } + static showAppSettings(): void { } /** * Display device location settings */ @Cordova({sync: true}) - static showLocationSettings(): void { - } + static showLocationSettings(): void { } /** * Method can be used to detect user changes in location services settings. @@ -435,17 +417,14 @@ export class BackgroundGeolocation { * NOTE: ANDROID only */ @Cordova() - static watchLocationMode(): Promise { - return; - } + static watchLocationMode(): Promise { return; } /** * Stop watching for location mode changes. * NOTE: ANDROID only */ @Cordova() - static stopWatchingLocationMode() { - } + static stopWatchingLocationMode() { } /** * Method will return all stored locations. @@ -457,35 +436,27 @@ export class BackgroundGeolocation { * NOTE: ANDROID only */ @Cordova() - static getLocations(): Promise { - return; - } + static getLocations(): Promise { return; } /**
 * Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
 */ @Cordova() - static getValidLocations(): Promise { - return; - } + static getValidLocations(): Promise { return; } /** * Delete stored location by given locationId. * NOTE: ANDROID only */ @Cordova() - static deleteLocation(locationId: number): Promise { - return; - } + static deleteLocation(locationId: number): Promise { return; } /** * Delete all stored locations. * NOTE: ANDROID only */ @Cordova() - static deleteAllLocations(): Promise { - return; - } + static deleteAllLocations(): Promise { return; } /** * Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself. @@ -502,9 +473,7 @@ export class BackgroundGeolocation { * @param {number} See above.
 */ @Cordova() - static switchMode(modeId: number): Promise { - return; - } + static switchMode(modeId: number): Promise { return; } /**
 * Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
 @@ -513,7 +482,5 @@ export class BackgroundGeolocation { * @param {number} Limits the number of entries
 */ @Cordova() - static getLogEntries(limit: number): Promise { - return; - } + static getLogEntries(limit: number): Promise { return; } } From 3903fee2bff1e86a59acc2d378ea194b70d8296f Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Wed, 21 Sep 2016 11:02:32 -0500 Subject: [PATCH 138/382] feat(scripts): publish script with npm and bower. Fixes #448 --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 14954f50e..a8dfcdac9 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "build:esm": "tsc -p tsconfig-esm.json", "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", "build:minify": "gulp minify:dist", + "publish": "npm run build && npm publish && bash ./scripts/bower.sh", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "plugin:create": "gulp plugin:create" }, From 4014972feb68e0b5abdb622f906ab97ef286b7e5 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Wed, 21 Sep 2016 15:04:46 -0500 Subject: [PATCH 139/382] feat(build): Support ES2015 modules --- package.json | 4 ++-- src/index.ts | 8 ++++---- src/plugins/3dtouch.ts | 2 +- src/plugins/admob.ts | 2 +- src/plugins/batterystatus.ts | 2 +- src/plugins/ble.ts | 2 +- src/plugins/bluetoothserial.ts | 2 +- src/plugins/camera-preview.ts | 2 +- src/plugins/code-push.ts | 2 +- src/plugins/dbmeter.ts | 2 +- src/plugins/deeplinks.ts | 2 +- src/plugins/devicemotion.ts | 2 +- src/plugins/deviceorientation.ts | 2 +- src/plugins/estimote-beacons.ts | 2 +- src/plugins/geofence.ts | 2 +- src/plugins/geolocation.ts | 2 +- src/plugins/googlemaps.ts | 2 +- src/plugins/httpd.ts | 2 +- src/plugins/ibeacon.ts | 2 +- src/plugins/inappbrowser.ts | 2 +- src/plugins/keyboard.ts | 2 +- src/plugins/media-capture.ts | 2 +- src/plugins/media.ts | 2 +- src/plugins/music-controls.ts | 2 +- src/plugins/network.ts | 2 +- src/plugins/nfc.ts | 2 +- src/plugins/onesignal.ts | 2 +- src/plugins/plugin.ts | 2 +- src/plugins/shake.ts | 2 +- src/plugins/toast.ts | 2 +- 30 files changed, 34 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index a8dfcdac9..04927d9ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.21", + "version": "1.3.22", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", @@ -9,7 +9,7 @@ "dist" ], "dependencies": { - "@reactivex/rxjs": "^5.0.0-beta.11" + "rxjs": "^5.0.0-beta.12" }, "devDependencies": { "browserify": "^13.0.1", diff --git a/src/index.ts b/src/index.ts index 055e91bed..dfa52d1c6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -156,14 +156,14 @@ AppVersion, Badge, BarcodeScanner, Base64ToGallery, -BatteryStatus, +// BatteryStatus, Brightness, BLE, BluetoothSerial, CallNumber, CameraPreview, Clipboard, -CodePush, +// CodePush, Crop, DBMeter, Deeplinks, @@ -172,7 +172,7 @@ Dialogs, Diagnostic, EmailComposer, EstimoteBeacons, -File, +// File, FileChooser, FileOpener, Flashlight, @@ -204,7 +204,7 @@ Splashscreen, SQLite, StatusBar, TouchID, -Transfer, +// Transfer, TextToSpeech, Vibration, WebIntent, diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 3147d1809..0288a28df 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var window: any; diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index a8c748d84..1c825b305 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name AdMob diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index caaf8467c..c70beae60 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name Battery Status diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 641dc6965..6df9f2f6d 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name BLE diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index 475437571..069fed3f3 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name Bluetooth Serial diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 1f06c991a..a9edfc5bc 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; export interface CameraPreviewRect { diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts index d656581cb..29f253d26 100644 --- a/src/plugins/code-push.ts +++ b/src/plugins/code-push.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; // below are taken from // https://raw.githubusercontent.com/Microsoft/cordova-plugin-code-push/master/typings/codePush.d.ts diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index fa3e9659d..138ee643a 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 8b581e285..9cc043016 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; export interface DeeplinkMatch { diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 14f90f277..b3a67bcfd 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; export interface AccelerationData { diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index f9f987dc9..431b9aa20 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; export interface CompassHeading { diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index 58b7fd496..2896120c1 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name EstimoteBeacons diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index 605166fa8..e7f2fa15e 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name Geofence * @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence. diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index fd4136eb4..289a1caec 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var navigator: any; diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index f6058527c..08048f89b 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1,5 +1,5 @@ import { Cordova, CordovaInstance, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index 8716de391..5d11b3941 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index d37d9aa02..c310f603e 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var cordova: any; diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index a7f0590cd..b088c9b58 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -1,5 +1,5 @@ import { Plugin, CordovaInstance } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var cordova: any; diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index afa07a0a7..07ecad051 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 2b1ddcd49..1bd838a08 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -1,5 +1,5 @@ import { Cordova, CordovaProperty, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var navigator: any; diff --git a/src/plugins/media.ts b/src/plugins/media.ts index b662f4d6a..5ef39307d 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -1,5 +1,5 @@ import { CordovaInstance, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var Media: any; diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts index 0564fea62..c091af332 100644 --- a/src/plugins/music-controls.ts +++ b/src/plugins/music-controls.ts @@ -1,5 +1,5 @@ import { Plugin, Cordova } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name MusicControls * @description diff --git a/src/plugins/network.ts b/src/plugins/network.ts index d1903a119..4b238ca11 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -1,5 +1,5 @@ import { Cordova, CordovaProperty, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var navigator: any; diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index f7ad96c11..1159b97a9 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -1,5 +1,5 @@ import { Plugin, Cordova } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name NFC * @description diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 4ad724098..cf6f14674 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index f0460fbce..55b3ff0c1 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -1,5 +1,5 @@ import { get } from '../util'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; declare var window; declare var Promise; diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts index 26a5e0fac..4e5208f03 100644 --- a/src/plugins/shake.ts +++ b/src/plugins/shake.ts @@ -1,5 +1,5 @@ import { Plugin, Cordova } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; /** * @name Shake * @description Handles shake gesture diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index d5b279a58..0b0ccc16c 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -1,5 +1,5 @@ import { Cordova, Plugin } from './plugin'; -import { Observable } from '@reactivex/rxjs'; +import { Observable } from 'rxjs/Observable'; export interface ToastOptions { From bb0d81a4e9005ebfc832572f94c2c09757bbecda Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Wed, 21 Sep 2016 15:10:44 -0500 Subject: [PATCH 140/382] vBump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 04927d9ec..1234dbb46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.22", + "version": "1.3.23", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", From b6b0359fcfeb120f3963ffe60d939d4551c9fa5c Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Wed, 21 Sep 2016 15:12:27 -0500 Subject: [PATCH 141/382] fixing package.json publish --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1234dbb46..1e2d81d7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.23", + "version": "1.3.24", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", @@ -57,7 +57,7 @@ "build:esm": "tsc -p tsconfig-esm.json", "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", "build:minify": "gulp minify:dist", - "publish": "npm run build && npm publish && bash ./scripts/bower.sh", + "shipit": "npm run build && npm publish && bash ./scripts/bower.sh", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "plugin:create": "gulp plugin:create" }, From 6a19c8cf484f45af9d8f9b0bfb43778c416f59d5 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:11:43 -0500 Subject: [PATCH 142/382] fix(ts): use old ts version for 1.3.x #567 --- package.json | 15 ++++++--------- tsconfig.json | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 tsconfig.json diff --git a/package.json b/package.json index 1e2d81d7e..40fe25038 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,8 @@ { "name": "ionic-native", - "version": "1.3.24", + "version": "1.3.25", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", - "main": "dist/es5/index.js", - "typings": "dist/es5/index.d.ts", - "module": "dist/esm/index.js", + "main": "dist/index.js", "files": [ "dist" ], @@ -43,7 +41,7 @@ "tsify": "~1.0.4", "tslint": "^3.8.1", "tslint-ionic-rules": "0.0.5", - "typescript": "^2.0.2", + "typescript": "^1.8.10", "watchify": "~3.7.0" }, "scripts": { @@ -52,10 +50,9 @@ "start": "npm run test:watch", "lint": "gulp lint", "watch": "tsc -w", - "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", - "build:js": "tsc -p tsconfig-es5.json", - "build:esm": "tsc -p tsconfig-esm.json", - "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", + "build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify", + "build:js": "tsc", + "build:bundle": "browserify dist/index.js > dist/ionic.native.js", "build:minify": "gulp minify:dist", "shipit": "npm run build && npm publish && bash ./scripts/bower.sh", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..be48d5b1b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "ES5", + "sourceMap": true, + "declaration": true, + "experimentalDecorators": true, + "outDir": "dist", + "moduleResolution": "node" + }, + "files": [ + "typings/es6-shim/es6-shim.d.ts", + "src/index.ts" + ] +} From de1086b894d162a8870c92d7f74440f29ac2d035 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:22:50 -0500 Subject: [PATCH 143/382] Bump to 2.0.0 typescript --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 40fe25038..24f3ec614 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.25", + "version": "2.0.0", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ @@ -41,7 +41,7 @@ "tsify": "~1.0.4", "tslint": "^3.8.1", "tslint-ionic-rules": "0.0.5", - "typescript": "^1.8.10", + "typescript": "^2.0.2", "watchify": "~3.7.0" }, "scripts": { From 2f20deacf286eb5ae2e831352548ad78e1778817 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:36:27 -0500 Subject: [PATCH 144/382] Revert "Bump to 2.0.0 typescript" This reverts commit de1086b894d162a8870c92d7f74440f29ac2d035. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 24f3ec614..40fe25038 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.0.0", + "version": "1.3.25", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ @@ -41,7 +41,7 @@ "tsify": "~1.0.4", "tslint": "^3.8.1", "tslint-ionic-rules": "0.0.5", - "typescript": "^2.0.2", + "typescript": "^1.8.10", "watchify": "~3.7.0" }, "scripts": { From b1ca6af2c3a16f789b24a7242a909e66aea711e8 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:36:04 -0500 Subject: [PATCH 145/382] add typings for old release --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 40fe25038..fa7ca9a6a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dist" ], "dependencies": { - "rxjs": "^5.0.0-beta.12" + "rxjs": "^5.0.0-beta.6" }, "devDependencies": { "browserify": "^13.0.1", @@ -67,6 +67,7 @@ "url": "https://github.com/driftyco/ionic-native/issues" }, "homepage": "https://github.com/driftyco/ionic-native", + "typings": "./dist/index.d.ts", "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog" From bfb63a77a252f2132a09515b7633433d2993d5fe Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:37:01 -0500 Subject: [PATCH 146/382] chore(npm): bump to 1.3.26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fa7ca9a6a..e902d7ac4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.25", + "version": "1.3.26", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From f87237852fcb8444f9d82dbbd9f9bcedf9854459 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:39:51 -0500 Subject: [PATCH 147/382] chore(npm): bump to 1.3.27 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e902d7ac4..7b0a6f487 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.26", + "version": "1.3.27", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From c33842f8f027d0ccd0259e807a3a6c64bc4b81f0 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 13:58:57 -0500 Subject: [PATCH 148/382] chore(npm): proper 2.0.0 typescript --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1e2d81d7e..3f4ef49e7 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "ionic-native", - "version": "1.3.24", + "version": "2.0.1", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", "module": "dist/esm/index.js", + "typings": "./dist/index.d.ts", "files": [ "dist" ], From e50b961bf9d6ce46e24991a7705ed6302b9642e8 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 15:10:44 -0500 Subject: [PATCH 149/382] fix(npm): duplicate typings --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 9f72c03a5..9f3633da7 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,10 @@ { "name": "ionic-native", - "version": "2.0.1", + "version": "2.0.2", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", "module": "dist/esm/index.js", - "typings": "./dist/index.d.ts", "files": [ "dist" ], @@ -70,7 +69,6 @@ "url": "https://github.com/driftyco/ionic-native/issues" }, "homepage": "https://github.com/driftyco/ionic-native", - "typings": "./dist/index.d.ts", "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog" From 4292959c87e4329335e349eda72b8cd0e38168f3 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 20:35:19 -0500 Subject: [PATCH 150/382] fix(plugins): export VideoPlayer. Fixes #563 --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index dfa52d1c6..9300d2085 100644 --- a/src/index.ts +++ b/src/index.ts @@ -207,6 +207,7 @@ TouchID, // Transfer, TextToSpeech, Vibration, +VideoPlayer, WebIntent, YoutubeVideoPlayer, Zip From a0b6b1084b013fb932d7bcfe36a3f571774b9836 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 20:37:36 -0500 Subject: [PATCH 151/382] fix(webintent): add type param. Fixes #564 --- src/plugins/webintent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/webintent.ts b/src/plugins/webintent.ts index a5b4b95d8..568a33e8e 100644 --- a/src/plugins/webintent.ts +++ b/src/plugins/webintent.ts @@ -35,7 +35,7 @@ export class WebIntent { } @Cordova() - static startActivity(options: { action: any, url: string }): Promise { return; } + static startActivity(options: { action: any, url: string, type?: string }): Promise { return; } @Cordova() static hasExtra(extra: any): Promise { return; } From 48196da28194db7b3ff50f2089304e6679939510 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 Sep 2016 20:43:51 -0500 Subject: [PATCH 152/382] feat(push): add coldstart property. Fixes #559 --- src/plugins/push.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index dea0b2007..92e72c8db 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -55,6 +55,7 @@ export interface NotificationEventAdditionalData { */ foreground?: boolean; collapse_key?: string; + coldstart?: boolean; from?: string; notId?: string; } From 6948eabc96f25b1065fdd91098837ae9e4ddb702 Mon Sep 17 00:00:00 2001 From: Ramon Ornelas Date: Sat, 24 Sep 2016 09:39:31 -0300 Subject: [PATCH 153/382] style(inapppurchase): fix angular style --- src/plugins/inapppurchase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts index ba68223a8..6603fcdfb 100644 --- a/src/plugins/inapppurchase.ts +++ b/src/plugins/inapppurchase.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** From e7e45f608cfea56c6983a29b59b98b6dd4634a1c Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 24 Sep 2016 15:39:03 -0500 Subject: [PATCH 154/382] feat(npm): typescript 2.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f3633da7..611fa3f50 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "tsify": "~1.0.4", "tslint": "^3.8.1", "tslint-ionic-rules": "0.0.5", - "typescript": "^1.8.10", + "typescript": "^2.0.1", "watchify": "~3.7.0" }, "scripts": { From 6407518892d31466354469b6b48260d73de3bc1c Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 24 Sep 2016 15:44:28 -0500 Subject: [PATCH 155/382] Add back erroneous exports --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9300d2085..69653c193 100644 --- a/src/index.ts +++ b/src/index.ts @@ -156,14 +156,14 @@ AppVersion, Badge, BarcodeScanner, Base64ToGallery, -// BatteryStatus, +BatteryStatus, Brightness, BLE, BluetoothSerial, CallNumber, CameraPreview, Clipboard, -// CodePush, +CodePush, Crop, DBMeter, Deeplinks, @@ -172,7 +172,7 @@ Dialogs, Diagnostic, EmailComposer, EstimoteBeacons, -// File, +File, FileChooser, FileOpener, Flashlight, @@ -204,7 +204,7 @@ Splashscreen, SQLite, StatusBar, TouchID, -// Transfer, +Transfer, TextToSpeech, Vibration, VideoPlayer, From a092a31a1ed4c286d922f0c5089d1b4bab5d46a6 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 24 Sep 2016 16:00:44 -0500 Subject: [PATCH 156/382] feat(emailcomposer): use new supported plugin. #568 --- src/plugins/emailcomposer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index 7701a5235..eb79c99d4 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -44,10 +44,10 @@ declare var cordova: any; * ``` */ @Plugin({ - plugin: 'cordova-plugin-email-composer', + plugin: 'cordova-plugin-email', pluginRef: 'cordova.plugins.email', - repo: 'https://github.com/katzer/cordova-plugin-email-composer.git', - platforms: ['Android', 'iOS', 'Windows Phone 8'] + repo: 'https://github.com/hypery2k/cordova-email-plugin', + platforms: ['Android', 'iOS'] }) export class EmailComposer { From f60d08b7a4110d7e183a36df5f0dadf412726ca5 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 24 Sep 2016 17:26:23 -0500 Subject: [PATCH 157/382] feat(plugin): cordova function override. fixes #437 --- src/plugins/backgroundmode.ts | 28 +++++++++++------ src/plugins/plugin.ts | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 9db7f4c86..ae0c77540 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -1,4 +1,6 @@ -import { Cordova, Plugin } from './plugin'; +import { Cordova, CordovaFunctionOverride, Plugin } from './plugin'; + +import { Observable } from 'rxjs/Observable'; /** * @name Background Mode @@ -80,17 +82,25 @@ export class BackgroundMode { @Cordova({ platforms: ['Android'] }) - static update(options?: Configure): void { } + static configure(options?: Configure): void { } /** - * Sets a callback for a specific event - * Can be used to get notified or run function when the background mode has been activated, deactivated or failed. - * @param {string} eventName The name of the event. Available events: activate, deactivate, failure + * Called when background mode is activated. */ - @Cordova({ - sync: true - }) - static on(eventName: string, callback: any): void { } + @CordovaFunctionOverride() + static onactivate(): Observable { return; }; + + /** + * Called when background mode is deactivated. + */ + @CordovaFunctionOverride() + static ondeactivate(): Observable { return; }; + + /** + * Called when background mode fails + */ + @CordovaFunctionOverride() + static onfailure(): Observable { return; }; } diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 55b3ff0c1..a0acfc9cc 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -230,6 +230,47 @@ function wrapEventObservable(event: string): Observable { }); } +/** + * Certain plugins expect the user to override methods in the plugin. For example, + * window.cordova.plugins.backgroundMode.onactivate = function() { ... }. + * + * Unfortunately, this is brittle and would be better wrapped as an Observable. overrideFunction + * does just this. + */ +function overrideFunction(pluginObj: any, methodName: string, args: any[], opts: any = {}): Observable { + return new Observable(observer => { + + let pluginInstance = getPlugin(pluginObj.pluginRef); + + if (!pluginInstance) { + // Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation). + if (!window.cordova) { + cordovaWarn(pluginObj.name, methodName); + observer.error({ + error: 'cordova_not_available' + }); + } + + pluginWarn(pluginObj, methodName); + observer.error({ + error: 'plugin_not_installed' + }); + return; + } + + let method = pluginInstance[methodName]; + if (!method) { + observer.error({ + error: 'no_such_method' + }); + observer.complete(); + return; + } + pluginInstance[methodName] = observer.next.bind(observer); + }); +} + + /** * @private * @param pluginObj @@ -364,3 +405,19 @@ export function InstanceProperty(target: any, key: string, descriptor: TypedProp return descriptor; } + +/** + * @private + * + * Wrap a stub function in a call to a Cordova plugin, checking if both Cordova + * and the required plugin are installed. + */ +export function CordovaFunctionOverride(opts: any = {}) { + return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor) => { + return { + value: function(...args: any[]) { + return overrideFunction(this, methodName, opts); + } + }; + }; +} From 62f15045141fdda60baf9c6fc1ad7ed7916e2782 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 24 Sep 2016 17:30:07 -0500 Subject: [PATCH 158/382] vBump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 611fa3f50..4cbb5ae37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.0.2", + "version": "2.0.3", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", From 3266d21ba437921d1e4011c4a37d22a4c92e8f98 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 24 Sep 2016 17:33:31 -0500 Subject: [PATCH 159/382] chore(changelog): update changelog --- CHANGELOG.md | 71 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd8d9d220..931949953 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ + +## [2.0.3](https://github.com/driftyco/ionic-native/compare/v1.3.21...v2.0.3) (2016-09-24) + + +### Bug Fixes + +* **call-number:** number should be a string ([763ad1b](https://github.com/driftyco/ionic-native/commit/763ad1b)), closes [#545](https://github.com/driftyco/ionic-native/issues/545) +* **googlemaps:** CameraPosition target can now be LatLngBounds ([23fc908](https://github.com/driftyco/ionic-native/commit/23fc908)), closes [#547](https://github.com/driftyco/ionic-native/issues/547) +* **npm:** duplicate typings ([e50b961](https://github.com/driftyco/ionic-native/commit/e50b961)) +* **plugins:** export VideoPlayer. Fixes [#563](https://github.com/driftyco/ionic-native/issues/563) ([4292959](https://github.com/driftyco/ionic-native/commit/4292959)) +* **ts:** use old ts version for 1.3.x [#567](https://github.com/driftyco/ionic-native/issues/567) ([6a19c8c](https://github.com/driftyco/ionic-native/commit/6a19c8c)) +* **webintent:** add type param. Fixes [#564](https://github.com/driftyco/ionic-native/issues/564) ([a0b6b10](https://github.com/driftyco/ionic-native/commit/a0b6b10)) + + +### Features + +* **background-geolocation:** add showAppSettings function ([281575b](https://github.com/driftyco/ionic-native/commit/281575b)), closes [#548](https://github.com/driftyco/ionic-native/issues/548) +* **BackgroundGeolocation:** code cleanup ([3170686](https://github.com/driftyco/ionic-native/commit/3170686)) +* **BackgroundGeolocation:** Update to the latest version ([808a75e](https://github.com/driftyco/ionic-native/commit/808a75e)) +* **BackgroundGeolocation:** Update to the latest version ([919e8da](https://github.com/driftyco/ionic-native/commit/919e8da)) +* **build:** Support ES2015 modules ([4014972](https://github.com/driftyco/ionic-native/commit/4014972)) +* **emailcomposer:** use new supported plugin. [#568](https://github.com/driftyco/ionic-native/issues/568) ([a092a31](https://github.com/driftyco/ionic-native/commit/a092a31)) +* **localNotifications:** added register and has permission functions ([#536](https://github.com/driftyco/ionic-native/issues/536)) ([c83b043](https://github.com/driftyco/ionic-native/commit/c83b043)) +* **npm:** typescript 2.0.2 ([e7e45f6](https://github.com/driftyco/ionic-native/commit/e7e45f6)) +* **plugin:** cordova function override. fixes [#437](https://github.com/driftyco/ionic-native/issues/437) ([f60d08b](https://github.com/driftyco/ionic-native/commit/f60d08b)) +* **push:** add coldstart property. Fixes [#559](https://github.com/driftyco/ionic-native/issues/559) ([48196da](https://github.com/driftyco/ionic-native/commit/48196da)) +* **scripts:** publish script with npm and bower. Fixes [#448](https://github.com/driftyco/ionic-native/issues/448) ([3903fee](https://github.com/driftyco/ionic-native/commit/3903fee)) + + + ## [1.3.21](https://github.com/driftyco/ionic-native/compare/v1.3.20...v1.3.21) (2016-09-07) @@ -15,6 +45,7 @@ * **install-instructions:** This fixes install instructions for deeplinks, facebook and googlemaps ([#499](https://github.com/driftyco/ionic-native/issues/499)) ([877ac27](https://github.com/driftyco/ionic-native/commit/877ac27)) * **media:** nest the constructor logic ([a566240](https://github.com/driftyco/ionic-native/commit/a566240)) * **mixpanel:** Make eventProperties optional ([#501](https://github.com/driftyco/ionic-native/issues/501)) ([51364f8](https://github.com/driftyco/ionic-native/commit/51364f8)) +* **ng1:** fail gracefully when angular 1 promises can't be retrieved ([d135dc2](https://github.com/driftyco/ionic-native/commit/d135dc2)) * **ng1:** grab injector from app. [#451](https://github.com/driftyco/ionic-native/issues/451) ([2dc68a4](https://github.com/driftyco/ionic-native/commit/2dc68a4)) * remove CanvasCamera plugin ([c75f898](https://github.com/driftyco/ionic-native/commit/c75f898)) * **social-sharing:** shareViaEmail now resolves/rejects when not providing optional args ([c76de34](https://github.com/driftyco/ionic-native/commit/c76de34)) @@ -133,12 +164,13 @@ -## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.13...v1.3.14) (2016-08-15) +## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.14) (2016-08-15) ### Bug Fixes * **datepicker:** date now accepts Date, string, or number ([#428](https://github.com/driftyco/ionic-native/issues/428)) ([aaddd9e](https://github.com/driftyco/ionic-native/commit/aaddd9e)), closes [#354](https://github.com/driftyco/ionic-native/issues/354) +* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85)) ### Features @@ -149,25 +181,24 @@ - -## [1.3.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13) + +## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.11...v1.3.12) (2016-08-13) ### Bug Fixes -* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85)) +* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866)) - -## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13) + +## [1.3.11](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.11) (2016-08-11) ### Bug Fixes * **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)) * **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)) -* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866)) * **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0)) * **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)) @@ -340,12 +371,28 @@ -## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26) +## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...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)) + + +### 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)) @@ -354,7 +401,6 @@ * **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)) ### Features @@ -362,13 +408,6 @@ * **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 f36b1c03cbaed2ddc71d4cbd02d55959d2267258 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 15:29:03 -0400 Subject: [PATCH 160/382] refractor(googlemaps): fix typo in GoogleMapsTileOverlayOptions --- 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 08048f89b..3f8f8d6c9 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -872,7 +872,7 @@ export class GoogleMapsPolygon { * @private */ export interface GoogleMapsTileOverlayOptions { - titleUrilFormat?: string; + titleUrlFormat?: string; visible?: boolean; zIndex?: number; tileSize?: number; From c5733326a97cdb53899ca8a9e5dafab19b0e4094 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sun, 25 Sep 2016 16:42:31 -0300 Subject: [PATCH 161/382] fix(isdebug): export IsDebug class (#578) --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 69653c193..48764d35d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -184,6 +184,7 @@ Hotspot, InAppPurchase, Insomnia, Instagram, +IsDebug, Keyboard, MusicControls, NativeAudio, From 3a6ec05bef87290bc6d3c80f8c43bfcc84d814ed Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 16:55:17 -0400 Subject: [PATCH 162/382] style(googlemaps): remove unecessary new lines --- src/plugins/googlemaps.ts | 443 +++++++++++--------------------------- 1 file changed, 130 insertions(+), 313 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 3f8f8d6c9..df98877c3 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -103,9 +103,7 @@ export class GoogleMap { * @return {Promise} */ @Cordova() - static isAvailable(): Promise { - return; - } + static isAvailable(): Promise { return; } constructor(element: string|HTMLElement, options?: any) { if (typeof element === 'string') element = document.getElementById(element); @@ -138,12 +136,10 @@ export class GoogleMap { } @CordovaInstance({ sync: true }) - setDebuggable(isDebuggable: boolean): void { - } + setDebuggable(isDebuggable: boolean): void { } @CordovaInstance({ sync: true }) - setClickable(isClickable: boolean): void { - } + setClickable(isClickable: boolean): void { } /** * Get the position of the camera. @@ -151,9 +147,7 @@ export class GoogleMap { * @return {Promise} */ @CordovaInstance() - getCameraPosition(): Promise { - return; - } + getCameraPosition(): Promise { return; } /** * Get the location of the user. @@ -161,9 +155,7 @@ export class GoogleMap { * @return {Promise} */ @CordovaInstance() - getMyLocation(options?: MyLocationOptions): Promise { - return; - } + getMyLocation(options?: MyLocationOptions): Promise { return; } /** * Get the visible region. @@ -171,38 +163,28 @@ export class GoogleMap { * @return {Promise} */ @CordovaInstance() - getVisibleRegion(): Promise { - return; - } + getVisibleRegion(): Promise { return; } @CordovaInstance({ sync: true }) - showDialog(): void { - } + showDialog(): void { } @CordovaInstance({ sync: true }) - closeDialog(): void { - } + closeDialog(): void { } @CordovaInstance() - getLicenseInfo(): Promise { - return; - } + getLicenseInfo(): Promise { return; } @CordovaInstance({ sync: true }) - setCenter(latLng: GoogleMapsLatLng): void { - } + setCenter(latLng: GoogleMapsLatLng): void { } @CordovaInstance({ sync: true }) - setZoom(zoomLevel: number): void { - } + setZoom(zoomLevel: number): void { } @CordovaInstance({ sync: true }) - setMapTypeId(typeId: string): void { - } + setMapTypeId(typeId: string): void { } @CordovaInstance({ sync: true }) - setTilt(tiltLevel: number): void { - } + setTilt(tiltLevel: number): void { } @CordovaInstance() animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } @@ -211,24 +193,19 @@ export class GoogleMap { moveCamera(cameraPosition: CameraPosition): Promise { return; } @CordovaInstance({ sync: true }) - setMyLocationEnabled(enabled: boolean): void { - } + setMyLocationEnabled(enabled: boolean): void { } @CordovaInstance({ sync: true }) - setIndoorEnabled(enabled: boolean): void { - } + setIndoorEnabled(enabled: boolean): void { } @CordovaInstance({ sync: true }) - setTrafficEnabled(enabled: boolean): void { - } + setTrafficEnabled(enabled: boolean): void { } @CordovaInstance({ sync: true }) - setCompassEnabled(enabled: boolean): void { - } + setCompassEnabled(enabled: boolean): void { } @CordovaInstance({ sync: true }) - setAllGesturesEnabled(enabled: boolean): void { - } + setAllGesturesEnabled(enabled: boolean): void { } addMarker(options: GoogleMapsMarkerOptions): Promise { return new Promise( @@ -329,55 +306,40 @@ export class GoogleMap { } @CordovaInstance({ sync: true }) - setDiv(domNode: HTMLElement): void { - } + setDiv(domNode: HTMLElement): void { } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - setOptions(options: any): void { - } + setOptions(options: any): void { } @CordovaInstance({ sync: true }) - setBackgroundColor(backgroundColor: string): void { - } + setBackgroundColor(backgroundColor: string): void { } @CordovaInstance({ sync: true }) - setPadding(top?: number, right?: number, bottom?: number, left?: number): void { - } + setPadding(top?: number, right?: number, bottom?: number, left?: number): void { } @CordovaInstance({ sync: true }) - clear(): void { - } + clear(): void { } @CordovaInstance({ sync: true }) - refreshLayout(): void { - } + refreshLayout(): void { } @CordovaInstance() - fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise { - return; - } + fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise { return; } @CordovaInstance() - fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise { - return; - } + fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise { return; } @CordovaInstance() - toDataURL(): Promise { - return; - } + toDataURL(): Promise { return; } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } @CordovaInstance({ sync: true }) - panBy(): void { - } + panBy(): void { } } @@ -461,8 +423,7 @@ export interface GoogleMapsMarkerIcon { */ export class GoogleMapsMarker { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } addEventListener(event: any): Observable { return new Observable( @@ -474,117 +435,79 @@ export class GoogleMapsMarker { } @CordovaInstance({ sync: true }) - isVisible(): boolean { - return; - } + isVisible(): boolean { return; } @CordovaInstance() - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - getHashCode(): string { - return; - } + getHashCode(): string { return; } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } @CordovaInstance({ sync: true }) - setOpacity(alpha: number): void { - } + setOpacity(alpha: number): void { } @CordovaInstance({ sync: true }) - getOpacity(): number { - return; - } + getOpacity(): number { return; } @CordovaInstance({ sync: true }) - setZIndex(): void { - } + setZIndex(): void { } @CordovaInstance({ sync: true }) - setIconAnchor(x: number, y: number): void { - } + setIconAnchor(x: number, y: number): void { } @CordovaInstance({ sync: true }) - setInfoWindowAnchor(x: number, y: number): void { - } + setInfoWindowAnchor(x: number, y: number): void { } @CordovaInstance({ sync: true }) - setDraggable(draggable: boolean): void { - } + setDraggable(draggable: boolean): void { } @CordovaInstance({ sync: true }) - isDraggable(): boolean { - return; - } + isDraggable(): boolean { return; } @CordovaInstance({ sync: true }) - setFlat(flat: boolean): void { - return; - } + setFlat(flat: boolean): void { return; } @CordovaInstance({ sync: true }) - setIcon(icon: GoogleMapsMarkerIcon): void { - } + setIcon(icon: GoogleMapsMarkerIcon): void { return; } @CordovaInstance({ sync: true }) - setTitle(title: string): void { - } + setTitle(title: string): void { } @CordovaInstance({ sync: true }) - getTitle(): string { - return; - } + getTitle(): string { return; } @CordovaInstance({ sync: true }) - setSnippet(snippet: string): void { - } + setSnippet(snippet: string): void { } @CordovaInstance({ sync: true }) - getSnippet(): string { - return; - } + getSnippet(): string { return; } @CordovaInstance({ sync: true }) - setRotation(rotation: number): void { - } + setRotation(rotation: number): void { } @CordovaInstance({ sync: true }) - getRotation(): number { - return; - } + getRotation(): number { return; } @CordovaInstance({ sync: true }) - showInfoWindow(): number { - return; - } + showInfoWindow(): number { return; } @CordovaInstance({ sync: true }) - hideInfoWindow(): number { - return; - } + hideInfoWindow(): number { return; } @CordovaInstance({ sync: true }) - setPosition(latLng: GoogleMapsLatLng): void { - } + setPosition(latLng: GoogleMapsLatLng): void { return; } @CordovaInstance() - getPosition(): Promise { - return; - } + getPosition(): Promise { return; } @CordovaInstance({ sync: true }) - getMap(): GoogleMap { - return; - } + getMap(): GoogleMap { return; } @CordovaInstance({ sync: true }) - setAnimation(animation: string): void { - } - + setAnimation(animation: string): void { } } @@ -606,8 +529,7 @@ export interface GoogleMapsCircleOptions { */ export class GoogleMapsCircle { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } addEventListener(event: any): Observable { return new Observable( @@ -619,66 +541,46 @@ export class GoogleMapsCircle { } @CordovaInstance({ sync: true }) - getCenter(): GoogleMapsLatLng { - return; - } + getCenter(): GoogleMapsLatLng { return; } @CordovaInstance({ sync: true }) - getRadius(): number { - return; - } + getRadius(): number { return; } @CordovaInstance({ sync: true }) - getStrokeColor(): string { - return; - } + getStrokeColor(): string { return; } @CordovaInstance({ sync: true }) - getVisible(): boolean { - return; - } + getVisible(): boolean { return; } @CordovaInstance({ sync: true }) - getZIndex(): number { - return; - } + getZIndex(): number { return; } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } @CordovaInstance({ sync: true }) - setCenter(latLng: GoogleMapsLatLng): void { - } + setCenter(latLng: GoogleMapsLatLng): void { } @CordovaInstance({ sync: true }) - setFillColor(fillColor: string): void { - } + setFillColor(fillColor: string): void { } @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void { - } + setStrokeColor(strokeColor: string): void { } @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void { - } + setStrokeWidth(strokeWidth: number): void { } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { - } + setZIndex(zIndex: number): void { } @CordovaInstance({ sync: true }) - setRadius(radius: number): void { - } + setRadius(radius: number): void { } @CordovaInstance({ sync: true }) - getMap(): GoogleMap { - return; - } + getMap(): GoogleMap { return; } } /** @@ -697,8 +599,7 @@ export interface GoogleMapsPolylineOptions { * @private */ export class GoogleMapsPolyline { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } addEventListener(event: any): Observable { return new Observable( @@ -710,62 +611,43 @@ export class GoogleMapsPolyline { } @CordovaInstance({ sync: true }) - getPoints(): Array { - return; - } + getPoints(): Array { return; } @CordovaInstance({ sync: true }) - getCOlor(): string { - return; - } + getCOlor(): string { return; } @CordovaInstance({ sync: true }) - getWidth(): number { - return; - } + getWidth(): number { return; } @CordovaInstance({ sync: true }) - getGeodesic(): boolean { - return; - } + getGeodesic(): boolean { return; } @CordovaInstance({ sync: true }) - getZIndex(): number { - return; - } + getZIndex(): number { return; } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } @CordovaInstance({ sync: true }) - setPoints(points: Array): void { - } + setPoints(points: Array): void { } @CordovaInstance({ sync: true }) - setColor(color: string): void { - } + setColor(color: string): void { } @CordovaInstance({ sync: true }) - setWidth(width: number): void { - } + setWidth(width: number): void { } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { - } + setZIndex(zIndex: number): void { } @CordovaInstance({ sync: true }) - setGeoDesic(geoDesic: boolean): void { - } + setGeoDesic(geoDesic: boolean): void { } @CordovaInstance({ sync: true }) - getMap(): GoogleMap { - return; - } + getMap(): GoogleMap { return; } } @@ -788,8 +670,7 @@ export interface GoogleMapsPolygonOptions { */ export class GoogleMapsPolygon { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } addEventListener(event: any): Observable { return new Observable( @@ -801,71 +682,49 @@ export class GoogleMapsPolygon { } @CordovaInstance({ sync: true }) - getPoints(): Array { - return; - } + getPoints(): Array { return; } @CordovaInstance({ sync: true }) - getStrokeColor(): string { - return; - } + getStrokeColor(): string { return; } @CordovaInstance({ sync: true }) - getFillColor(): string { - return; - } + getFillColor(): string { return; } @CordovaInstance({ sync: true }) - getStrokeWidth(): number { - return; - } + getStrokeWidth(): number { return; } @CordovaInstance({ sync: true }) - getGeodesic(): boolean { - return; - } + getGeodesic(): boolean { return; } @CordovaInstance({ sync: true }) - getVisible(): boolean { - return; - } + getVisible(): boolean { return; } @CordovaInstance({ sync: true }) - getZIndex(): boolean { - return; - } + getZIndex(): boolean { return; } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } @CordovaInstance({ sync: true }) - setPoints(points: Array): void { - } + setPoints(points: Array): void { } @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void { - } + setStrokeColor(strokeColor: string): void { } @CordovaInstance({ sync: true }) - setFillColor(fillColor: string): void { - } + setFillColor(fillColor: string): void { } @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void { - } + setStrokeWidth(strokeWidth: number): void { } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { - } + setZIndex(zIndex: number): void { } @CordovaInstance({ sync: true }) - setGeodesic(geodesic: boolean): void { - } + setGeodesic(geodesic: boolean): void { } } /** @@ -884,52 +743,37 @@ export interface GoogleMapsTileOverlayOptions { */ export class GoogleMapsTileOverlay { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } @CordovaInstance({ sync: true }) - getVisible(): boolean { - return; - } + getVisible(): boolean { return; } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - getFadeIn(): boolean { - return; - } + getFadeIn(): boolean { return; } @CordovaInstance({ sync: true }) - setFadeIn(fadeIn: boolean): void { - } + setFadeIn(fadeIn: boolean): void { } @CordovaInstance({ sync: true }) - getZIndex(): number { - return; - } + getZIndex(): number { return; } @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { - } + setZIndex(zIndex: number): void { } @CordovaInstance({ sync: true }) - getOpacity(): number { - return; - } + getOpacity(): number { return; } @CordovaInstance({ sync: true }) - setOpacity(opacity: number): void { - } + setOpacity(opacity: number): void { } @CordovaInstance({ sync: true }) - clearTileCache(): void { - } + clearTileCache(): void { } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } } @@ -950,43 +794,31 @@ export interface GoogleMapsGroundOverlayOptions { */ export class GoogleMapsGroundOverlay { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } @CordovaInstance({ sync: true }) - setBearing(bearing: number): void { - } + setBearing(bearing: number): void { } @CordovaInstance({ sync: true }) - getBearing(): number { - return; - } + getBearing(): number { return; } @CordovaInstance({ sync: true }) - setOpacity(opacity: number): void { - } + setOpacity(opacity: number): void { } @CordovaInstance({ sync: true }) - getOpacity(): number { - return; - } + getOpacity(): number { return; } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { - } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - getVisible(): boolean { - return; - } + getVisible(): boolean { return; } @CordovaInstance({ sync: true }) - setImage(image: string): void { - }; + setImage(image: string): void { }; @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } } @@ -1004,17 +836,13 @@ export interface GoogleMapsKmlOverlayOptions { */ export class GoogleMapsKmlOverlay { - constructor(private _objectInstance: any) { - } + constructor(private _objectInstance: any) { } @CordovaInstance({ sync: true }) - remove(): void { - } + remove(): void { } @CordovaInstance({ sync: true }) - getOverlays(): Array { - return; - } + getOverlays(): Array { return; } } /** @@ -1029,28 +857,19 @@ export class GoogleMapsLatLngBounds { } @CordovaInstance({ sync: true }) - toString(): string { - return; - } + toString(): string { return; } @CordovaInstance({ sync: true }) - toUrlValue(precision?: number): string { - return; - } + toUrlValue(precision?: number): string { return; } @CordovaInstance({ sync: true }) - extend(LatLng: GoogleMapsLatLng): void { - } + extend(LatLng: GoogleMapsLatLng): void { } @CordovaInstance({ sync: true }) - contains(LatLng: GoogleMapsLatLng): boolean { - return; - } + contains(LatLng: GoogleMapsLatLng): boolean { return; } @CordovaInstance({ sync: true }) - getCenter(): GoogleMapsLatLng { - return; - } + getCenter(): GoogleMapsLatLng { return; } } /** @@ -1068,9 +887,7 @@ export class GoogleMapsLatLng { } @CordovaInstance({ sync: true }) - toString(): string { - return; - } + toString(): string { return; } toUrlValue(precision?: number): string { precision = precision || 6; From 972d63b2d2dfd8d51deb9469ec02be400bbf4d9e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 17:53:17 -0400 Subject: [PATCH 163/382] feat(themable-browser): add ThemableBrowser plugin closes #549 --- src/plugins/themable-browser.ts | 194 ++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 src/plugins/themable-browser.ts diff --git a/src/plugins/themable-browser.ts b/src/plugins/themable-browser.ts new file mode 100644 index 000000000..43259837c --- /dev/null +++ b/src/plugins/themable-browser.ts @@ -0,0 +1,194 @@ +import { Plugin, CordovaInstance } from './plugin'; +import { Observable } from 'rxjs/Observable'; +import { InAppBrowserEvent } from './inappbrowser'; +declare var cordova: any; +/** + * @name ThemableBrowser + * @description + * In-app browser that allows styling. + * + * @usage + * ``` + * import { ThemableBrowser } from 'ionic-native'; + * + * // can add options from the original InAppBrowser in a JavaScript object form (not string) + * // This options object also takes additional parameters introduced by the ThemableBrowser plugin + * // This example only shows the additional parameters for ThemableBrowser + * // Note that that `image` and `imagePressed` values refer to resources that are stored in your app + * let options = { + * statusbar: { + * color: '#ffffffff' + * }, + * toolbar: { + * height: 44, + * color: '#f0f0f0ff' + * }, + * title: { + * color: '#003264ff', + * showPageTitle: true + * }, + * backButton: { + * image: 'back', + * imagePressed: 'back_pressed', + * align: 'left', + * event: 'backPressed' + * }, + * forwardButton: { + * image: 'forward', + * imagePressed: 'forward_pressed', + * align: 'left', + * event: 'forwardPressed' + * }, + * closeButton: { + * image: 'close', + * imagePressed: 'close_pressed', + * align: 'left', + * event: 'closePressed' + * }, + * customButtons: [ + * { + * image: 'share', + * imagePressed: 'share_pressed', + * align: 'right', + * event: 'sharePressed' + * } + * ], + * menu: { + * image: 'menu', + * imagePressed: 'menu_pressed', + * title: 'Test', + * cancel: 'Cancel', + * align: 'right', + * items: [ + * { + * event: 'helloPressed', + * label: 'Hello World!' + * }, + * { + * event: 'testPressed', + * label: 'Test!' + * } + * ] + * }, + * backButtonCanClose: true + * }; + * + * let browser = new ThemeableBrowser('https://ionic.io', '_blank', options); + * + * ``` + * We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here. + */ +@Plugin({ + plugin: 'cordova-plugin-themeablebrowser', + pluginRef: 'cordova.ThemeableBrowser', + repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser' +}) +export class ThemableBrowser { + private _objectInstance: any; + + constructor(url: string, target: string, styleOptions: ThemeableBrowserOptions) { + this._objectInstance = cordova.ThemableBrowser.open(arguments); + } + + /** + * Displays an browser window that was opened hidden. Calling this has no effect + * if the browser was already visible. + */ + @CordovaInstance({sync: true}) + show(): void { } + + /** + * Closes the browser window. + */ + @CordovaInstance({sync: true}) + close(): void { } + + /** + * Reloads the current page + */ + @CordovaInstance({ sync: true }) + reload(): void { } + + /** + * Injects JavaScript code into the browser window. + * @param script Details of the script to run, specifying either a file or code key. + */ + @CordovaInstance() + executeScript(script: {file?: string, code?: string}): Promise {return; } + + /** + * Injects CSS into the browser window. + * @param css Details of the script to run, specifying either a file or code key. + */ + @CordovaInstance() + insertCss(css: {file?: string, code?: string}): Promise {return; } + + /** + * A method that allows you to listen to events happening in the browser. + * Available events are: `ThemableBrowserError`, `ThemableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined` + * @param event Event name + * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. + */ + on(event: string): Observable { + return new Observable((observer) => { + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); + }); + } + +} + +export interface ThemeableBrowserOptions { + statusbar?: { color: string; }; + toobar?: { + height?: number; + color?: string; + }; + title?: { color: string; }; + backButton?: ThemableBrowserButton; + forwardButton?: ThemableBrowserButton; + closeButton?: ThemableBrowserButton; + customButtons?: ThemableBrowserButton[]; + menu?: { + image?: string; + imagePressed?: string; + title?: string; + cancel?: string; + align?: string; + items?: { + event: string; + label: string; + }[]; + }; + backButtonCanClose?: boolean; + + // inAppBrowser options + location?: string; + hidden?: string; + clearcache?: string; + clearsessioncache?: string; + zoom?: string; + hardwareback?: string; + mediaPlaybackRequiresUserAction?: string; + shouldPauseOnSuspsend?: string; + closebuttoncaption?: string; + disallowoverscroll?: string; + enableViewportScale?: string; + allowInlineMediaPlayback?: string; + keyboardDisplayRequiresUserAction?: string; + suppressesIncrementalRendering?: string; + presentationstyle?: string; + transitionstyle?: string; + toolbarposition?: string; + fullscreen?: string; +} + +export interface ThemableBrowserButton { + wwwImage?: string; + image?: string; + wwwImagePressed?: string; + imagePressed?: string; + wwwImageDensity?: number; + align?: string; + event?: string; +} From b9151bc062bccf31c22c864190eba0a1372cabbc Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 17:55:13 -0400 Subject: [PATCH 164/382] feat(themable-browser): add ThemableBrowser plugin closes #549 --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index 48764d35d..83f9dc845 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,6 +98,7 @@ import { ThreeDeeTouch } from './plugins/3dtouch'; import { Toast } from './plugins/toast'; import { TouchID } from './plugins/touchid'; import { TextToSpeech } from './plugins/text-to-speech'; +import {ThemableBrowser} from './plugins/themable-browser'; import { TwitterConnect } from './plugins/twitter-connect'; import { Vibration } from './plugins/vibration'; import { VideoEditor } from './plugins/video-editor'; @@ -142,6 +143,7 @@ export * from './plugins/safari-view-controller'; export * from './plugins/sms'; export * from './plugins/spinnerdialog'; export * from './plugins/streaming-media'; +export * from './plugins/themable-browser'; export * from './plugins/toast'; export * from './plugins/twitter-connect'; export * from './plugins/video-editor'; @@ -311,6 +313,7 @@ window['IonicNative'] = { TouchID, Transfer, TextToSpeech, + ThemableBrowser, TwitterConnect, VideoEditor, VideoPlayer, From df06a24746776e0447f8cea6c398b751b654a4c7 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 17:57:38 -0400 Subject: [PATCH 165/382] fix badges --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1be9d43d..0a1869f3a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ [![Circle CI](https://circleci.com/gh/driftyco/ionic-native.svg?style=shield)](https://circleci.com/gh/driftyco/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -[![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native-playground) +[![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native) [![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/) - +[![NPM](https://nodei.co/npm-dl/ionic-native.png?months=12&height=3)](https://nodei.co/npm/ionic-native/) # Ionic Native From 310e0942fd5954f0ff7368702e982503b6d358e0 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 17:58:13 -0400 Subject: [PATCH 166/382] fix badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a1869f3a..71b2018ee 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native) [![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/) -[![NPM](https://nodei.co/npm-dl/ionic-native.png?months=12&height=3)](https://nodei.co/npm/ionic-native/) +[![NPM](https://nodei.co/npm-dl/ionic-native.png?months=6)](https://nodei.co/npm/ionic-native/) # Ionic Native From 8bb22fb576def0d0b3fed28f77ae58253e8bd295 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 17:58:32 -0400 Subject: [PATCH 167/382] fix badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71b2018ee..5a5e39235 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/ionic-native) [![NPM](https://nodei.co/npm/ionic-native.png?stars&downloads)](https://nodei.co/npm/ionic-native/) -[![NPM](https://nodei.co/npm-dl/ionic-native.png?months=6)](https://nodei.co/npm/ionic-native/) +[![NPM](https://nodei.co/npm-dl/ionic-native.png?months=6&height=2)](https://nodei.co/npm/ionic-native/) # Ionic Native From c377489aba7bceede9617ac7bb748f9bd65090d1 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 17:59:21 -0400 Subject: [PATCH 168/382] chore(): add license --- LICENSE | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..623c70a83 --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +Copyright 2015-present Drifty Co. +http://drifty.com/ + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 60b7c7469adf9096c3deee666475562bc0da0629 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 18:28:22 -0400 Subject: [PATCH 169/382] feat(location-accuracy): add location accuracy plugin (#583) closes #484 --- src/index.ts | 5 ++- src/plugins/location-accuracy.ts | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/plugins/location-accuracy.ts diff --git a/src/index.ts b/src/index.ts index 83f9dc845..8a042898b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,6 +64,7 @@ import { IsDebug } from './plugins/is-debug'; import { Keyboard } from './plugins/keyboard'; import { LaunchNavigator } from './plugins/launchnavigator'; import { LocalNotifications } from './plugins/localnotifications'; +import { LocationAccuracy } from './plugins/location-accuracy'; import { MediaCapture } from './plugins/media-capture'; import { NativeAudio } from './plugins/native-audio'; import { NativePageTransitions } from './plugins/native-page-transitions'; @@ -98,7 +99,7 @@ import { ThreeDeeTouch } from './plugins/3dtouch'; import { Toast } from './plugins/toast'; import { TouchID } from './plugins/touchid'; import { TextToSpeech } from './plugins/text-to-speech'; -import {ThemableBrowser} from './plugins/themable-browser'; +import { ThemableBrowser } from './plugins/themable-browser'; import { TwitterConnect } from './plugins/twitter-connect'; import { Vibration } from './plugins/vibration'; import { VideoEditor } from './plugins/video-editor'; @@ -188,6 +189,7 @@ Insomnia, Instagram, IsDebug, Keyboard, +LocationAccuracy, MusicControls, NativeAudio, NativeStorage, @@ -278,6 +280,7 @@ window['IonicNative'] = { Keyboard, LaunchNavigator, LocalNotifications, + LocationAccuracy, Market, MediaCapture, MediaPlugin, diff --git a/src/plugins/location-accuracy.ts b/src/plugins/location-accuracy.ts new file mode 100644 index 000000000..b99f2405e --- /dev/null +++ b/src/plugins/location-accuracy.ts @@ -0,0 +1,66 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name LocationAccuracy + * @description + * This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually. + * + * @usage + * ``` + * import { LocationAccuracy } from 'ionic-native'; + * + * LocationAccuracy.canRequest().then((canRequest: boolean) => { + * + * if(canRequest) { + * // the accuracy option will be ignored by iOS + * LocationAccuracy.request(LocaitonAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( + * () => console.log('Request successful'), + * error => console.log('Error requesting location permissions', error) + * ); + * } + * + * }); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-request-location-accuracy', + pluginRef: 'cordova.plugins.locationAccuracy', + repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy' +}) +export class LocationAccuracy { + /** + * Indicates if you can request accurate location + * @returns {Promise} Returns a promise that resovles with a boolean that indicates if you can request accurate location + */ + @Cordova() + static canRequest(): Promise { return; } + + /** + * Indicates if a request is currently in progress + * @returns {Promise} Returns a promise that resolves with a boolean that indicates if a request is currently in progress + */ + @Cordova() + static isRequesting(): Promise { return; } + + /** + * Requests accurate location + * @returns {Promise} Returns a promise that resolves on success and rejects if an error occurred + */ + @Cordova({ callbackOrder: 'reverse' }) + static request(accuracy: string): Promise { return; } + + static REQUEST_PRIORITY_NO_POWER = 0; + static REQUEST_PRIORITY_LOW_POWER = 1; + static REQUEST_PRIORITY_BALANCED_POWER_ACCURACY = 2; + static REQUEST_PRIORITY_HIGH_ACCURACY = 3; + static SUCCESS_SETTINGS_SATISFIED = 0; + static SUCCESS_USER_AGREED = 1; + static ERROR_ALREADY_REQUESTING = -1; + static ERROR_INVALID_ACTION = 0; + static ERROR_INVALID_ACCURACY = 1; + static ERROR_EXCEPTION = 1; + static ERROR_CANNOT_CHANGE_ACCURACY = 3; + static ERROR_USER_DISAGREED = 4; + static ERROR_GOOGLE_API_CONNECTION_FAILED = 4; + +} From 79f0a3fc7b34aeba6ad319b3990ff9027732652b Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 18:36:00 -0400 Subject: [PATCH 170/382] feat(ble): add startScanWithOptions closes #539 --- src/plugins/ble.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 6df9f2f6d..a653841aa 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -207,6 +207,18 @@ export class BLE { }) static startScan(services: string[]): Observable { return; } + /** + * Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports). + * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices + * @param options {any} + */ + @Cordova({ + observable: true, + clearFunction: 'stopScan', + clearWithArgs: true + }) + static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable { return; } + /** * Stop a scan started by `startScan`. * From 49bf9b7cc5a664e2bcfb232bbacaf7f8f418b90e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 25 Sep 2016 18:44:29 -0400 Subject: [PATCH 171/382] docs(ble): add return docs for startScanWithOptions --- src/plugins/ble.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index a653841aa..a947a87d6 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -211,6 +211,7 @@ export class BLE { * Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports). * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices * @param options {any} + * @return Returns an Observable that notifies of each peripheral discovered. */ @Cordova({ observable: true, From d45a2b5407a3c1dcf10a033d61889be9a5a2635d Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sun, 25 Sep 2016 17:59:56 -0500 Subject: [PATCH 172/382] feat(plugin): add getPlugin to plugin interface. Fixes #582 --- src/plugins/plugin.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index a0acfc9cc..b2d0127c3 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -326,6 +326,10 @@ export function Plugin(config) { return !!getPlugin(config.pluginRef); }; + cls['getPlugin'] = function() { + return getPlugin(config.pluginRef); + }; + return cls; }; } From 1b87af86bf1510ba10823b02ec88cc55192cac88 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sun, 25 Sep 2016 20:01:39 -0300 Subject: [PATCH 173/382] docs(emailcompposer): change repo #568 (#584) --- src/plugins/emailcomposer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index eb79c99d4..9e5069f10 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -7,7 +7,7 @@ declare var cordova: any; * @name Email Composer * @description * - * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer). + * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/hypery2k/cordova-email-plugin). * * 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. * A good alternative to this plugin is the social sharing plugin. From 47112c7c24dce2b1462410ebf420525d54dee2bb Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sun, 25 Sep 2016 18:17:03 -0500 Subject: [PATCH 174/382] feat(plugin): checkInstall w/ warning msg --- src/plugins/plugin.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index b2d0127c3..23ea04ff6 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -18,7 +18,7 @@ export const getPlugin = function(pluginRef: string): any { * @param pluginObj * @param method */ -export const pluginWarn = function(pluginObj: any, method: string) { +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.'); @@ -322,7 +322,7 @@ export function Plugin(config) { cls[k] = config[k]; } - cls['installed'] = function() { + cls['installed'] = function(printWarning?: boolean) { return !!getPlugin(config.pluginRef); }; @@ -330,6 +330,16 @@ export function Plugin(config) { return getPlugin(config.pluginRef); }; + cls['checkInstall'] = function() { + let pluginInstance = getPlugin(config.pluginRef); + + if (!pluginInstance) { + pluginWarn(cls); + return false; + } + return true; + }; + return cls; }; } From dde011c8f6c3972bc881130f3e752b786ef13c15 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 27 Sep 2016 10:46:41 -0400 Subject: [PATCH 175/382] document interfaces + other classes --- scripts/docs/dgeni-config.js | 37 +++- scripts/docs/tag-defs/tag-defs.js | 4 +- scripts/docs/templates/common.template.html | 232 ++++++++++++-------- src/plugins/camera.ts | 3 + src/plugins/googlemaps.ts | 27 +++ 5 files changed, 207 insertions(+), 96 deletions(-) diff --git a/scripts/docs/dgeni-config.js b/scripts/docs/dgeni-config.js index a0cf4217c..49c3a108a 100644 --- a/scripts/docs/dgeni-config.js +++ b/scripts/docs/dgeni-config.js @@ -31,12 +31,37 @@ module.exports = function(currentVersion) { // $runBefore: ['rendering-docs'], // $process: function(docs){ // docs.forEach(function(doc){ -// if (doc.members && doc.name == "IonicApp"){ -// doc.members.forEach(function(method){ -// if (method.name === "load") { -// console.log(method); -// } -// }) +// if (doc.name == "Camera"){ +// +// // console.log(doc.tags); +// // doc.tags.forEach(function(tag){ +// // if(tag.tagName == 'classes'){ +// // +// // } +// // }); +// +// // doc.moduleDoc.exports.forEach(function(d,i){ +// // if(d.name === 'CameraOptions') { +// // console.log('Name: ' + d.name); +// // console.log('Type: ' + d.docType); +// // console.log('First member: ', d.members[0]); +// // } +// // }); +// +// +// // var exports = doc.exportSymbol.parent.exports; +// // for(var p in exports) { +// // if(p == 'CameraOptions') +// // { +// // var x = exports[p]; +// // console.log(x.members.quality); +// // } +// // } +// // doc.members.forEach(function(method){ +// // if (method.name === "getPicture") { +// // console.log(method); +// // } +// // }) // } // }) // } diff --git a/scripts/docs/tag-defs/tag-defs.js b/scripts/docs/tag-defs/tag-defs.js index 5c0803ccd..f4a8afad2 100644 --- a/scripts/docs/tag-defs/tag-defs.js +++ b/scripts/docs/tag-defs/tag-defs.js @@ -1,5 +1,7 @@ module.exports = [ {'name': 'advanced'}, {'name': 'demo'}, - {'name': 'usage'} + {'name': 'usage'}, + {'name': 'classes'}, // related classes + {'name': 'interfaces'} // related interfaces ]; diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index 252bc5c9b..124490cde 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -11,6 +11,39 @@ doc: "<$ doc.name $>" docType: "<$ doc.docType $>" --- +<@ macro interfaceTable(interface) @> +<@ for export in doc.moduleDoc.exports -@> +<@ if export.name == interface @> + + + + + + + + + + <@ for param in export.members @> + + + + + + <@ endfor @> + +
ParamTypeDetails
+ <$ param.name $> + <@ if param.optional @>
(optional)
<@ endif @> +
+ <$ param.returnType | escape $> + + <$ param.description | marked $> +
+ +<@ endif @> +<@- endfor @> +<@ endmacro @> + <@ macro paramList(paramData) -@> <@- if paramData -@>( <@- for param in paramData -@> @@ -73,15 +106,81 @@ docType: "<$ doc.docType $>" <$ typeList(fn.typeList) $> <$ fn.description $> <@- endmacro -@> + + +<@ macro documentClass(doc) @> +<@- if doc.statics.length -@> +

Static Members

+<@ for method in doc.statics -@> +<@ if not method.internal @> +
+

<$ functionSyntax(method) $>

+<@- if method.decorators @> +<@ for prop in method.decorators[0].argumentInfo @> +<@ if prop.platforms @> +

+ Platforms: + <@- for platform in prop.platforms @> + <$ platform $>  + <@ endfor -@> +

+<@ endif @> +<@ endfor @> +<@- endif @> + +<$ method.description $> + +<@ if method.params @> +<$ paramTable(method.params) $> +<@ endif @> + +<@ if method.this -@> +

Method's `this` + <$ method.this $> +

+<@- endif @> + +<@ if method.returns @> +
+ + Returns: <$ typeInfo(method.returns) $> +
+<@ endif @> +<@ endif @> +<@ endfor -@> +<@ endif @> + + +<@- if doc.members and doc.members.length @> + +

Instance Members

+<@ for method in doc.members -@> +
+

+ <$ functionSyntax(method) $> +

+<$ method.description $> +<@ if method.params -@> +<$ paramTable(method.params) $> +<@- endif @> +<@ if method.this -@> +

Method's `this` + <$ method.this $> +

+<@- endif @> +<@ if method.returns -@> +
+ + Returns: <$ typeInfo(method.returns) $> +
+<@- endif @> +<@- endfor @> +<@- endif -@> +<@ endmacro @> <@ block body @> - - <@ block content @> - <@ block header @> -

- <@ if doc.docType == "directive" @> <$ doc.name | dashCase $> <@ else @> @@ -108,10 +207,6 @@ docType: "<$ doc.docType $>" Improve this doc -<@ if doc.codepen @> -{% include codepen.html id="<$ doc.codepen $>" %} -<@ endif @> - <@ endblock @> @@ -141,9 +236,9 @@ docType: "<$ doc.docType $>"

Supported platforms

<@ block platforms @>
    - <@- for platform in prop.platforms @> + <@ for platform in prop.platforms -@>
  • <$ platform $>
  • - <@ endfor -@> + <@- endfor @>
<@ endblock @> @@ -181,12 +276,11 @@ docType: "<$ doc.docType $>" - <@ for prop in doc.properties @> + <@ for prop in doc.properties -@> <$ prop.name $> - <@ if hasTypes @> <$ prop.type.name $> @@ -197,86 +291,12 @@ docType: "<$ doc.docType $>" <$ prop.description $> - <@ endfor @> + <@- endfor @> <@ endif @> -<@- if doc.statics.length -@> -

Static Members

-<@- for method in doc.statics @><@ if not method.internal @> -
-

<$ functionSyntax(method) $>

- -<@- if method.decorators @> -<@ for prop in method.decorators[0].argumentInfo @> -<@ if prop.platforms @> -

-Platforms: -<@- for platform in prop.platforms @> -<$ platform $>  -<@ endfor -@> -

-<@ endif @> -<@ endfor @> -<@ endif -@> - -<$ method.description $> - -<@ if method.params @> -<$ paramTable(method.params) $> -<@ endif @> - -<@ if method.this @> -

Method's `this` - <$ method.this $> -

-<@ endif @> - -<@ if method.returns @> -
- - Returns: <$ typeInfo(method.returns) $> -
-<@ endif @> -<@ endif @> -<@ endfor -@> -<@ endif @> - - -<@- if doc.members and doc.members.length @> - -

Instance Members

-<@- for method in doc.members @> - -
- -

- <$ functionSyntax(method) $> -

- -<$ method.description $> - -<@ if method.params @> -<$ paramTable(method.params) $> -<@ endif @> - -<@ if method.this @> -

Method's `this` - <$ method.this $> -

-<@ endif @> - -<@ if method.returns @> -
- - Returns: <$ typeInfo(method.returns) $> -
-<@ endif @> - -<@ endfor -@> - -<@- endif -@> +<$ documentClass(doc) $> <@ block advanced @> <@- if doc.advanced -@> @@ -285,6 +305,40 @@ docType: "<$ doc.docType $>" <@- endif -@> <@ endblock @> + +<@ for tag in doc.tags.tags -@> +<@ if tag.tagName == 'classes' -@> +

Related Classes

+<@ set classes = tag.description.split('\n') @> +<@ for item in classes -@> +<@ if item.length > 1 @> +<@ for export in doc.moduleDoc.exports -@> +<@ if export.name == item @> +

<$ item $>

+<$ documentClass(export) $> +<@ endif @> +<@- endfor @> +<@ endif @> +<@- endfor @> +<@- endif @> +<@- endfor @> + + + +<@ for tag in doc.tags.tags -@> +<@ if tag.tagName == 'interfaces' @> +

Interfaces

+<@ set interfaces = tag.description.split('\n') @> +<@ for item in interfaces -@> +<@ if item.length > 1 @> +

<$ item $>

+<$ interfaceTable(item) $> +<@ endif @> +<@- endfor @> +<@ endif @> +<@- endfor @> + + <@- if doc.see @> diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 12e61530d..41b5bd6d1 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -105,6 +105,9 @@ export interface CameraPopoverOptions { * // Handle error * }); * ``` + * @interfaces + * CameraOptions + * CameraPopoverOptions */ @Plugin({ plugin: 'cordova-plugin-camera', diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index df98877c3..ab08a60f7 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -87,6 +87,33 @@ export const GoogleMapsAnimation = { * marker.showInfoWindow(); * }); * ``` + * @interfaces + * AnimateCameraOptions + * CameraPosition + * MyLocation + * MyLocationOptions + * VisibleRegion + * GoogleMApsMarkerOptions + * GoogleMapsMarkerIcon + * GoogleMapsCircleOptions + * GoogleMapsPolylineOptions + * GoogleMapsPolygonOptions + * GoogleMapsTileOverlayOptions + * GoogleMapsGroundOverlayOptions + * GoogleMapsKmlOverlayOptions + * GeocoderRequest + * GeocoderResult + * @classes + * GoogleMapsMarker + * GoogleMapsCircle + * GoogleMapsPolyline + * GoogleMapsPolygon + * GoogleMapsTileOverlay + * GoogleMapsGroundOverlay + * GoogleMapsKmlOverlay + * GoogleMapsLatLngBounds + * GoogleMapsLatLng + * Geocoder */ @Plugin({ pluginRef: 'plugin.google.maps.Map', From be2c19825995854d32d40f8bfa57e3a9414aa8c4 Mon Sep 17 00:00:00 2001 From: SylvainGuittard Date: Tue, 27 Sep 2016 10:51:04 -0400 Subject: [PATCH 176/382] fix(googlemaps): typo in GoogleMapsTileOverlayOptions (#589) --- 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 df98877c3..47fd69130 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -731,7 +731,7 @@ export class GoogleMapsPolygon { * @private */ export interface GoogleMapsTileOverlayOptions { - titleUrlFormat?: string; + tileUrlFormat?: string; visible?: boolean; zIndex?: number; tileSize?: number; From 8d21f5f2254390e88cc048c9a08aecdb0f1f974b Mon Sep 17 00:00:00 2001 From: Daniel Leal Date: Tue, 27 Sep 2016 15:51:43 +0100 Subject: [PATCH 177/382] fix(googlemaps): CameraPosition target can now be GoogleMapsLatLng[] (#587) --- 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 47fd69130..34a5c350e 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -358,7 +358,7 @@ export interface AnimateCameraOptions { * @private */ export interface CameraPosition { - target?: GoogleMapsLatLng | GoogleMapsLatLngBounds; + target?: GoogleMapsLatLng | GoogleMapsLatLngBounds | GoogleMapsLatLng[]; zoom?: number; tilt?: number; bearing?: number; From 2ed84b1b71394e0231fd75b95cebd765cef2c996 Mon Sep 17 00:00:00 2001 From: Hoisel Date: Tue, 27 Sep 2016 15:00:01 -0300 Subject: [PATCH 178/382] fix(social-sharing): shareWithOptions method signature (#598) Fix shareWithOptions method signature, replacing 'options.file' property with 'options.files' to match social sharing plugin [method interface](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209) --- src/plugins/socialsharing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index 058e968c5..78a1ad264 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -50,7 +50,7 @@ export class SocialSharing { @Cordova({ platforms: ['iOS', 'Android'] }) - static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise { return; } + static shareWithOptions(options: { message?: string, subject?: string, files?: string|string[], url?: string, chooserTitle?: string }): Promise { return; } /** * Checks if you can share via a specific app. From 16f05c3b0d7e84bf395e36567ab14d52bc42ed76 Mon Sep 17 00:00:00 2001 From: Steve Sanders Date: Wed, 28 Sep 2016 12:51:03 -0500 Subject: [PATCH 179/382] fix(push): Add support for passing notification id into finish (#600) --- src/plugins/push.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 92e72c8db..c4cfff762 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -134,8 +134,9 @@ export interface PushNotification { * successHandler gets called when background push processing is successfully completed. * @param successHandler * @param errorHandler + * @param id */ - finish(successHandler: () => any, errorHandler: () => any): void; + finish(successHandler: () => any, errorHandler: () => any, id?: string): void; } export interface IOSPushOptions { From 80ff2f3bfad2bddecf442f6f6f9e4554ef9fb4dc Mon Sep 17 00:00:00 2001 From: Chris Maissan Date: Wed, 28 Sep 2016 13:54:19 -0400 Subject: [PATCH 180/382] fix(calendar): fixed modifyEventWithOptions and related interface * Fixed Calendar modifyEventWithOptions method * Updated comments --- src/plugins/calendar.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 0f09902b9..225f1cafb 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -5,6 +5,7 @@ import { Cordova, Plugin } from './plugin'; * @private */ export interface CalendarOptions { + id?: string; firstReminderMinutes?: number; secondReminderMinutes?: number; recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly' @@ -336,7 +337,8 @@ export class Calendar { * @param {string} [newNotes] The new event notes * @param {Date} [newStartDate] The new event start date * @param {Date} [newEndDate] The new event end date - * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions` + * @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions` * @return Returns a Promise */ @Cordova() @@ -351,8 +353,9 @@ export class Calendar { newNotes?: string, newStartDate?: Date, newEndDate?: Date, - options?: CalendarOptions - ) { return; } + filterOptions?: CalendarOptions, + newOptions?: CalendarOptions + ): Promise { return; } /** * Delete an event. From d6060a95d7be35a14f0d8b9e9c1602e7c88dadb8 Mon Sep 17 00:00:00 2001 From: Gianfranco Palumbo Date: Wed, 28 Sep 2016 22:56:27 +0100 Subject: [PATCH 181/382] fix(power-management): fix repo and pluginref (#603) Fixes the link that is generated in the docs here http://ionicframework.com/docs/v2/native/powermanagement/ --- src/plugins/power-management.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/power-management.ts b/src/plugins/power-management.ts index 5d9e1d6d9..a43999acc 100644 --- a/src/plugins/power-management.ts +++ b/src/plugins/power-management.ts @@ -17,8 +17,8 @@ import { Plugin, Cordova } from './plugin'; */ @Plugin({ plugin: 'cordova-plugin-powermanagement-orig', - pluginRef: 'https://github.com/Viras-/cordova-plugin-powermanagement', - repo: 'powerManagement' + pluginRef: 'powerManagement', + repo: 'https://github.com/Viras-/cordova-plugin-powermanagement' }) export class PowerManagement { /** From 66e9e46458712640102ddcdcc284d42d02d55a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Z=C3=B6hner?= Date: Thu, 29 Sep 2016 17:52:14 +0200 Subject: [PATCH 182/382] feat(googlemaps): support bounds in Geocoder (#599) --- src/plugins/googlemaps.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 34a5c350e..6437c64a2 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -900,6 +900,7 @@ export class GoogleMapsLatLng { */ export interface GeocoderRequest { address?: string; + bounds?: GoogleMapsLatLng[]; position?: { lat: number; lng: number }; } /** From 58a99a14d50b7de24d7236e2fd2006004d87976f Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 1 Oct 2016 15:05:08 -0400 Subject: [PATCH 183/382] fix(media): add status as a parmeter instead of property of instance --- src/plugins/media.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index 5ef39307d..d2d6e086b 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -118,19 +118,17 @@ export class MediaPlugin { // Properties private _objectInstance: any; - status: Observable; init: Promise; // Methods /** * Open a media file * @param src {string} A URI containing the audio content. + * @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes */ - constructor(src: string) { + constructor(src: string, onStatusUpdate?: Function) { this.init = new Promise((resolve, reject) => { - this.status = new Observable((observer) => { - this._objectInstance = new Media(src, resolve, reject, observer.next.bind(observer)); - }); + this._objectInstance = new Media(src, resolve, reject, onStatusUpdate); }); } From 96bb4d38dc47063ad20a04737cf15c1559c4ee27 Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 1 Oct 2016 15:19:16 -0400 Subject: [PATCH 184/382] chore(media): remove unused import, ensure plugin is installed --- src/plugins/media.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index d2d6e086b..a71d3ebcc 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -1,6 +1,4 @@ -import { CordovaInstance, Plugin } from './plugin'; -import { Observable } from 'rxjs/Observable'; - +import {CordovaInstance, Plugin, getPlugin, pluginWarn} from './plugin'; declare var Media: any; @@ -69,11 +67,12 @@ export interface MediaError { * * ``` */ -@Plugin({ +let pluginMeta = { repo: 'https://github.com/apache/cordova-plugin-media', plugin: 'cordova-plugin-media', pluginRef: 'Media' -}) +}; +@Plugin(pluginMeta) export class MediaPlugin { // Constants @@ -127,9 +126,13 @@ export class MediaPlugin { * @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes */ constructor(src: string, onStatusUpdate?: Function) { - this.init = new Promise((resolve, reject) => { - this._objectInstance = new Media(src, resolve, reject, onStatusUpdate); - }); + if (!!getPlugin('Media')) { + this.init = new Promise((resolve, reject) => { + this._objectInstance = new Media(src, resolve, reject, onStatusUpdate); + }); + } else { + pluginWarn(pluginMeta); + } } /** From 0a07bef2d25d8ef222b37be9e50e5dcf387d703a Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 1 Oct 2016 17:15:32 -0300 Subject: [PATCH 185/382] chore(): move CONTRIBUTING to .github/CONTRIBUTING (#613) --- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md From 624bc1d9b56e5e77eec0b9ba03b2f7e600798308 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 1 Oct 2016 17:15:58 -0300 Subject: [PATCH 186/382] style(media): fix angular style (#614) --- src/plugins/media.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index a71d3ebcc..d9af0592d 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -1,4 +1,4 @@ -import {CordovaInstance, Plugin, getPlugin, pluginWarn} from './plugin'; +import { CordovaInstance, Plugin, getPlugin, pluginWarn } from './plugin'; declare var Media: any; From 8f26f4b3ef49b023ea0a27216a50653310e45510 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sun, 2 Oct 2016 19:19:24 -0300 Subject: [PATCH 187/382] chore(): move templates of the root folder to scripts/templates similar to Ionic (#612) --- gulpfile.js | 2 +- TEMPLATE-MIN => scripts/templates/wrap-min.tmpl | 0 TEMPLATE => scripts/templates/wrap.tmpl | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename TEMPLATE-MIN => scripts/templates/wrap-min.tmpl (100%) rename TEMPLATE => scripts/templates/wrap.tmpl (100%) diff --git a/gulpfile.js b/gulpfile.js index 863bcfbf5..8994b78a3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,7 +33,7 @@ gulp.task('lint', function() { gulp.task('plugin:create', function(){ if(flags.n && flags.n !== ''){ - var src = flags.m?'./TEMPLATE-MIN':'./TEMPLATE'; + var src = flags.m?'./scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl'; return gulp.src(src) .pipe(replace('PluginName', flags.n)) .pipe(rename(decamelize(flags.n, '-') + '.ts')) diff --git a/TEMPLATE-MIN b/scripts/templates/wrap-min.tmpl similarity index 100% rename from TEMPLATE-MIN rename to scripts/templates/wrap-min.tmpl diff --git a/TEMPLATE b/scripts/templates/wrap.tmpl similarity index 100% rename from TEMPLATE rename to scripts/templates/wrap.tmpl From a99b753d2dc47b494c64a8ec0e853413f55001be Mon Sep 17 00:00:00 2001 From: Tomas Beran Date: Mon, 3 Oct 2016 00:20:01 +0200 Subject: [PATCH 188/382] feat(stepcounter): add stepcounter plugin (#607) * feat(stepcounter): add stepcounter plugin * docs(stepcounter): add missing returns --- src/index.ts | 3 ++ src/plugins/stepcounter.ts | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/plugins/stepcounter.ts diff --git a/src/index.ts b/src/index.ts index 8a042898b..f7e66519f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -94,6 +94,7 @@ import { SpinnerDialog } from './plugins/spinnerdialog'; import { Splashscreen } from './plugins/splashscreen'; import { SQLite } from './plugins/sqlite'; import { StatusBar } from './plugins/statusbar'; +import { Stepcounter } from './plugins/stepcounter'; import { StreamingMedia } from './plugins/streaming-media'; import { ThreeDeeTouch } from './plugins/3dtouch'; import { Toast } from './plugins/toast'; @@ -208,6 +209,7 @@ Sim, Splashscreen, SQLite, StatusBar, +Stepcounter, TouchID, Transfer, TextToSpeech, @@ -310,6 +312,7 @@ window['IonicNative'] = { Splashscreen, SQLite, StatusBar, + Stepcounter, StreamingMedia, ThreeDeeTouch, Toast, diff --git a/src/plugins/stepcounter.ts b/src/plugins/stepcounter.ts new file mode 100644 index 000000000..4a7bfd78e --- /dev/null +++ b/src/plugins/stepcounter.ts @@ -0,0 +1,73 @@ +import { Plugin, Cordova } from './plugin'; +/** + * @name Stepcounter + * @description + * Cordova plugin for using device's stepcounter on Android (API > 19) + * + * Use to + * - start and stop stepcounter service + * - read device's stepcounter data + * + * @usage + * ``` + * import { Stepcounter } from 'ionic-native'; + * + * let startingOffset = 0; + * Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure)); + * + * Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure)); + * + * ``` + */ +@Plugin({ + plugin: 'https://github.com/texh/cordova-plugin-stepcounter', + pluginRef: 'stepcounter', + repo: 'https://github.com/texh/cordova-plugin-stepcounter', + platforms: ['Android'] +}) +export class Stepcounter { + + /** + * Start the step counter + * + * @param startingOffset {number} will be added to the total steps counted in this session + * @return {Promise} Returns a Promise that resolves on success or rejects on failure + */ + @Cordova() + static start(startingOffset: number): Promise { return; } + + /** + * Stop the step counter + * @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure + */ + @Cordova() + static stop(): Promise { return; } + + /** + * Get the amount of steps for today (or -1 if it no data given) + * @return {Promise} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure + */ + @Cordova() + static getTodayStepCount(): Promise { return; } + + /** + * Get the amount of steps since the start command has been called + * @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure + */ + @Cordova() + static getStepCount(): Promise { return; } + + /** + * Returns true/false if Android device is running >API level 19 && has the step counter API available + * @return {Promise} Returns a Promise that resolves on success, or rejects on failure + */ + @Cordova() + static deviceCanCountSteps(): Promise { return; } + + /** + * Get the step history (JavaScript object) + * @return {Promise} Returns a Promise that resolves on success, or rejects on failure + */ + @Cordova() + static getHistory(): Promise { return; } +} From 5d13ba03d832eec0ff49dc0575c4b2c3f5006f21 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 03:14:51 -0400 Subject: [PATCH 189/382] fix(paypal): fix typings, add PayPalItem and PayPalPaymentDetails --- src/plugins/pay-pal.ts | 126 ++++++++++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 33 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 32c70fe8b..ea19307c4 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -16,6 +16,9 @@ import { Plugin, Cordova } from './plugin'; * .catch(onError); * * ``` + * @interfaces + * PayPalEnvironment + * @classes */ @Plugin({ plugin: 'com.paypal.cordova.mobilesdk', @@ -84,61 +87,106 @@ export interface PayPalEnvironment { PayPalEnvironmentProduction: string; PayPalEnvironmentSandbox: string; } -/** - * @private - */ -export declare class PayPalPayment { +export declare var PayPalPayment: { /** * Convenience constructor. * Returns a PayPalPayment with the specified amount, currency code, and short description. * @param {String} amount: The amount of the payment. * @param {String} currencyCode: The ISO 4217 currency for the payment. - * @param {String} shortDescription: A short descripton of the payment. + * @param {String} shortDescription: A short description of the payment. * @param {String} intent: "Sale" for an immediate payment. */ - new(amount: string, currencyCode: string, shortDescription: string, intent: string); - + new(amount: string, currencyCode: string, shortDescription: string, intent: string): PayPalPayment; +}; +/** + * @private + */ +export interface PayPalPayment { /** - * Optional invoice number, for your tracking purposes. (up to 256 characters) - * @param {String} invoiceNumber: The invoice number for the payment. + * The amount of the payment. */ - invoiceNumber(invoiceNumber: string): void; - + amount: string; /** - * Optional text, for your tracking purposes. (up to 256 characters) - * @param {String} custom: The custom text for the payment. + * The ISO 4217 currency for the payment. */ - custom(custom: string): void; - + currencyCode: string; /** - * Optional text which will appear on the customer's credit card statement. (up to 22 characters) - * @param {String} softDescriptor: credit card text for payment + * A short description of the payment. */ - softDescriptor(softDescriptor: string): void; - + shortDescription: string; + /** + * "Sale" for an immediate payment. + */ + intent: string; /** * Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com, * for your tracking purposes. - * @param {String} bnCode: bnCode for payment */ - bnCode(bnCode: string): void; + bnCode: string; + /** + * Optional invoice number, for your tracking purposes. (up to 256 characters) + */ + invoiceNumber: string; /** - * Optional array of PayPalItem objects. @see PayPalItem - * @note If you provide one or more items, be sure that the various prices correctly - * sum to the payment `amount` or to `paymentDetails.subtotal`. - * @param items {Array} Optional + * Optional text, for your tracking purposes. (up to 256 characters) */ - items(items?: any): void; + custom: string; + + /** + * Optional text which will appear on the customer's credit card statement. (up to 22 characters) + */ + softDescriptor: string; + + /** + * Optional array of PayPalItem objects. + */ + items: string; /** * Optional customer shipping address, if your app wishes to provide this to the SDK. - * @note make sure to set `payPalShippingAddressOption` in PayPalConfiguration to 1 or 3. - * @param {PayPalShippingAddress} shippingAddress: PayPalShippingAddress object */ - shippingAddress(shippingAddress: PayPalShippingAddress): void; + shippingAddress: string; } +export interface PayPalItem { + name: string; + quantity: number; + price: string; + currency: string; + sku: string; +} + +export declare var PayPalItem: { + /** + * The PayPalItem class defines an optional itemization for a payment. + * @see https://developer.paypal.com/docs/api/#item-object for more details. + * @param {String} name: Name of the item. 127 characters max + * @param {Number} quantity: Number of units. 10 characters max. + * @param {String} price: Unit price for this item 10 characters max. + * May be negative for "coupon" etc + * @param {String} currency: ISO standard currency code. + * @param {String} sku: The stock keeping unit for this item. 50 characters max (optional) + */ + new(name: string, quantity: number, price: string, currency: string, sku: string): PayPalItem; +}; + +export interface PayPalPaymentDetails { + subtotal: string; + shipping: string; + tax: string; +} + +export declare var PayPalPaymentDetails: { + /** + * The PayPalPaymentDetails class defines optional amount details. + * @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places. + * @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places. + * @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places. + */ + new(subtotal: string, shipping: string, tax: string): PayPalPaymentDetails; +}; + export interface PayPalConfigurationOptions { defaultUserEmail?: string; defaultUserPhoneCountryCode?: string; @@ -159,17 +207,20 @@ export interface PayPalConfigurationOptions { /** * @private */ -export declare class PayPalConfiguration { +export declare var PayPalConfiguration: { /** * You use a PayPalConfiguration object to configure many aspects of how the SDK behaves. * see defaults for options available */ - new(options: PayPalConfigurationOptions); + new(options: PayPalConfigurationOptions): PayPalConfiguration; +}; +export interface PayPalConfiguration { + } /** * @private */ -export declare class PayPalShippingAddress { +export declare var PayPalShippingAddress: { /** * See the documentation of the individual properties for more detail. * @param {String} recipientName: Name of the recipient at this address. 50 characters max. @@ -180,5 +231,14 @@ export declare class PayPalShippingAddress { * @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries. * @param {String} countryCode: 2-letter country code. 2 characters max. */ - new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string); + new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string): PayPalShippingAddress; +}; +export interface PayPalShippingAddress { + recipientName: string; + line1: string; + line2: string; + city: string; + state: string; + postalCode: string; + countryCode: string; } From 7fcd1f85a34c3fffcd77d23912e03dab87d75aa3 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 03:18:54 -0400 Subject: [PATCH 190/382] docs(paypal): add related interfaces --- src/plugins/pay-pal.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index ea19307c4..dc48277c9 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -18,7 +18,12 @@ import { Plugin, Cordova } from './plugin'; * ``` * @interfaces * PayPalEnvironment - * @classes + * PayPalPayment + * PayPAlItem + * PayPalPaymentDetails + * PayPalConfiguration + * PayPalConfigurationOptions + * PayPalShippingAddress */ @Plugin({ plugin: 'com.paypal.cordova.mobilesdk', From 344ce11a3ec20ac19ccf3ae270e7eaa4ec0ec3f7 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Mon, 3 Oct 2016 14:26:13 +0200 Subject: [PATCH 191/382] docs(LocationAccuracy): fixes typo --- src/plugins/location-accuracy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/location-accuracy.ts b/src/plugins/location-accuracy.ts index b99f2405e..124408327 100644 --- a/src/plugins/location-accuracy.ts +++ b/src/plugins/location-accuracy.ts @@ -12,7 +12,7 @@ import {Plugin, Cordova} from './plugin'; * * if(canRequest) { * // the accuracy option will be ignored by iOS - * LocationAccuracy.request(LocaitonAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( + * LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( * () => console.log('Request successful'), * error => console.log('Error requesting location permissions', error) * ); From e9e37f33f98b0f3a97641bc583b3addcdb1d3db0 Mon Sep 17 00:00:00 2001 From: Nakul Gulati Date: Mon, 3 Oct 2016 18:50:40 +0530 Subject: [PATCH 192/382] Changed observable to promise in docs GoogleMaps.one() returns Promise not Observable --- 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 6437c64a2..86cdb96e3 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -60,7 +60,7 @@ export const GoogleMapsAnimation = { * let map = new GoogleMap(mapElement); * * // listen to MAP_READY event - * map.one(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); + * map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!')); * * * // create LatLng object From 83ac4c7bbededc37642712049cd28c28f015f2b0 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 16:51:57 -0400 Subject: [PATCH 193/382] more docs --- src/plugins/pay-pal.ts | 137 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 3 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index dc48277c9..ce4a4651b 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -177,8 +177,17 @@ export declare var PayPalItem: { }; export interface PayPalPaymentDetails { + /** + * Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places. + */ subtotal: string; + /** + * Amount charged for shipping. 10 characters max with support for 2 decimal places. + */ shipping: string; + /** + * Amount charged for tax. 10 characters max with support for 2 decimal places. + */ tax: string; } @@ -192,21 +201,102 @@ export declare var PayPalPaymentDetails: { new(subtotal: string, shipping: string, tax: string): PayPalPaymentDetails; }; +/** + * @private + */ export interface PayPalConfigurationOptions { + /** + * Will be overridden by email used in most recent PayPal login. + */ defaultUserEmail?: string; + /** + * Will be overridden by phone country code used in most recent PayPal login + */ defaultUserPhoneCountryCode?: string; + /** + * Will be overridden by phone number used in most recent PayPal login. + */ defaultUserPhoneNumber?: string; + /** + * Your company name, as it should be displayed to the user when requesting consent via a PayPalFuturePaymentViewController. + */ merchantName?: string; + /** + * URL of your company's privacy policy, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController. + */ merchantPrivacyPolicyUrl?: string; + /** + * URL of your company's user agreement, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController. + */ merchantUserAgreementUrl?: string; + /** + * If set to NO, the SDK will only support paying with PayPal, not with credit cards. + * This applies only to single payments (via PayPalPaymentViewController). + * Future payments (via PayPalFuturePaymentViewController) always use PayPal. + * Defaults to true + */ acceptCreditCards?: boolean; + /** + * For single payments, options for the shipping address. + * - 0 - PayPalShippingAddressOptionNone: no shipping address applies. + * - 1 - PayPalShippingAddressOptionProvided: shipping address will be provided by your app, + * in the shippingAddress property of PayPalPayment. + * - 2 - PayPalShippingAddressOptionPayPal: user will choose from shipping addresses on file + * for their PayPal account. + * - 3 - PayPalShippingAddressOptionBoth: user will choose from the shipping address provided by your app, + * in the shippingAddress property of PayPalPayment, plus the shipping addresses on file for the user's PayPal account. + * Defaults to 0 (PayPalShippingAddressOptionNone). + */ payPalShippingAddressOption?: number; + /** + * If set to YES, then if the user pays via their PayPal account, + * the SDK will remember the user's PayPal username or phone number; + * if the user pays via their credit card, then the SDK will remember + * the PayPal Vault token representing the user's credit card. + * + * If set to NO, then any previously-remembered username, phone number, or + * credit card token will be erased, and subsequent payment information will + * not be remembered. + * + * Defaults to YES. + */ rememberUser?: boolean; + /** + * If not set, or if set to nil, defaults to the device's current language setting. + * + * Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.). + * If the library does not contain localized strings for a specified locale, then will fall back to the language. E.g., "es_CO" -> "es". + * If the library does not contain localized strings for a specified language, then will fall back to American English. + * + * If you specify only a language code, and that code matches the device's currently preferred language, + * then the library will attempt to use the device's current region as well. + * E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB". + */ languageOrLocale?: string; + /** + * Normally, the SDK blurs the screen when the app is backgrounded, + * to obscure credit card or PayPal account details in the iOS-saved screenshot. + * If your app already does its own blurring upon backgrounding, you might choose to disable this. + * Defaults to NO. + */ disableBlurWhenBackgrounding?: boolean; + /** + * If you will present the SDK's view controller within a popover, then set this property to YES. + * Defaults to NO. (iOS only) + */ presentingInPopover?: boolean; + /** + * Sandbox credentials can be difficult to type on a mobile device. Setting this flag to YES will + * cause the sandboxUserPassword and sandboxUserPin to always be pre-populated into login fields. + */ forceDefaultsInSandbox?: boolean; - sandboxUserPAssword?: string; + /** + * Password to use for sandbox if 'forceDefaultsInSandbox' is set. + */ + sandboxUserPassword?: string; + /** + * PIN to use for sandbox if 'forceDefaultsInSandbox' is set. + */ sandboxUserPin?: string; } /** @@ -219,8 +309,25 @@ export declare var PayPalConfiguration: { */ new(options: PayPalConfigurationOptions): PayPalConfiguration; }; +/** + * @private + */ export interface PayPalConfiguration { - + defaultUserEmail: string; + defaultUserPhoneCountryCode: string; + defaultUserPhoneNumber: string; + merchantName: string; + merchantPrivacyPolicyUrl: string; + merchantUserAgreementUrl: string; + acceptCreditCards: boolean; + payPalShippingAddressOption: number; + rememberUser: boolean; + languageOrLocale: string; + disableBlurWhenBackgrounding: boolean; + presentingInPopover: boolean; + forceDefaultsInSandbox: boolean; + sandboxUserPassword: string; + sandboxUserPin: string; } /** * @private @@ -230,7 +337,7 @@ export declare var PayPalShippingAddress: { * See the documentation of the individual properties for more detail. * @param {String} recipientName: Name of the recipient at this address. 50 characters max. * @param {String} line1: Line 1 of the address (e.g., Number, street, etc). 100 characters max. - * @param {String} Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional. + * @param {String} line2: Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional. * @param {String} city: City name. 50 characters max. * @param {String} state: 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries. * @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries. @@ -238,12 +345,36 @@ export declare var PayPalShippingAddress: { */ new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string): PayPalShippingAddress; }; +/** + * @private + */ export interface PayPalShippingAddress { + /** + * Name of the recipient at this address. 50 characters max. + */ recipientName: string; + /** + * Line 1 of the address (e.g., Number, street, etc). 100 characters max. + */ line1: string; + /** + * Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional. + */ line2: string; + /** + * City name. 50 characters max. + */ city: string; + /** + * 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries. + */ state: string; + /** + * ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries. + */ postalCode: string; + /** + * 2-letter country code. 2 characters max. + */ countryCode: string; } From fcda04acf1bddbb0864fbec060443781736917cb Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 16:56:15 -0400 Subject: [PATCH 194/382] add missing docs --- src/plugins/pay-pal.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index ce4a4651b..0fdc2a862 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -21,7 +21,6 @@ import { Plugin, Cordova } from './plugin'; * PayPalPayment * PayPAlItem * PayPalPaymentDetails - * PayPalConfiguration * PayPalConfigurationOptions * PayPalShippingAddress */ @@ -155,10 +154,25 @@ export interface PayPalPayment { } export interface PayPalItem { + /** + * Name of the item. 127 characters max + */ name: string; + /** + * Number of units. 10 characters max. + */ quantity: number; + /** + * Unit price for this item 10 characters max. + */ price: string; + /** + * ISO standard currency code. + */ currency: string; + /** + * The stock keeping unit for this item. 50 characters max (optional) + */ sku: string; } From 7cf9bd8e5e4ef27dba8c670fcf63a48b4a781068 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 17:04:49 -0400 Subject: [PATCH 195/382] 2.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4cbb5ae37..19f3d3c89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.0.3", + "version": "2.1.0", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "typings": "dist/es5/index.d.ts", From ebda0554443b7c172cfee88f4950480847a5c681 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 17:05:21 -0400 Subject: [PATCH 196/382] chore(): update changelog --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 931949953..4e1f07f8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ + +# [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03) + + +### Bug Fixes + +* **calendar:** fixed modifyEventWithOptions and related interface ([80ff2f3](https://github.com/driftyco/ionic-native/commit/80ff2f3)) +* **googlemaps:** CameraPosition target can now be GoogleMapsLatLng[] ([#587](https://github.com/driftyco/ionic-native/issues/587)) ([8d21f5f](https://github.com/driftyco/ionic-native/commit/8d21f5f)) +* **googlemaps:** typo in GoogleMapsTileOverlayOptions ([#589](https://github.com/driftyco/ionic-native/issues/589)) ([be2c198](https://github.com/driftyco/ionic-native/commit/be2c198)) +* **isdebug:** export IsDebug class ([#578](https://github.com/driftyco/ionic-native/issues/578)) ([c573332](https://github.com/driftyco/ionic-native/commit/c573332)) +* **media:** add status as a parmeter instead of property of instance ([58a99a1](https://github.com/driftyco/ionic-native/commit/58a99a1)) +* **paypal:** fix typings, add PayPalItem and PayPalPaymentDetails ([5d13ba0](https://github.com/driftyco/ionic-native/commit/5d13ba0)) +* **power-management:** fix repo and pluginref ([#603](https://github.com/driftyco/ionic-native/issues/603)) ([d6060a9](https://github.com/driftyco/ionic-native/commit/d6060a9)) +* **push:** Add support for passing notification id into finish ([#600](https://github.com/driftyco/ionic-native/issues/600)) ([16f05c3](https://github.com/driftyco/ionic-native/commit/16f05c3)) +* **social-sharing:** shareWithOptions method signature ([#598](https://github.com/driftyco/ionic-native/issues/598)) ([2ed84b1](https://github.com/driftyco/ionic-native/commit/2ed84b1)), closes [/github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java#L209](https://github.com//github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SocialSharing.java/issues/L209) + + +### Features + +* **ble:** add startScanWithOptions ([79f0a3f](https://github.com/driftyco/ionic-native/commit/79f0a3f)), closes [#539](https://github.com/driftyco/ionic-native/issues/539) +* **googlemaps:** support bounds in Geocoder ([#599](https://github.com/driftyco/ionic-native/issues/599)) ([66e9e46](https://github.com/driftyco/ionic-native/commit/66e9e46)) +* **location-accuracy:** add location accuracy plugin ([#583](https://github.com/driftyco/ionic-native/issues/583)) ([60b7c74](https://github.com/driftyco/ionic-native/commit/60b7c74)), closes [#484](https://github.com/driftyco/ionic-native/issues/484) +* **plugin:** add getPlugin to plugin interface. Fixes [#582](https://github.com/driftyco/ionic-native/issues/582) ([d45a2b5](https://github.com/driftyco/ionic-native/commit/d45a2b5)) +* **plugin:** checkInstall w/ warning msg ([47112c7](https://github.com/driftyco/ionic-native/commit/47112c7)) +* **stepcounter:** add stepcounter plugin ([#607](https://github.com/driftyco/ionic-native/issues/607)) ([a99b753](https://github.com/driftyco/ionic-native/commit/a99b753)) +* **themable-browser:** add ThemableBrowser plugin ([b9151bc](https://github.com/driftyco/ionic-native/commit/b9151bc)), closes [#549](https://github.com/driftyco/ionic-native/issues/549) +* **themable-browser:** add ThemableBrowser plugin ([972d63b](https://github.com/driftyco/ionic-native/commit/972d63b)), closes [#549](https://github.com/driftyco/ionic-native/issues/549) + + + ## [2.0.3](https://github.com/driftyco/ionic-native/compare/v1.3.21...v2.0.3) (2016-09-24) From c5724fdc4eec3f2b879e331134080c0c5e5e7735 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 17:38:42 -0400 Subject: [PATCH 197/382] chore(): fix main and typings paths --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 19f3d3c89..a7d026c9b 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,8 @@ "name": "ionic-native", "version": "2.1.0", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", - "main": "dist/es5/index.js", - "typings": "dist/es5/index.d.ts", - "module": "dist/esm/index.js", + "main": "dist/index.js", + "typings": "dist/index.d.ts", "files": [ "dist" ], From b5f9ba588aa4733d04212841a980681b35d866e4 Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 3 Oct 2016 17:38:47 -0400 Subject: [PATCH 198/382] 2.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7d026c9b..013af8c1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.0", + "version": "2.1.1", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "typings": "dist/index.d.ts", From 973c80b26484bb6884fb9334f931667daadf6212 Mon Sep 17 00:00:00 2001 From: perry Date: Mon, 3 Oct 2016 17:06:40 -0500 Subject: [PATCH 199/382] =?UTF-8?q?docs(pay-pal):=20interfaces=20dont?= =?UTF-8?q?=E2=80=99=20need=20to=20be=20marked=20private=20if=20their=20co?= =?UTF-8?q?rresponding=20var=20is?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/pay-pal.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 0fdc2a862..b2450640d 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -323,9 +323,7 @@ export declare var PayPalConfiguration: { */ new(options: PayPalConfigurationOptions): PayPalConfiguration; }; -/** - * @private - */ + export interface PayPalConfiguration { defaultUserEmail: string; defaultUserPhoneCountryCode: string; @@ -359,9 +357,7 @@ export declare var PayPalShippingAddress: { */ new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string): PayPalShippingAddress; }; -/** - * @private - */ + export interface PayPalShippingAddress { /** * Name of the recipient at this address. 50 characters max. From 010a6ea304c8c128287cf82bc5aefb7760f09ff6 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 4 Oct 2016 13:45:54 -0400 Subject: [PATCH 200/382] docs(geolocation): add error handling and related interfaces --- src/plugins/geolocation.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 289a1caec..b2f15ef93 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -121,14 +121,22 @@ export interface GeolocationOptions { * Geolocation.getCurrentPosition().then((resp) => { * // resp.coords.latitude * // resp.coords.longitude - * }) + * }).catch((error) => { + * console.log('Error getting location', error); + * }); * * let watch = Geolocation.watchPosition(); * watch.subscribe((data) => { + * // data can be a set of coordinates, or an error (if an error occurred). * // data.coords.latitude * // data.coords.longitude - * }) + * }); * ``` + * @interfaces + * Coordinates + * Geoposition + * PositionError + * GeolocationOptions */ @Plugin({ plugin: 'cordova-plugin-geolocation', From 7ababc4d67cec72876a1e3e596d71e7304a70405 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 4 Oct 2016 13:47:28 -0400 Subject: [PATCH 201/382] docs(googlemaps): remove related interface untill they're well documented --- src/plugins/googlemaps.ts | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index a5aa47363..86cdb96e3 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -87,33 +87,6 @@ export const GoogleMapsAnimation = { * marker.showInfoWindow(); * }); * ``` - * @interfaces - * AnimateCameraOptions - * CameraPosition - * MyLocation - * MyLocationOptions - * VisibleRegion - * GoogleMApsMarkerOptions - * GoogleMapsMarkerIcon - * GoogleMapsCircleOptions - * GoogleMapsPolylineOptions - * GoogleMapsPolygonOptions - * GoogleMapsTileOverlayOptions - * GoogleMapsGroundOverlayOptions - * GoogleMapsKmlOverlayOptions - * GeocoderRequest - * GeocoderResult - * @classes - * GoogleMapsMarker - * GoogleMapsCircle - * GoogleMapsPolyline - * GoogleMapsPolygon - * GoogleMapsTileOverlay - * GoogleMapsGroundOverlay - * GoogleMapsKmlOverlay - * GoogleMapsLatLngBounds - * GoogleMapsLatLng - * Geocoder */ @Plugin({ pluginRef: 'plugin.google.maps.Map', From 0bc73e525d62814c9aed2adb5c7f07c576115040 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 4 Oct 2016 13:59:32 -0400 Subject: [PATCH 202/382] docs(contacts): improve docs --- src/plugins/contacts.ts | 50 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 71ab50df9..f0ba12e73 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -1,9 +1,11 @@ import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin'; - declare var window: any, navigator: any; +/** + * @private + */ export interface IContactProperties { /** A globally unique identifier. */ id?: string; @@ -75,6 +77,9 @@ export class Contact implements IContactProperties { save(): Promise { return; } } +/** + * @private + */ interface IContactError { /** Error code */ code: number; @@ -82,6 +87,9 @@ interface IContactError { message: string; } +/** + * @private + */ declare var ContactError: { new (code: number): IContactError; UNKNOWN_ERROR: number; @@ -186,13 +194,21 @@ export class ContactAddress implements IContactAddress { this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country); } + /** Set to true if this ContactAddress contains the user's preferred value. */ @InstanceProperty get pref(): boolean { return; } + /** A string indicating what type of field this is, home for example. */ @InstanceProperty get type(): string { return; } + /** The full address formatted for display. */ @InstanceProperty get formatted(): string { return; } + /** The full street address. */ @InstanceProperty get streetAddress(): string { return; } + /** The city or locality. */ @InstanceProperty get locality(): string { return; } + /** The state or region. */ @InstanceProperty get region(): string { return; } + /** The zip code or postal code. */ @InstanceProperty get postalCode(): string { return; } + /** The country name. */ @InstanceProperty get country(): string { return; } } @@ -217,10 +233,15 @@ export class ContactOrganization implements IContactOrganization { constructor() { this._objectInstance = new window.ContactOrganization(); } + /** Set to true if this ContactOrganization contains the user's preferred value. */ @InstanceProperty get pref(): boolean { return; } + /** A string that indicates what type of field this is, home for example. */ @InstanceProperty get type(): string { return; } + /** The name of the organization. */ @InstanceProperty get name(): string { return; } + /** The department the contract works for. */ @InstanceProperty get department(): string { return; } + /** The contact's title at the organization. */ @InstanceProperty get title(): string { return; } } @@ -232,6 +253,10 @@ export interface IContactFindOptions { multiple?: boolean; /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */ desiredFields?: string[]; + /** + * (Android only): Filters the search to only return contacts with a phone number informed. + */ + hasPhoneNumber?: boolean; } /** @@ -244,9 +269,24 @@ export class ContactFindOptions implements IContactFindOptions { this._objectInstance = new window.ContactFindOptions(); } + /** + * The search string used to find navigator.contacts. (Default: "") + */ @InstanceProperty get filter(): string { return; } + + /** + * Determines if the find operation returns multiple navigator.contacts. (Default: false) + */ @InstanceProperty get multiple(): boolean { return; } + + /** + * Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. + */ @InstanceProperty get desiredFields(): any { return; } + + /** + * (Android only): Filters the search to only return contacts with a phone number informed. + */ @InstanceProperty get hasPhoneNumber(): boolean { return; } } @@ -268,8 +308,12 @@ export class ContactFindOptions implements IContactFindOptions { * (error: any) => console.error('Error saving contact.', error) * ); * ``` - * - * + * @interfaces + * IContactProperties + * @classes + * ContactFindOptions + * ContactOrganization + * ContactAddress */ @Plugin({ plugin: 'cordova-plugin-contacts', From bbbbb3e8d0040d132dfcc6de33bb3a47d8ca282f Mon Sep 17 00:00:00 2001 From: AndreasGassmann Date: Tue, 4 Oct 2016 21:12:39 +0200 Subject: [PATCH 203/382] feat(zBar): add zBar barcode scanner plugin (#634) --- src/index.ts | 3 ++ src/plugins/z-bar.ts | 91 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/plugins/z-bar.ts diff --git a/src/index.ts b/src/index.ts index f7e66519f..de7b6bef5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -107,6 +107,7 @@ import { VideoEditor } from './plugins/video-editor'; import { VideoPlayer } from './plugins/video-player'; import { WebIntent } from './plugins/webintent'; import { YoutubeVideoPlayer } from './plugins/youtube-video-player'; +import { ZBar } from './plugins/z-bar'; import { Zip } from './plugins/zip'; export * from './plugins/3dtouch'; export * from './plugins/background-geolocation'; @@ -217,6 +218,7 @@ Vibration, VideoPlayer, WebIntent, YoutubeVideoPlayer, +ZBar, Zip } @@ -326,6 +328,7 @@ window['IonicNative'] = { Vibration, WebIntent, YoutubeVideoPlayer, + ZBar, Zip }; diff --git a/src/plugins/z-bar.ts b/src/plugins/z-bar.ts new file mode 100644 index 000000000..185280c0b --- /dev/null +++ b/src/plugins/z-bar.ts @@ -0,0 +1,91 @@ +import { Plugin, Cordova } from './plugin'; + +/** + * @name ZBar + * @description + * The ZBar Scanner Plugin allows you to scan 2d barcodes. + * + * Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar). + * + * @usage + * ``` + * import { ZBar } from 'ionic-native'; + * + * let zBarOptions = { + * flash: "off", + * drawSight: false + * }; + * + * ZBar.scan(zBarOptions) + * .then(result => { + * console.log(result); // Scanned code + * }) + * .catch(error => { + * console.log(error); // Error message + * }); + * + * ``` + * + * @advanced + * zBar options + * + * | Option | Type | Values | Defaults | + * |--------------------|-----------|-----------------------------------------------------------------------------------------| + * | text_title |`string?` | | `"Scan QR Code"` (Android only) | + * | text_instructions |`string?` | | `"Please point your camera at the QR code."` (Android only) | + * | camera |`string?` | `"front"`, `"back"`, | `"back"` | + * | flash |`string?` | `"on"`, `"off"`, `"auto"` | `"auto"` | + * | drawSight |`boolean?` | `true`, `false` | `true` (Draws red line in center of scanner) | + * + */ +@Plugin({ + plugin: 'cordova-plugin-cszbar', + pluginRef: 'cloudSky.zBar', + repo: 'https://github.com/tjwoon/csZBar', + platforms: ['Android', 'iOS'] +}) +export class ZBar { + + /** + * Open the scanner + * @param options { ZBarOptions } Scan options + * @return Returns a Promise that resolves with the scanned string, or rejects with an error. + */ + @Cordova() + static scan(options: ZBarOptions): Promise { return; } + +} + +export interface ZBarOptions { + /** + * A string representing the title text (Android only). + * Default: "Scan QR Code" + */ + text_title?: string; + + /** + * A string representing the instruction text (Android only). + * Default: "Please point your camera at the QR code." + */ + text_instructions?: string; + + /** + * A string defining the active camera when opening the scanner. + * Possible values: "front", "back" + * Default: "back" + */ + camera?: string; + + /** + * A string defining the state of the flash. + * Possible values: "on", "off", "auto" + * Default: "auto" + */ + flash?: string; + + /** + * A boolean to show or hide a line in the center of the scanner. + * Default: true + */ + drawSight?: boolean; +} From ad3bef2e5a77fff056181af29bd74a64485239c7 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 5 Oct 2016 20:29:40 -0400 Subject: [PATCH 204/382] chore(): fix module export conflicts (#633) * chore(): fix module export conflicts * remove export{} * resolve conflicting export names --- package.json | 12 +-- src/index.ts | 141 +++++++++++++++----------------- src/plugins/estimote-beacons.ts | 37 +++++---- src/plugins/hotspot.ts | 10 +-- 4 files changed, 99 insertions(+), 101 deletions(-) diff --git a/package.json b/package.json index 013af8c1b..3462c6d51 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,9 @@ "name": "ionic-native", "version": "2.1.1", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", - "main": "dist/index.js", - "typings": "dist/index.d.ts", + "main": "dist/es5/index.js", + "module": "dist/esm/index.js", + "typings": "dist/es5/index.d.ts", "files": [ "dist" ], @@ -51,9 +52,10 @@ "start": "npm run test:watch", "lint": "gulp lint", "watch": "tsc -w", - "build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify", - "build:js": "tsc", - "build:bundle": "browserify dist/index.js > dist/ionic.native.js", + "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", + "build:js": "tsc -p tsconfig-es5.json", + "build:esm": "tsc -p tsconfig-esm.json", + "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", "build:minify": "gulp minify:dist", "shipit": "npm run build && npm publish && bash ./scripts/bower.sh", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", diff --git a/src/index.ts b/src/index.ts index de7b6bef5..8e4696871 100644 --- a/src/index.ts +++ b/src/index.ts @@ -110,119 +110,111 @@ import { YoutubeVideoPlayer } from './plugins/youtube-video-player'; import { ZBar } from './plugins/z-bar'; import { Zip } from './plugins/zip'; export * from './plugins/3dtouch'; +export * from './plugins/actionsheet'; +export * from './plugins/admob'; +export * from './plugins/android-fingerprint-auth'; +export * from './plugins/appavailability'; +export * from './plugins/apprate'; +export * from './plugins/appversion'; export * from './plugins/background-geolocation'; export * from './plugins/backgroundmode'; +export * from './plugins/badge'; +export * from './plugins/barcodescanner'; +export * from './plugins/base64togallery'; export * from './plugins/batterystatus'; +export * from './plugins/ble'; +export * from './plugins/bluetoothserial'; +export * from './plugins/brightness'; export * from './plugins/calendar'; +export * from './plugins/call-number'; export * from './plugins/camera'; +export * from './plugins/camera-preview'; export * from './plugins/card-io'; +export * from './plugins/clipboard'; export * from './plugins/code-push'; export * from './plugins/contacts'; +export * from './plugins/crop'; export * from './plugins/datepicker'; +export * from './plugins/dbmeter'; +export * from './plugins/deeplinks'; export * from './plugins/device'; +export * from './plugins/deviceaccounts'; export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; +export * from './plugins/diagnostic'; +export * from './plugins/dialogs'; +export * from './plugins/emailcomposer'; +export * from './plugins/estimote-beacons'; export * from './plugins/facebook'; export * from './plugins/file'; +export * from './plugins/file-chooser'; +export * from './plugins/file-opener'; export * from './plugins/filetransfer'; +export * from './plugins/flashlight'; +export * from './plugins/geofence'; export * from './plugins/geolocation'; +export * from './plugins/globalization'; +export * from './plugins/google-plus'; +export * from './plugins/googleanalytics'; export * from './plugins/googlemaps'; +export * from './plugins/hotspot'; export * from './plugins/httpd'; export * from './plugins/ibeacon'; export * from './plugins/imagepicker'; export * from './plugins/imageresizer'; export * from './plugins/inappbrowser'; +export * from './plugins/inapppurchase'; +export * from './plugins/insomnia'; +export * from './plugins/instagram'; +export * from './plugins/is-debug'; +export * from './plugins/keyboard'; export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; -export * from './plugins/nfc'; +export * from './plugins/location-accuracy'; +export * from './plugins/market'; export * from './plugins/media'; export * from './plugins/media-capture'; export * from './plugins/mixpanel'; -export * from './plugins/pay-pal'; +export * from './plugins/music-controls'; +export * from './plugins/native-audio'; export * from './plugins/native-page-transitions'; +export * from './plugins/nativestorage'; +export * from './plugins/network'; +export * from './plugins/nfc'; +export * from './plugins/onesignal'; +export * from './plugins/pay-pal'; +export * from './plugins/photo-viewer'; +export * from './plugins/pin-dialog'; +export * from './plugins/plugin'; +export * from './plugins/power-management'; export * from './plugins/printer'; export * from './plugins/push'; export * from './plugins/safari-view-controller'; +export * from './plugins/screen-orientation'; +export * from './plugins/screenshot'; +export * from './plugins/securestorage'; +export * from './plugins/shake'; +export * from './plugins/sim'; export * from './plugins/sms'; +export * from './plugins/socialsharing'; export * from './plugins/spinnerdialog'; +export * from './plugins/splashscreen'; +export * from './plugins/sqlite'; +export * from './plugins/statusbar'; +export * from './plugins/stepcounter'; export * from './plugins/streaming-media'; +export * from './plugins/text-to-speech'; export * from './plugins/themable-browser'; export * from './plugins/toast'; +export * from './plugins/touchid'; export * from './plugins/twitter-connect'; +export * from './plugins/vibration'; export * from './plugins/video-editor'; export * from './plugins/video-player'; -export { -ActionSheet, -AdMob, -AndroidFingerprintAuth, -AppAvailability, -AppRate, -AppVersion, -Badge, -BarcodeScanner, -Base64ToGallery, -BatteryStatus, -Brightness, -BLE, -BluetoothSerial, -CallNumber, -CameraPreview, -Clipboard, -CodePush, -Crop, -DBMeter, -Deeplinks, -DeviceAccounts, -Dialogs, -Diagnostic, -EmailComposer, -EstimoteBeacons, -File, -FileChooser, -FileOpener, -Flashlight, -Geofence, -Globalization, -GooglePlus, -GoogleAnalytics, -Hotspot, -InAppPurchase, -Insomnia, -Instagram, -IsDebug, -Keyboard, -LocationAccuracy, -MusicControls, -NativeAudio, -NativeStorage, -Network, -Market, -OneSignal, -PhotoViewer, -ScreenOrientation, -PinDialog, -PowerManagement, -Screenshot, -SecureStorage, -Shake, -SocialSharing, -Sim, -Splashscreen, -SQLite, -StatusBar, -Stepcounter, -TouchID, -Transfer, -TextToSpeech, -Vibration, -VideoPlayer, -WebIntent, -YoutubeVideoPlayer, -ZBar, -Zip -} - -export * from './plugins/plugin'; +export * from './plugins/webintent'; +export * from './plugins/youtube-video-player'; +export * from './plugins/z-bar'; +export * from './plugins/zip'; // Window export to use outside of a module loading system window['IonicNative'] = { @@ -279,6 +271,7 @@ window['IonicNative'] = { ImageResizer, InAppBrowser, InAppPurchase, + Insomnia, Instagram, IsDebug, Keyboard, diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index 2896120c1..f43ef464c 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -272,7 +272,7 @@ export class EstimoteBeacons { * * @usage * ``` - * let region: BeaconRegion = {} // Empty region matches all beacons. + * let region: EstimoteBeaconRegion = {} // Empty region matches all beacons. * EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => { * console.log(JSON.stringify(info)); * }); @@ -280,7 +280,7 @@ export class EstimoteBeacons { * EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); }); * }, 5000); * ``` - * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory). * @return Returns an Observable that notifies of each beacon discovered. */ @Cordova({ @@ -288,14 +288,14 @@ export class EstimoteBeacons { clearFunction: 'stopRangingBeaconsInRegion', clearWithArgs: true }) - static startRangingBeaconsInRegion(region: BeaconRegion): Observable { return; } + static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable { return; } /** * Stop ranging beacons. Available on iOS and Android. * * @usage * ``` - * let region: BeaconRegion = {} // Empty region matches all beacons. + * let region: EstimoteBeaconRegion = {} // Empty region matches all beacons. * EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => { * console.log(JSON.stringify(info)); * }); @@ -303,11 +303,11 @@ export class EstimoteBeacons { * EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); }); * }, 5000); * ``` - * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory). * @return returns a Promise. */ @Cordova() - static stopRangingBeaconsInRegion(region: BeaconRegion): Promise { return; } + static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise { return; } /** * Start ranging secure beacons. Available on iOS. @@ -321,7 +321,7 @@ export class EstimoteBeacons { clearFunction: 'stopRangingSecureBeaconsInRegion', clearWithArgs: true }) - static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable { return; } + static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable { return; } /** * Stop ranging secure beacons. Available on iOS. @@ -329,19 +329,19 @@ export class EstimoteBeacons { * {@link EstimoteBeacons.stopRangingBeaconsInRegion}. */ @Cordova() - static stopRangingSecureBeaconsInRegion(region: BeaconRegion): Promise { return; } + static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise { return; } /** * Start monitoring beacons. Available on iOS and Android. * * @usage * ``` - * let region: BeaconRegion = {} // Empty region matches all beacons. + * let region: EstimoteBeaconRegion = {} // 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 region {EstimoteBeaconRegion} 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} @@ -355,21 +355,21 @@ export class EstimoteBeacons { successIndex: 1, errorIndex: 2 }) - static startMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } + static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } /** * Stop monitoring beacons. Available on iOS and Android. * * @usage * ``` - * let region: BeaconRegion = {} // Empty region matches all beacons. + * let region: EstimoteBeaconRegion = {} // Empty region matches all beacons. * EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); }); * ``` - * @param region {BeaconRegion} Dictionary with region properties (mandatory). + * @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory). * @return returns a Promise. */ @Cordova() - static stopMonitoringForRegion(region: BeaconRegion): Promise { return; } + static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise { return; } /** * Start monitoring secure beacons. Available on iOS. @@ -378,6 +378,8 @@ export class EstimoteBeacons { * To use secure beacons set the App ID and App Token using * {@link EstimoteBeacons.setupAppIDAndAppToken}. * @see {@link EstimoteBeacons.startMonitoringForRegion} + * @param region {EstimoteBeaconRegion} Region + * @param notifyEntryStateOnDisplay {boolean} */ @Cordova({ observable: true, @@ -386,16 +388,17 @@ export class EstimoteBeacons { successIndex: 1, errorIndex: 2 }) - static startSecureMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } + static startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable { return; } /** * Stop monitoring secure beacons. Available on iOS. * This function has the same parameters/behaviour as * {@link EstimoteBeacons.stopMonitoringForRegion}. + * @param region {EstimoteBeaconRegion} Region */ @Cordova() - static stopSecureMonitoringForRegion(region: BeaconRegion): Promise { return; } + static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise { return; } /** * Connect to Estimote Beacon. Available on Android. @@ -473,7 +476,7 @@ export class EstimoteBeacons { } -export interface BeaconRegion { +export interface EstimoteBeaconRegion { state?: string; major: number; minor: number; diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index 79b8a29ca..bec8ba13b 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -155,10 +155,10 @@ export class Hotspot { 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; } @@ -167,7 +167,7 @@ export class Hotspot { static stopWifiPeriodicallyScan(): Promise { return; } @Cordova() - static getNetConfig(): Promise { return; } + static getNetConfig(): Promise { return; } @Cordova() static getConnectionInfo(): Promise { return; } @@ -243,7 +243,7 @@ export interface ConnectionInfo { networkID: string; } -export interface Network { +export interface HotspotNetwork { /** * @property {string} SSID * Human readable network name @@ -275,7 +275,7 @@ export interface Network { */ capabilities: string; } -export interface NetworkConfig { +export interface HotspotNetworkConfig { /** * @property {string} deviceIPAddress - Device IP Address */ From 1e0509da98cb606ed0edcc912356e599a54fb3dd Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 5 Oct 2016 21:32:12 -0300 Subject: [PATCH 205/382] docs(paypal): fix typo name interface (#637) --- src/plugins/pay-pal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index b2450640d..fb3c21d71 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -19,7 +19,7 @@ import { Plugin, Cordova } from './plugin'; * @interfaces * PayPalEnvironment * PayPalPayment - * PayPAlItem + * PayPalItem * PayPalPaymentDetails * PayPalConfigurationOptions * PayPalShippingAddress From ac301c284fa6e11a7f58cd72ecd0004b43eef98f Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 5 Oct 2016 21:32:29 -0300 Subject: [PATCH 206/382] docs(one-signal): fix types params (#638) --- src/plugins/onesignal.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index cf6f14674..f35aefcb4 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -34,7 +34,7 @@ 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 {string} 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 {Observable} when a notification is received. Handle your notification action here. */ @@ -58,8 +58,8 @@ export class OneSignal { * 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. + * @param {string} Key of your choosing to create or update. + * @param {string} 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 { } @@ -68,7 +68,7 @@ export class OneSignal { * 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"} + * @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"} */ @Cordova({ sync: true }) static sendTags(json: any): void { } @@ -84,7 +84,7 @@ export class OneSignal { /** * 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. + * @param {string} Key to remove. */ @Cordova({ sync: true }) static deleteTag(key: string): void { } @@ -92,7 +92,7 @@ export class OneSignal { /** * Deletes tags that were previously set on a user with `sendTag` or `sendTags`. * - * @param {keys} Keys to remove. + * @param {Array} Keys to remove. */ @Cordova({ sync: true }) static deleteTags(keys: string[]): void { } @@ -114,7 +114,7 @@ export class OneSignal { * 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. + * @param {boolean} false to disable vibrate, true to re-enable it. */ @Cordova({ sync: true }) static enableVibrate(enable: boolean): void { } @@ -126,7 +126,7 @@ export class OneSignal { * 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. + * @param {boolean} false to disable sound, true to re-enable it. */ @Cordova({ sync: true }) static enableSound(enable: boolean): void { } @@ -138,7 +138,7 @@ export class OneSignal { * 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 + * @param {boolean} enable */ @Cordova({ sync: true }) static enableNotificationsWhenActive(enable: boolean): void { } @@ -148,7 +148,7 @@ export class OneSignal { * 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 + * @param {boolean} enable */ @Cordova({ sync: true }) static enableInAppAlertNotification(enable: boolean): void { } @@ -157,7 +157,7 @@ export class OneSignal { * 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 + * @param {boolean} enable */ @Cordova({ sync: true }) static setSubscription(enable: boolean): void { } From ad373c93ae63a873e0cda39323ab22fafc6d0489 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 5 Oct 2016 21:32:47 -0300 Subject: [PATCH 207/382] docs(paypal): delete ':' of the params (#639) --- src/plugins/pay-pal.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index fb3c21d71..a4867f524 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -36,8 +36,8 @@ export class PayPal { * UI faster. The preconnect is valid for a limited time, so * the recommended time to preconnect is on page load. * - * @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox" - * @param {PayPalConfiguration} configuration: For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set + * @param {String} environment available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox" + * @param {PayPalConfiguration} configuration For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set */ @Cordova() static init(environment: PayPalEnvironment, configuration?: PayPalConfiguration): Promise {return; } @@ -53,7 +53,7 @@ export class PayPal { * See https://developer.paypal.com/webapps/developer/docs/integration/mobile/ios-integration-guide/ * for more documentation of the params. * - * @param {PayPalPayment} payment: PayPalPayment object + * @param {PayPalPayment} payment PayPalPayment object */ @Cordova() static renderSinglePaymentUI(payment: PayPalPayment): Promise {return; } @@ -79,7 +79,7 @@ export class PayPal { /** * Please Read Docs on Profile Sharing at https://github.com/paypal/PayPal-iOS-SDK#profile-sharing * - * @param {Array} scopes: scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes + * @param {Array} scopes scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes * See https://developer.paypal.com/docs/integration/direct/identity/attributes/ for more details **/ @Cordova() From 083118aff4ceb853e0a79347c0b7ec6e74fd7224 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 5 Oct 2016 21:33:13 -0300 Subject: [PATCH 208/382] docs(background-geolocation): exports interfaces to template dgeni (#640) --- src/plugins/background-geolocation.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 0179f14e6..95028f4f6 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -267,6 +267,9 @@ export interface Config { * BackgroundGeolocation.stop(); * * ``` + * @interfaces + * Location + * Config */ @Plugin({ plugin: 'cordova-plugin-mauron85-background-geolocation', From 1ab0d2f9154ca40c16327991c2f99623868e1ca7 Mon Sep 17 00:00:00 2001 From: Andrew Cole Date: Wed, 5 Oct 2016 17:33:31 -0700 Subject: [PATCH 209/382] Changed confusing sentence structure. (#644) Reading the document on which destination type, without commas leads to confusing behaviour. --- src/plugins/camera.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 41b5bd6d1..9257f6987 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -7,8 +7,8 @@ export interface CameraOptions { /** * 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 + * 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) */ From 72a694a5e1a61d8743e742ebe7431bafd3f0ed4d Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 20:43:57 -0400 Subject: [PATCH 210/382] fix(googlemaps): add missing properties should fix #642 --- src/plugins/googlemaps.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 86cdb96e3..19d095e65 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1,4 +1,4 @@ -import { Cordova, CordovaInstance, Plugin } from './plugin'; +import {Cordova, CordovaInstance, Plugin, InstanceProperty} from './plugin'; import { Observable } from 'rxjs/Observable'; @@ -851,7 +851,10 @@ export class GoogleMapsKmlOverlay { export class GoogleMapsLatLngBounds { private _objectInstance: any; - constructor(public southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], public northeast?: GoogleMapsLatLng) { + @InstanceProperty get northeast(): GoogleMapsLatLng { return; } + @InstanceProperty get southwest(): GoogleMapsLatLng { return; } + + constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) { let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng; this._objectInstance = new plugin.google.maps.LatLngBounds(args); } @@ -878,7 +881,10 @@ export class GoogleMapsLatLngBounds { export class GoogleMapsLatLng { private _objectInstance: any; - constructor(public lat: number, public lng: number) { + @InstanceProperty get lat(): number { return; } + @InstanceProperty get lng(): number { return; } + + constructor(lat: number, lng: number) { this._objectInstance = new plugin.google.maps.LatLng(lat, lng); } From 5da746d2fc4e63a9ad5fa0dea6b3318ab0d038f1 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 21:03:06 -0400 Subject: [PATCH 211/382] 2.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3462c6d51..4756b8241 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.1", + "version": "2.1.2", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From ab5bbae2f6f8a284b48e0307118d7e1500c68162 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 21:04:04 -0400 Subject: [PATCH 212/382] chore(): update changelog --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e1f07f8d..6c67f7864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ + +## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.1...v2.1.2) (2016-10-06) + + +### Bug Fixes + +* **googlemaps:** add missing properties ([72a694a](https://github.com/driftyco/ionic-native/commit/72a694a)), closes [#642](https://github.com/driftyco/ionic-native/issues/642) + + +### Features + +* **zBar:** add zBar barcode scanner plugin ([#634](https://github.com/driftyco/ionic-native/issues/634)) ([bbbbb3e](https://github.com/driftyco/ionic-native/commit/bbbbb3e)) + + + + +## [2.1.1](https://github.com/driftyco/ionic-native/compare/v2.1.0...v2.1.1) (2016-10-03) + + + # [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03) From 40325cad9fa0dddc507bf15b6717b0b2ea688446 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:20:55 -0400 Subject: [PATCH 213/382] fix(google-analytics): fix depreciated plugin reference --- src/plugins/googleanalytics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 001437b94..a08fbe406 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -14,7 +14,7 @@ declare var window; */ @Plugin({ plugin: 'cordova-plugin-google-analytics', - pluginRef: 'analytics', + pluginRef: 'ga', repo: 'https://github.com/danwilson/google-analytics-plugin', platforms: ['Android', 'iOS'] }) From 77b0277290da9a2bd3c325a91989a45d7684b1c5 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:27:28 -0400 Subject: [PATCH 214/382] fix(google-analytics): add missing methods, fix return types --- src/plugins/googleanalytics.ts | 105 +++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 44 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index a08fbe406..9be60b233 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -27,6 +27,58 @@ export class GoogleAnalytics { @Cordova() static startTrackerWithId(id: string): Promise { return; } + /** + * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more + * @param allow {boolean} + * @return {Promise} + */ + @Cordova() + static setAllowIDFACollection(allow: boolean): Promise { return; } + + /** + * Set a UserId + * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id + * @param {string} id + * @return {Promise} + */ + @Cordova() + static setUserId(id: string): Promise { return; } + + /** + * Set a anonymize Ip address + * @param anonymize + */ + @Cordova() + static setAnonymizeIp(anonymize: boolean): Promise { return; } + + /** + * Sets the app version + * @param appVersion + */ + @Cordova() + static setAppVersion(appVersion: string): Promise { return; } + + /** + * + * @param oputout + */ + @Cordova() + static setOptOut(oputout: boolean): Promise { return; } + + /** + * Enable verbose logging + */ + @Cordova() + static debugMode(): Promise { return; } + + /** + * + * @param key + * @param value + */ + @Cordova() + static trackMetric(key, value): Promise { return; } + /** * Track a screen * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens @@ -37,6 +89,15 @@ export class GoogleAnalytics { @Cordova() static trackView(title: string, campaignUrl?: 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; } + /** * Track an event * https://developers.google.com/analytics/devguides/collection/analyticsjs/events @@ -93,50 +154,6 @@ export class GoogleAnalytics { @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; } - - /** - * Set a UserId - * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id - * @param {string} id - */ - @Cordova({sync: true}) - static setUserId(id: string): void { } - - /** - * Sets the app version - * @param appVersion - */ - @Cordova({sync: true}) - static setAppVersion(appVersion: string): void { } - - /** - * Set a anonymize Ip address - * @param anonymize - */ - @Cordova({sync: true}) - static setAnonymizeIp(anonymize: boolean): void { } - - /** - * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more - * @param allow - */ - @Cordova({sync: true}) - static setAllowIDFACollection(allow: boolean): void { } - - /** - * Enable verbose logging - */ - @Cordova({sync: true}) - static debugMode(): Promise { return; } - /** * Enable/disable automatic reporting of uncaught exceptions * @param {boolean} shouldEnable From 7dba41cbe1e9dbd0bd50bd86e63a0fb15ff3888d Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:30:40 -0400 Subject: [PATCH 215/382] docs(google-analytics): add missing docs --- src/plugins/googleanalytics.ts | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 9be60b233..50e81c810 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -23,6 +23,7 @@ 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 + * @return {Promise} */ @Cordova() static startTrackerWithId(id: string): Promise { return; } @@ -38,7 +39,7 @@ export class GoogleAnalytics { /** * Set a UserId * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id - * @param {string} id + * @param {string} id User ID * @return {Promise} */ @Cordova() @@ -46,38 +47,43 @@ export class GoogleAnalytics { /** * Set a anonymize Ip address - * @param anonymize + * @param anonymize {boolean} Set to true to anonymize the IP Address + * @return {Promise} */ @Cordova() static setAnonymizeIp(anonymize: boolean): Promise { return; } /** * Sets the app version - * @param appVersion + * @param appVersion {string} App version + * @return {Promise} */ @Cordova() static setAppVersion(appVersion: string): Promise { return; } /** - * - * @param oputout + * Set OptOut + * @param optout {boolean} + * @return {Promise} */ @Cordova() - static setOptOut(oputout: boolean): Promise { return; } + static setOptOut(optout: boolean): Promise { return; } /** * Enable verbose logging + * @return {Promise} */ @Cordova() static debugMode(): Promise { return; } /** - * - * @param key - * @param value + * Track custom metric + * @param key {string} + * @param value {any} + * @return {Promise} */ @Cordova() - static trackMetric(key, value): Promise { return; } + static trackMetric(key: string, value?: any): Promise { return; } /** * Track a screen @@ -85,6 +91,7 @@ export class GoogleAnalytics { * * @param {string} title Screen title * @param {string} campaignUrl Campaign url for measuring referrals + * @return {Promise} */ @Cordova() static trackView(title: string, campaignUrl?: string): Promise { return; } @@ -94,6 +101,7 @@ export class GoogleAnalytics { * https://developers.google.com/analytics/devguides/platform/customdimsmets * @param {string} key * @param {string} value + * @return {Promise} */ @Cordova() static addCustomDimension(key: number, value: string): Promise { return; } @@ -105,6 +113,7 @@ export class GoogleAnalytics { * @param {string} action * @param {string} label * @param {number} value + * @return {Promise} */ @Cordova() static trackEvent(category: string, action: string, label?: string, value?: number): Promise { return; } @@ -113,6 +122,7 @@ export class GoogleAnalytics { * Track an exception * @param {string} description * @param {boolean} fatal + * @return {Promise} */ @Cordova() static trackException(description: string, fatal: boolean): Promise { return; } @@ -123,6 +133,7 @@ export class GoogleAnalytics { * @param {number} intervalInMilliseconds * @param {string} variable * @param {string} label + * @return {Promise} */ @Cordova() static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { return; } @@ -136,6 +147,7 @@ export class GoogleAnalytics { * @param {number} tax * @param {number} shipping * @param {string} currencyCode + * @return {Promise} */ @Cordova() static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise { return; } @@ -150,6 +162,7 @@ export class GoogleAnalytics { * @param {number} price * @param {number} quantity * @param {string} currencyCode + * @return {Promise} */ @Cordova() static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise { return; } @@ -157,6 +170,7 @@ export class GoogleAnalytics { /** * Enable/disable automatic reporting of uncaught exceptions * @param {boolean} shouldEnable + * @return {Promise} */ @Cordova() static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { return; } From f62e1081e152bff321ac6c73f59221ea0f7e33e8 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:35:52 -0400 Subject: [PATCH 216/382] fix(google-analytics): add newSession param --- src/plugins/googleanalytics.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 50e81c810..7207eacd8 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -89,12 +89,13 @@ export class GoogleAnalytics { * Track a screen * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens * - * @param {string} title Screen title - * @param {string} campaignUrl Campaign url for measuring referrals + * @param title {string} Screen title + * @param campaignUrl {string} Campaign url for measuring referrals + * @param newSession {boolean} Set to true to create a new session * @return {Promise} */ @Cordova() - static trackView(title: string, campaignUrl?: string): Promise { return; } + static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise { return; } /** * Add a Custom Dimension @@ -109,14 +110,15 @@ export class GoogleAnalytics { /** * Track an event * https://developers.google.com/analytics/devguides/collection/analyticsjs/events - * @param {string} category - * @param {string} action - * @param {string} label - * @param {number} value + * @param category {string} + * @param action {string} + * @param label {string} + * @param value {number} + * @param newSession {boolean} Set to true to create a new session * @return {Promise} */ @Cordova() - static trackEvent(category: string, action: string, label?: string, value?: number): Promise { return; } + static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise { return; } /** * Track an exception From c9ddec3bb59b58744431a3470a8dc5f15b58e9d1 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:36:10 -0400 Subject: [PATCH 217/382] 2.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4756b8241..2c715936f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.2", + "version": "2.1.3", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 84f54d64aa07217a38b28eb85f0ace9e39ea40a0 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:42:35 -0400 Subject: [PATCH 218/382] chore(): update changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c67f7864..0990a2fce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ + +## [2.1.3](https://github.com/driftyco/ionic-native/compare/v2.1.2...v2.1.3) (2016-10-06) + + +### Bug Fixes + +* **google-analytics:** add missing methods, fix return types ([77b0277](https://github.com/driftyco/ionic-native/commit/77b0277)) +* **google-analytics:** add newSession param ([f62e108](https://github.com/driftyco/ionic-native/commit/f62e108)) +* **google-analytics:** fix depreciated plugin reference ([40325ca](https://github.com/driftyco/ionic-native/commit/40325ca)) + + + ## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.1...v2.1.2) (2016-10-06) From 6f23bef5d1fafdcfd9295529d1da8f3a80457739 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:43:20 -0400 Subject: [PATCH 219/382] fix(google-analytics): specify successIndex and errorIndex for methods with optional params --- src/plugins/googleanalytics.ts | 45 ++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 7207eacd8..d6a4e5883 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -82,7 +82,10 @@ export class GoogleAnalytics { * @param value {any} * @return {Promise} */ - @Cordova() + @Cordova({ + successIndex: 2, + errorIndex: 3 + }) static trackMetric(key: string, value?: any): Promise { return; } /** @@ -94,14 +97,17 @@ export class GoogleAnalytics { * @param newSession {boolean} Set to true to create a new session * @return {Promise} */ - @Cordova() + @Cordova({ + successIndex: 3, + errorIndex: 4 + }) static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise { return; } /** * Add a Custom Dimension * https://developers.google.com/analytics/devguides/platform/customdimsmets - * @param {string} key - * @param {string} value + * @param key {string} + * @param value {string} * @return {Promise} */ @Cordova() @@ -117,13 +123,16 @@ export class GoogleAnalytics { * @param newSession {boolean} Set to true to create a new session * @return {Promise} */ - @Cordova() + @Cordova({ + successIndex: 5, + errorIndex: 6 + }) static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise { return; } /** * Track an exception - * @param {string} description - * @param {boolean} fatal + * @param description {string} + * @param fatal {boolean} * @return {Promise} */ @Cordova() @@ -131,10 +140,10 @@ export class GoogleAnalytics { /** * Track User Timing (App Speed) - * @param {string} category - * @param {number} intervalInMilliseconds - * @param {string} variable - * @param {string} label + * @param category {string} + * @param intervalInMilliseconds {number} + * @param variable {string} + * @param label {string} * @return {Promise} */ @Cordova() @@ -143,12 +152,12 @@ export class GoogleAnalytics { /** * 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 + * @param id {string} + * @param affiliation {string} + * @param revenue {number} + * @param tax {number} + * @param shipping {number} + * @param currencyCode {string} * @return {Promise} */ @Cordova() @@ -171,7 +180,7 @@ export class GoogleAnalytics { /** * Enable/disable automatic reporting of uncaught exceptions - * @param {boolean} shouldEnable + * @param shouldEnable {boolean} * @return {Promise} */ @Cordova() From 09d481e1d6f9401f65027df7a7fb55274b1009f7 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:43:31 -0400 Subject: [PATCH 220/382] 2.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c715936f..40d6cbda3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.3", + "version": "2.1.4", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 2bdd3a386818c218e89492e0051cef9e13af7faf Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:43:59 -0400 Subject: [PATCH 221/382] chore(): update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0990a2fce..bbf8938ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [2.1.4](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.4) (2016-10-06) + + +### Bug Fixes + +* **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef)) + + + ## [2.1.3](https://github.com/driftyco/ionic-native/compare/v2.1.2...v2.1.3) (2016-10-06) From d79d62bfa0bf9addde747278ebd1e2cca6a8f24e Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 22:46:22 -0400 Subject: [PATCH 222/382] docs(hotspot): remove unecessary doc tags --- src/plugins/hotspot.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index bec8ba13b..ffa21d87a 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -217,27 +217,27 @@ export class Hotspot { export interface ConnectionInfo { /** - * @property {string} SSID + * SSID * The service set identifier (SSID) of the current 802.11 network. */ SSID: string; /** - * @property {string} BSSID + * BSSID * The basic service set identifier (BSSID) of the current access point. */ BSSID: string; /** - * @property {string} linkSpeed + * linkSpeed * The current link speed in Mbps */ linkSpeed: string; /** - * @property {string} IPAddress + * IPAddress * The IP Address */ IPAddress: string; /** - * @property {string} networkID + * networkID * Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant. */ networkID: string; @@ -245,62 +245,62 @@ export interface ConnectionInfo { export interface HotspotNetwork { /** - * @property {string} SSID + * SSID * Human readable network name */ SSID: string; /** - * @property {string} BSSID + * BSSID * MAC Address of the access point */ BSSID: string; /** - * @property {number (int)} frequency + * frequency * The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point. */ frequency: number; /** - * @property {number} level + * level * The detected signal level in dBm, also known as the RSSI. */ level: number; /** - * @property {number} timestamp + * timestamp * Timestamp in microseconds (since boot) when this result was last seen. */ timestamp: number; /** - * @property {string} capabilities + * capabilities * Describes the authentication, key management, and encryption schemes supported by the access point. */ capabilities: string; } export interface HotspotNetworkConfig { /** - * @property {string} deviceIPAddress - Device IP Address + * deviceIPAddress - Device IP Address */ deviceIPAddress: string; /** - * @property {string} deviceMacAddress - Device MAC Address + * deviceMacAddress - Device MAC Address */ deviceMacAddress: string; /** - * @property {string} gatewayIPAddress - Gateway IP Address + * gatewayIPAddress - Gateway IP Address */ gatewayIPAddress: string; /** - * @property {string} gatewayMacAddress - Gateway MAC Address + * gatewayMacAddress - Gateway MAC Address */ gatewayMacAddress: string; } export interface HotspotDevice { /** - * @property {string} ip + * ip * Hotspot IP Address */ ip: string; /** - * @property {string} mac + * mac * Hotspot MAC Address */ mac: string; From 6b286db51a69c0cc78ba9801e403240d4c49c3d9 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 23:19:45 -0400 Subject: [PATCH 223/382] chore(): add successIndex at the correct position if we have optional params --- src/plugins/plugin.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 23ea04ff6..7b0a744c5 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -61,7 +61,12 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func args.push(obj); } else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') { // If we've specified a success/error index - args.splice(opts.successIndex, 0, resolve); + + if (opts.successIndex > args.length) { + args[opts.successIndex] = resolve; + } else { + args.splice(opts.successIndex, 0, resolve); + } // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour. if (opts.errorIndex > args.length) { From e30ccabf7b2308bf16dda439d4eacf64effa9405 Mon Sep 17 00:00:00 2001 From: Ibby Date: Wed, 5 Oct 2016 23:19:55 -0400 Subject: [PATCH 224/382] 2.1.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 40d6cbda3..73f590303 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.4", + "version": "2.1.5", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From f0026572e73e58ab248eae4e7c2e446803797dce Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 6 Oct 2016 00:26:59 -0400 Subject: [PATCH 225/382] fix(paypal): fix helper classes --- src/plugins/pay-pal.ts | 151 +++++++++++++++++++++++++---------------- 1 file changed, 92 insertions(+), 59 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index a4867f524..a21f63567 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -18,10 +18,11 @@ import { Plugin, Cordova } from './plugin'; * ``` * @interfaces * PayPalEnvironment + * PayPalConfigurationOptions + * @classes * PayPalPayment * PayPalItem * PayPalPaymentDetails - * PayPalConfigurationOptions * PayPalShippingAddress */ @Plugin({ @@ -91,7 +92,11 @@ export interface PayPalEnvironment { PayPalEnvironmentProduction: string; PayPalEnvironmentSandbox: string; } -export declare var PayPalPayment: { + +/** + * @private + */ +export class PayPalPayment { /** * Convenience constructor. * Returns a PayPalPayment with the specified amount, currency code, and short description. @@ -100,12 +105,13 @@ export declare var PayPalPayment: { * @param {String} shortDescription: A short description of the payment. * @param {String} intent: "Sale" for an immediate payment. */ - new(amount: string, currencyCode: string, shortDescription: string, intent: string): PayPalPayment; -}; -/** - * @private - */ -export interface PayPalPayment { + constructor(amount: string, currencyCode: string, shortDescription: string, intent: string) { + this.amount = amount; + this.currencyCode = currencyCode; + this.shortDescription = shortDescription; + this.intent = intent; + } + /** * The amount of the payment. */ @@ -126,7 +132,7 @@ export interface PayPalPayment { * Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com, * for your tracking purposes. */ - bnCode: string; + bnCode: string = 'PhoneGap_SP'; /** * Optional invoice number, for your tracking purposes. (up to 256 characters) */ @@ -153,7 +159,27 @@ export interface PayPalPayment { shippingAddress: string; } -export interface PayPalItem { +/** + * @private + */ +export class PayPalItem { + /** + * The PayPalItem class defines an optional itemization for a payment. + * @see https://developer.paypal.com/docs/api/#item-object for more details. + * @param {String} name: Name of the item. 127 characters max + * @param {Number} quantity: Number of units. 10 characters max. + * @param {String} price: Unit price for this item 10 characters max. + * May be negative for "coupon" etc + * @param {String} currency: ISO standard currency code. + * @param {String} sku: The stock keeping unit for this item. 50 characters max (optional) + */ + constructor(name: string, quantity: number, price: string, currency: string, sku: string) { + this.name = name; + this.quantity = quantity; + this.price = price; + this.currency = currency; + this.sku = sku; + } /** * Name of the item. 127 characters max */ @@ -176,21 +202,21 @@ export interface PayPalItem { sku: string; } -export declare var PayPalItem: { +/** + * @private + */ +export class PayPalPaymentDetails { /** - * The PayPalItem class defines an optional itemization for a payment. - * @see https://developer.paypal.com/docs/api/#item-object for more details. - * @param {String} name: Name of the item. 127 characters max - * @param {Number} quantity: Number of units. 10 characters max. - * @param {String} price: Unit price for this item 10 characters max. - * May be negative for "coupon" etc - * @param {String} currency: ISO standard currency code. - * @param {String} sku: The stock keeping unit for this item. 50 characters max (optional) + * The PayPalPaymentDetails class defines optional amount details. + * @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places. + * @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places. + * @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places. */ - new(name: string, quantity: number, price: string, currency: string, sku: string): PayPalItem; -}; - -export interface PayPalPaymentDetails { + constructor(subtotal: string, shipping: string, tax: string) { + this.subtotal = subtotal; + this.shipping = shipping; + this.tax = tax; + } /** * Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places. */ @@ -205,16 +231,6 @@ export interface PayPalPaymentDetails { tax: string; } -export declare var PayPalPaymentDetails: { - /** - * The PayPalPaymentDetails class defines optional amount details. - * @param {String} subtotal: Sub-total (amount) of items being paid for. 10 characters max with support for 2 decimal places. - * @param {String} shipping: Amount charged for shipping. 10 characters max with support for 2 decimal places. - * @param {String} tax: Amount charged for tax. 10 characters max with support for 2 decimal places. - */ - new(subtotal: string, shipping: string, tax: string): PayPalPaymentDetails; -}; - /** * @private */ @@ -238,11 +254,11 @@ export interface PayPalConfigurationOptions { /** * URL of your company's privacy policy, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController. */ - merchantPrivacyPolicyUrl?: string; + merchantPrivacyPolicyURL?: string; /** * URL of your company's user agreement, which will be offered to the user when requesting consent via a PayPalFuturePaymentViewController. */ - merchantUserAgreementUrl?: string; + merchantUserAgreementURL?: string; /** * If set to NO, the SDK will only support paying with PayPal, not with credit cards. * This applies only to single payments (via PayPalPaymentViewController). @@ -316,35 +332,47 @@ export interface PayPalConfigurationOptions { /** * @private */ -export declare var PayPalConfiguration: { +export class PayPalConfiguration implements PayPalConfigurationOptions { /** * You use a PayPalConfiguration object to configure many aspects of how the SDK behaves. * see defaults for options available */ - new(options: PayPalConfigurationOptions): PayPalConfiguration; -}; + constructor(options?: PayPalConfigurationOptions) { -export interface PayPalConfiguration { - defaultUserEmail: string; - defaultUserPhoneCountryCode: string; - defaultUserPhoneNumber: string; - merchantName: string; - merchantPrivacyPolicyUrl: string; - merchantUserAgreementUrl: string; - acceptCreditCards: boolean; - payPalShippingAddressOption: number; - rememberUser: boolean; - languageOrLocale: string; - disableBlurWhenBackgrounding: boolean; - presentingInPopover: boolean; - forceDefaultsInSandbox: boolean; - sandboxUserPassword: string; - sandboxUserPin: string; + let defaults: PayPalConfigurationOptions = { + defaultUserEmail: null, + defaultUserPhoneCountryCode: null, + defaultUserPhoneNumber: null, + merchantName: null, + merchantPrivacyPolicyURL: null, + merchantUserAgreementURL: null, + acceptCreditCards: true, + payPalShippingAddressOption: 0, + rememberUser: true, + languageOrLocale: null, + disableBlurWhenBackgrounding: false, + presentingInPopover: false, + forceDefaultsInSandbox: false, + sandboxUserPassword: null, + sandboxUserPin: null + }; + + if (options && typeof options === 'object') { + for (var i in options) { + if (defaults.hasOwnProperty(i)) { + defaults[i] = options[i]; + } + } + } + + return defaults; + } } + /** * @private */ -export declare var PayPalShippingAddress: { +export class PayPalShippingAddress { /** * See the documentation of the individual properties for more detail. * @param {String} recipientName: Name of the recipient at this address. 50 characters max. @@ -355,10 +383,15 @@ export declare var PayPalShippingAddress: { * @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries. * @param {String} countryCode: 2-letter country code. 2 characters max. */ - new(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string): PayPalShippingAddress; -}; - -export interface PayPalShippingAddress { + constructor(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string) { + this.recipientName = recipientName; + this.line1 = line1; + this.line2 = line2; + this.city = city; + this.state = state; + this.postalCode = postalCode; + this.countryCode = countryCode; + } /** * Name of the recipient at this address. 50 characters max. */ From 4ac348bd0f38ea36ddad273827efe9ca69f62368 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 6 Oct 2016 00:27:04 -0400 Subject: [PATCH 226/382] 2.1.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 73f590303..7b28f6cc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.5", + "version": "2.1.6", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From c24b3318662017ba4cdd84bf11dc89c3d4745b36 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 6 Oct 2016 00:27:24 -0400 Subject: [PATCH 227/382] chore(): update changelog --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbf8938ac..33facf69b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ + +## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.5...v2.1.6) (2016-10-06) + + +### Bug Fixes + +* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657)) + + + + +## [2.1.5](https://github.com/driftyco/ionic-native/compare/v2.1.4...v2.1.5) (2016-10-06) + + + ## [2.1.4](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.4) (2016-10-06) From e4bde77bd4c6c3c98b51fd56856cd0b86bf21817 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Thu, 6 Oct 2016 01:37:34 -0300 Subject: [PATCH 228/382] chore(): deleted ionic-gulp-tslint change for gulp-tslint directly (#611) --- gulpfile.js | 9 +++++++-- package.json | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8994b78a3..93d75ac45 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('ionic-gulp-tslint'); +var tslint = require('gulp-tslint'); var decamelize = require('decamelize'); var replace = require('gulp-replace'); @@ -28,7 +28,12 @@ gulp.task("minify:dist", function(){ }); gulp.task('lint', function() { - tslint({src: 'src/**/*.ts'}); + gulp.src('src/**/*.ts') + .pipe(tslint({ + formatter: "verbose", + configuration: 'tslint.json' + })) + .pipe(tslint.report()) }); gulp.task('plugin:create', function(){ diff --git a/package.json b/package.json index 7b28f6cc4..120a76023 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,8 @@ "gulp": "^3.9.1", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4", - "gulp-tslint": "^5.0.0", + "gulp-tslint": "^6.1.2", "gulp-uglify": "^1.5.4", - "ionic-gulp-tslint": "^1.0.0", "jasmine-core": "~2.5.0", "karma": "~1.2.0", "karma-browserify": "~5.1.0", @@ -41,7 +40,7 @@ "q": "1.4.1", "semver": "^5.0.1", "tsify": "~1.0.4", - "tslint": "^3.8.1", + "tslint": "^3.15.1", "tslint-ionic-rules": "0.0.5", "typescript": "^2.0.1", "watchify": "~3.7.0" From 6f0f02bb66d3a78e8ec3f7c56e0d3e47fa0be3f5 Mon Sep 17 00:00:00 2001 From: ziggyJ Date: Fri, 7 Oct 2016 11:33:42 +1100 Subject: [PATCH 229/382] fix google maps setPadding not working issue #573 (#654) --- src/plugins/plugin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 7b0a744c5..fb02c5638 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -77,8 +77,10 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func } else { // Otherwise, let's tack them on to the end of the argument list // which is 90% of cases - args.push(resolve); - args.push(reject); + if (!opts.sync) { + args.push(resolve); + args.push(reject); + } } return args; } From 598f8a9e7c63094e8cf92666e2d5310b54f849d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Bu=C3=9Fmann?= Date: Fri, 7 Oct 2016 02:34:45 +0200 Subject: [PATCH 230/382] fix(paypal): fixed currency code not found issue (#653) --- src/plugins/pay-pal.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index a21f63567..1627ee1f2 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -101,13 +101,13 @@ export class PayPalPayment { * Convenience constructor. * Returns a PayPalPayment with the specified amount, currency code, and short description. * @param {String} amount: The amount of the payment. - * @param {String} currencyCode: The ISO 4217 currency for the payment. + * @param {String} currency: The ISO 4217 currency for the payment. * @param {String} shortDescription: A short description of the payment. * @param {String} intent: "Sale" for an immediate payment. */ - constructor(amount: string, currencyCode: string, shortDescription: string, intent: string) { + constructor(amount: string, currency: string, shortDescription: string, intent: string) { this.amount = amount; - this.currencyCode = currencyCode; + this.currency = currency; this.shortDescription = shortDescription; this.intent = intent; } @@ -119,7 +119,7 @@ export class PayPalPayment { /** * The ISO 4217 currency for the payment. */ - currencyCode: string; + currency: string; /** * A short description of the payment. */ From 7a91c87a725f6dbae3706452ff504132e3a6154a Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 6 Oct 2016 20:37:41 -0400 Subject: [PATCH 231/382] test(): sync methods no longer get resolve/reject --- test/plugin.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts index 3fd61f159..5ecbb477a 100644 --- a/test/plugin.spec.ts +++ b/test/plugin.spec.ts @@ -36,7 +36,7 @@ describe('plugin', () => { const spy = spyOn(window.plugins.test, 'syncMethod').and.callThrough(); const result = Test.syncMethod('foo'); expect(result).toEqual('syncResult'); - expect(spy).toHaveBeenCalledWith('foo', undefined, undefined); + expect(spy).toHaveBeenCalledWith('foo'); }); @@ -138,4 +138,4 @@ describe('plugin', () => { }); -}); \ No newline at end of file +}); From 2da02e6d46206cee48f49ffcd3513e5865661dfb Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 6 Oct 2016 20:38:21 -0400 Subject: [PATCH 232/382] 2.1.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 120a76023..276ba255c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.6", + "version": "2.1.7", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 4c7defb2ec2e78d42fcebecc7837d57247424b6e Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 6 Oct 2016 20:38:32 -0400 Subject: [PATCH 233/382] chore(): update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33facf69b..891f55223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [2.1.7](https://github.com/driftyco/ionic-native/compare/v2.1.6...v2.1.7) (2016-10-07) + + +### Bug Fixes + +* **paypal:** fixed currency code not found issue ([#653](https://github.com/driftyco/ionic-native/issues/653)) ([598f8a9](https://github.com/driftyco/ionic-native/commit/598f8a9)) + + + ## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.5...v2.1.6) (2016-10-06) From 2c6cc37a5f0abf874eccf7f79f68c69b397b4059 Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Sat, 8 Oct 2016 14:54:02 -0400 Subject: [PATCH 234/382] docs(calendar): fix typo (#660) --- src/plugins/calendar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 225f1cafb..b2ed66c13 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -53,7 +53,7 @@ export class Calendar { * - You're using Android < 6, or * - You've already granted permission * - * If this returns false, you should call `requestReadWritePermissions` function + * If this returns false, you should call the `requestReadWritePermission` function * @returns {Promise} */ @Cordova() From d3e6f3ba41e334b3fc0894104fc31af7c24959e0 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 8 Oct 2016 16:07:01 -0300 Subject: [PATCH 235/382] refactor(plugin): improvement pull #654 (#661) --- src/plugins/plugin.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index fb02c5638..ec11b3cd1 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -41,6 +41,11 @@ export const cordovaWarn = function(pluginName: string, method: string) { } }; function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any { + // ignore resolve and reject in case sync + if (opts.sync) { + return args; + } + // If the plugin method expects myMethod(success, err, options) if (opts.callbackOrder === 'reverse') { // Get those arguments in the order [resolve, reject, ...restOfArgs] @@ -77,10 +82,8 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func } else { // Otherwise, let's tack them on to the end of the argument list // which is 90% of cases - if (!opts.sync) { - args.push(resolve); - args.push(reject); - } + args.push(resolve); + args.push(reject); } return args; } From 11653ce752726751540de37236c6d7c572a6785d Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 8 Oct 2016 18:48:28 -0400 Subject: [PATCH 236/382] fix(googlemaps): fixes GoogleMapsLatLng class closes 658 --- src/plugins/googlemaps.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 19d095e65..b98c73de4 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -879,21 +879,22 @@ export class GoogleMapsLatLngBounds { * @private */ export class GoogleMapsLatLng { - private _objectInstance: any; - @InstanceProperty get lat(): number { return; } - @InstanceProperty get lng(): number { return; } + lat: number; + lng: number; constructor(lat: number, lng: number) { - this._objectInstance = new plugin.google.maps.LatLng(lat, lng); + this.lat = lat; + this.lng = lng; } equals(other: GoogleMapsLatLng): boolean { return this.lat === other.lat && this.lng === other.lng; } - @CordovaInstance({ sync: true }) - toString(): string { return; } + toString(): string { + return this.lat + ',' + this.lng; + } toUrlValue(precision?: number): string { precision = precision || 6; From 4dba0580accdafee814011e814a31ab3ca0cac68 Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 8 Oct 2016 18:50:36 -0400 Subject: [PATCH 237/382] 2.1.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 276ba255c..5c0446077 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.7", + "version": "2.1.8", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From b40b0fff98ffd25820e310fa6398f20d4e2d107a Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 8 Oct 2016 18:50:49 -0400 Subject: [PATCH 238/382] chore(): update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 891f55223..3a4f706a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [2.1.8](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.8) (2016-10-08) + + +### Bug Fixes + +* **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce)) + + + ## [2.1.7](https://github.com/driftyco/ionic-native/compare/v2.1.6...v2.1.7) (2016-10-07) From 7d1686ef93d61b92f50fad559fae5d5a0609e65f Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 8 Oct 2016 21:29:53 -0300 Subject: [PATCH 239/382] refactor(googlemaps): throw warnings plugin_not_installed (#655) * refactor(googlemaps): adjust imports to warnings console and delete @author comments * refactor(googlemaps): throw warnings plugin_not_installed * refactor(googlemaps): delete warnings of the methods added Promise.reject case plugin_not_instalet --- src/plugins/googlemaps.ts | 69 +++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index b98c73de4..f2b20c065 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1,11 +1,6 @@ -import {Cordova, CordovaInstance, Plugin, InstanceProperty} from './plugin'; +import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin'; import { Observable } from 'rxjs/Observable'; - -/** - * @private - * Created by Ibrahim on 3/29/2016. - */ declare var plugin: any; /** @@ -88,12 +83,13 @@ export const GoogleMapsAnimation = { * }); * ``` */ -@Plugin({ +let pluginMap = { pluginRef: 'plugin.google.maps.Map', plugin: 'cordova-plugin-googlemaps', repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"' -}) +}; +@Plugin(pluginMap) export class GoogleMap { _objectInstance: any; @@ -106,8 +102,14 @@ export class GoogleMap { static isAvailable(): Promise { return; } constructor(element: string|HTMLElement, options?: any) { - if (typeof element === 'string') element = document.getElementById(element); - this._objectInstance = plugin.google.maps.Map.getMap(element, options); + if (!!getPlugin('plugin.google.maps.Map')) { + if (typeof element === 'string') { + element = document.getElementById(element); + } + this._objectInstance = plugin.google.maps.Map.getMap(element, options); + } else { + pluginWarn(pluginMap); + } } /** @@ -116,6 +118,12 @@ export class GoogleMap { * @return {Observable} */ on(event: any): Observable { + if (!this._objectInstance) { + return new Observable((observer) => { + observer.error({ error: 'plugin_not_installed' }); + }); + } + return new Observable( (observer) => { this._objectInstance.on(event, observer.next.bind(observer)); @@ -130,6 +138,9 @@ export class GoogleMap { * @return {Promise} */ one(event: any): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( resolve => this._objectInstance.one(event, resolve) ); @@ -207,7 +218,10 @@ export class GoogleMap { @CordovaInstance({ sync: true }) setAllGesturesEnabled(enabled: boolean): void { } - addMarker(options: GoogleMapsMarkerOptions): Promise { + addMarker(options: GoogleMapsMarkerOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addMarker(options, (marker: any) => { @@ -221,7 +235,10 @@ export class GoogleMap { ); } - addCircle(options: GoogleMapsCircleOptions): Promise { + addCircle(options: GoogleMapsCircleOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addCircle(options, (circle: any) => { @@ -235,7 +252,10 @@ export class GoogleMap { ); } - addPolygon(options: GoogleMapsPolygonOptions): Promise { + addPolygon(options: GoogleMapsPolygonOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addPolygon(options, (polygon: any) => { @@ -249,7 +269,10 @@ export class GoogleMap { ); } - addPolyline(options: GoogleMapsPolylineOptions): Promise { + addPolyline(options: GoogleMapsPolylineOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addPolyline(options, (polyline: any) => { @@ -263,7 +286,10 @@ export class GoogleMap { ); } - addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise { + addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addTileOverlay(options, (tileOverlay: any) => { @@ -277,7 +303,10 @@ export class GoogleMap { ); } - addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise { + addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => { @@ -291,7 +320,10 @@ export class GoogleMap { ); } - addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise { + addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise { + if (!this._objectInstance) { + return Promise.reject({ error: 'plugin_not_installed' }); + } return new Promise( (resolve, reject) => { this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => { @@ -942,9 +974,10 @@ export class Geocoder { * @param {GeocoderRequest} request Request object with either an address or a position * @returns {Promise} */ - static geocode(request: GeocoderRequest): Promise { + static geocode(request: GeocoderRequest): Promise { return new Promise((resolve, reject) => { if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) { + pluginWarn(pluginMap); reject({ error: 'plugin_not_installed' }); } else { plugin.google.maps.Geocoder.geocode(request, resolve); From 3dd6a92ccfa5f91c9a6331e27d0fe1841eb8305d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Bu=C3=9Fmann?= Date: Sun, 9 Oct 2016 02:34:27 +0200 Subject: [PATCH 240/382] fix(paypal): problems with selection of PayPal environment (#662) * Fixed bugs with selection of environment and added missing prepareToRender function * Updated PayPal usage example --- src/plugins/pay-pal.ts | 67 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 1627ee1f2..4b0b96975 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -6,15 +6,47 @@ import { Plugin, Cordova } from './plugin'; * * @usage * ``` - * import {PayPal} from 'ionic-native'; + * import {PayPal, PayPalPayment, PayPalConfiguration} from "ionic-native"; * * PayPal.init({ - * "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID", - "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID" - }) - * .then(onSuccess) - * .catch(onError); + * "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID", + * "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID" + * }).then(() => { + * // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction + * PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({ + * // Only needed if you get an "Internal Service Error" after PayPal login! + * //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal + * })).then(() => { + * let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale'); + * PayPal.renderSinglePaymentUI(payment).then(() => { + * // Successfully paid * + * // Example sandbox response + * // + * // { + * // "client": { + * // "environment": "sandbox", + * // "product_name": "PayPal iOS SDK", + * // "paypal_sdk_version": "2.16.0", + * // "platform": "iOS" + * // }, + * // "response_type": "payment", + * // "response": { + * // "id": "PAY-1AB23456CD789012EF34GHIJ", + * // "state": "approved", + * // "create_time": "2016-10-03T13:33:33Z", + * // "intent": "sale" + * // } + * // } + * }, () => { + * // Error or render dialog closed without being successful + * }); + * }, () => { + * // Error in configuration + * }); + * }, () => { + * // Error in initialization, maybe PayPal isn't supported or something else + * }); * ``` * @interfaces * PayPalEnvironment @@ -31,23 +63,33 @@ import { Plugin, Cordova } from './plugin'; repo: 'https://github.com/paypal/PayPal-Cordova-Plugin' }) export class PayPal { + /** + * Retrieve the version of the PayPal iOS SDK library. Useful when contacting support. + */ + @Cordova() + static version(): Promise {return; } + /** * You must preconnect to PayPal to prepare the device for processing payments. * This improves the user experience, by making the presentation of the * UI faster. The preconnect is valid for a limited time, so * the recommended time to preconnect is on page load. * - * @param {String} environment available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox" - * @param {PayPalConfiguration} configuration For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set + * @param {PayPalEnvironment} clientIdsForEnvironments: set of client ids for environments */ @Cordova() - static init(environment: PayPalEnvironment, configuration?: PayPalConfiguration): Promise {return; } + static init(clientIdsForEnvironments: PayPalEnvironment): Promise {return; } /** - * Retreive the version of PayPal iOS SDK Library. - */ + * You must preconnect to PayPal to prepare the device for processing payments. + * This improves the user experience, by making the presentation of the UI faster. + * The preconnect is valid for a limited time, so the recommended time to preconnect is on page load. + * + * @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox" + * @param {PayPalConfiguration} configuration: PayPalConfiguration object, for Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set + **/ @Cordova() - static version(): Promise {return; } + static prepareToRender(environment: string, configuration: PayPalConfiguration): Promise {return; } /** * Start PayPal UI to collect payment from the user. @@ -85,7 +127,6 @@ export class PayPal { **/ @Cordova() static renderProfileSharingUI(scopes: string[]): Promise {return; } - } export interface PayPalEnvironment { From 720084578d282963815acd68cdadc19f9bfe1b94 Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 8 Oct 2016 20:44:32 -0400 Subject: [PATCH 241/382] fix(paypal): add optional details param to paypalpayment --- src/plugins/pay-pal.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 4b0b96975..cd550b65d 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -138,19 +138,12 @@ export interface PayPalEnvironment { * @private */ export class PayPalPayment { - /** - * Convenience constructor. - * Returns a PayPalPayment with the specified amount, currency code, and short description. - * @param {String} amount: The amount of the payment. - * @param {String} currency: The ISO 4217 currency for the payment. - * @param {String} shortDescription: A short description of the payment. - * @param {String} intent: "Sale" for an immediate payment. - */ - constructor(amount: string, currency: string, shortDescription: string, intent: string) { + constructor(amount: string, currency: string, shortDescription: string, intent: string, details?: PayPalPaymentDetails) { this.amount = amount; this.currency = currency; this.shortDescription = shortDescription; this.intent = intent; + this.details = details; } /** @@ -198,6 +191,11 @@ export class PayPalPayment { * Optional customer shipping address, if your app wishes to provide this to the SDK. */ shippingAddress: string; + + /** + * Optional PayPalPaymentDetails object + */ + details: PayPalPaymentDetails; } /** From 79670b78781bf1919ea703ef70edf7da047235fa Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 8 Oct 2016 20:57:47 -0400 Subject: [PATCH 242/382] 2.1.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5c0446077..be491ff8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.8", + "version": "2.1.9", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 4a798281e4dc526a8345f3420547c269450aef2c Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 8 Oct 2016 20:57:54 -0400 Subject: [PATCH 243/382] chore(): update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a4f706a9..4a94d2c7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.8...v2.1.9) (2016-10-09) + + +### Bug Fixes + +* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845)) +* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92)) + + + ## [2.1.8](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.8) (2016-10-08) From 13681756aef19c1b05097b2c25a9e3698118bd6f Mon Sep 17 00:00:00 2001 From: Xueron Nee Date: Sun, 9 Oct 2016 16:33:54 +0800 Subject: [PATCH 244/382] fix(thmeable-browser): fix the name of the plugin (#663) --- src/index.ts | 6 +- ...emable-browser.ts => themeable-browser.ts} | 132 ++++++++++-------- 2 files changed, 73 insertions(+), 65 deletions(-) rename src/plugins/{themable-browser.ts => themeable-browser.ts} (85%) diff --git a/src/index.ts b/src/index.ts index 8e4696871..77bc9891f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -100,7 +100,7 @@ import { ThreeDeeTouch } from './plugins/3dtouch'; import { Toast } from './plugins/toast'; import { TouchID } from './plugins/touchid'; import { TextToSpeech } from './plugins/text-to-speech'; -import { ThemableBrowser } from './plugins/themable-browser'; +import { ThemeableBrowser } from './plugins/themeable-browser'; import { TwitterConnect } from './plugins/twitter-connect'; import { Vibration } from './plugins/vibration'; import { VideoEditor } from './plugins/video-editor'; @@ -204,7 +204,7 @@ export * from './plugins/statusbar'; export * from './plugins/stepcounter'; export * from './plugins/streaming-media'; export * from './plugins/text-to-speech'; -export * from './plugins/themable-browser'; +export * from './plugins/themeable-browser'; export * from './plugins/toast'; export * from './plugins/touchid'; export * from './plugins/twitter-connect'; @@ -314,7 +314,7 @@ window['IonicNative'] = { TouchID, Transfer, TextToSpeech, - ThemableBrowser, + ThemeableBrowser, TwitterConnect, VideoEditor, VideoPlayer, diff --git a/src/plugins/themable-browser.ts b/src/plugins/themeable-browser.ts similarity index 85% rename from src/plugins/themable-browser.ts rename to src/plugins/themeable-browser.ts index 43259837c..852a61c15 100644 --- a/src/plugins/themable-browser.ts +++ b/src/plugins/themeable-browser.ts @@ -1,22 +1,79 @@ import { Plugin, CordovaInstance } from './plugin'; import { Observable } from 'rxjs/Observable'; import { InAppBrowserEvent } from './inappbrowser'; + declare var cordova: any; + +export interface ThemeableBrowserButton { + wwwImage?: string; + image?: string; + wwwImagePressed?: string; + imagePressed?: string; + wwwImageDensity?: number; + align?: string; + event?: string; +} + +export interface ThemeableBrowserOptions { + statusbar?: { color: string; }; + toolbar?: { + height?: number; + color?: string; + }; + title?: { color: string; }; + backButton?: ThemeableBrowserButton; + forwardButton?: ThemeableBrowserButton; + closeButton?: ThemeableBrowserButton; + customButtons?: ThemeableBrowserButton[]; + menu?: { + image?: string; + imagePressed?: string; + title?: string; + cancel?: string; + align?: string; + items?: { + event: string; + label: string; + }[]; + }; + backButtonCanClose?: boolean; + + // inAppBrowser options + location?: string; + hidden?: string; + clearcache?: string; + clearsessioncache?: string; + zoom?: string; + hardwareback?: string; + mediaPlaybackRequiresUserAction?: string; + shouldPauseOnSuspsend?: string; + closebuttoncaption?: string; + disallowoverscroll?: string; + enableViewportScale?: string; + allowInlineMediaPlayback?: string; + keyboardDisplayRequiresUserAction?: string; + suppressesIncrementalRendering?: string; + presentationstyle?: string; + transitionstyle?: string; + toolbarposition?: string; + fullscreen?: string; +} + /** - * @name ThemableBrowser + * @name ThemeableBrowser * @description * In-app browser that allows styling. * * @usage * ``` - * import { ThemableBrowser } from 'ionic-native'; + * import { ThemeableBrowser } from 'ionic-native'; * * // can add options from the original InAppBrowser in a JavaScript object form (not string) - * // This options object also takes additional parameters introduced by the ThemableBrowser plugin - * // This example only shows the additional parameters for ThemableBrowser + * // This options object also takes additional parameters introduced by the ThemeableBrowser plugin + * // This example only shows the additional parameters for ThemeableBrowser * // Note that that `image` and `imagePressed` values refer to resources that are stored in your app * let options = { - * statusbar: { + * statusbar: { * color: '#ffffffff' * }, * toolbar: { @@ -83,11 +140,16 @@ declare var cordova: any; pluginRef: 'cordova.ThemeableBrowser', repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser' }) -export class ThemableBrowser { +export class ThemeableBrowser { private _objectInstance: any; constructor(url: string, target: string, styleOptions: ThemeableBrowserOptions) { - this._objectInstance = cordova.ThemableBrowser.open(arguments); + try { + this._objectInstance = cordova.ThemeableBrowser.open(url, target, styleOptions); + } catch (e) { + window.open(url); + console.warn('Native: ThemeableBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.'); + } } /** @@ -125,7 +187,7 @@ export class ThemableBrowser { /** * A method that allows you to listen to events happening in the browser. - * Available events are: `ThemableBrowserError`, `ThemableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined` + * Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined` * @param event Event name * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. */ @@ -138,57 +200,3 @@ export class ThemableBrowser { } -export interface ThemeableBrowserOptions { - statusbar?: { color: string; }; - toobar?: { - height?: number; - color?: string; - }; - title?: { color: string; }; - backButton?: ThemableBrowserButton; - forwardButton?: ThemableBrowserButton; - closeButton?: ThemableBrowserButton; - customButtons?: ThemableBrowserButton[]; - menu?: { - image?: string; - imagePressed?: string; - title?: string; - cancel?: string; - align?: string; - items?: { - event: string; - label: string; - }[]; - }; - backButtonCanClose?: boolean; - - // inAppBrowser options - location?: string; - hidden?: string; - clearcache?: string; - clearsessioncache?: string; - zoom?: string; - hardwareback?: string; - mediaPlaybackRequiresUserAction?: string; - shouldPauseOnSuspsend?: string; - closebuttoncaption?: string; - disallowoverscroll?: string; - enableViewportScale?: string; - allowInlineMediaPlayback?: string; - keyboardDisplayRequiresUserAction?: string; - suppressesIncrementalRendering?: string; - presentationstyle?: string; - transitionstyle?: string; - toolbarposition?: string; - fullscreen?: string; -} - -export interface ThemableBrowserButton { - wwwImage?: string; - image?: string; - wwwImagePressed?: string; - imagePressed?: string; - wwwImageDensity?: number; - align?: string; - event?: string; -} From 4fef8ff32633e339805801af4b82976efee71e1f Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 10 Oct 2016 20:10:14 -0400 Subject: [PATCH 245/382] refractor(onesignal): add OneSignalNotification interface --- src/plugins/onesignal.ts | 130 ++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index f35aefcb4..f900f3ee3 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -41,8 +41,8 @@ export class OneSignal { @Cordova({ observable: true }) static init(appId: string, options: { - googleProjectNumber: string, - autoRegister: boolean + googleProjectNumber: string; + autoRegister: boolean; }): Observable { return; } @@ -168,68 +168,7 @@ export class OneSignal { * @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; } + static postNotification(notificationObj: OneSignalNotification): Promise { return; } /** * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard. @@ -252,3 +191,66 @@ export class OneSignal { }): void { } } + +export interface OneSignalNotification { + 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 +} From 35c8bbd49e7275aa9f002b008133b8024549ea0d Mon Sep 17 00:00:00 2001 From: Ibby Date: Mon, 10 Oct 2016 20:50:10 -0400 Subject: [PATCH 246/382] fix(native-transitions): add missing interface properties --- src/plugins/native-page-transitions.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts index ef66f9c23..41b5d79a1 100644 --- a/src/plugins/native-page-transitions.ts +++ b/src/plugins/native-page-transitions.ts @@ -81,6 +81,9 @@ export interface TransitionOptions { iosdelay?: number; androiddelay?: number; winphonedelay?: number; - fixedPixelsTops?: number; + fixedPixelsTop?: number; fixedPixelsBottom?: number; + action?: string; + origin?: string; + href?: string; } From f0961c7b23dca97f59ea041a770277f2db5a6cd9 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 11 Oct 2016 01:06:41 -0700 Subject: [PATCH 247/382] feat(http): add cordovaHTTP wrapper (#674) --- src/index.ts | 1 + src/plugins/http.ts | 158 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 src/plugins/http.ts diff --git a/src/index.ts b/src/index.ts index 77bc9891f..66fbca981 100644 --- a/src/index.ts +++ b/src/index.ts @@ -158,6 +158,7 @@ export * from './plugins/google-plus'; export * from './plugins/googleanalytics'; export * from './plugins/googlemaps'; export * from './plugins/hotspot'; +export * from './plugins/http'; export * from './plugins/httpd'; export * from './plugins/ibeacon'; export * from './plugins/imagepicker'; diff --git a/src/plugins/http.ts b/src/plugins/http.ts new file mode 100644 index 000000000..39b4b229f --- /dev/null +++ b/src/plugins/http.ts @@ -0,0 +1,158 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name HTTP + * @description + * Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android. + * + * Advantages over Javascript requests: + * - Background threading - all requests are done in a background thread + * - SSL Pinning + * + * @usage + * ``` + * import { HTTP } from 'ionic-native'; + * + * HTTP.get('http://ionic.io', {}, {}) + * .then(data => { + * + * console.log(data.status); + * console.log(data.data); // data received by server + * console.log(data.headers); + * + * }) + * .catch(error => { + * + * console.log(error.status); + * console.log(error.error); // error message as string + * console.log(error.headers); + * + * }); + * + * ``` + * @interfaces + * HTTPResponse + */ +@Plugin({ + plugin: 'cordova-plugin-http', + pluginRef: 'cordovaHTTP', + repo: 'https://github.com/wymsee/cordova-HTTP' +}) +export class HTTP { + + /** + * This returns an object representing a basic HTTP Authorization header of the form. + * @param username {string} Username + * @param password {string} Password + * @return {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'} + */ + @Cordova({ sync: true }) + static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; } + + /** + * This sets up all future requests to use Basic HTTP authentication with the given username and password. + * @param username {string} Username + * @param password {string} Password + */ + @Cordova({ sync: true }) + static useBasicAuth(username: string, password: string): void { } + + /** + * Set a header for all future requests. Takes a header and a value. + * @param header {string} The name of the header + * @param value {string} The value of the header + */ + @Cordova({ sync: true }) + static setHeader(header: string, value: string): void { } + + /** + * Enable or disable SSL Pinning. This defaults to false. + * + * To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this stackoverflow answer. You want to convert it to a DER encoded certificate with a .cer extension. + * + * As an alternative, you can store your .cer files in the www/certificates folder. + * @param enable {boolean} Set to true to enable + * @return {Promise} returns a promise that will resolve on success, and reject on failure + */ + @Cordova() + static enableSSLPinning(enable: boolean): Promise { return; } + + /** + * Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false. + * @param accept {boolean} Set to true to accept + * @return {Promise} returns a promise that will resolve on success, and reject on failure + */ + @Cordova() + static acceptAllCerts(accept: boolean): Promise { return; } + + /** + * Whether or not to validate the domain name in the certificate. This defaults to true. + * @param validate {boolean} Set to true to validate + * @return {Promise} returns a promise that will resolve on success, and reject on failure + */ + @Cordova() + static validateDomainName(validate: boolean): Promise { return; } + + /** + * Make a POST request + * @param url {string} The url to send the request to + * @param body {Object} The body of the request + * @param headers {Object} The headers to set for this request + * @return {Promise} returns a promise that resolve on success, and reject on failure + */ + @Cordova() + static post(url: string, body: any, headers: any): Promise { return; } + + /** + * + * @param url {string} The url to send the request to + * @param parameters {Object} Parameters to send with the request + * @param headers {Object} The headers to set for this request + * @return {Promise} returns a promise that resolve on success, and reject on failure + */ + @Cordova() + static get(url: string, parameters: any, headers: any): Promise { return; } + + /** + * + * @param url {string} The url to send the request to + * @param body {Object} The body of the request + * @param headers {Object} The headers to set for this request + * @param filePath {string} The local path of the file to upload + * @param fileParameter {string} The name of the parameter to pass the file along as + * @return {Promise} returns a promise that resolve on success, and reject on failure + */ + @Cordova() + static uploadFile(url: string, body: any, headers: any, filePath: string, fileParameter: string): Promise { return; } + + /** + * + * @param url {string} The url to send the request to + * @param body {Object} The body of the request + * @param headers {Object} The headers to set for this request + * @param filePath {string} The path to donwload the file to, including the file name. + * @return {Promise} returns a promise that resolve on success, and reject on failure + */ + @Cordova() + static downloadFile(url: string, body: any, headers: any, filePath: string): Promise { return; } + + +} + +export interface HTTPResponse { + /** + * The status number of the response + */ + status: number; + /** + * The data that is in the response. This property usually exists when a promise returned by a request method resolves. + */ + data?: any; + /** + * The headers of the response + */ + headers: any; + /** + * Error response from the server. This property usually exists when a promise returned by a request method rejects. + */ + error?: string; +} From 7b2fe69c7c2b2eac31707bec00d0fc55a498b023 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 11 Oct 2016 05:11:05 -0300 Subject: [PATCH 248/382] docs(camera-preview): change repo no longer maintaned fix #360 * docs(camera-preview): change repo no longer maintaned fix #360 * refactor(camera-preview): delete dead code --- src/plugins/camera-preview.ts | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index a9edfc5bc..842be05e4 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -19,7 +19,7 @@ export interface CameraPreviewSize { * @description * Showing camera preview in HTML * - * 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/westonganger/cordova-plugin-camera-preview'). * * @usage * ``` @@ -71,7 +71,7 @@ export interface CameraPreviewSize { @Plugin({ plugin: 'cordova-plugin-camera-preview', pluginRef: 'cordova.plugins.camerapreview', - repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview', + repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', platforms: ['Android', 'iOS'] }) export class CameraPreview { @@ -139,14 +139,6 @@ export class CameraPreview { }) static hide(): void { }; - /** - * Set the default mode for the Flash. - */ - // @Cordova({ - // sync: true - // }) - // static setFlashMode(mode: number): void { }; - /** * Set camera color effect. */ @@ -154,15 +146,4 @@ export class CameraPreview { sync: true }) static setColorEffect(effect: string): void { }; - - /** - * @private - * @enum {number} - */ - static FlashMode = { - OFF: 0, - ON: 1, - AUTO: 2 - }; - } From c5fd83ddb6fbe8e533823f20d5d4ac2df537df32 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 11 Oct 2016 05:12:32 -0300 Subject: [PATCH 249/382] style(onesignal): add semicolon fix lint (#672) --- src/plugins/onesignal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index f900f3ee3..5d3414441 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -252,5 +252,5 @@ export interface OneSignalNotification { adm_group_message?: any; ttl?: number; priority?: number; - ios_category?: string + ios_category?: string; } From 7c6e6d8b6ba12554faec794df0216129015b07cf Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Tue, 11 Oct 2016 01:12:43 -0700 Subject: [PATCH 250/382] fix(onesignal): update to match latest api (#671) closes #667 --- src/plugins/onesignal.ts | 154 ++++++++++++++++++++++++--------------- 1 file changed, 96 insertions(+), 58 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 5d3414441..ec878e4c9 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -14,13 +14,19 @@ import { Observable } from 'rxjs/Observable'; * ```typescript * import { OneSignal } from 'ionic-native'; * - * OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', - * {googleProjectNumber: '703322744261'}) - * .subscribe(jsonData => { - * console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData)); - * }); + * OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261'); * * OneSignal.enableInAppAlertNotification(true); + * + * OneSignal.handleNotificationReceived().subscribe(() => { + * // do something when notification is received + * }); + * + * OneSignal.handleNotificationOpened().subscribe(() => { + * // do something when a notification is opened + * }); + * + * OneSignal.endInit(); * ``` * */ @@ -32,26 +38,71 @@ import { Observable } from 'rxjs/Observable'; export class OneSignal { /** - * Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event. - * - * @param {string} 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 {Observable} when a notification is received. Handle your notification action here. + * @private */ - @Cordova({ observable: true }) - static init(appId: string, - options: { - googleProjectNumber: string; - autoRegister: boolean; - }): Observable { return; } - + static OSInFocusDisplayOption = { + None: 0, + InAppAlert : 1, + Notification : 2 + }; /** - * 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. + * Start the initialization process. Once you are done configuring OneSignal, call the endInit function. + * + * @param {string} appId Your AppId from your OneSignal app + * @param {string} googleProjectNumber The Google Project Number (which you can get from the Google Developer Portal) and the autoRegister option. */ @Cordova({ sync: true }) - static registerForPushNotifications(): void { } + static startInit(appId: string, googleProjectNumber: string): any { return; } + + /** + * Callback to run when a notification is received + * @return {Observable} + */ + @Cordova({ + observable: true + }) + static handleNotificationReceived(): Observable { return; } + + /** + * Callback to run when a notification is opened + * @return {Observable} + */ + @Cordova({ + observable: true + }) + static handleNotificationOpened(): Observable { return; } + + /** + * + * @param settings + */ + @Cordova({ sync: true }) + static iOSSettings(settings: { + kOSSettingsKeyInAppLaunchURL: boolean; + kOSSettingsKeyAutoPrompt: boolean; + }): any { return; } + + @Cordova({ sync: true }) + static endInit(): any { return; } + + /** + * 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; } + + /** + * 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; } /** @@ -65,47 +116,36 @@ export class OneSignal { 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 {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"} - */ + * 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 {string} 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 {string} Key to remove. - */ + * 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 {string} 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 {Array} Keys to remove. - */ + * Deletes tags that were previously set on a user with `sendTag` or `sendTags`. + * + * @param {Array} 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; } + * 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 { } /** * Warning: @@ -143,15 +183,6 @@ export class OneSignal { @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 {boolean} 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. @@ -176,6 +207,13 @@ export class OneSignal { @Cordova({ sync: true }) static promptLocation(): void { } + /** + * + * @param email {string} + */ + @Cordova({ sync: true }) + static syncHashedEmail(email: string): 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 From 7a8577007c91eb616525b1da534cff417b8f39d8 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 04:19:02 -0400 Subject: [PATCH 251/382] 2.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be491ff8c..32a786db7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.1.9", + "version": "2.2.0", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 1784036ef7553f97c80f0b8478231e89ee333972 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 04:22:46 -0400 Subject: [PATCH 252/382] chore(): update changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a94d2c7f..50cb0e1eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +# [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11) + + +### Bug Fixes + +* **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd)) +* **onesignal:** update to match latest api ([#671](https://github.com/driftyco/ionic-native/issues/671)) ([7c6e6d8](https://github.com/driftyco/ionic-native/commit/7c6e6d8)), closes [#667](https://github.com/driftyco/ionic-native/issues/667) +* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175)) + + +### Features + +* **http:** add cordovaHTTP wrapper ([#674](https://github.com/driftyco/ionic-native/issues/674)) ([f0961c7](https://github.com/driftyco/ionic-native/commit/f0961c7)) + + + ## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.8...v2.1.9) (2016-10-09) From 5b060345d2c2a68bab2db3fc5c141cd59533e8d0 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 04:30:55 -0400 Subject: [PATCH 253/382] chore(): update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50cb0e1eb..16b180151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ # [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11) +## BREAKING CHANGES + +### OneSignal +The wrapper for this plugin has been updated to the match latest version of the plugin (2.x). If you are still using and older version of the plugin (1.x), you should use ionic-native v.2.1.x. + +### ThemeableBrowser +The wrapper for this plugin (and related interfaces) has been refactored to replace "Themable" with "Themeable". Please fix your existing code to match the new class and interfaces names. + +---- + ### Bug Fixes * **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd)) From cf7abe110d1d7505e8fb35c459985d365c3291c7 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 11 Oct 2016 07:25:15 -0300 Subject: [PATCH 254/382] fix(http): export via window.IonicNative (#675) * fix(http): fix export system module * style(http): fix angular style * style(http): delete multiline * chore(http): add attribute platforms to decorator Plugin * fix(http): typo param uploadFile() * fix(http): typo commit https://github.com/driftyco/ionic-native/pull/675/commits/ba6a7e993085683bae705d44c4ce726adcc04b10 --- src/index.ts | 2 ++ src/plugins/http.ts | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 66fbca981..81cad6053 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,6 +52,7 @@ import { GooglePlus } from './plugins/google-plus'; import { GoogleMap } from './plugins/googlemaps'; import { GoogleAnalytics } from './plugins/googleanalytics'; import { Hotspot } from './plugins/hotspot'; +import { HTTP } from './plugins/http'; import { Httpd } from './plugins/httpd'; import { IBeacon } from './plugins/ibeacon'; import { ImagePicker } from './plugins/imagepicker'; @@ -266,6 +267,7 @@ window['IonicNative'] = { GoogleMap, GoogleAnalytics, Hotspot, + HTTP, Httpd, IBeacon, ImagePicker, diff --git a/src/plugins/http.ts b/src/plugins/http.ts index 39b4b229f..ac96557dc 100644 --- a/src/plugins/http.ts +++ b/src/plugins/http.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name HTTP * @description @@ -35,7 +35,8 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-http', pluginRef: 'cordovaHTTP', - repo: 'https://github.com/wymsee/cordova-HTTP' + repo: 'https://github.com/wymsee/cordova-HTTP', + platforms: ['Android', 'iOS'] }) export class HTTP { @@ -118,11 +119,11 @@ export class HTTP { * @param body {Object} The body of the request * @param headers {Object} The headers to set for this request * @param filePath {string} The local path of the file to upload - * @param fileParameter {string} The name of the parameter to pass the file along as + * @param name {string} The name of the parameter to pass the file along as * @return {Promise} returns a promise that resolve on success, and reject on failure */ @Cordova() - static uploadFile(url: string, body: any, headers: any, filePath: string, fileParameter: string): Promise { return; } + static uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise { return; } /** * @@ -134,8 +135,6 @@ export class HTTP { */ @Cordova() static downloadFile(url: string, body: any, headers: any, filePath: string): Promise { return; } - - } export interface HTTPResponse { From 7f38cb5a160aa0feb56dc877b17758c6bb52a4a4 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 09:13:56 -0400 Subject: [PATCH 255/382] docs(datepicker): improve docs --- src/plugins/datepicker.ts | 77 ++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index cb16a453a..4416b6ef2 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -1,66 +1,104 @@ -import { Cordova, Plugin } from './plugin'; +import {Cordova, Plugin} from './plugin'; export interface DatePickerOptions { /** - * Platforms: iOS, Android, Windows * The mode of the date picker * Values: date | time | datetime */ mode: string; /** - * Platforms: iOS, Android, Windows * Selected date */ date: Date | string | number; /** - * Platforms: iOS, Android, Windows * Minimum date - * Type: Date | empty String * Default: empty String */ minDate?: Date | string | number; /** - * Platforms?: iOS, Android, Windows * Maximum date - * Type?: Date | empty String * Default?: empty String */ maxDate?: Date | string | number; /** - * Platforms?: Android * Label for the dialog title. If empty, uses android default (Set date/Set time). - * Type?: String * Default?: empty String */ titleText?: string; /** - * Platforms?: Android * Label of BUTTON_POSITIVE (done button) on Android */ okText?: string; - - // TODO complete documentation here, and copy params & docs to main plugin docs + /** + * Label of BUTTON_NEGATIVE (cancel button). If empty, uses android.R.string.cancel. + */ cancelText?: string; + /** + * Label of today button. If empty, doesn't show the option to select current date. + */ todayText?: string; + /** + * Label of now button. If empty, doesn't show the option to select current time. + */ nowText?: string; + /** + * Shows time dialog in 24 hours format. + */ is24Hour?: boolean; + /** + * Choose the Android theme for the picker. You can use the DatePicker.ANDROID_THEMES property. + * Values: 1: THEME_TRADITIONAL | 2: THEME_HOLO_DARK | 3: THEME_HOLO_LIGHT | 4: THEME_DEVICE_DEFAULT_DARK | 5: THEME_DEVICE_DEFAULT_LIGHT + */ androidTheme?: number; + /** + * Shows or hide dates earlier then selected date. + */ allowOldDate?: boolean; + /** + * Shows or hide dates after selected date. + */ allowFutureDates?: boolean; + /** + * Label of done button. + */ doneButtonLabel?: string; + /** + * Hex color of done button. + */ doneButtonColor?: string; + /** + * Label of cancel button. + */ cancelButtonLabel?: string; + /** + * Hex color of cancel button. + */ cancelButtonColor?: string; + /** + * X position of date picker. The position is absolute to the root view of the application. + */ x?: number; + /** + * Y position of date picker. The position is absolute to the root view of the application. + */ y?: number; + /** + * Interval between options in the minute section of the date picker. + */ minuteInterval?: number; + /** + * Force the UIPopoverArrowDirection enum. The value any will revert to default UIPopoverArrowDirectionAny and let the app choose the proper direction itself. + */ popoverArrowDirection?: string; + /** + * Force locale for datePicker. + */ locale?: string; } @@ -86,7 +124,8 @@ export interface DatePickerOptions { * err => console.log('Error occurred while getting date: ', err) * ); * ``` - * + * @interfaces + * DatePickerOptions */ @Plugin({ plugin: 'cordova-plugin-datepicker', @@ -95,12 +134,22 @@ export interface DatePickerOptions { }) export class DatePicker { + static ANDROID_THEMES = { + THEME_TRADITIONAL: 1, + THEME_HOLO_DARK: 2, + THEME_HOLO_LIGHT: 3, + THEME_DEVICE_DEFAULT_DARK: 4, + THEME_DEVICE_DEFAULT_LIGHT: 5 + }; + /** * Shows the date and/or time picker dialog(s) * @param {DatePickerOptions} options Options for the date picker. * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ @Cordova() - static show(options: DatePickerOptions): Promise { return; } + static show(options: DatePickerOptions): Promise { + return; + } } From 69c9b6f555949fac5694f5e6cfac214b4035ba35 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 09:14:17 -0400 Subject: [PATCH 256/382] docs(): set ANDROID_THEMES to private --- src/plugins/datepicker.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 4416b6ef2..0aaa090ae 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -134,6 +134,9 @@ export interface DatePickerOptions { }) export class DatePicker { + /** + * @private + */ static ANDROID_THEMES = { THEME_TRADITIONAL: 1, THEME_HOLO_DARK: 2, From bff48629796b076ba4eba7a7f6d118755b99661b Mon Sep 17 00:00:00 2001 From: Job Date: Wed, 12 Oct 2016 01:32:24 +0200 Subject: [PATCH 257/382] fix(diagnostic): misspelled getContactsAuthorizationStatus method (#678) --- src/plugins/diagnostic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index d2ee0519c..28a18dcda 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -279,7 +279,7 @@ export class Diagnostic { * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) - static getContactsAuthroizationStatus(): Promise { return; } + static getContactsAuthorizationStatus(): Promise { return; } /** * Requests contacts authorization for the application. From e28e5b0f5f4fa82936b1d24310003022ac14a00e Mon Sep 17 00:00:00 2001 From: Xueron Nee Date: Wed, 12 Oct 2016 07:33:35 +0800 Subject: [PATCH 258/382] fix(themeablebrowser): add missed options (#680) --- src/plugins/themeable-browser.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/themeable-browser.ts b/src/plugins/themeable-browser.ts index 852a61c15..e1d659104 100644 --- a/src/plugins/themeable-browser.ts +++ b/src/plugins/themeable-browser.ts @@ -15,12 +15,19 @@ export interface ThemeableBrowserButton { } export interface ThemeableBrowserOptions { - statusbar?: { color: string; }; + statusbar?: { + color: string; + }; toolbar?: { height?: number; color?: string; + image?: string; + }; + title?: { + color?: string; + staticText?: string; + showPageTitle?: boolean; }; - title?: { color: string; }; backButton?: ThemeableBrowserButton; forwardButton?: ThemeableBrowserButton; closeButton?: ThemeableBrowserButton; @@ -37,6 +44,7 @@ export interface ThemeableBrowserOptions { }[]; }; backButtonCanClose?: boolean; + disableAnimation?: boolean; // inAppBrowser options location?: string; From c2d4f1c0dabe1087f405eea17368337289c5a9c7 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 19:35:54 -0400 Subject: [PATCH 259/382] fix(location-accuracy): accuracy param is number closes #676 --- src/plugins/location-accuracy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/location-accuracy.ts b/src/plugins/location-accuracy.ts index 124408327..0f9bdef7d 100644 --- a/src/plugins/location-accuracy.ts +++ b/src/plugins/location-accuracy.ts @@ -44,10 +44,11 @@ export class LocationAccuracy { /** * Requests accurate location + * @param accuracy {number} Accuracy, from 0 to 4. You can use the static properties of this class that start with REQUEST_PRIORITY_ * @returns {Promise} Returns a promise that resolves on success and rejects if an error occurred */ @Cordova({ callbackOrder: 'reverse' }) - static request(accuracy: string): Promise { return; } + static request(accuracy: number): Promise { return; } static REQUEST_PRIORITY_NO_POWER = 0; static REQUEST_PRIORITY_LOW_POWER = 1; From 842a80d4930e3cb01d2da6b91708f4e1b1d266eb Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:10:47 -0400 Subject: [PATCH 260/382] fix(file): fix writeFile method addresses #464 #552 #666 --- src/plugins/file.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 59c0ccea2..9cb067588 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -674,22 +674,30 @@ export class File { if (replaceOrOptions) { if (typeof(replaceOrOptions) === 'boolean') { opts.replace = replaceOrOptions; + } else { + opts.replace = (replaceOrOptions).replace } } + let getFileOpts: Flags = { + create: true, + exclusive: opts.replace + }; + return File.resolveDirectoryUrl(path) .then((fse) => { - return File.getFile(fse, fileName, opts); + return File.getFile(fse, fileName, getFileOpts); }) .then((fe) => { return File.createWriter(fe); }) .then((writer) => { + if (opts.append) { writer.seek(writer.length); } - if (opts.hasOwnProperty('truncate')) { + if (opts.truncate) { writer.truncate(opts.truncate); } @@ -1018,9 +1026,7 @@ export class File { private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { - fse.getFile(fn, flags, (fe) => { - resolve(fe); - }, (err) => { + fse.getFile(fn, flags, resolve, (err) => { File.fillErrorMessage(err); reject(err); }); @@ -1123,12 +1129,12 @@ export class File { return this.writeFileInChunks(writer, gu); } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { writer.onwriteend = (evt) => { if (writer.error) { reject(writer.error); } else { - resolve(); + resolve(evt); } }; writer.write(gu); From 5710eb78a85e3cde0d04078b1915961d6ef26562 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:13:21 -0400 Subject: [PATCH 261/382] fix(file): last parameter for writeFile now only accepts options --- src/plugins/file.ts | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 9cb067588..e352c5bb5 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -659,29 +659,20 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName path relative to base path * @param {string | Blob} text content or blob to write - * @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information. + * @param {WriteOptions} options replace file if set to true. See WriteOptions for more information. * @returns {Promise} Returns a Promise that resolves or rejects with an error. */ static writeFile(path: string, fileName: string, - text: string | Blob, replaceOrOptions: boolean | WriteOptions): Promise { + text: string | Blob, options: WriteOptions): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); err.message = 'file-name cannot start with \/'; return Promise.reject(err); } - let opts: WriteOptions = {}; - if (replaceOrOptions) { - if (typeof(replaceOrOptions) === 'boolean') { - opts.replace = replaceOrOptions; - } else { - opts.replace = (replaceOrOptions).replace - } - } - let getFileOpts: Flags = { create: true, - exclusive: opts.replace + exclusive: options.replace }; return File.resolveDirectoryUrl(path) @@ -693,12 +684,12 @@ export class File { }) .then((writer) => { - if (opts.append) { + if (options.append) { writer.seek(writer.length); } - if (opts.truncate) { - writer.truncate(opts.truncate); + if (options.truncate) { + writer.truncate(options.truncate); } return File.write(writer, text); From 542ff4cf952ada154541e1c2dc81ac2485d931fe Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:16:39 -0400 Subject: [PATCH 262/382] feat(file): resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods closes #657 --- src/plugins/file.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index e352c5bb5..588bc89fa 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -958,9 +958,11 @@ export class File { } /** - * @private + * Resolves a local file system URL + * @param furl {string} file system url + * @returns {Promise} */ - private static resolveLocalFilesystemUrl(furl: string): Promise { + static resolveLocalFilesystemUrl(furl: string): Promise { return new Promise((resolve, reject) => { try { window.resolveLocalFileSystemURL(furl, (entry) => { @@ -977,9 +979,11 @@ export class File { } /** - * @private + * Resolves a local directory url + * @param durl {string} directory system url + * @returns {Promise} */ - private static resolveDirectoryUrl(durl: string): Promise { + static resolveDirectoryUrl(durl: string): Promise { return File.resolveLocalFilesystemUrl(durl) .then((de) => { if (de.isDirectory) { From 32f09275aa96ce3e615742df254dcd645dcb3d04 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:18:17 -0400 Subject: [PATCH 263/382] 2.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 32a786db7..c35688221 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.0", + "version": "2.2.1", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 046cbe7fcad3816dd50191b0b9b089e5a96f51e7 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:18:33 -0400 Subject: [PATCH 264/382] chore(): update changelog --- CHANGELOG.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16b180151..37c9ae328 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,20 @@ + +## [2.2.1](https://github.com/driftyco/ionic-native/compare/v2.2.0...v2.2.1) (2016-10-12) + + +### Bug Fixes + +* **diagnostic:** misspelled getContactsAuthorizationStatus method ([#678](https://github.com/driftyco/ionic-native/issues/678)) ([bff4862](https://github.com/driftyco/ionic-native/commit/bff4862)) +* **http:** export via window.IonicNative ([#675](https://github.com/driftyco/ionic-native/issues/675)) ([cf7abe1](https://github.com/driftyco/ionic-native/commit/cf7abe1)) +* **location-accuracy:** accuracy param is number ([c2d4f1c](https://github.com/driftyco/ionic-native/commit/c2d4f1c)), closes [#676](https://github.com/driftyco/ionic-native/issues/676) +* **themeablebrowser:** add missed options ([#680](https://github.com/driftyco/ionic-native/issues/680)) ([e28e5b0](https://github.com/driftyco/ionic-native/commit/e28e5b0)) + + + # [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11) -## BREAKING CHANGES - -### OneSignal -The wrapper for this plugin has been updated to the match latest version of the plugin (2.x). If you are still using and older version of the plugin (1.x), you should use ionic-native v.2.1.x. - -### ThemeableBrowser -The wrapper for this plugin (and related interfaces) has been refactored to replace "Themable" with "Themeable". Please fix your existing code to match the new class and interfaces names. - ----- - ### Bug Fixes * **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd)) From 5c92455ee9868f704354de6f36c1c3e91daee400 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:30:14 -0400 Subject: [PATCH 265/382] feat(file): getFile and getDirectory are now public closes #657 --- src/plugins/file.ts | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 588bc89fa..794e2d8ad 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -959,13 +959,13 @@ export class File { /** * Resolves a local file system URL - * @param furl {string} file system url + * @param fileUrl {string} file system url * @returns {Promise} */ - static resolveLocalFilesystemUrl(furl: string): Promise { + static resolveLocalFilesystemUrl(fileUrl: string): Promise { return new Promise((resolve, reject) => { try { - window.resolveLocalFileSystemURL(furl, (entry) => { + window.resolveLocalFileSystemURL(fileUrl, (entry) => { resolve(entry); }, (err) => { File.fillErrorMessage(err); @@ -980,11 +980,11 @@ export class File { /** * Resolves a local directory url - * @param durl {string} directory system url + * @param directoryUrl {string} directory system url * @returns {Promise} */ - static resolveDirectoryUrl(durl: string): Promise { - return File.resolveLocalFilesystemUrl(durl) + static resolveDirectoryUrl(directoryUrl: string): Promise { + return File.resolveLocalFilesystemUrl(directoryUrl) .then((de) => { if (de.isDirectory) { return de; @@ -997,12 +997,16 @@ export class File { } /** - * @private + * Get a directory + * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method + * @param directoryName {string} Directory name + * @param flags {Flags} Options + * @returns {Promise} */ - private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise { + static getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { - fse.getDirectory(dn, flags, (de) => { + directoryEntry.getDirectory(directoryName, flags, (de) => { resolve(de); }, (err) => { File.fillErrorMessage(err); @@ -1016,12 +1020,16 @@ export class File { } /** - * @private + * Get a file + * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method + * @param fileName {string} File name + * @param flags {Flags} Options + * @returns {Promise} */ - private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise { + static getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { - fse.getFile(fn, flags, resolve, (err) => { + directoryEntry.getFile(fileName, flags, resolve, (err) => { File.fillErrorMessage(err); reject(err); }); From fe46907aaa8db6a3778a2e457a13502ce78a44e1 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:39:26 -0400 Subject: [PATCH 266/382] docs(file): document getFreeDiskspace --- src/plugins/file.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 794e2d8ad..612332cab 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -381,6 +381,10 @@ export class File { 14: 'DIR_READ_ERR', }; + /** + * Get free disk space + * @returns {Promise { return; @@ -393,7 +397,6 @@ export class File { * @param {string} dir Name of directory to check * @return {Promise} Returns a Promise that resolves to true if the directory exists or rejects with an error. */ - static checkDir(path: string, dir: string): Promise { if ((/^\//.test(dir))) { let err = new FileError(5); @@ -418,7 +421,6 @@ export class File { * @param {boolean} replace If true, replaces file with same name. If false returns error * @return {Promise} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. */ - static createDir(path: string, dirName: string, replace: boolean): Promise { if ((/^\//.test(dirName))) { let err = new FileError(5); @@ -447,7 +449,6 @@ export class File { * @param {string} dirName The directory name * @return {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ - static removeDir(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { let err = new FileError(5); @@ -473,7 +474,6 @@ export class File { * @param {string} newDirName The destination directory name * @return {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. */ - static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { newDirName = newDirName || dirName; @@ -530,7 +530,6 @@ export class File { * @param {string} dirName Name of directory * @return {Promise} Returns a Promise that resolves to an array of Entry objects or rejects with an error. */ - static listDir(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { let err = new FileError(5); @@ -555,7 +554,6 @@ export class File { * @param {string} dirName Name of directory * @return {Promise} Returns a Promise that resolves with a RemoveResult or rejects with an error. */ - static removeRecursively(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { let err = new FileError(5); @@ -579,7 +577,6 @@ export class File { * @param {string} file Name of file to check * @return {Promise} Returns a Promise that resolves with a boolean or rejects with an error. */ - static checkFile(path: string, file: string): Promise { if ((/^\//.test(file))) { let err = new FileError(5); @@ -637,7 +634,6 @@ export class File { * @param {string} fileName Name of file to remove * @return {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ - static removeFile(path: string, fileName: string): Promise { if ((/^\//.test(fileName))) { let err = new FileError(5); From d2f42ef33a12b2f706016dd06cf4f337aebd0c03 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:44:27 -0400 Subject: [PATCH 267/382] fix(file): getFreeDiskSpace now works --- src/plugins/file.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 612332cab..3e540b981 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1,4 +1,4 @@ -import { Plugin, Cordova } from './plugin'; +import {Plugin, Cordova, pluginWarn} from './plugin'; declare var window: any; declare var cordova: any; @@ -337,6 +337,12 @@ declare var FileError: { PATH_EXISTS_ERR: number; }; +let pluginMeta = { + plugin: 'cordova-plugin-file', + pluginRef: 'cordova.file', + repo: 'https://github.com/apache/cordova-plugin-file' +}; + /** * @name File * @description @@ -358,11 +364,7 @@ declare var FileError: { * Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/ * It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html */ -@Plugin({ - plugin: 'cordova-plugin-file', - pluginRef: 'cordova.file', - repo: 'https://github.com/apache/cordova-plugin-file' -}) +@Plugin(pluginMeta) export class File { static cordovaFileError: {} = { 1: 'NOT_FOUND_ERR', @@ -383,11 +385,17 @@ export class File { /** * Get free disk space - * @returns {Promise} */ - @Cordova() static getFreeDiskSpace(): Promise { - return; + return new Promise((resolve, reject) => { + if (!cordova || !cordova.exec) { + pluginWarn(pluginMeta); + reject({ error: 'plugin_not_installed' }); + } else { + cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []); + } + }); } /** From 397a209ad2551413aef8b91b814a84d5ec85ad00 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:46:05 -0400 Subject: [PATCH 268/382] docs(file): improve docs --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 3e540b981..ec0a2a548 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -385,7 +385,7 @@ export class File { /** * Get free disk space - * @returns {Promise} + * @returns {Promise} Returns a promise that resolves with the remaining free disk space */ static getFreeDiskSpace(): Promise { return new Promise((resolve, reject) => { From 276d61bf3a681684cf79531ead83d0e8c4bc8fcc Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:48:53 -0400 Subject: [PATCH 269/382] fix(file): read methods can accept Blobs too --- src/plugins/file.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index ec0a2a548..69cf3287f 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -301,10 +301,10 @@ export interface FileReader { onabort: (evt: ProgressEvent) => void; abort(): void; - readAsText(fe: File, encoding?: string): void; - readAsDataURL(fe: File): void; - readAsBinaryString(fe: File): void; - readAsArrayBuffer(fe: File): void; + readAsText(fe: File | Blob, encoding?: string): void; + readAsDataURL(fe: File | Blob): void; + readAsBinaryString(fe: File | Blob): void; + readAsArrayBuffer(fe: File | Blob): void; } declare var FileReader: { From 5cfb3b033b39739c61e255dcd44f199c9aa19ef7 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 21:02:53 -0400 Subject: [PATCH 270/382] refractor(): remove unused import --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 69cf3287f..7528afb1c 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova, pluginWarn} from './plugin'; +import {Plugin, pluginWarn} from './plugin'; declare var window: any; declare var cordova: any; From 798625698dfa1fa53d543e3d277594e58978aca2 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 21:03:23 -0400 Subject: [PATCH 271/382] 2.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c35688221..c5a8a414a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.1", + "version": "2.2.2", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From ceb4217415122c47b64716222deec97f1e05db9b Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 21:03:52 -0400 Subject: [PATCH 272/382] chore(): update changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c9ae328..48f27cb91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +## [2.2.2](https://github.com/driftyco/ionic-native/compare/v2.2.1...v2.2.2) (2016-10-12) + + +### Bug Fixes + +* **file:** getFreeDiskSpace now works ([d2f42ef](https://github.com/driftyco/ionic-native/commit/d2f42ef)) +* **file:** read methods can accept Blobs too ([276d61b](https://github.com/driftyco/ionic-native/commit/276d61b)) + + +### Features + +* **file:** getFile and getDirectory are now public ([5c92455](https://github.com/driftyco/ionic-native/commit/5c92455)), closes [#657](https://github.com/driftyco/ionic-native/issues/657) + + + ## [2.2.1](https://github.com/driftyco/ionic-native/compare/v2.2.0...v2.2.1) (2016-10-12) @@ -5,11 +21,18 @@ ### Bug Fixes * **diagnostic:** misspelled getContactsAuthorizationStatus method ([#678](https://github.com/driftyco/ionic-native/issues/678)) ([bff4862](https://github.com/driftyco/ionic-native/commit/bff4862)) +* **file:** fix writeFile method ([842a80d](https://github.com/driftyco/ionic-native/commit/842a80d)) +* **file:** last parameter for writeFile now only accepts options ([5710eb7](https://github.com/driftyco/ionic-native/commit/5710eb7)) * **http:** export via window.IonicNative ([#675](https://github.com/driftyco/ionic-native/issues/675)) ([cf7abe1](https://github.com/driftyco/ionic-native/commit/cf7abe1)) * **location-accuracy:** accuracy param is number ([c2d4f1c](https://github.com/driftyco/ionic-native/commit/c2d4f1c)), closes [#676](https://github.com/driftyco/ionic-native/issues/676) * **themeablebrowser:** add missed options ([#680](https://github.com/driftyco/ionic-native/issues/680)) ([e28e5b0](https://github.com/driftyco/ionic-native/commit/e28e5b0)) +### Features + +* **file:** resolveLocalFilesystemUrl and resolveDirectoryUrl are now public methods ([542ff4c](https://github.com/driftyco/ionic-native/commit/542ff4c)), closes [#657](https://github.com/driftyco/ionic-native/issues/657) + + # [2.2.0](https://github.com/driftyco/ionic-native/compare/v2.1.9...v2.2.0) (2016-10-11) From babfb0dca3eb32f672062ddd8ed2b2a545c394f4 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 12 Oct 2016 23:51:57 -0300 Subject: [PATCH 273/382] fix(onesignal): update to match latest API version (#691) --- src/plugins/onesignal.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index ec878e4c9..f3c234954 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -1,7 +1,6 @@ import { Cordova, Plugin } from './plugin'; import { Observable } from 'rxjs/Observable'; - /** * @name OneSignal * @description @@ -16,7 +15,7 @@ import { Observable } from 'rxjs/Observable'; * * OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261'); * - * OneSignal.enableInAppAlertNotification(true); + * OneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert); * * OneSignal.handleNotificationReceived().subscribe(() => { * // do something when notification is received @@ -38,7 +37,7 @@ import { Observable } from 'rxjs/Observable'; export class OneSignal { /** - * @private + * constants to use in inFocusDisplaying() */ static OSInFocusDisplayOption = { None: 0, @@ -172,17 +171,13 @@ export class OneSignal { 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. + * Setting to control how OneSignal notifications will be shown when one is received while your app is in focus. By default this is set to inAppAlert, which can be helpful during development. * - * @param {boolean} enable + * @param {number} displayOption Options are 0 = None, 1 = InAppAlert, and 2 = Notification. */ @Cordova({ sync: true }) - static enableNotificationsWhenActive(enable: boolean): void { } - + static inFocusDisplaying(displayOption: number): void { } /** * You can call this method with false to opt users out of receiving all notifications through OneSignal. From 43c8592b4093aceebd0626cc3609c4c45939fe39 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 12 Oct 2016 23:52:27 -0300 Subject: [PATCH 274/382] style(file): fix angular style (#685) --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 7528afb1c..c58179719 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -1,4 +1,4 @@ -import {Plugin, pluginWarn} from './plugin'; +import { Plugin, pluginWarn } from './plugin'; declare var window: any; declare var cordova: any; From 74a252b3246c6aab25197fed53de4e747e9d10a3 Mon Sep 17 00:00:00 2001 From: Colin Frick Date: Fri, 14 Oct 2016 01:00:15 +0200 Subject: [PATCH 275/382] fix(googlemaps): Expose 'type' property in GoogleMapsLatLngBounds #693 (#694) --- src/plugins/googlemaps.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index f2b20c065..2cccc1771 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -885,6 +885,7 @@ export class GoogleMapsLatLngBounds { @InstanceProperty get northeast(): GoogleMapsLatLng { return; } @InstanceProperty get southwest(): GoogleMapsLatLng { return; } + @InstanceProperty get type(): string { return; } constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) { let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng; From 51bc5ef5424bd9a5ab33be417b2f78436ab5158d Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 13 Oct 2016 19:15:38 -0400 Subject: [PATCH 276/382] docs(ble): update docs for isEnabled closes #665 --- src/plugins/ble.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index a947a87d6..fa3a545c7 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -400,17 +400,10 @@ export class BLE { /** * Report if bluetooth is enabled. * - * @usage - * ``` - * BLE.isEnabled().then( - * () => { console.log('enabled'); }, - * () => { console.log('not enabled'); } - * ); - * ``` - * @return Returns a Promise. + * @return {Promise} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled. */ @Cordova() - static isEnabled(): Promise { return; } + static isEnabled(): Promise { return; } /** * Open System Bluetooth settings (Android only). From 82d4ec2738d086a4063a4e55479590bc9468b12d Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 06:03:59 -0400 Subject: [PATCH 277/382] 2.2.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c5a8a414a..472d272fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.2", + "version": "2.2.3", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From b031ceed99349ea4f6323000edd75d176d4f12a6 Mon Sep 17 00:00:00 2001 From: william Date: Fri, 14 Oct 2016 03:06:11 -0700 Subject: [PATCH 278/382] docs(camera-preview): fix repo link (#695) Breaking link to Repo. --- 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 842be05e4..4f306b09e 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -19,7 +19,7 @@ export interface CameraPreviewSize { * @description * Showing camera preview in HTML * - * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview'). + * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview). * * @usage * ``` From debe6834ef27303e61a64f012caa92d65b69ed9f Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 06:06:49 -0400 Subject: [PATCH 279/382] chore(): update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48f27cb91..40332d912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## [2.2.3](https://github.com/driftyco/ionic-native/compare/v2.2.2...v2.2.3) (2016-10-14) + + +### Bug Fixes + +* **googlemaps:** Expose 'type' property in GoogleMapsLatLngBounds [#693](https://github.com/driftyco/ionic-native/issues/693) ([#694](https://github.com/driftyco/ionic-native/issues/694)) ([74a252b](https://github.com/driftyco/ionic-native/commit/74a252b)) +* **onesignal:** update to match latest API version ([#691](https://github.com/driftyco/ionic-native/issues/691)) ([babfb0d](https://github.com/driftyco/ionic-native/commit/babfb0d)) + + + ## [2.2.2](https://github.com/driftyco/ionic-native/compare/v2.2.1...v2.2.2) (2016-10-12) From 6521e1833c4683459ef108ac1d6e60f61b161caf Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 06:43:02 -0400 Subject: [PATCH 280/382] refractor(): change return type of configure --- src/plugins/background-geolocation.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 95028f4f6..053516bce 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -236,8 +236,8 @@ export interface Config { * * // When device is ready : * platform.ready().then(() => { - * // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission. - * + * // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission. + * * // BackgroundGeolocation is highly configurable. See platform specific configuration options * let config = { * desiredAccuracy: 10, @@ -330,10 +330,9 @@ export class BackgroundGeolocation { /** * Configure the plugin. * - * @param {Function} Success callback will be called when background location is determined. - * @param {Function} Fail callback to be executed every time a geolocation error occurs. - * @param {Object} An object of type Config - * + * @param {Function} callback callback will be called when background location is determined. + * @param {Function} errorCallback callback to be executed every time a geolocation error occurs. + * @param {Config} options An object of type Config * @return Location object, which tries to mimic w3c Coordinates interface. * See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface * Callback to be executed every time a geolocation is recorded in the background. @@ -341,7 +340,7 @@ export class BackgroundGeolocation { @Cordova({ sync: true }) - static configure(callback: Function, errorCallback: Function, options: Config): void { return; } + static configure(callback: Function, errorCallback: Function, options: Config): any { return; } /** * Turn ON the background-geolocation system. From db3d5b63c6945980aa334ad14ef3ee2d95055c2a Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 06:44:57 -0400 Subject: [PATCH 281/382] docs(image-picker): add interface docs --- src/plugins/imagepicker.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 7347951b7..800167348 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -2,19 +2,23 @@ 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. + /** + * 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. + /** + * Max width to allow images to be + */ width?: number; + /** + * Max height to allow images to be + */ height?: number; - // quality of resized image, defaults to 100 + /** + * Quality of images, defaults to 100 + */ quality?: number; } @@ -38,6 +42,8 @@ export interface ImagePickerOptions { * } * }, (err) => { }); * ``` + * @interfaces + * ImagePickerOptions */ @Plugin({ plugin: 'cordova-plugin-image-picker', From 37ed9a097a8ba00bca2bc95fe2dca023094a638e Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 07:11:41 -0400 Subject: [PATCH 282/382] docs(toast): add interface to docs --- src/plugins/toast.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 0b0ccc16c..d7355ffe9 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -53,6 +53,8 @@ export interface ToastOptions { * } * ); * ``` + * @interfaces + * ToastOptions */ @Plugin({ plugin: 'cordova-plugin-x-toast', From 99c1d499f7753982b7f051df4f0c9562df61a37a Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 08:12:35 -0400 Subject: [PATCH 283/382] chore(): update contributing guide --- .github/CONTRIBUTING.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2bfe91b22..8956e377b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,18 +1,19 @@ # Contributing to Ionic Native - -## Feature request? -Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add. - -Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins. - ## Have an issue? #### There are no rules, but here are a few things to consider: ###### Before you submit an issue: * Do a quick search to see if there are similar issues -* **Check that you are using the latest version of** `ionic-native` +* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/v2/api/platform/Platform/#ready). +* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save ionic-native@latest` ###### Still having problems? submit an issue with the following details: * Short description of the issue * Steps to reproduce * Stack trace (if available) + + +## Feature request? +Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add. + +Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins. \ No newline at end of file From 3edfafb6f9273c403d5d7b740c9334f3540bf256 Mon Sep 17 00:00:00 2001 From: Ibby Date: Fri, 14 Oct 2016 06:48:57 -0400 Subject: [PATCH 284/382] feat(image-picker): add new android methods --- src/plugins/imagepicker.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 800167348..fdc898304 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -62,4 +62,22 @@ export class ImagePicker { }) static getPictures(options: ImagePickerOptions): Promise { return; } + /** + * Check if we have permission to read images + * @returns {Promise} Returns a promise that resolves with a boolean that indicates whether we have permission + */ + @Cordova({ + platforms: ['Android'] + }) + static hasReadPermission(): Promise { return; } + + /** + * Request permission to read images + * @returns {Promise} + */ + @Cordova({ + platforms: ['Android'] + }) + static requestReadPermission(): Promise { return; } + } From bbda6e22a2d7bd975e34f63e1b6d70a6bb1bc108 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 15 Oct 2016 07:41:06 -0700 Subject: [PATCH 285/382] feat(device-feedback): add DeviceFeedback plugin (#696) --- src/index.ts | 3 ++ src/plugins/device-feedback.ts | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/plugins/device-feedback.ts diff --git a/src/index.ts b/src/index.ts index 81cad6053..4231e2337 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,6 +32,7 @@ import { DatePicker } from './plugins/datepicker'; import { DBMeter } from './plugins/dbmeter'; import { Deeplinks } from './plugins/deeplinks'; import { Device } from './plugins/device'; +import { DeviceFeedback } from './plugins/device-feedback'; import { DeviceAccounts } from './plugins/deviceaccounts'; import { DeviceMotion } from './plugins/devicemotion'; import { DeviceOrientation } from './plugins/deviceorientation'; @@ -139,6 +140,7 @@ export * from './plugins/datepicker'; export * from './plugins/dbmeter'; export * from './plugins/deeplinks'; export * from './plugins/device'; +export * from './plugins/device-feedback'; export * from './plugins/deviceaccounts'; export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; @@ -248,6 +250,7 @@ window['IonicNative'] = { DBMeter, Deeplinks, Device, + DeviceFeedback, DeviceAccounts, DeviceMotion, DeviceOrientation, diff --git a/src/plugins/device-feedback.ts b/src/plugins/device-feedback.ts new file mode 100644 index 000000000..8d2e332ec --- /dev/null +++ b/src/plugins/device-feedback.ts @@ -0,0 +1,54 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name DeviceFeedback + * @description + * + * Plugin that lets you provide haptic or acoustic feedback on Android devices. + * + * @usage + * ``` + * import { DeviceFeedback } from 'ionic-native'; + * + * DeviceFeedback.acoustic(); + * + * DeviceFeedback.haptic(0); + * + * DeviceFeedback.isFeedbackEnabled() + * .then((feedback) => { + * console.log(feedback); + * // { + * // acoustic: true, + * // haptic: true + * // } + * }); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-velda-devicefeedback', + pluginRef: 'plugins.deviceFeedback', + repo: 'https://github.com/VVelda/device-feedback', + platforms: ['Android'] +}) +export class DeviceFeedback { + + /** + * Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do. + */ + @Cordova({ sync: true }) + static acoustic(): void { } + + /** + * Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do. + * @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap. + */ + @Cordova({ sync: true }) + static haptic(type: number): void { } + + /** + * Check if haptic and acoustic feedback is enabled by user settings. + */ + @Cordova() + static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; } + +} From b95f88c165d37ef1beee0bb946859563365ac939 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 15 Oct 2016 07:41:37 -0700 Subject: [PATCH 286/382] feat(mixpanel): MixpanelPeople returns promises (#681) * feat(mixpanel): make MixpanelPeople return promises * remove decorator from people property * add cordova decorator' * test(mixpanel): add mixpanel tests * test(mixpanel): remove unused imports * fix(mixpanel): fix MixpanelPeople class closes #667 --- src/plugins/mixpanel.ts | 76 ++++++++++++++++++++++++++++------- test/plugin.spec.ts | 2 +- test/plugins/mixpanel.spec.ts | 28 +++++++++++++ 3 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 test/plugins/mixpanel.spec.ts diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index f57303a8f..6fa0000f3 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -1,7 +1,15 @@ -import { Cordova, CordovaProperty, Plugin } from './plugin'; +import { Cordova, Plugin } from './plugin'; declare var mixpanel: any; +/** + * @private + */ +export const pluginMeta = { + plugin: 'cordova-plugin-mixpanel', + pluginRef: 'mixpanel', + repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' +}; /** * @name Mixpanel @@ -18,11 +26,7 @@ declare var mixpanel: any; * * ``` */ -@Plugin({ - plugin: 'cordova-plugin-mixpanel', - pluginRef: 'mixpanel', - repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' -}) +@Plugin(pluginMeta) export class Mixpanel { /** * @@ -96,17 +100,61 @@ export class Mixpanel { * * @returns {MixpanelPeople} */ - @CordovaProperty - static get people(): MixpanelPeople { return mixpanel.people; }; + static get people(): typeof MixpanelPeople { + return MixpanelPeople; + }; } /** * @private */ -export declare class MixpanelPeople { - static identify(distinctId: string, onSuccess?: Function, onFail?: Function): void; - static increment(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; - static setPushId(pushId: string, onSuccess?: Function, onFail?: Function): void; - static set(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; - static setOnce(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; +export class MixpanelPeople { + /** + * @private + */ + static plugin: string = pluginMeta.plugin; + /** + * @private + */ + static pluginRef: string = pluginMeta.pluginRef + '.people'; + + /** + * + * @param distinctId {string} + * @return {Promise} + */ + @Cordova() + static identify(distinctId: string): Promise { return; } + + /** + * + * @param peopleProperties {string} + * @return {Promise} + */ + @Cordova() + static increment(peopleProperties: any): Promise { return; } + + /** + * + * @param pushId + * @return {Promise} + */ + @Cordova() + static setPushId(pushId: string): Promise { return; } + + /** + * + * @param peopleProperties + * @return {Promise} + */ + @Cordova() + static set(peopleProperties: any): Promise { return; } + + /** + * + * @param peopleProperties + * @return {Promise} + */ + @Cordova() + static setOnce(peopleProperties: any): Promise { return; } } diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts index 5ecbb477a..8109e5cf2 100644 --- a/test/plugin.spec.ts +++ b/test/plugin.spec.ts @@ -1,4 +1,4 @@ -/// +/// import 'es6-shim'; import {Plugin, Cordova} from './../src/plugins/plugin'; diff --git a/test/plugins/mixpanel.spec.ts b/test/plugins/mixpanel.spec.ts new file mode 100644 index 000000000..7eb43d0b4 --- /dev/null +++ b/test/plugins/mixpanel.spec.ts @@ -0,0 +1,28 @@ +import {Mixpanel} from '../../src/plugins/mixpanel'; +declare const window: any; + +window.mixpanel = { + people: { + identify: (args, success, error) => success('Success') + } +}; + +describe('Mixpanel', () => { + + it('should return MixpanelPeople', () => { + expect(Mixpanel.people).toBeDefined(); + expect(Mixpanel.people.identify).toBeDefined(); + }); + + it('should call a method of MixpanelPeople', (done) => { + const spy = spyOn(window.mixpanel.people, 'identify').and.callThrough(); + Mixpanel.people.identify('veryDistinctSuchIdVeryWow') + .then(result => { + expect(result).toEqual('Success'); + done(); + }); + expect(spy.calls.mostRecent().args[0]).toEqual('veryDistinctSuchIdVeryWow'); + expect(window.mixpanel.people.identify).toHaveBeenCalled(); + }); + +}); From 799e2f0b2e4dbbdacea560b49ab83c3f2d7fd8b8 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 15 Oct 2016 07:41:46 -0700 Subject: [PATCH 287/382] fix(sqlite): fix callback order for transaction (#700) --- src/plugins/sqlite.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 5a98ba617..1942e6c38 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -87,7 +87,10 @@ export class SQLite { }) addTransaction(transaction: any): void { } - @CordovaInstance() + @CordovaInstance({ + successIndex: 2, + errorIndex: 1 + }) transaction(fn: any): Promise { return; } @CordovaInstance() From 4dc82383a0ac3dfc3e5c456ed9e2899d057e93bf Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 15 Oct 2016 13:17:06 -0400 Subject: [PATCH 288/382] 2.2.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 472d272fa..e2cdff10c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.3", + "version": "2.2.4", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 41abaeb7c9e19d34998f214043c075d6da581259 Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 15 Oct 2016 13:17:23 -0400 Subject: [PATCH 289/382] chore(): update changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40332d912..344892feb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [2.2.4](https://github.com/driftyco/ionic-native/compare/v2.2.3...v2.2.4) (2016-10-15) + + +### Bug Fixes + +* **sqlite:** fix callback order for transaction ([#700](https://github.com/driftyco/ionic-native/issues/700)) ([799e2f0](https://github.com/driftyco/ionic-native/commit/799e2f0)) + + +### Features + +* **device-feedback:** add DeviceFeedback plugin ([#696](https://github.com/driftyco/ionic-native/issues/696)) ([bbda6e2](https://github.com/driftyco/ionic-native/commit/bbda6e2)) +* **image-picker:** add new android methods ([3edfafb](https://github.com/driftyco/ionic-native/commit/3edfafb)) +* **mixpanel:** MixpanelPeople returns promises ([#681](https://github.com/driftyco/ionic-native/issues/681)) ([b95f88c](https://github.com/driftyco/ionic-native/commit/b95f88c)), closes [#667](https://github.com/driftyco/ionic-native/issues/667) + + + ## [2.2.3](https://github.com/driftyco/ionic-native/compare/v2.2.2...v2.2.3) (2016-10-14) From 0649d8ca8c275c50204aee0d7a90352f095bc9dd Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sun, 16 Oct 2016 08:00:27 -0200 Subject: [PATCH 290/382] style(device-feedback): fix angular style (#703) --- src/plugins/device-feedback.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/device-feedback.ts b/src/plugins/device-feedback.ts index 8d2e332ec..a04423b76 100644 --- a/src/plugins/device-feedback.ts +++ b/src/plugins/device-feedback.ts @@ -1,4 +1,4 @@ -import {Plugin, Cordova} from './plugin'; +import { Plugin, Cordova } from './plugin'; /** * @name DeviceFeedback * @description From d09018d2d473d9de9b04d89ec46d9d1c8fdd83c2 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Mon, 17 Oct 2016 10:34:16 +0100 Subject: [PATCH 291/382] docs(camera): correct costants paths (#706) --- src/plugins/camera.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 9257f6987..3551c60fa 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -6,7 +6,7 @@ export interface CameraOptions { quality?: number; /** * Choose the format of the return value. - * Defined in navigator.camera.DestinationType. Default is FILE_URI. + * Defined in 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 @@ -15,7 +15,7 @@ export interface CameraOptions { destinationType?: number; /** * Set the source of the picture. - * Defined in navigator.camera.PictureSourceType. Default is CAMERA. + * Defined in Camera.PictureSourceType. Default is CAMERA. * PHOTOLIBRARY : 0, * CAMERA : 1, * SAVEDPHOTOALBUM : 2 @@ -25,7 +25,7 @@ export interface CameraOptions { allowEdit?: boolean; /** * Choose the returned image file's encoding. - * Defined in navigator.camera.EncodingType. Default is JPEG + * Defined in Camera.EncodingType. Default is JPEG * JPEG : 0 Return JPEG encoded image * PNG : 1 Return PNG encoded image */ @@ -42,7 +42,7 @@ export interface CameraOptions { targetHeight?: number; /** * Set the type of media to select from. Only works when PictureSourceType - * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType + * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in 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 @@ -55,7 +55,7 @@ export interface CameraOptions { saveToPhotoAlbum?: boolean; /** * Choose the camera to use (front- or back-facing). - * Defined in navigator.camera.Direction. Default is BACK. + * Defined in Camera.Direction. Default is BACK. * FRONT: 0 * BACK: 1 */ From 96776567eb1d3f316e788ded75f1372ab9ce9713 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 17 Oct 2016 20:33:17 -0500 Subject: [PATCH 292/382] feat(plugins): add name field --- src/plugins/3dtouch.ts | 1 + src/plugins/actionsheet.ts | 1 + src/plugins/admob.ts | 1 + src/plugins/android-fingerprint-auth.ts | 1 + src/plugins/appavailability.ts | 1 + src/plugins/apprate.ts | 1 + src/plugins/appversion.ts | 1 + src/plugins/background-geolocation.ts | 1 + src/plugins/backgroundmode.ts | 1 + src/plugins/badge.ts | 1 + src/plugins/barcodescanner.ts | 1 + src/plugins/base64togallery.ts | 3 ++- src/plugins/batterystatus.ts | 1 + src/plugins/ble.ts | 1 + src/plugins/bluetoothserial.ts | 1 + src/plugins/brightness.ts | 1 + src/plugins/calendar.ts | 1 + src/plugins/call-number.ts | 1 + src/plugins/camera-preview.ts | 1 + src/plugins/camera.ts | 1 + src/plugins/card-io.ts | 1 + src/plugins/clipboard.ts | 1 + src/plugins/code-push.ts | 1 + src/plugins/contacts.ts | 1 + src/plugins/crop.ts | 1 + src/plugins/datepicker.ts | 1 + src/plugins/dbmeter.ts | 1 + src/plugins/deeplinks.ts | 1 + src/plugins/device.ts | 1 + src/plugins/deviceaccounts.ts | 1 + src/plugins/devicemotion.ts | 1 + src/plugins/deviceorientation.ts | 1 + src/plugins/diagnostic.ts | 1 + src/plugins/dialogs.ts | 1 + src/plugins/emailcomposer.ts | 1 + src/plugins/estimote-beacons.ts | 1 + src/plugins/facebook.ts | 1 + src/plugins/file-chooser.ts | 1 + src/plugins/file-opener.ts | 1 + src/plugins/file.ts | 1 + src/plugins/filetransfer.ts | 3 ++- src/plugins/flashlight.ts | 1 + src/plugins/geofence.ts | 3 ++- src/plugins/geolocation.ts | 1 + src/plugins/globalization.ts | 1 + src/plugins/google-plus.ts | 11 ++++++----- src/plugins/googleanalytics.ts | 1 + src/plugins/googlemaps.ts | 1 + src/plugins/hotspot.ts | 1 + src/plugins/httpd.ts | 1 + src/plugins/ibeacon.ts | 1 + src/plugins/imagepicker.ts | 1 + src/plugins/imageresizer.ts | 1 + src/plugins/inappbrowser.ts | 1 + src/plugins/inapppurchase.ts | 1 + src/plugins/insomnia.ts | 1 + src/plugins/instagram.ts | 1 + src/plugins/is-debug.ts | 1 + src/plugins/keyboard.ts | 1 + src/plugins/launchnavigator.ts | 1 + src/plugins/localnotifications.ts | 1 + src/plugins/market.ts | 1 + src/plugins/media-capture.ts | 1 + src/plugins/media.ts | 1 + src/plugins/mixpanel.ts | 1 + src/plugins/music-controls.ts | 1 + src/plugins/native-audio.ts | 1 + src/plugins/native-page-transitions.ts | 1 + src/plugins/nativestorage.ts | 1 + src/plugins/network.ts | 1 + src/plugins/nfc.ts | 1 + src/plugins/onesignal.ts | 1 + src/plugins/pay-pal.ts | 1 + src/plugins/photo-viewer.ts | 1 + src/plugins/pin-dialog.ts | 1 + src/plugins/power-management.ts | 1 + src/plugins/printer.ts | 1 + src/plugins/push.ts | 1 + src/plugins/safari-view-controller.ts | 1 + src/plugins/screen-orientation.ts | 7 ++++--- src/plugins/screenshot.ts | 1 + src/plugins/securestorage.ts | 1 + src/plugins/shake.ts | 1 + src/plugins/sim.ts | 1 + src/plugins/sms.ts | 1 + src/plugins/socialsharing.ts | 1 + src/plugins/spinnerdialog.ts | 1 + src/plugins/splashscreen.ts | 1 + src/plugins/sqlite.ts | 7 ++++--- src/plugins/statusbar.ts | 1 + src/plugins/streaming-media.ts | 1 + src/plugins/text-to-speech.ts | 1 + src/plugins/toast.ts | 1 + src/plugins/touchid.ts | 1 + src/plugins/twitter-connect.ts | 1 + src/plugins/vibration.ts | 3 ++- src/plugins/video-editor.ts | 1 + src/plugins/video-player.ts | 1 + src/plugins/webintent.ts | 1 + src/plugins/youtube-video-player.ts | 1 + src/plugins/zip.ts | 1 + 101 files changed, 116 insertions(+), 15 deletions(-) diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 0288a28df..16af3bbc1 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -65,6 +65,7 @@ declare var window: any; * ``` */ @Plugin({ + name: 'ThreeDeeTouch', plugin: 'cordova-plugin-3dtouch', pluginRef: 'ThreeDeeTouch', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch', diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index c5f457868..03a4901c6 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -41,6 +41,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ + name: 'ActionSheet', plugin: 'cordova-plugin-actionsheet', pluginRef: 'plugins.actionsheet', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet', diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index 1c825b305..b2cd1ffe4 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -8,6 +8,7 @@ import { Observable } from 'rxjs/Observable'; * Please refer the the plugin's original repository for detailed usage. */ @Plugin({ + name: 'AdMob', plugin: 'cordova-plugin-admobpro', pluginRef: 'AdMob', repo: 'https://github.com/floatinghotpot/cordova-admob-pro', diff --git a/src/plugins/android-fingerprint-auth.ts b/src/plugins/android-fingerprint-auth.ts index d75713ac7..8a54fe836 100644 --- a/src/plugins/android-fingerprint-auth.ts +++ b/src/plugins/android-fingerprint-auth.ts @@ -30,6 +30,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'AndroidFingerprintAuth', plugin: 'cordova-plugin-android-fingerprint-auth', pluginRef: 'FingerprintAuth', repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth' diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 58232e203..5461eef69 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -28,6 +28,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'AppAvailability', plugin: 'cordova-plugin-appavailability', pluginRef: 'appAvailability', repo: 'https://github.com/ohh2ahh/AppAvailability', diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 91cd59f79..3a902fc2c 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -44,6 +44,7 @@ declare var window; */ @Plugin({ + name: 'AppRate', plugin: 'cordova-plugin-apprate', pluginRef: 'AppRate', repo: 'https://github.com/pushandplay/cordova-plugin-apprate', diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 644f9657b..4d1e9eb43 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -19,6 +19,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'AppVersion', plugin: 'cordova-plugin-app-version', pluginRef: 'cordova.getAppVersion', repo: 'https://github.com/whiteoctober/cordova-plugin-app-version', diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 053516bce..50252b68f 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -272,6 +272,7 @@ export interface Config { * Config */ @Plugin({ + name: 'BackgroundGeolocation', plugin: 'cordova-plugin-mauron85-background-geolocation', pluginRef: 'backgroundGeolocation', repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation', diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index ae0c77540..fd8d41c85 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -28,6 +28,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ + name: 'BackgroundMode', plugin: 'cordova-plugin-background-mode', pluginRef: 'cordova.plugins.backgroundMode', repo: 'https://github.com/katzer/cordova-plugin-background-mode', diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index c188d273e..0809219b9 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -18,6 +18,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Badge', plugin: 'cordova-plugin-badge', pluginRef: 'cordova.plugins.notification.badge', repo: 'https://github.com/katzer/cordova-plugin-badge', diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 65b4227ff..48ed1a3ed 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -20,6 +20,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'BarcodeScanner', plugin: 'phonegap-plugin-barcodescanner', pluginRef: 'cordova.plugins.barcodeScanner', repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner', diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index 61d55dca1..895f623d7 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -14,6 +14,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Base64ToGallery', plugin: 'cordova-base64-to-gallery', pluginRef: 'cordova', repo: 'https://github.com/Nexxa/cordova-base64-to-gallery', @@ -24,7 +25,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 {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS. + * @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS. * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova({ diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index c70beae60..64f9a1cb3 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -24,6 +24,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'BatteryStatus', plugin: 'cordova-plugin-battery-status', repo: 'https://github.com/apache/cordova-plugin-battery-status', platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'] diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index fa3a545c7..81331ce67 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -160,6 +160,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ + name: 'BLE', plugin: 'cordova-plugin-ble-central', pluginRef: 'ble', repo: 'https://github.com/don/cordova-plugin-ble-central', diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index 069fed3f3..49b8b7344 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -28,6 +28,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'BluetoothSerial', repo: 'https://github.com/don/BluetoothSerial', plugin: 'cordova-plugin-bluetooth-serial', pluginRef: 'bluetoothSerial', diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts index f23161890..15ef6e153 100644 --- a/src/plugins/brightness.ts +++ b/src/plugins/brightness.ts @@ -18,6 +18,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ + name: 'Brightness', plugin: 'cordova-plugin-brightness', pluginRef: 'cordova.plugins.brightness', repo: 'https://github.com/mgcrea/cordova-plugin-brightness', diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index b2ed66c13..ddaf69028 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -38,6 +38,7 @@ export interface CalendarOptions { * */ @Plugin({ + name: 'Calendar', plugin: 'cordova-plugin-calendar', pluginRef: 'plugins.calendar', repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin', diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts index fc305d1b6..281a91ffb 100644 --- a/src/plugins/call-number.ts +++ b/src/plugins/call-number.ts @@ -16,6 +16,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'CallNumber', plugin: 'call-number', pluginRef: 'plugins.CallNumber', repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin', diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 4f306b09e..a47ca50d8 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -69,6 +69,7 @@ export interface CameraPreviewSize { * */ @Plugin({ + name: 'CameraPreview', plugin: 'cordova-plugin-camera-preview', pluginRef: 'cordova.plugins.camerapreview', repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 3551c60fa..a892e9eec 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -110,6 +110,7 @@ export interface CameraPopoverOptions { * CameraPopoverOptions */ @Plugin({ + name: 'Camera', plugin: 'cordova-plugin-camera', pluginRef: 'navigator.camera', repo: 'https://github.com/apache/cordova-plugin-camera', diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index ef6952782..4d390d7f4 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -25,6 +25,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'CardIO', plugin: 'https://github.com/card-io/card.io-Cordova-Plugin', pluginRef: 'CardIO', repo: 'https://github.com/card-io/card.io-Cordova-Plugin', diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 77e502190..ae83a3063 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -28,6 +28,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Clipboard', plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git', pluginRef: 'cordova.plugins.clipboard', repo: 'https://github.com/VersoSolutions/CordovaClipboard', diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts index 29f253d26..4808423ad 100644 --- a/src/plugins/code-push.ts +++ b/src/plugins/code-push.ts @@ -420,6 +420,7 @@ export interface DownloadProgress { * ``` */ @Plugin({ + name: 'CodePush', plugin: 'cordova-plugin-code-push', pluginRef: 'codePush', repo: 'https://github.com/Microsoft/cordova-plugin-code-push', diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index f0ba12e73..43c938134 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -316,6 +316,7 @@ export class ContactFindOptions implements IContactFindOptions { * ContactAddress */ @Plugin({ + name: 'Contacts', plugin: 'cordova-plugin-contacts', pluginRef: 'navigator.contacts', repo: 'https://github.com/apache/cordova-plugin-contacts' diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts index 29f89554a..4c0e7336e 100644 --- a/src/plugins/crop.ts +++ b/src/plugins/crop.ts @@ -16,6 +16,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Crop', plugin: 'cordova-plugin-crop', pluginRef: 'plugins', repo: 'https://github.com/jeduan/cordova-plugin-crop' diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 0aaa090ae..5a991fb56 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -128,6 +128,7 @@ export interface DatePickerOptions { * DatePickerOptions */ @Plugin({ + name: 'DatePicker', plugin: 'cordova-plugin-datepicker', pluginRef: 'datePicker', repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker' diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index 138ee643a..907dded42 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -31,6 +31,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'DBMeter', plugin: 'cordova-plugin-dbmeter', pluginRef: 'DBMeter', repo: 'https://github.com/akofman/cordova-plugin-dbmeter', diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 9cc043016..3b85f36c4 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -33,6 +33,7 @@ export interface DeeplinkMatch { * ``` */ @Plugin({ + name: 'Deeplinks', plugin: 'ionic-plugin-deeplinks', pluginRef: 'IonicDeeplink', repo: 'https://github.com/driftyco/ionic-plugin-deeplinks', diff --git a/src/plugins/device.ts b/src/plugins/device.ts index 6dd106936..01d07cd23 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -41,6 +41,7 @@ export interface Device { * ``` */ @Plugin({ + name: 'Device', plugin: 'cordova-plugin-device', pluginRef: 'device', repo: 'https://github.com/apache/cordova-plugin-device' diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts index 1b1a7a11f..c7392b573 100644 --- a/src/plugins/deviceaccounts.ts +++ b/src/plugins/deviceaccounts.ts @@ -2,6 +2,7 @@ import { Cordova, Plugin } from './plugin'; @Plugin({ + name: 'DeviceAccounts', plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git', pluginRef: 'plugins.DeviceAccounts', repo: 'https://github.com/loicknuchel/cordova-device-accounts', diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index b3a67bcfd..025912f83 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -62,6 +62,7 @@ export interface AccelerometerOptions { * ``` */ @Plugin({ + name: 'DeviceMotion', plugin: 'cordova-plugin-device-motion', pluginRef: 'navigator.accelerometer', repo: 'https://github.com/apache/cordova-plugin-device-motion' diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 431b9aa20..1d5b247a9 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -67,6 +67,7 @@ export interface CompassOptions { * ``` */ @Plugin({ + name: 'DeviceOrientation', plugin: 'cordova-plugin-device-orientation', pluginRef: 'navigator.compass', repo: 'https://github.com/apache/cordova-plugin-device-orientation' diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 28a18dcda..22209e2c3 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -29,6 +29,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Diagnostic', plugin: 'cordova.plugins.diagnostic', pluginRef: 'cordova.plugins.diagnostic', repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin' diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index bfda6f7f8..17effc154 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -32,6 +32,7 @@ export interface PromptCallback { * ``` */ @Plugin({ + name: 'Dialogs', plugin: 'cordova-plugin-dialogs', pluginRef: 'navigator.notification', repo: 'https://github.com/apache/cordova-plugin-dialogs.git' diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index 9e5069f10..f396a5604 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -44,6 +44,7 @@ declare var cordova: any; * ``` */ @Plugin({ + name: 'EmailComposer', plugin: 'cordova-plugin-email', pluginRef: 'cordova.plugins.email', repo: 'https://github.com/hypery2k/cordova-email-plugin', diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index f43ef464c..07d42d6fa 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -9,6 +9,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ + name: 'EstimoteBeacons', plugin: 'cordova-plugin-estimote', pluginRef: 'estimote.beacons', repo: 'https://github.com/evothings/phonegap-estimotebeacons', diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index d6fe83b42..41e982db7 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -78,6 +78,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ + name: 'Facebook', plugin: 'cordova-plugin-facebook4', pluginRef: 'facebookConnectPlugin', repo: 'https://github.com/jeduan/cordova-plugin-facebook4', diff --git a/src/plugins/file-chooser.ts b/src/plugins/file-chooser.ts index 3f1066d91..8fa42e704 100644 --- a/src/plugins/file-chooser.ts +++ b/src/plugins/file-chooser.ts @@ -16,6 +16,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'FileChooser', plugin: 'http://github.com/don/cordova-filechooser.git', pluginRef: 'fileChooser', repo: 'https://github.com/don/cordova-filechooser', diff --git a/src/plugins/file-opener.ts b/src/plugins/file-opener.ts index 638e36358..03d034028 100644 --- a/src/plugins/file-opener.ts +++ b/src/plugins/file-opener.ts @@ -13,6 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'FileOpener', plugin: 'cordova-plugin-file-opener2', pluginRef: 'cordova.plugins.fileOpener2', repo: 'https://github.com/pwlin/cordova-plugin-file-opener2' diff --git a/src/plugins/file.ts b/src/plugins/file.ts index c58179719..3d4d6c162 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -338,6 +338,7 @@ declare var FileError: { }; let pluginMeta = { + name: 'File', plugin: 'cordova-plugin-file', pluginRef: 'cordova.file', repo: 'https://github.com/apache/cordova-plugin-file' diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index defdbeecb..73991d117 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -138,7 +138,7 @@ export interface FileTransferError { * fileKey: 'file', * fileName: 'name.jpg', * headers: {} - * ..... + * ..... * } * fileTransfer.upload("", "", options) * .then((data) => { @@ -152,6 +152,7 @@ export interface FileTransferError { * */ @Plugin({ + name: 'FileTransfer', plugin: 'cordova-plugin-file-transfer', pluginRef: 'FileTransfer', repo: 'https://github.com/apache/cordova-plugin-file-transfer' diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 137901816..7c325b46c 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -16,6 +16,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Flashlight', plugin: 'cordova-plugin-flashlight', pluginRef: 'window.plugins.flashlight', repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git' diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index e7f2fa15e..436ad13a0 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -74,6 +74,7 @@ import { Observable } from 'rxjs/Observable'; declare var window: any; @Plugin({ + name: 'Geofence', plugin: 'cordova-plugin-geofence', pluginRef: 'geofence', repo: 'https://github.com/cowbell/cordova-plugin-geofence/', @@ -146,7 +147,7 @@ export class Geofence { } /** - * Called when the user clicks a geofence notification. iOS and Android only. + * Called when the user clicks a geofence notification. iOS and Android only. * * @return {Promise} */ diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index b2f15ef93..539541e1b 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -139,6 +139,7 @@ export interface GeolocationOptions { * GeolocationOptions */ @Plugin({ + name: 'Geolocation', plugin: 'cordova-plugin-geolocation', pluginRef: 'navigator.geolocation', repo: 'https://github.com/apache/cordova-plugin-geolocation' diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index 88988a8ae..52e3586f2 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -11,6 +11,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Globalization', plugin: 'cordova-plugin-globalization', pluginRef: 'navigator.globalization', repo: 'https://github.com/apache/cordova-plugin-globalization' diff --git a/src/plugins/google-plus.ts b/src/plugins/google-plus.ts index e3401e158..63c0957f8 100644 --- a/src/plugins/google-plus.ts +++ b/src/plugins/google-plus.ts @@ -12,11 +12,12 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - plugin: 'cordova-plugin-googleplus', - pluginRef: 'window.plugins.googleplus', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus', - platforms: ['Web', 'Android', 'iOS'], - install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid' + name: 'GooglePlus', + plugin: 'cordova-plugin-googleplus', + pluginRef: 'window.plugins.googleplus', + repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus', + platforms: ['Web', 'Android', 'iOS'], + install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid' }) export class GooglePlus { diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index d6a4e5883..2ab94af0b 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -13,6 +13,7 @@ declare var window; * - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html) */ @Plugin({ + name: 'GoogleAnalytics', plugin: 'cordova-plugin-google-analytics', pluginRef: 'ga', repo: 'https://github.com/danwilson/google-analytics-plugin', diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 2cccc1771..ec7938b8d 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -84,6 +84,7 @@ export const GoogleMapsAnimation = { * ``` */ let pluginMap = { + name: 'GoogleMap', pluginRef: 'plugin.google.maps.Map', plugin: 'cordova-plugin-googlemaps', repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index ffa21d87a..eb4fcb418 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -15,6 +15,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Hotspot', plugin: 'cordova-plugin-hotspot', pluginRef: 'cordova.plugins.hotspot', repo: 'https://github.com/hypery2k/cordova-hotspot-plugin', diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index 5d11b3941..3c09f6602 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -23,6 +23,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'Httpd', plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', pluginRef: 'cordova.plugins.CorHttpd', repo: 'https://github.com/floatinghotpot/cordova-httpd', diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index c310f603e..f5c178832 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -268,6 +268,7 @@ export interface Delegate { * ``` */ @Plugin({ + name: 'IBeacon', plugin: 'cordova-plugin-ibeacon', pluginRef: 'cordova.plugins.locationManager', repo: 'https://github.com/petermetz/cordova-plugin-ibeacon', diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index fdc898304..d63216de5 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -46,6 +46,7 @@ export interface ImagePickerOptions { * ImagePickerOptions */ @Plugin({ + name: 'ImagePicker', plugin: 'cordova-plugin-image-picker', pluginRef: 'window.imagePicker', repo: 'https://github.com/wymsee/cordova-imagePicker' diff --git a/src/plugins/imageresizer.ts b/src/plugins/imageresizer.ts index bf0f7d756..6bee4bd4f 100644 --- a/src/plugins/imageresizer.ts +++ b/src/plugins/imageresizer.ts @@ -67,6 +67,7 @@ export interface ImageResizerOptions { * ``` */ @Plugin({ + name: 'ImageResizer', plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git', pluginRef: 'ImageResizer', repo: 'https://github.com/protonet/cordova-plugin-image-resizer' diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index b088c9b58..e50b3e8f9 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -31,6 +31,7 @@ export interface InAppBrowserEvent extends Event { * ``` */ @Plugin({ + name: 'InAppBrowser', plugin: 'cordova-plugin-inappbrowser', pluginRef: 'cordova.InAppBrowser', repo: 'https://github.com/apache/cordova-plugin-inappbrowser' diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts index 6603fcdfb..701e2ca1e 100644 --- a/src/plugins/inapppurchase.ts +++ b/src/plugins/inapppurchase.ts @@ -51,6 +51,7 @@ import { Plugin, Cordova } from './plugin'; * */ @Plugin({ + name: 'InAppPurchase', plugin: 'cordova-plugin-inapppurchase', pluginRef: 'inAppPurchase', platforms: ['Android', 'iOS'], diff --git a/src/plugins/insomnia.ts b/src/plugins/insomnia.ts index 8e39c4422..ba46e0ff2 100644 --- a/src/plugins/insomnia.ts +++ b/src/plugins/insomnia.ts @@ -26,6 +26,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ + name: 'Insomnia', plugin: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git', pluginRef: 'plugins.insomnia', repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin', diff --git a/src/plugins/instagram.ts b/src/plugins/instagram.ts index 9334a7255..f045d6698 100644 --- a/src/plugins/instagram.ts +++ b/src/plugins/instagram.ts @@ -15,6 +15,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'Instagram', plugin: 'cordova-instagram-plugin', pluginRef: 'Instagram', repo: 'https://github.com/vstirbu/InstagramPlugin' diff --git a/src/plugins/is-debug.ts b/src/plugins/is-debug.ts index c842a3c15..d04447cf2 100644 --- a/src/plugins/is-debug.ts +++ b/src/plugins/is-debug.ts @@ -17,6 +17,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'IsDebug', plugin: 'cordova-plugin-is-debug', pluginRef: 'cordova.plugins.IsDebug', repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug' diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index 07ecad051..f1998a916 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -14,6 +14,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'Keyboard', plugin: 'ionic-plugin-keyboard', pluginRef: 'cordova.plugins.Keyboard', repo: 'https://github.com/driftyco/ionic-plugin-keyboard' diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 03bd91e68..5746151aa 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -82,6 +82,7 @@ export interface LaunchNavigatorOptions { * ``` */ @Plugin({ + name: 'LaunchNavigator', plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator', pluginRef: 'launchnavigator', repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git' diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 7912e7fa4..d60c0d2d1 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -45,6 +45,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ + name: 'LocalNotifications', plugin: 'de.appplant.cordova.plugin.local-notification', pluginRef: 'cordova.plugins.notification.local', repo: 'https://github.com/katzer/cordova-plugin-local-notifications' diff --git a/src/plugins/market.ts b/src/plugins/market.ts index 1e63ce6fe..0ba60687e 100644 --- a/src/plugins/market.ts +++ b/src/plugins/market.ts @@ -13,6 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'Market', plugin: 'cordova-plugin-market', pluginRef: 'plugins.market', repo: 'https://github.com/xmartlabs/cordova-plugin-market' diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 1bd838a08..f2aba7160 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -22,6 +22,7 @@ declare var navigator: any; * ``` */ @Plugin({ + name: 'MediaCapture', plugin: 'cordova-plugin-media-capture', pluginRef: 'navigator.device.capture', repo: 'https://github.com/apache/cordova-plugin-media-capture' diff --git a/src/plugins/media.ts b/src/plugins/media.ts index d9af0592d..bef100f63 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -68,6 +68,7 @@ export interface MediaError { * ``` */ let pluginMeta = { + name: 'MediaPlugin', repo: 'https://github.com/apache/cordova-plugin-media', plugin: 'cordova-plugin-media', pluginRef: 'Media' diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index 6fa0000f3..6137a9e0c 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -6,6 +6,7 @@ declare var mixpanel: any; * @private */ export const pluginMeta = { + name: 'Mixpanel', plugin: 'cordova-plugin-mixpanel', pluginRef: 'mixpanel', repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts index c091af332..cddd6be00 100644 --- a/src/plugins/music-controls.ts +++ b/src/plugins/music-controls.ts @@ -73,6 +73,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'MusicControls', plugin: 'cordova-plugin-music-controls', pluginRef: 'MusicControls', repo: 'https://github.com/homerours/cordova-music-controls-plugin' diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts index 3eef0d13a..58485763f 100644 --- a/src/plugins/native-audio.ts +++ b/src/plugins/native-audio.ts @@ -21,6 +21,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'NativeAudio', plugin: 'cordova-plugin-nativeaudio', pluginRef: 'plugins.NativeAudio', repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio' diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts index 41b5d79a1..7020e0114 100644 --- a/src/plugins/native-page-transitions.ts +++ b/src/plugins/native-page-transitions.ts @@ -27,6 +27,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'NativePageTransitions', plugin: 'com.telerik.plugins.nativepagetransitions', pluginRef: 'plugins.nativepagetransitions', repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions', diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 66bc7e9e3..f4ee84108 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -23,6 +23,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'NativeStorage', plugin: 'cordova-plugin-nativestorage', pluginRef: 'NativeStorage', repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage' diff --git a/src/plugins/network.ts b/src/plugins/network.ts index 4b238ca11..964b4e501 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -43,6 +43,7 @@ declare var navigator: any; * The `connection` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none` */ @Plugin({ + name: 'Network', plugin: 'cordova-plugin-network-information', repo: 'https://github.com/apache/cordova-plugin-network-information', platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'], diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 1159b97a9..7d1ea916d 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -23,6 +23,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'NFC', plugin: 'phonegap-nfc', pluginRef: 'nfc', repo: 'https://github.com/chariotsolutions/phonegap-nfc' diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index f3c234954..1209d0537 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -30,6 +30,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ + name: 'OneSignal', plugin: 'onesignal-cordova-plugin', pluginRef: 'plugins.OneSignal', repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK' diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index cd550b65d..0539dbf70 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -58,6 +58,7 @@ import { Plugin, Cordova } from './plugin'; * PayPalShippingAddress */ @Plugin({ + name: 'PayPal', plugin: 'com.paypal.cordova.mobilesdk', pluginRef: 'PayPalMobile', repo: 'https://github.com/paypal/PayPal-Cordova-Plugin' diff --git a/src/plugins/photo-viewer.ts b/src/plugins/photo-viewer.ts index 95728f0fd..cca6e4039 100644 --- a/src/plugins/photo-viewer.ts +++ b/src/plugins/photo-viewer.ts @@ -12,6 +12,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'PhotoViewer', plugin: 'com-sarriaroman-photoviewer', pluginRef: 'PhotoViewer', repo: 'https://github.com/sarriaroman/photoviewer' diff --git a/src/plugins/pin-dialog.ts b/src/plugins/pin-dialog.ts index 3e2ac519a..ba7f50052 100644 --- a/src/plugins/pin-dialog.ts +++ b/src/plugins/pin-dialog.ts @@ -20,6 +20,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'PinDialog', plugin: 'cordova-plugin-pin-dialog', pluginRef: 'plugins.pinDialog', repo: 'https://github.com/Paldom/PinDialog' diff --git a/src/plugins/power-management.ts b/src/plugins/power-management.ts index a43999acc..e5dbf7129 100644 --- a/src/plugins/power-management.ts +++ b/src/plugins/power-management.ts @@ -16,6 +16,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'PowerManagement', plugin: 'cordova-plugin-powermanagement-orig', pluginRef: 'powerManagement', repo: 'https://github.com/Viras-/cordova-plugin-powermanagement' diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts index 43ae62f20..72c5062a2 100644 --- a/src/plugins/printer.ts +++ b/src/plugins/printer.ts @@ -61,6 +61,7 @@ export interface PrintOptions { * ``` */ @Plugin({ + name: 'Printer', plugin: 'de.appplant.cordova.plugin.printer', pluginRef: 'cordova.plugins.printer', repo: 'https://github.com/katzer/cordova-plugin-printer.git', diff --git a/src/plugins/push.ts b/src/plugins/push.ts index c4cfff762..10d452b31 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -286,6 +286,7 @@ declare var PushNotification: { * ``` */ @Plugin({ + name: 'Push', plugin: 'phonegap-plugin-push', pluginRef: 'PushNotification', repo: 'https://github.com/phonegap/phonegap-plugin-push' diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 62d342913..12e009a7d 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -39,6 +39,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'SafariViewController', plugin: 'cordova-plugin-safariviewcontroller', pluginRef: 'SafariViewController', platforms: ['iOS', 'Android'], diff --git a/src/plugins/screen-orientation.ts b/src/plugins/screen-orientation.ts index f5c4d4463..a7d305f51 100644 --- a/src/plugins/screen-orientation.ts +++ b/src/plugins/screen-orientation.ts @@ -23,9 +23,9 @@ declare var window; * ``` * * @advanced - * + * * Accepted orientation values: - * + * * | Value | Description | * |-------------------------------|------------------------------------------------------------------------------| * | portrait-primary | The orientation is in the primary portrait mode. | @@ -34,9 +34,10 @@ declare var window; * | 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). | - * + * */ @Plugin({ + name: 'ScreenOrientation', plugin: 'cordova-plugin-screen-orientation', pluginRef: 'window.screen', repo: 'https://github.com/apache/cordova-plugin-screen-orientation', diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index 9b8d97381..822876c69 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -17,6 +17,7 @@ declare var navigator: any; * ``` */ @Plugin({ + name: 'Screenshot', plugin: 'https://github.com/gitawego/cordova-screenshot.git', pluginRef: 'navigator.screenshot', repo: 'https://github.com/gitawego/cordova-screenshot.git' diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts index 09c766a8a..8cf873243 100644 --- a/src/plugins/securestorage.ts +++ b/src/plugins/securestorage.ts @@ -40,6 +40,7 @@ declare var cordova: any; * ``` */ @Plugin({ + name: 'SecureStorage', plugin: 'cordova-plugin-secure-storage', pluginRef: 'plugins.securestorage', repo: 'https://github.com/Crypho/cordova-plugin-secure-storage', diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts index 4e5208f03..99df465b1 100644 --- a/src/plugins/shake.ts +++ b/src/plugins/shake.ts @@ -15,6 +15,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'Shake', plugin: 'cordova-plugin-shake', pluginRef: 'shake', repo: 'https://github.com/leecrossley/cordova-plugin-shake' diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts index bff9a49b0..fe173d7a5 100644 --- a/src/plugins/sim.ts +++ b/src/plugins/sim.ts @@ -20,6 +20,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Sim', plugin: 'cordova-plugin-sim', pluginRef: 'plugins.sim', repo: 'https://github.com/pbakondy/cordova-plugin-sim', diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index d659fc6af..c1b996e37 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -40,6 +40,7 @@ export interface SmsOptionsAndroid { * ``` */ @Plugin({ + name: 'SMS', plugin: 'cordova-sms-plugin', pluginRef: 'sms', repo: 'https://github.com/cordova-sms/cordova-sms-plugin', diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index 78a1ad264..c64ca8433 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -25,6 +25,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'SocialSharing', plugin: 'cordova-plugin-x-socialsharing', pluginRef: 'plugins.socialsharing', repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin', diff --git a/src/plugins/spinnerdialog.ts b/src/plugins/spinnerdialog.ts index 6f5397111..f2c9182cf 100644 --- a/src/plugins/spinnerdialog.ts +++ b/src/plugins/spinnerdialog.ts @@ -15,6 +15,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'SpinnerDialog', plugin: 'cordova-plugin-spinner-dialog', pluginRef: 'window.plugins.spinnerDialog', repo: 'https://github.com/Paldom/SpinnerDialog', diff --git a/src/plugins/splashscreen.ts b/src/plugins/splashscreen.ts index f5bc86623..974c03abe 100644 --- a/src/plugins/splashscreen.ts +++ b/src/plugins/splashscreen.ts @@ -15,6 +15,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Splashscreen', plugin: 'cordova-plugin-splashscreen', pluginRef: 'navigator.splashscreen', repo: 'https://github.com/apache/cordova-plugin-splashscreen' diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 1942e6c38..2b123aa27 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -31,9 +31,10 @@ declare var sqlitePlugin; * */ @Plugin({ - pluginRef: 'sqlitePlugin', - plugin: 'cordova-sqlite-storage', - repo: 'https://github.com/litehelpers/Cordova-sqlite-storage' + name: 'SQLite', + pluginRef: 'sqlitePlugin', + plugin: 'cordova-sqlite-storage', + repo: 'https://github.com/litehelpers/Cordova-sqlite-storage' }) export class SQLite { diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index 2628d9205..2bf89ed5d 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -22,6 +22,7 @@ declare var window; * */ @Plugin({ + name: 'StatusBar', plugin: 'cordova-plugin-statusbar', pluginRef: 'StatusBar', repo: 'https://github.com/apache/cordova-plugin-statusbar', diff --git a/src/plugins/streaming-media.ts b/src/plugins/streaming-media.ts index 86cdf26be..96534232c 100644 --- a/src/plugins/streaming-media.ts +++ b/src/plugins/streaming-media.ts @@ -19,6 +19,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'StreamingMedia', plugin: 'cordova-plugin-streaming-media', pluginRef: 'plugins.streamingMedia', repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media', diff --git a/src/plugins/text-to-speech.ts b/src/plugins/text-to-speech.ts index 41a16025e..f6afd107e 100644 --- a/src/plugins/text-to-speech.ts +++ b/src/plugins/text-to-speech.ts @@ -25,6 +25,7 @@ export interface TTSOptions { * ``` */ @Plugin({ + name: 'TextToSpeech', plugin: 'cordova-plugin-tts', pluginRef: 'TTS', repo: 'https://github.com/vilic/cordova-plugin-tts' diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index d7355ffe9..3e1613479 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -57,6 +57,7 @@ export interface ToastOptions { * ToastOptions */ @Plugin({ + name: 'Toast', plugin: 'cordova-plugin-x-toast', pluginRef: 'plugins.toast', repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin', diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index 559aa8054..749d7b21e 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -45,6 +45,7 @@ import { Cordova, Plugin } from './plugin'; * - `-8` - TouchID is locked out from too many tries */ @Plugin({ + name: 'TouchID', plugin: 'cordova-plugin-touch-id', pluginRef: 'plugins.touchid', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id', diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index f39c93b5b..cd3a7730c 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -27,6 +27,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'TwitterConnect', plugin: 'twitter-connect-plugin', pluginRef: 'TwitterConnect', repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin', diff --git a/src/plugins/vibration.ts b/src/plugins/vibration.ts index 5f2c82a52..df09bcaeb 100644 --- a/src/plugins/vibration.ts +++ b/src/plugins/vibration.ts @@ -10,7 +10,7 @@ import { Cordova, Plugin } from './plugin'; * * * // Vibrate the device for a second - * // Duration is ignored on iOS. + * // Duration is ignored on iOS. * Vibration.vibrate(1000); * * // Vibrate 2 seconds @@ -25,6 +25,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'Vibration', plugin: 'cordova-plugin-vibration', pluginRef: 'navigator', repo: 'https://github.com/apache/cordova-plugin-vibration', diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts index 17a1ea9d9..0c9399a45 100644 --- a/src/plugins/video-editor.ts +++ b/src/plugins/video-editor.ts @@ -137,6 +137,7 @@ export interface VideoInfo { * ``` */ @Plugin({ + name: 'VideoEditor', plugin: 'cordova-plugin-video-editor', pluginRef: 'VideoEditor', repo: 'https://github.com/jbavari/cordova-plugin-video-editor', diff --git a/src/plugins/video-player.ts b/src/plugins/video-player.ts index a39ad9812..47089b03b 100644 --- a/src/plugins/video-player.ts +++ b/src/plugins/video-player.ts @@ -38,6 +38,7 @@ export interface VideoOptions { * ``` */ @Plugin({ + name: 'VideoPlayer', plugin: 'cordova-plugin-videoplayer', pluginRef: 'VideoPlayer', repo: 'https://github.com/moust/cordova-plugin-videoplayer', diff --git a/src/plugins/webintent.ts b/src/plugins/webintent.ts index 568a33e8e..8373dbe0a 100644 --- a/src/plugins/webintent.ts +++ b/src/plugins/webintent.ts @@ -17,6 +17,7 @@ declare var window; * ``` */ @Plugin({ + name: 'WebIntent', plugin: 'https://github.com/Initsogar/cordova-webintent.git', pluginRef: 'window.plugins.webintent', repo: 'https://github.com/Initsogar/cordova-webintent.git', diff --git a/src/plugins/youtube-video-player.ts b/src/plugins/youtube-video-player.ts index 27511bfba..20f034955 100644 --- a/src/plugins/youtube-video-player.ts +++ b/src/plugins/youtube-video-player.ts @@ -13,6 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'YoutubeVideoPlayer', plugin: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git', pluginRef: 'YoutubeVideoPlayer', repo: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer', diff --git a/src/plugins/zip.ts b/src/plugins/zip.ts index b2d4058b1..01dd6e972 100644 --- a/src/plugins/zip.ts +++ b/src/plugins/zip.ts @@ -18,6 +18,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'Zip', plugin: 'cordova-plugin-zip', pluginRef: 'zip', repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip', From 0660a3bc67e82051abcc9aa1c365813a23485943 Mon Sep 17 00:00:00 2001 From: Colin Frick Date: Tue, 18 Oct 2016 12:05:19 +0200 Subject: [PATCH 293/382] feat(filepath): add cordova-plugin-filepath (#714) --- src/index.ts | 3 +++ src/plugins/filepath.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/plugins/filepath.ts diff --git a/src/index.ts b/src/index.ts index 4231e2337..25439d2ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,7 @@ import { Facebook } from './plugins/facebook'; import { File } from './plugins/file'; import { FileChooser } from './plugins/file-chooser'; import { FileOpener } from './plugins/file-opener'; +import { FilePath } from './plugins/filepath'; import { Transfer } from './plugins/filetransfer'; import { Flashlight } from './plugins/flashlight'; import { Geofence } from './plugins/geofence'; @@ -153,6 +154,7 @@ export * from './plugins/file'; export * from './plugins/file-chooser'; export * from './plugins/file-opener'; export * from './plugins/filetransfer'; +export * from './plugins/filepath'; export * from './plugins/flashlight'; export * from './plugins/geofence'; export * from './plugins/geolocation'; @@ -262,6 +264,7 @@ window['IonicNative'] = { File, FileChooser, FileOpener, + FilePath, Flashlight, Geofence, Geolocation, diff --git a/src/plugins/filepath.ts b/src/plugins/filepath.ts new file mode 100644 index 000000000..958570827 --- /dev/null +++ b/src/plugins/filepath.ts @@ -0,0 +1,34 @@ +import { Plugin, Cordova } from './plugin'; + +declare var window: any; + +/** + * @name FilePath + * @description + * + * This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library. + * + * @usage + * ``` + * import {FilePath} from 'ionic-native'; + * + * FilePath.resolveNativePath(path) + * .then(filePath => console.log(filePath); + * .catch(err => console.log(err); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-filepath', + pluginRef: 'window.FilePath', + repo: 'https://github.com/hiddentao/cordova-plugin-filepath', + platforms: ['Android'] +}) +export class FilePath { + /** + * Resolve native path for given content URL/path. + * @param {String} path Content URL/path. + */ + @Cordova() + static resolveNativePath(path: string): Promise {return; } +} From 6982a2d35f26165475b2542325f090148f661ce0 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 18 Oct 2016 12:21:43 -0500 Subject: [PATCH 294/382] chore(deeplinks): Updated Deeplinks docs --- src/plugins/deeplinks.ts | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 3b85f36c4..103474aea 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -28,9 +28,35 @@ export interface DeeplinkMatch { * * @usage * ```typescript - * import { IonicDeeplinks } from 'ionic-native'; + * import { Deeplinks } from 'ionic-native'; * + * Deeplinks.route({ + '/about-us': AboutPage, + '/universal-links-test': AboutPage, + '/products/:productId': ProductPage + }).subscribe((match) => { + // match.$route - the route we matched, which is the matched entry from the arguments to route() + // match.$args - the args passed in the link + // match.$link - the full link data + console.log('Successfully matched route', match); + }, (nomatch) => { + // nomatch.$link - the full link data + console.error('Got a deeplink that didn\'t match', nomatch); + }); * ``` + * + * Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles + * the actual navigation for you: + * + * ```typescript + * Deeplinks.routeWithNavController(this.navController, { + '/about-us': AboutPage, + '/products/:productId': ProductPage + }); + * ``` + * + * See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to + * retrieve the `NavController` reference at runtime. */ @Plugin({ name: 'Deeplinks', @@ -49,8 +75,8 @@ export class Deeplinks { * paths takes an object of the form { 'path': data }. If a deeplink * matches the path, the resulting path-data pair will be returned in the * promise result which you can then use to navigate in the app as you see fit. - * @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and - * is rejected if a deeplink comes through that does not match a given path. + * @returns {Observable} Returns an Observable that is called each time a deeplink comes through, and + * errors if a deeplink comes through that does not match a given path. */ @Cordova({ observable: true @@ -72,8 +98,8 @@ export class Deeplinks { * matches the path, the resulting path-data pair will be returned in the * promise result which you can then use to navigate in the app as you see fit. * - * @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and - * is rejected if a deeplink comes through that does not match a given path. + * @returns {Observable} Returns an Observable that resolves each time a deeplink comes through, and + * errors if a deeplink comes through that does not match a given path. */ @Cordova({ observable: true From 1a803e70becab35c18a6f4e1b8fd5bef6b385974 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Wed, 19 Oct 2016 00:37:53 -0200 Subject: [PATCH 295/382] refractor(filepath): add name field (#722) --- src/plugins/filepath.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/filepath.ts b/src/plugins/filepath.ts index 958570827..44957ae6f 100644 --- a/src/plugins/filepath.ts +++ b/src/plugins/filepath.ts @@ -19,6 +19,7 @@ declare var window: any; * ``` */ @Plugin({ + name: 'FilePath', plugin: 'cordova-plugin-filepath', pluginRef: 'window.FilePath', repo: 'https://github.com/hiddentao/cordova-plugin-filepath', From 970eb755b697d5fb2e4778944854597c84c968b1 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 22 Oct 2016 13:17:44 -0400 Subject: [PATCH 296/382] chore(scripts): clean old docs before processing This should clean the old docs before processing the new ones, to remove any old directories. --- scripts/docs/prepare.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/docs/prepare.sh b/scripts/docs/prepare.sh index 03a25083f..a10db472a 100755 --- a/scripts/docs/prepare.sh +++ b/scripts/docs/prepare.sh @@ -28,6 +28,9 @@ function run { git reset --hard git pull origin master fi + + git rm -rf docs/v2/native/* + } source $(dirname $0)/../utils.inc.sh From 6e445b1beba7ec1b3a183a813f69816385190ac9 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:13 -0200 Subject: [PATCH 297/382] chore(templates): add name field (#729) --- scripts/templates/wrap-min.tmpl | 1 + scripts/templates/wrap.tmpl | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/templates/wrap-min.tmpl b/scripts/templates/wrap-min.tmpl index 733c35cd2..396826dca 100644 --- a/scripts/templates/wrap-min.tmpl +++ b/scripts/templates/wrap-min.tmpl @@ -11,6 +11,7 @@ import { Plugin } from './plugin'; * ``` */ @Plugin({ + name: 'PluginName', plugin: '', pluginRef: '', repo: '' diff --git a/scripts/templates/wrap.tmpl b/scripts/templates/wrap.tmpl index b80894b4b..1e00a120a 100644 --- a/scripts/templates/wrap.tmpl +++ b/scripts/templates/wrap.tmpl @@ -29,6 +29,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ + name: 'PluginName', plugin: '', // npm package name, example: cordova-plugin-camera pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation repo: '', // the github repository URL for the plugin From 49d8348db378a15b12db4a40046366a04dcd52fb Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:19 -0200 Subject: [PATCH 298/382] chore(themeable-browser): add name field (#728) --- src/plugins/themeable-browser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/themeable-browser.ts b/src/plugins/themeable-browser.ts index e1d659104..8ce65868e 100644 --- a/src/plugins/themeable-browser.ts +++ b/src/plugins/themeable-browser.ts @@ -144,6 +144,7 @@ export interface ThemeableBrowserOptions { * We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here. */ @Plugin({ + name: 'ThemeableBrowser', plugin: 'cordova-plugin-themeablebrowser', pluginRef: 'cordova.ThemeableBrowser', repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser' From ee4cfadff175904026aadce6effa2ef64aeab4ef Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:25 -0200 Subject: [PATCH 299/382] chore(devicefeedback): add name field (#727) --- src/plugins/device-feedback.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/device-feedback.ts b/src/plugins/device-feedback.ts index a04423b76..20b1f3d55 100644 --- a/src/plugins/device-feedback.ts +++ b/src/plugins/device-feedback.ts @@ -25,6 +25,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'DeviceFeedback', plugin: 'cordova-plugin-velda-devicefeedback', pluginRef: 'plugins.deviceFeedback', repo: 'https://github.com/VVelda/device-feedback', From 77c7b9d00abd00f92ddfb379d7f8dcd0e6fa68bd Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:32 -0200 Subject: [PATCH 300/382] chore(stepcounter): add name field (#726) --- src/plugins/stepcounter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/stepcounter.ts b/src/plugins/stepcounter.ts index 4a7bfd78e..d10e1f9a6 100644 --- a/src/plugins/stepcounter.ts +++ b/src/plugins/stepcounter.ts @@ -20,6 +20,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ + name: 'Stepcounter', plugin: 'https://github.com/texh/cordova-plugin-stepcounter', pluginRef: 'stepcounter', repo: 'https://github.com/texh/cordova-plugin-stepcounter', From 04d01ac1b32e9b714ceedfc60c772294cfcee371 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:38 -0200 Subject: [PATCH 301/382] chore(zbar): add name field see https://github.com/driftyco/ionic-native/commit/96776567eb1d3f316e788ded75f1372ab9ce9713 (#723) --- src/plugins/z-bar.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/z-bar.ts b/src/plugins/z-bar.ts index 185280c0b..b33ba0854 100644 --- a/src/plugins/z-bar.ts +++ b/src/plugins/z-bar.ts @@ -39,6 +39,7 @@ import { Plugin, Cordova } from './plugin'; * */ @Plugin({ + name: 'ZBar', plugin: 'cordova-plugin-cszbar', pluginRef: 'cloudSky.zBar', repo: 'https://github.com/tjwoon/csZBar', From fa0175d2486a765c5bc4092b745960293ae2e257 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:43 -0200 Subject: [PATCH 302/382] chore(http): add name field (#725) --- src/plugins/http.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/http.ts b/src/plugins/http.ts index ac96557dc..a3df55021 100644 --- a/src/plugins/http.ts +++ b/src/plugins/http.ts @@ -33,6 +33,7 @@ import { Plugin, Cordova } from './plugin'; * HTTPResponse */ @Plugin({ + name: 'HTTP', plugin: 'cordova-plugin-http', pluginRef: 'cordovaHTTP', repo: 'https://github.com/wymsee/cordova-HTTP', From 693ba01137c0d7265b03f0a7aa6ffa2ddd37de5b Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Sat, 22 Oct 2016 15:19:49 -0200 Subject: [PATCH 303/382] chore(location-accuracy): add name field (#724) --- src/plugins/location-accuracy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/location-accuracy.ts b/src/plugins/location-accuracy.ts index 0f9bdef7d..098642404 100644 --- a/src/plugins/location-accuracy.ts +++ b/src/plugins/location-accuracy.ts @@ -23,6 +23,7 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ + name: 'LocationAccuracy', plugin: 'cordova-plugin-request-location-accuracy', pluginRef: 'cordova.plugins.locationAccuracy', repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy' From 757d0961b92098b199c14978c9cfc801f1f7b4d4 Mon Sep 17 00:00:00 2001 From: AndreasGassmann Date: Mon, 24 Oct 2016 22:12:01 +0200 Subject: [PATCH 304/382] fix(3dtouch): add missing property (#739) --- src/plugins/3dtouch.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 16af3bbc1..53301124d 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -54,7 +54,7 @@ declare var window: any; * ]; * ThreeDeeTouch.configureQuickActions(actions); * - * ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe( + * ThreeDeeTouch.onHomeIconPressed().subscribe( * (payload) => { * // returns an object that is the button you presed * console.log('Pressed the ${payload.title} button') @@ -95,6 +95,7 @@ export class ThreeDeeTouch { * @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 + * @param {string} iconTemplate (optional) Can be used to provide your own icon */ @Cordova({ sync: true @@ -140,6 +141,7 @@ export interface ThreeDeeTouchQuickAction { title: string; subtitle?: string; iconType?: string; + iconTemplate?: string; } export interface ThreeDeeTouchForceTouch { From 0317d4455f31e002019909a23285c7f05f351f58 Mon Sep 17 00:00:00 2001 From: twaldecker Date: Thu, 27 Oct 2016 12:30:02 +0200 Subject: [PATCH 305/382] docs(transfer): add how-to download files (#745) also add information how to browse your app files directory, which is hard to find. I needed very long time to check where my files are. --- src/plugins/filetransfer.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 73991d117..334d67095 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -148,8 +148,29 @@ export interface FileTransferError { * }) * } * + * // Cordova + * declare var cordova: any; + * + * download() { + * const fileTransfer = new Transfer(); + * let url = 'http://www.example.com/file.pdf'; + * fileTransfer.download(url, cordova.file.dataDirectory + 'file.pdf').then((entry) => { + * console.log('download complete: ' + entry.toURL()); + * }, (error) => { + * // handle error + * }); + * } + * * ``` * + * Note: You will not see your documents using a file explorer on your device. Use adb: + * + * ``` + * adb shell + * run-as com.your.app + * cd files + * ls + * ``` */ @Plugin({ name: 'FileTransfer', From eb03de96ba9dd508ed47dcf25b0edb207f05bc76 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 06:38:46 -0400 Subject: [PATCH 306/382] feat(diagnostic): add missing functions closes #743 --- src/plugins/diagnostic.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 22209e2c3..1f7451ee5 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,4 +1,5 @@ import { Cordova, Plugin } from './plugin'; +import {Observable} from "rxjs"; /** * @name Diagnostic @@ -441,6 +442,24 @@ export class Diagnostic { @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) static requestRuntimePermissions(permissions: any[]): Promise { return; } + /** + * Indicates if the plugin is currently requesting a runtime permission via the native API. + * Note that only one request can be made concurrently because the native API cannot handle concurrent requests, + * so the plugin will invoke the error callback if attempting to make more than one simultaneous request. + * Multiple permission requests should be grouped into a single call since the native API is setup to handle batch requests of multiple permission groups. + * @return {boolean} + */ + @Cordova({ sync: true }) + static isRequestingPermission(): boolean { return; } + + /** + * Registers a function to be called when a runtime permission request has completed. + * Pass in a falsey value to de-register the currently registered function. + * @param handler {Function} + */ + @Cordova({ sync: true }) + static registerPermissionRequestCompleteHandler(handler: Function): void { return; } + /** * Checks if the device setting for Bluetooth is switched on. * This requires `BLUETOOTH` permission on Android From 24752652b7a7a5e2109d03a7c6a7051361fb67db Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 06:40:22 -0400 Subject: [PATCH 307/382] style(): tslint --- src/plugins/diagnostic.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 1f7451ee5..81148577d 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -1,5 +1,4 @@ import { Cordova, Plugin } from './plugin'; -import {Observable} from "rxjs"; /** * @name Diagnostic From 0388ac3f6b41937da977b75a36dbafb7f2d62cb5 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 06:59:00 -0400 Subject: [PATCH 308/382] test(): fix tests --- karma.conf.ts | 1 + test/plugin.spec.ts | 2 +- test/plugins/mixpanel.spec.ts | 28 ---------------------------- 3 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 test/plugins/mixpanel.spec.ts diff --git a/karma.conf.ts b/karma.conf.ts index da215d038..5b3106254 100644 --- a/karma.conf.ts +++ b/karma.conf.ts @@ -22,6 +22,7 @@ module.exports = config => { }, browserify: { + debug: true, plugin: [ 'tsify' ], extensions: ['.js', '.ts'] }, diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts index 8109e5cf2..ecdb07a74 100644 --- a/test/plugin.spec.ts +++ b/test/plugin.spec.ts @@ -3,7 +3,7 @@ import 'es6-shim'; import {Plugin, Cordova} from './../src/plugins/plugin'; -declare const window: any; +declare let window: any; window.plugins = { test: {} }; diff --git a/test/plugins/mixpanel.spec.ts b/test/plugins/mixpanel.spec.ts deleted file mode 100644 index 7eb43d0b4..000000000 --- a/test/plugins/mixpanel.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {Mixpanel} from '../../src/plugins/mixpanel'; -declare const window: any; - -window.mixpanel = { - people: { - identify: (args, success, error) => success('Success') - } -}; - -describe('Mixpanel', () => { - - it('should return MixpanelPeople', () => { - expect(Mixpanel.people).toBeDefined(); - expect(Mixpanel.people.identify).toBeDefined(); - }); - - it('should call a method of MixpanelPeople', (done) => { - const spy = spyOn(window.mixpanel.people, 'identify').and.callThrough(); - Mixpanel.people.identify('veryDistinctSuchIdVeryWow') - .then(result => { - expect(result).toEqual('Success'); - done(); - }); - expect(spy.calls.mostRecent().args[0]).toEqual('veryDistinctSuchIdVeryWow'); - expect(window.mixpanel.people.identify).toHaveBeenCalled(); - }); - -}); From 62d864546809ff47e9403f4d3ea81300da6bd170 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 27 Oct 2016 07:09:38 -0400 Subject: [PATCH 309/382] leave index.md untouched --- scripts/docs/prepare.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docs/prepare.sh b/scripts/docs/prepare.sh index a10db472a..f41d4e097 100755 --- a/scripts/docs/prepare.sh +++ b/scripts/docs/prepare.sh @@ -29,7 +29,7 @@ function run { git pull origin master fi - git rm -rf docs/v2/native/* + git rm -rf docs/v2/native/*/ } From 48e5d46f1e9b3093398d96211cb7b7c6cc76e9c1 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:17:14 -0400 Subject: [PATCH 310/382] refractor(googlemap): googlemaps.ts to googlemap.ts --- src/index.ts | 4 ++-- src/plugins/{googlemaps.ts => googlemap.ts} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename src/plugins/{googlemaps.ts => googlemap.ts} (100%) diff --git a/src/index.ts b/src/index.ts index 25439d2ec..8b8d55f6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,7 +51,7 @@ import { Geofence } from './plugins/geofence'; import { Geolocation } from './plugins/geolocation'; import { Globalization } from './plugins/globalization'; import { GooglePlus } from './plugins/google-plus'; -import { GoogleMap } from './plugins/googlemaps'; +import { GoogleMap } from './plugins/googlemap'; import { GoogleAnalytics } from './plugins/googleanalytics'; import { Hotspot } from './plugins/hotspot'; import { HTTP } from './plugins/http'; @@ -161,7 +161,7 @@ export * from './plugins/geolocation'; export * from './plugins/globalization'; export * from './plugins/google-plus'; export * from './plugins/googleanalytics'; -export * from './plugins/googlemaps'; +export * from './plugins/googlemap'; export * from './plugins/hotspot'; export * from './plugins/http'; export * from './plugins/httpd'; diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemap.ts similarity index 100% rename from src/plugins/googlemaps.ts rename to src/plugins/googlemap.ts From a5e591cfa6ec21063ef83ef3fc0d2039ddf81605 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:23:13 -0400 Subject: [PATCH 311/382] refractor(googlemap): remove pluginMap constant --- src/plugins/googlemap.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/googlemap.ts b/src/plugins/googlemap.ts index ec7938b8d..aa71a35bf 100644 --- a/src/plugins/googlemap.ts +++ b/src/plugins/googlemap.ts @@ -83,14 +83,13 @@ export const GoogleMapsAnimation = { * }); * ``` */ -let pluginMap = { +@Plugin({ name: 'GoogleMap', pluginRef: 'plugin.google.maps.Map', plugin: 'cordova-plugin-googlemaps', repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"' -}; -@Plugin(pluginMap) +}) export class GoogleMap { _objectInstance: any; @@ -109,7 +108,10 @@ export class GoogleMap { } this._objectInstance = plugin.google.maps.Map.getMap(element, options); } else { - pluginWarn(pluginMap); + pluginWarn({ + name: 'GoogleMap', + plugin: 'plugin.google.maps.Map' + }); } } @@ -979,7 +981,10 @@ export class Geocoder { static geocode(request: GeocoderRequest): Promise { return new Promise((resolve, reject) => { if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) { - pluginWarn(pluginMap); + pluginWarn({ + name: 'GoogleMap', + plugin: 'plugin.google.maps.Map' + }); reject({ error: 'plugin_not_installed' }); } else { plugin.google.maps.Geocoder.geocode(request, resolve); From 55b6ab9c54e20a2b7a68833308a6d5e931dbb4a3 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:24:19 -0400 Subject: [PATCH 312/382] refractor(file): remove pluginMeta variable --- src/plugins/file.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 3d4d6c162..1af744db7 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -337,12 +337,6 @@ declare var FileError: { PATH_EXISTS_ERR: number; }; -let pluginMeta = { - name: 'File', - plugin: 'cordova-plugin-file', - pluginRef: 'cordova.file', - repo: 'https://github.com/apache/cordova-plugin-file' -}; /** * @name File @@ -365,7 +359,12 @@ let pluginMeta = { * Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/ * It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html */ -@Plugin(pluginMeta) +@Plugin({ + name: 'File', + plugin: 'cordova-plugin-file', + pluginRef: 'cordova.file', + repo: 'https://github.com/apache/cordova-plugin-file' +}) export class File { static cordovaFileError: {} = { 1: 'NOT_FOUND_ERR', @@ -391,7 +390,10 @@ export class File { static getFreeDiskSpace(): Promise { return new Promise((resolve, reject) => { if (!cordova || !cordova.exec) { - pluginWarn(pluginMeta); + pluginWarn({ + name: 'File', + plugin: 'cordova-plugin-file' + }); reject({ error: 'plugin_not_installed' }); } else { cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []); From 7324246e6a95f1b2db700b963bbcd07cfba9c797 Mon Sep 17 00:00:00 2001 From: Andrew Cole Date: Thu, 27 Oct 2016 04:25:12 -0700 Subject: [PATCH 313/382] refractor(mixpanel): remove pluginMeta variable (#742) Documentation doesn't specify the repo or the correct command for ionic plugin add ... --- src/plugins/mixpanel.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index 6137a9e0c..7185ee4c4 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -5,12 +5,6 @@ declare var mixpanel: any; /** * @private */ -export const pluginMeta = { - name: 'Mixpanel', - plugin: 'cordova-plugin-mixpanel', - pluginRef: 'mixpanel', - repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' -}; /** * @name Mixpanel @@ -27,7 +21,12 @@ export const pluginMeta = { * * ``` */ -@Plugin(pluginMeta) +@Plugin({ + name: 'Mixpanel', + plugin: 'cordova-plugin-mixpanel', + pluginRef: 'mixpanel', + repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' +}) export class Mixpanel { /** * From 8f5532eb74cb68161ab3183a063b2ca6887f0a0b Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:26:12 -0400 Subject: [PATCH 314/382] refractor(mixpanel): remove pluginMeta variable --- src/plugins/media.ts | 10 ++++++---- src/plugins/mixpanel.ts | 8 ++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/plugins/media.ts b/src/plugins/media.ts index bef100f63..ae23d60ea 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -67,13 +67,12 @@ export interface MediaError { * * ``` */ -let pluginMeta = { +@Plugin({ name: 'MediaPlugin', repo: 'https://github.com/apache/cordova-plugin-media', plugin: 'cordova-plugin-media', pluginRef: 'Media' -}; -@Plugin(pluginMeta) +}) export class MediaPlugin { // Constants @@ -132,7 +131,10 @@ export class MediaPlugin { this._objectInstance = new Media(src, resolve, reject, onStatusUpdate); }); } else { - pluginWarn(pluginMeta); + pluginWarn({ + name: 'MediaPlugin', + plugin: 'cordova-plugin-media' + }); } } diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index 7185ee4c4..1550bbe57 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -2,10 +2,6 @@ import { Cordova, Plugin } from './plugin'; declare var mixpanel: any; -/** - * @private - */ - /** * @name Mixpanel * @description @@ -112,11 +108,11 @@ export class MixpanelPeople { /** * @private */ - static plugin: string = pluginMeta.plugin; + static plugin: string = 'cordova-plugin-mixpanel'; /** * @private */ - static pluginRef: string = pluginMeta.pluginRef + '.people'; + static pluginRef: string = 'mixpanel.people'; /** * From c98b4f4c85bf05558782ac0598805b32683db8cb Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:30:06 -0400 Subject: [PATCH 315/382] fix(sqlite): check if plugin exists before opening database --- src/plugins/sqlite.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 2b123aa27..ee9e25cae 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -1,4 +1,4 @@ -import { Cordova, CordovaInstance, Plugin } from './plugin'; +import {Cordova, CordovaInstance, Plugin, pluginWarn} from './plugin'; declare var sqlitePlugin; @@ -73,13 +73,20 @@ export class SQLite { */ openDatabase(config: any): Promise { return new Promise((resolve, reject) => { - sqlitePlugin.openDatabase(config, db => { - this._objectInstance = db; - resolve(db); - }, error => { - console.warn(error); - reject(error); - }); + if (typeof sqlitePlugin !== 'undefined') { + sqlitePlugin.openDatabase(config, db => { + this._objectInstance = db; + resolve(db); + }, error => { + console.warn(error); + reject(error); + }); + } else { + pluginWarn({ + name: 'SQLite', + plugin: 'cordova-sqlite-storage' + }); + } }); } From 6f4737190b27058629fe43551fe330dc7e27433d Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:30:06 -0400 Subject: [PATCH 316/382] fix(sqlite): check if plugin exists before opening database --- src/plugins/sqlite.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 2b123aa27..ee9e25cae 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -1,4 +1,4 @@ -import { Cordova, CordovaInstance, Plugin } from './plugin'; +import {Cordova, CordovaInstance, Plugin, pluginWarn} from './plugin'; declare var sqlitePlugin; @@ -73,13 +73,20 @@ export class SQLite { */ openDatabase(config: any): Promise { return new Promise((resolve, reject) => { - sqlitePlugin.openDatabase(config, db => { - this._objectInstance = db; - resolve(db); - }, error => { - console.warn(error); - reject(error); - }); + if (typeof sqlitePlugin !== 'undefined') { + sqlitePlugin.openDatabase(config, db => { + this._objectInstance = db; + resolve(db); + }, error => { + console.warn(error); + reject(error); + }); + } else { + pluginWarn({ + name: 'SQLite', + plugin: 'cordova-sqlite-storage' + }); + } }); } From a72cd59b99de68dfccb007822d2e570237215c89 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 07:59:33 -0400 Subject: [PATCH 317/382] fix(sqlite): fix callback issue with transaction method closes #732 --- src/plugins/plugin.ts | 33 +++++++++++++++++++++++---------- test/plugin.spec.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index ec11b3cd1..69ee6cc4f 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -65,20 +65,33 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func obj[opts.errorName] = reject; args.push(obj); } else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') { - // If we've specified a success/error index + const setSuccessIndex = () => { + // If we've specified a success/error index + if (opts.successIndex > args.length) { + args[opts.successIndex] = resolve; + } else { + args.splice(opts.successIndex, 0, resolve); + } + }; - if (opts.successIndex > args.length) { - args[opts.successIndex] = resolve; + const setErrorIndex = () => { + // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour. + if (opts.errorIndex > args.length) { + args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index + } else { + args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array + } + }; + + if(opts.successIndex > opts.errorIndex) { + setErrorIndex(); + setSuccessIndex(); } else { - args.splice(opts.successIndex, 0, resolve); + setSuccessIndex(); + setErrorIndex(); } - // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour. - if (opts.errorIndex > args.length) { - args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index - } else { - args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array - } + } else { // Otherwise, let's tack them on to the end of the argument list // which is 90% of cases diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts index ecdb07a74..b808936c0 100644 --- a/test/plugin.spec.ts +++ b/test/plugin.spec.ts @@ -138,4 +138,36 @@ describe('plugin', () => { }); + it('reverse callback at the end of the function', done => { + + window.plugins.test.reverseEndCallback = (args, error, success) => { + success('Success'); + }; + + @Plugin(testPluginMeta) + class Test { + + @Cordova({ + successIndex: 2, + errorIndex: 1 + }) + static reverseEndCallback(args: any): Promise { return; } + + } + + const spy = spyOn(window.plugins.test, 'reverseEndCallback').and.callThrough(); + const cb = (result) => { + expect(result).toEqual('Success'); + done(); + }; + + Test.reverseEndCallback('foo').then(cb, cb); + + expect(spy.calls.mostRecent().args[0]).toEqual('foo'); + expect(spy.calls.mostRecent().args[1]).toBeDefined(); + expect(spy.calls.mostRecent().args[2]).toBeDefined(); + expect(spy.calls.mostRecent().args[3]).toBeUndefined(); + + }); + }); From d5310b0f739967c59227927461c0ac7d993f28b3 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 08:09:36 -0400 Subject: [PATCH 318/382] fix(geolocation): fix watchPosition return type closes #741 --- 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 539541e1b..9e57a72b8 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -174,7 +174,7 @@ export class Geolocation { * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). * @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors. */ - static watchPosition(options?: GeolocationOptions): Observable { + static watchPosition(options?: GeolocationOptions): Observable { return new Observable( (observer: any) => { let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options); From 685ac5c7a03f71beaabcc347319f628c13ec6124 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 08:11:45 -0400 Subject: [PATCH 319/382] refractor(contacts): export ContactError closes #731 --- src/plugins/contacts.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 43c938134..e355b6066 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -80,7 +80,7 @@ export class Contact implements IContactProperties { /** * @private */ -interface IContactError { +export interface IContactError { /** Error code */ code: number; /** Error message */ @@ -90,7 +90,7 @@ interface IContactError { /** * @private */ -declare var ContactError: { +export declare var ContactError: { new (code: number): IContactError; UNKNOWN_ERROR: number; INVALID_ARGUMENT_ERROR: number; From 8fbf1f2b34fa8d31595a6e4e585d84f1a9a20d33 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 08:14:47 -0400 Subject: [PATCH 320/382] feat(sms): add hasPermission method closes #721 --- src/plugins/sms.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index c1b996e37..b674ae00f 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -60,6 +60,15 @@ export class SMS { phoneNumber: string | string[], message: string, options?: SmsOptions - ): Promise { return; } + ): Promise { return; } + + /** + * This function lets you know if the app has permission to send SMS + * @return {Promise} returns a promise that resolves with a boolean that indicates if we have permission + */ + @Cordova({ + platforms: ['Android'] + }) + static hasPermission(): Promise { return; } } From ac181c543970b1497014957debf0bd7d4acad108 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 08:24:28 -0400 Subject: [PATCH 321/382] fix(nfc): fix Ndef class closes #713 --- src/plugins/nfc.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 7d1ea916d..ab904ac37 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -1,5 +1,6 @@ import { Plugin, Cordova } from './plugin'; import { Observable } from 'rxjs/Observable'; +declare let window: any; /** * @name NFC * @description @@ -156,9 +157,20 @@ export class NFC { /** * @private */ -export declare class Ndef { - static uriRecord(uri: string): any; - static textRecord(text: string): any; - static mimeMediaRecord(mimeType: string, payload: string): any; - static androidApplicationRecord(packageName: string): any; +export class Ndef { + private static name = 'NFC'; + private static plugin = 'phonegap-nfc'; + private static pluginRef = 'ndef'; + + @Cordova({ sync: true }) + static uriRecord(uri: string): any { return; } + + @Cordova({ sync: true }) + static textRecord(text: string): any { return; } + + @Cordova({ sync: true }) + static mimeMediaRecord(mimeType: string, payload: string): any { return; } + + @Cordova({ sync: true }) + static androidApplicationRecord(packageName: string): any { return; } } From 00e63d9fc81ec0edd723905c88e3abfe696c0964 Mon Sep 17 00:00:00 2001 From: Daniel Flood Date: Thu, 27 Oct 2016 09:15:03 -0400 Subject: [PATCH 322/382] docs(youtube-video-player): fix typo (#747) Changed YouTubeVideoPlayer.openVideo to YoutubeVideoPlayer.openVideo (notice the T in Youtube). --- src/plugins/youtube-video-player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/youtube-video-player.ts b/src/plugins/youtube-video-player.ts index 20f034955..1c6e0e494 100644 --- a/src/plugins/youtube-video-player.ts +++ b/src/plugins/youtube-video-player.ts @@ -8,7 +8,7 @@ import { Plugin, Cordova } from './plugin'; * ``` * import {YoutubeVideoPlayer} from 'ionic-native'; * - * YouTubeVideoPlayer.openVideo('myvideoid'); + * YoutubeVideoPlayer.openVideo('myvideoid'); * * ``` */ From bec0eac122ec69ae09030ccfd6b8ac2f6d051c15 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 09:17:11 -0400 Subject: [PATCH 323/382] style(): tslint --- src/plugins/nfc.ts | 15 ++++++++++++--- src/plugins/plugin.ts | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index ab904ac37..7635a48f5 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -158,9 +158,18 @@ export class NFC { * @private */ export class Ndef { - private static name = 'NFC'; - private static plugin = 'phonegap-nfc'; - private static pluginRef = 'ndef'; + /** + * @private + */ + static name = 'NFC'; + /** + * @private + */ + static plugin = 'phonegap-nfc'; + /** + * @private + */ + static pluginRef = 'ndef'; @Cordova({ sync: true }) static uriRecord(uri: string): any { return; } diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 69ee6cc4f..f14fe2929 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -83,7 +83,7 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func } }; - if(opts.successIndex > opts.errorIndex) { + if (opts.successIndex > opts.errorIndex) { setErrorIndex(); setSuccessIndex(); } else { From 0669ba522254d263f96e839621cbf2c1c96390a4 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 09:17:35 -0400 Subject: [PATCH 324/382] 2.2.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e2cdff10c..26b33d099 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.4", + "version": "2.2.5", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 71916a85ddbffbaac3967ec3ef45e1fa36c73df0 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 27 Oct 2016 12:48:50 -0500 Subject: [PATCH 325/382] fix(plugin): don't bind to name field. Fixes #740 --- src/plugins/3dtouch.ts | 2 +- src/plugins/actionsheet.ts | 2 +- src/plugins/admob.ts | 2 +- src/plugins/android-fingerprint-auth.ts | 2 +- src/plugins/appavailability.ts | 2 +- src/plugins/apprate.ts | 2 +- src/plugins/appversion.ts | 2 +- src/plugins/background-geolocation.ts | 2 +- src/plugins/backgroundmode.ts | 2 +- src/plugins/badge.ts | 2 +- src/plugins/barcodescanner.ts | 2 +- src/plugins/base64togallery.ts | 2 +- src/plugins/batterystatus.ts | 2 +- src/plugins/ble.ts | 2 +- src/plugins/bluetoothserial.ts | 2 +- src/plugins/brightness.ts | 2 +- src/plugins/calendar.ts | 2 +- src/plugins/call-number.ts | 2 +- src/plugins/camera-preview.ts | 2 +- src/plugins/camera.ts | 2 +- src/plugins/card-io.ts | 2 +- src/plugins/clipboard.ts | 2 +- src/plugins/code-push.ts | 2 +- src/plugins/contacts.ts | 2 +- src/plugins/crop.ts | 2 +- src/plugins/datepicker.ts | 2 +- src/plugins/dbmeter.ts | 2 +- src/plugins/deeplinks.ts | 2 +- src/plugins/device-feedback.ts | 2 +- src/plugins/device.ts | 2 +- src/plugins/deviceaccounts.ts | 2 +- src/plugins/devicemotion.ts | 2 +- src/plugins/deviceorientation.ts | 2 +- src/plugins/diagnostic.ts | 2 +- src/plugins/dialogs.ts | 2 +- src/plugins/emailcomposer.ts | 2 +- src/plugins/estimote-beacons.ts | 2 +- src/plugins/facebook.ts | 2 +- src/plugins/file-chooser.ts | 2 +- src/plugins/file-opener.ts | 2 +- src/plugins/file.ts | 4 ++-- src/plugins/filepath.ts | 2 +- src/plugins/filetransfer.ts | 2 +- src/plugins/flashlight.ts | 2 +- src/plugins/geofence.ts | 2 +- src/plugins/geolocation.ts | 2 +- src/plugins/globalization.ts | 2 +- src/plugins/google-plus.ts | 2 +- src/plugins/googleanalytics.ts | 2 +- src/plugins/googlemap.ts | 6 +++--- src/plugins/hotspot.ts | 2 +- src/plugins/http.ts | 2 +- src/plugins/httpd.ts | 2 +- src/plugins/ibeacon.ts | 2 +- src/plugins/imagepicker.ts | 2 +- src/plugins/imageresizer.ts | 2 +- src/plugins/inappbrowser.ts | 2 +- src/plugins/inapppurchase.ts | 2 +- src/plugins/insomnia.ts | 2 +- src/plugins/instagram.ts | 2 +- src/plugins/is-debug.ts | 2 +- src/plugins/keyboard.ts | 2 +- src/plugins/launchnavigator.ts | 2 +- src/plugins/localnotifications.ts | 2 +- src/plugins/location-accuracy.ts | 2 +- src/plugins/market.ts | 2 +- src/plugins/media-capture.ts | 2 +- src/plugins/media.ts | 4 ++-- src/plugins/mixpanel.ts | 2 +- src/plugins/music-controls.ts | 2 +- src/plugins/native-audio.ts | 2 +- src/plugins/native-page-transitions.ts | 2 +- src/plugins/nativestorage.ts | 2 +- src/plugins/network.ts | 2 +- src/plugins/nfc.ts | 2 +- src/plugins/onesignal.ts | 2 +- src/plugins/pay-pal.ts | 2 +- src/plugins/photo-viewer.ts | 2 +- src/plugins/pin-dialog.ts | 2 +- src/plugins/plugin.ts | 12 ++++++------ src/plugins/power-management.ts | 2 +- src/plugins/printer.ts | 2 +- src/plugins/push.ts | 2 +- src/plugins/safari-view-controller.ts | 2 +- src/plugins/screen-orientation.ts | 2 +- src/plugins/screenshot.ts | 2 +- src/plugins/securestorage.ts | 2 +- src/plugins/shake.ts | 2 +- src/plugins/sim.ts | 2 +- src/plugins/sms.ts | 2 +- src/plugins/socialsharing.ts | 2 +- src/plugins/spinnerdialog.ts | 2 +- src/plugins/splashscreen.ts | 2 +- src/plugins/sqlite.ts | 4 ++-- src/plugins/statusbar.ts | 2 +- src/plugins/stepcounter.ts | 2 +- src/plugins/streaming-media.ts | 2 +- src/plugins/text-to-speech.ts | 2 +- src/plugins/themeable-browser.ts | 2 +- src/plugins/toast.ts | 2 +- src/plugins/touchid.ts | 2 +- src/plugins/twitter-connect.ts | 2 +- src/plugins/vibration.ts | 2 +- src/plugins/video-editor.ts | 2 +- src/plugins/video-player.ts | 2 +- src/plugins/webintent.ts | 2 +- src/plugins/youtube-video-player.ts | 2 +- src/plugins/z-bar.ts | 2 +- src/plugins/zip.ts | 2 +- 109 files changed, 119 insertions(+), 119 deletions(-) diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 53301124d..40d1fc885 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -65,7 +65,7 @@ declare var window: any; * ``` */ @Plugin({ - name: 'ThreeDeeTouch', + pluginName: 'ThreeDeeTouch', plugin: 'cordova-plugin-3dtouch', pluginRef: 'ThreeDeeTouch', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch', diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 03a4901c6..a6cb933f7 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -41,7 +41,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ - name: 'ActionSheet', + pluginName: 'ActionSheet', plugin: 'cordova-plugin-actionsheet', pluginRef: 'plugins.actionsheet', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet', diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index b2cd1ffe4..67b8274f9 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -8,7 +8,7 @@ import { Observable } from 'rxjs/Observable'; * Please refer the the plugin's original repository for detailed usage. */ @Plugin({ - name: 'AdMob', + pluginName: 'AdMob', plugin: 'cordova-plugin-admobpro', pluginRef: 'AdMob', repo: 'https://github.com/floatinghotpot/cordova-admob-pro', diff --git a/src/plugins/android-fingerprint-auth.ts b/src/plugins/android-fingerprint-auth.ts index 8a54fe836..e98e7e421 100644 --- a/src/plugins/android-fingerprint-auth.ts +++ b/src/plugins/android-fingerprint-auth.ts @@ -30,7 +30,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'AndroidFingerprintAuth', + pluginName: 'AndroidFingerprintAuth', plugin: 'cordova-plugin-android-fingerprint-auth', pluginRef: 'FingerprintAuth', repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth' diff --git a/src/plugins/appavailability.ts b/src/plugins/appavailability.ts index 5461eef69..39c5e196b 100644 --- a/src/plugins/appavailability.ts +++ b/src/plugins/appavailability.ts @@ -28,7 +28,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'AppAvailability', + pluginName: 'AppAvailability', plugin: 'cordova-plugin-appavailability', pluginRef: 'appAvailability', repo: 'https://github.com/ohh2ahh/AppAvailability', diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 3a902fc2c..40399dd06 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -44,7 +44,7 @@ declare var window; */ @Plugin({ - name: 'AppRate', + pluginName: 'AppRate', plugin: 'cordova-plugin-apprate', pluginRef: 'AppRate', repo: 'https://github.com/pushandplay/cordova-plugin-apprate', diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 4d1e9eb43..364184f12 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -19,7 +19,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'AppVersion', + pluginName: 'AppVersion', plugin: 'cordova-plugin-app-version', pluginRef: 'cordova.getAppVersion', repo: 'https://github.com/whiteoctober/cordova-plugin-app-version', diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 50252b68f..35248243b 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -272,7 +272,7 @@ export interface Config { * Config */ @Plugin({ - name: 'BackgroundGeolocation', + pluginName: 'BackgroundGeolocation', plugin: 'cordova-plugin-mauron85-background-geolocation', pluginRef: 'backgroundGeolocation', repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation', diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index fd8d41c85..04fc99eed 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -28,7 +28,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ - name: 'BackgroundMode', + pluginName: 'BackgroundMode', plugin: 'cordova-plugin-background-mode', pluginRef: 'cordova.plugins.backgroundMode', repo: 'https://github.com/katzer/cordova-plugin-background-mode', diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index 0809219b9..950124322 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -18,7 +18,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Badge', + pluginName: 'Badge', plugin: 'cordova-plugin-badge', pluginRef: 'cordova.plugins.notification.badge', repo: 'https://github.com/katzer/cordova-plugin-badge', diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 48ed1a3ed..ae1656dfc 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -20,7 +20,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'BarcodeScanner', + pluginName: 'BarcodeScanner', plugin: 'phonegap-plugin-barcodescanner', pluginRef: 'cordova.plugins.barcodeScanner', repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner', diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index 895f623d7..035182274 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -14,7 +14,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Base64ToGallery', + pluginName: 'Base64ToGallery', plugin: 'cordova-base64-to-gallery', pluginRef: 'cordova', repo: 'https://github.com/Nexxa/cordova-base64-to-gallery', diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 64f9a1cb3..6526cc30e 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -24,7 +24,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'BatteryStatus', + pluginName: 'BatteryStatus', plugin: 'cordova-plugin-battery-status', repo: 'https://github.com/apache/cordova-plugin-battery-status', platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'] diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 81331ce67..9c776f1f0 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -160,7 +160,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ - name: 'BLE', + pluginName: 'BLE', plugin: 'cordova-plugin-ble-central', pluginRef: 'ble', repo: 'https://github.com/don/cordova-plugin-ble-central', diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index 49b8b7344..82809e66b 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -28,7 +28,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'BluetoothSerial', + pluginName: 'BluetoothSerial', repo: 'https://github.com/don/BluetoothSerial', plugin: 'cordova-plugin-bluetooth-serial', pluginRef: 'bluetoothSerial', diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts index 15ef6e153..8a5d7b228 100644 --- a/src/plugins/brightness.ts +++ b/src/plugins/brightness.ts @@ -18,7 +18,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ - name: 'Brightness', + pluginName: 'Brightness', plugin: 'cordova-plugin-brightness', pluginRef: 'cordova.plugins.brightness', repo: 'https://github.com/mgcrea/cordova-plugin-brightness', diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index ddaf69028..b389c8cd9 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -38,7 +38,7 @@ export interface CalendarOptions { * */ @Plugin({ - name: 'Calendar', + pluginName: 'Calendar', plugin: 'cordova-plugin-calendar', pluginRef: 'plugins.calendar', repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin', diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts index 281a91ffb..06367432b 100644 --- a/src/plugins/call-number.ts +++ b/src/plugins/call-number.ts @@ -16,7 +16,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'CallNumber', + pluginName: 'CallNumber', plugin: 'call-number', pluginRef: 'plugins.CallNumber', repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin', diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index a47ca50d8..1dac77910 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -69,7 +69,7 @@ export interface CameraPreviewSize { * */ @Plugin({ - name: 'CameraPreview', + pluginName: 'CameraPreview', plugin: 'cordova-plugin-camera-preview', pluginRef: 'cordova.plugins.camerapreview', repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index a892e9eec..2942162fd 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -110,7 +110,7 @@ export interface CameraPopoverOptions { * CameraPopoverOptions */ @Plugin({ - name: 'Camera', + pluginName: 'Camera', plugin: 'cordova-plugin-camera', pluginRef: 'navigator.camera', repo: 'https://github.com/apache/cordova-plugin-camera', diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index 4d390d7f4..3e5a2b722 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -25,7 +25,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'CardIO', + pluginName: 'CardIO', plugin: 'https://github.com/card-io/card.io-Cordova-Plugin', pluginRef: 'CardIO', repo: 'https://github.com/card-io/card.io-Cordova-Plugin', diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index ae83a3063..4443e99c0 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -28,7 +28,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Clipboard', + pluginName: 'Clipboard', plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git', pluginRef: 'cordova.plugins.clipboard', repo: 'https://github.com/VersoSolutions/CordovaClipboard', diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts index 4808423ad..7990dc9e7 100644 --- a/src/plugins/code-push.ts +++ b/src/plugins/code-push.ts @@ -420,7 +420,7 @@ export interface DownloadProgress { * ``` */ @Plugin({ - name: 'CodePush', + pluginName: 'CodePush', plugin: 'cordova-plugin-code-push', pluginRef: 'codePush', repo: 'https://github.com/Microsoft/cordova-plugin-code-push', diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index e355b6066..8648b032a 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -316,7 +316,7 @@ export class ContactFindOptions implements IContactFindOptions { * ContactAddress */ @Plugin({ - name: 'Contacts', + pluginName: 'Contacts', plugin: 'cordova-plugin-contacts', pluginRef: 'navigator.contacts', repo: 'https://github.com/apache/cordova-plugin-contacts' diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts index 4c0e7336e..8d5887111 100644 --- a/src/plugins/crop.ts +++ b/src/plugins/crop.ts @@ -16,7 +16,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Crop', + pluginName: 'Crop', plugin: 'cordova-plugin-crop', pluginRef: 'plugins', repo: 'https://github.com/jeduan/cordova-plugin-crop' diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 5a991fb56..22ce9473c 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -128,7 +128,7 @@ export interface DatePickerOptions { * DatePickerOptions */ @Plugin({ - name: 'DatePicker', + pluginName: 'DatePicker', plugin: 'cordova-plugin-datepicker', pluginRef: 'datePicker', repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker' diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index 907dded42..ef85709fe 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -31,7 +31,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'DBMeter', + pluginName: 'DBMeter', plugin: 'cordova-plugin-dbmeter', pluginRef: 'DBMeter', repo: 'https://github.com/akofman/cordova-plugin-dbmeter', diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 103474aea..09c66712a 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -59,7 +59,7 @@ export interface DeeplinkMatch { * retrieve the `NavController` reference at runtime. */ @Plugin({ - name: 'Deeplinks', + pluginName: 'Deeplinks', plugin: 'ionic-plugin-deeplinks', pluginRef: 'IonicDeeplink', repo: 'https://github.com/driftyco/ionic-plugin-deeplinks', diff --git a/src/plugins/device-feedback.ts b/src/plugins/device-feedback.ts index 20b1f3d55..f8274be88 100644 --- a/src/plugins/device-feedback.ts +++ b/src/plugins/device-feedback.ts @@ -25,7 +25,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'DeviceFeedback', + pluginName: 'DeviceFeedback', plugin: 'cordova-plugin-velda-devicefeedback', pluginRef: 'plugins.deviceFeedback', repo: 'https://github.com/VVelda/device-feedback', diff --git a/src/plugins/device.ts b/src/plugins/device.ts index 01d07cd23..49a0beb0a 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -41,7 +41,7 @@ export interface Device { * ``` */ @Plugin({ - name: 'Device', + pluginName: 'Device', plugin: 'cordova-plugin-device', pluginRef: 'device', repo: 'https://github.com/apache/cordova-plugin-device' diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts index c7392b573..90a413676 100644 --- a/src/plugins/deviceaccounts.ts +++ b/src/plugins/deviceaccounts.ts @@ -2,7 +2,7 @@ import { Cordova, Plugin } from './plugin'; @Plugin({ - name: 'DeviceAccounts', + pluginName: 'DeviceAccounts', plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git', pluginRef: 'plugins.DeviceAccounts', repo: 'https://github.com/loicknuchel/cordova-device-accounts', diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 025912f83..27dddabd6 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -62,7 +62,7 @@ export interface AccelerometerOptions { * ``` */ @Plugin({ - name: 'DeviceMotion', + pluginName: 'DeviceMotion', plugin: 'cordova-plugin-device-motion', pluginRef: 'navigator.accelerometer', repo: 'https://github.com/apache/cordova-plugin-device-motion' diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index 1d5b247a9..8bae29652 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -67,7 +67,7 @@ export interface CompassOptions { * ``` */ @Plugin({ - name: 'DeviceOrientation', + pluginName: 'DeviceOrientation', plugin: 'cordova-plugin-device-orientation', pluginRef: 'navigator.compass', repo: 'https://github.com/apache/cordova-plugin-device-orientation' diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index 81148577d..bac1ba937 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -29,7 +29,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Diagnostic', + pluginName: 'Diagnostic', plugin: 'cordova.plugins.diagnostic', pluginRef: 'cordova.plugins.diagnostic', repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin' diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index 17effc154..3f92678e5 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -32,7 +32,7 @@ export interface PromptCallback { * ``` */ @Plugin({ - name: 'Dialogs', + pluginName: 'Dialogs', plugin: 'cordova-plugin-dialogs', pluginRef: 'navigator.notification', repo: 'https://github.com/apache/cordova-plugin-dialogs.git' diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index f396a5604..781b93b1a 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -44,7 +44,7 @@ declare var cordova: any; * ``` */ @Plugin({ - name: 'EmailComposer', + pluginName: 'EmailComposer', plugin: 'cordova-plugin-email', pluginRef: 'cordova.plugins.email', repo: 'https://github.com/hypery2k/cordova-email-plugin', diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index 07d42d6fa..567b6a083 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -9,7 +9,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ - name: 'EstimoteBeacons', + pluginName: 'EstimoteBeacons', plugin: 'cordova-plugin-estimote', pluginRef: 'estimote.beacons', repo: 'https://github.com/evothings/phonegap-estimotebeacons', diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 41e982db7..a241b2d7d 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -78,7 +78,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ - name: 'Facebook', + pluginName: 'Facebook', plugin: 'cordova-plugin-facebook4', pluginRef: 'facebookConnectPlugin', repo: 'https://github.com/jeduan/cordova-plugin-facebook4', diff --git a/src/plugins/file-chooser.ts b/src/plugins/file-chooser.ts index 8fa42e704..16ea5ab87 100644 --- a/src/plugins/file-chooser.ts +++ b/src/plugins/file-chooser.ts @@ -16,7 +16,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'FileChooser', + pluginName: 'FileChooser', plugin: 'http://github.com/don/cordova-filechooser.git', pluginRef: 'fileChooser', repo: 'https://github.com/don/cordova-filechooser', diff --git a/src/plugins/file-opener.ts b/src/plugins/file-opener.ts index 03d034028..4a113c049 100644 --- a/src/plugins/file-opener.ts +++ b/src/plugins/file-opener.ts @@ -13,7 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'FileOpener', + pluginName: 'FileOpener', plugin: 'cordova-plugin-file-opener2', pluginRef: 'cordova.plugins.fileOpener2', repo: 'https://github.com/pwlin/cordova-plugin-file-opener2' diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 1af744db7..d38ac8dec 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -360,7 +360,7 @@ declare var FileError: { * It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html */ @Plugin({ - name: 'File', + pluginName: 'File', plugin: 'cordova-plugin-file', pluginRef: 'cordova.file', repo: 'https://github.com/apache/cordova-plugin-file' @@ -391,7 +391,7 @@ export class File { return new Promise((resolve, reject) => { if (!cordova || !cordova.exec) { pluginWarn({ - name: 'File', + pluginName: 'File', plugin: 'cordova-plugin-file' }); reject({ error: 'plugin_not_installed' }); diff --git a/src/plugins/filepath.ts b/src/plugins/filepath.ts index 44957ae6f..129c770f6 100644 --- a/src/plugins/filepath.ts +++ b/src/plugins/filepath.ts @@ -19,7 +19,7 @@ declare var window: any; * ``` */ @Plugin({ - name: 'FilePath', + pluginName: 'FilePath', plugin: 'cordova-plugin-filepath', pluginRef: 'window.FilePath', repo: 'https://github.com/hiddentao/cordova-plugin-filepath', diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 334d67095..6b397a4c0 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -173,7 +173,7 @@ export interface FileTransferError { * ``` */ @Plugin({ - name: 'FileTransfer', + pluginName: 'FileTransfer', plugin: 'cordova-plugin-file-transfer', pluginRef: 'FileTransfer', repo: 'https://github.com/apache/cordova-plugin-file-transfer' diff --git a/src/plugins/flashlight.ts b/src/plugins/flashlight.ts index 7c325b46c..a2fad261e 100644 --- a/src/plugins/flashlight.ts +++ b/src/plugins/flashlight.ts @@ -16,7 +16,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Flashlight', + pluginName: 'Flashlight', plugin: 'cordova-plugin-flashlight', pluginRef: 'window.plugins.flashlight', repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git' diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index 436ad13a0..b9727829d 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -74,7 +74,7 @@ import { Observable } from 'rxjs/Observable'; declare var window: any; @Plugin({ - name: 'Geofence', + pluginName: 'Geofence', plugin: 'cordova-plugin-geofence', pluginRef: 'geofence', repo: 'https://github.com/cowbell/cordova-plugin-geofence/', diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 9e57a72b8..3c0794d65 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -139,7 +139,7 @@ export interface GeolocationOptions { * GeolocationOptions */ @Plugin({ - name: 'Geolocation', + pluginName: 'Geolocation', plugin: 'cordova-plugin-geolocation', pluginRef: 'navigator.geolocation', repo: 'https://github.com/apache/cordova-plugin-geolocation' diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index 52e3586f2..172ba6c67 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -11,7 +11,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Globalization', + pluginName: 'Globalization', plugin: 'cordova-plugin-globalization', pluginRef: 'navigator.globalization', repo: 'https://github.com/apache/cordova-plugin-globalization' diff --git a/src/plugins/google-plus.ts b/src/plugins/google-plus.ts index 63c0957f8..633828c8c 100644 --- a/src/plugins/google-plus.ts +++ b/src/plugins/google-plus.ts @@ -12,7 +12,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'GooglePlus', + pluginName: 'GooglePlus', plugin: 'cordova-plugin-googleplus', pluginRef: 'window.plugins.googleplus', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus', diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 2ab94af0b..79b1161ae 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -13,7 +13,7 @@ declare var window; * - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html) */ @Plugin({ - name: 'GoogleAnalytics', + pluginName: 'GoogleAnalytics', plugin: 'cordova-plugin-google-analytics', pluginRef: 'ga', repo: 'https://github.com/danwilson/google-analytics-plugin', diff --git a/src/plugins/googlemap.ts b/src/plugins/googlemap.ts index aa71a35bf..33a08d3e6 100644 --- a/src/plugins/googlemap.ts +++ b/src/plugins/googlemap.ts @@ -84,7 +84,7 @@ export const GoogleMapsAnimation = { * ``` */ @Plugin({ - name: 'GoogleMap', + pluginName: 'GoogleMap', pluginRef: 'plugin.google.maps.Map', plugin: 'cordova-plugin-googlemaps', repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', @@ -109,7 +109,7 @@ export class GoogleMap { this._objectInstance = plugin.google.maps.Map.getMap(element, options); } else { pluginWarn({ - name: 'GoogleMap', + pluginName: 'GoogleMap', plugin: 'plugin.google.maps.Map' }); } @@ -982,7 +982,7 @@ export class Geocoder { return new Promise((resolve, reject) => { if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) { pluginWarn({ - name: 'GoogleMap', + pluginName: 'GoogleMap', plugin: 'plugin.google.maps.Map' }); reject({ error: 'plugin_not_installed' }); diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index eb4fcb418..f8d9a5511 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -15,7 +15,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Hotspot', + pluginName: 'Hotspot', plugin: 'cordova-plugin-hotspot', pluginRef: 'cordova.plugins.hotspot', repo: 'https://github.com/hypery2k/cordova-hotspot-plugin', diff --git a/src/plugins/http.ts b/src/plugins/http.ts index a3df55021..6ab4af479 100644 --- a/src/plugins/http.ts +++ b/src/plugins/http.ts @@ -33,7 +33,7 @@ import { Plugin, Cordova } from './plugin'; * HTTPResponse */ @Plugin({ - name: 'HTTP', + pluginName: 'HTTP', plugin: 'cordova-plugin-http', pluginRef: 'cordovaHTTP', repo: 'https://github.com/wymsee/cordova-HTTP', diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index 3c09f6602..2d0f322e3 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -23,7 +23,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'Httpd', + pluginName: 'Httpd', plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', pluginRef: 'cordova.plugins.CorHttpd', repo: 'https://github.com/floatinghotpot/cordova-httpd', diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index f5c178832..7f12553c9 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -268,7 +268,7 @@ export interface Delegate { * ``` */ @Plugin({ - name: 'IBeacon', + pluginName: 'IBeacon', plugin: 'cordova-plugin-ibeacon', pluginRef: 'cordova.plugins.locationManager', repo: 'https://github.com/petermetz/cordova-plugin-ibeacon', diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index d63216de5..14539543e 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -46,7 +46,7 @@ export interface ImagePickerOptions { * ImagePickerOptions */ @Plugin({ - name: 'ImagePicker', + pluginName: 'ImagePicker', plugin: 'cordova-plugin-image-picker', pluginRef: 'window.imagePicker', repo: 'https://github.com/wymsee/cordova-imagePicker' diff --git a/src/plugins/imageresizer.ts b/src/plugins/imageresizer.ts index 6bee4bd4f..382c11e8f 100644 --- a/src/plugins/imageresizer.ts +++ b/src/plugins/imageresizer.ts @@ -67,7 +67,7 @@ export interface ImageResizerOptions { * ``` */ @Plugin({ - name: 'ImageResizer', + pluginName: 'ImageResizer', plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git', pluginRef: 'ImageResizer', repo: 'https://github.com/protonet/cordova-plugin-image-resizer' diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index e50b3e8f9..3a82707a0 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -31,7 +31,7 @@ export interface InAppBrowserEvent extends Event { * ``` */ @Plugin({ - name: 'InAppBrowser', + pluginName: 'InAppBrowser', plugin: 'cordova-plugin-inappbrowser', pluginRef: 'cordova.InAppBrowser', repo: 'https://github.com/apache/cordova-plugin-inappbrowser' diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts index 701e2ca1e..874970148 100644 --- a/src/plugins/inapppurchase.ts +++ b/src/plugins/inapppurchase.ts @@ -51,7 +51,7 @@ import { Plugin, Cordova } from './plugin'; * */ @Plugin({ - name: 'InAppPurchase', + pluginName: 'InAppPurchase', plugin: 'cordova-plugin-inapppurchase', pluginRef: 'inAppPurchase', platforms: ['Android', 'iOS'], diff --git a/src/plugins/insomnia.ts b/src/plugins/insomnia.ts index ba46e0ff2..1fde35b18 100644 --- a/src/plugins/insomnia.ts +++ b/src/plugins/insomnia.ts @@ -26,7 +26,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ - name: 'Insomnia', + pluginName: 'Insomnia', plugin: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git', pluginRef: 'plugins.insomnia', repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin', diff --git a/src/plugins/instagram.ts b/src/plugins/instagram.ts index f045d6698..9680acc0f 100644 --- a/src/plugins/instagram.ts +++ b/src/plugins/instagram.ts @@ -15,7 +15,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'Instagram', + pluginName: 'Instagram', plugin: 'cordova-instagram-plugin', pluginRef: 'Instagram', repo: 'https://github.com/vstirbu/InstagramPlugin' diff --git a/src/plugins/is-debug.ts b/src/plugins/is-debug.ts index d04447cf2..25f1ab51b 100644 --- a/src/plugins/is-debug.ts +++ b/src/plugins/is-debug.ts @@ -17,7 +17,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'IsDebug', + pluginName: 'IsDebug', plugin: 'cordova-plugin-is-debug', pluginRef: 'cordova.plugins.IsDebug', repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug' diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index f1998a916..8be9b2d36 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -14,7 +14,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'Keyboard', + pluginName: 'Keyboard', plugin: 'ionic-plugin-keyboard', pluginRef: 'cordova.plugins.Keyboard', repo: 'https://github.com/driftyco/ionic-plugin-keyboard' diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 5746151aa..b3bc546e7 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -82,7 +82,7 @@ export interface LaunchNavigatorOptions { * ``` */ @Plugin({ - name: 'LaunchNavigator', + pluginName: 'LaunchNavigator', plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator', pluginRef: 'launchnavigator', repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git' diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index d60c0d2d1..d6f517a01 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -45,7 +45,7 @@ import { Cordova, Plugin } from './plugin'; * */ @Plugin({ - name: 'LocalNotifications', + pluginName: 'LocalNotifications', plugin: 'de.appplant.cordova.plugin.local-notification', pluginRef: 'cordova.plugins.notification.local', repo: 'https://github.com/katzer/cordova-plugin-local-notifications' diff --git a/src/plugins/location-accuracy.ts b/src/plugins/location-accuracy.ts index 098642404..c56a74c96 100644 --- a/src/plugins/location-accuracy.ts +++ b/src/plugins/location-accuracy.ts @@ -23,7 +23,7 @@ import {Plugin, Cordova} from './plugin'; * ``` */ @Plugin({ - name: 'LocationAccuracy', + pluginName: 'LocationAccuracy', plugin: 'cordova-plugin-request-location-accuracy', pluginRef: 'cordova.plugins.locationAccuracy', repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy' diff --git a/src/plugins/market.ts b/src/plugins/market.ts index 0ba60687e..70a97bca4 100644 --- a/src/plugins/market.ts +++ b/src/plugins/market.ts @@ -13,7 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'Market', + pluginName: 'Market', plugin: 'cordova-plugin-market', pluginRef: 'plugins.market', repo: 'https://github.com/xmartlabs/cordova-plugin-market' diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index f2aba7160..de3126789 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -22,7 +22,7 @@ declare var navigator: any; * ``` */ @Plugin({ - name: 'MediaCapture', + pluginName: 'MediaCapture', plugin: 'cordova-plugin-media-capture', pluginRef: 'navigator.device.capture', repo: 'https://github.com/apache/cordova-plugin-media-capture' diff --git a/src/plugins/media.ts b/src/plugins/media.ts index ae23d60ea..eb05933c1 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -68,7 +68,7 @@ export interface MediaError { * ``` */ @Plugin({ - name: 'MediaPlugin', + pluginName: 'MediaPlugin', repo: 'https://github.com/apache/cordova-plugin-media', plugin: 'cordova-plugin-media', pluginRef: 'Media' @@ -132,7 +132,7 @@ export class MediaPlugin { }); } else { pluginWarn({ - name: 'MediaPlugin', + pluginName: 'MediaPlugin', plugin: 'cordova-plugin-media' }); } diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index 1550bbe57..972c6dd4b 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -18,7 +18,7 @@ declare var mixpanel: any; * ``` */ @Plugin({ - name: 'Mixpanel', + pluginName: 'Mixpanel', plugin: 'cordova-plugin-mixpanel', pluginRef: 'mixpanel', repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts index cddd6be00..baf4718e9 100644 --- a/src/plugins/music-controls.ts +++ b/src/plugins/music-controls.ts @@ -73,7 +73,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'MusicControls', + pluginName: 'MusicControls', plugin: 'cordova-plugin-music-controls', pluginRef: 'MusicControls', repo: 'https://github.com/homerours/cordova-music-controls-plugin' diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts index 58485763f..11588ec77 100644 --- a/src/plugins/native-audio.ts +++ b/src/plugins/native-audio.ts @@ -21,7 +21,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'NativeAudio', + pluginName: 'NativeAudio', plugin: 'cordova-plugin-nativeaudio', pluginRef: 'plugins.NativeAudio', repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio' diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts index 7020e0114..0783c7d48 100644 --- a/src/plugins/native-page-transitions.ts +++ b/src/plugins/native-page-transitions.ts @@ -27,7 +27,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'NativePageTransitions', + pluginName: 'NativePageTransitions', plugin: 'com.telerik.plugins.nativepagetransitions', pluginRef: 'plugins.nativepagetransitions', repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions', diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index f4ee84108..6da71c445 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -23,7 +23,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'NativeStorage', + pluginName: 'NativeStorage', plugin: 'cordova-plugin-nativestorage', pluginRef: 'NativeStorage', repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage' diff --git a/src/plugins/network.ts b/src/plugins/network.ts index 964b4e501..cf0ad673d 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -43,7 +43,7 @@ declare var navigator: any; * The `connection` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none` */ @Plugin({ - name: 'Network', + pluginName: 'Network', plugin: 'cordova-plugin-network-information', repo: 'https://github.com/apache/cordova-plugin-network-information', platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'], diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 7635a48f5..ca24acc62 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -24,7 +24,7 @@ declare let window: any; * ``` */ @Plugin({ - name: 'NFC', + pluginName: 'NFC', plugin: 'phonegap-nfc', pluginRef: 'nfc', repo: 'https://github.com/chariotsolutions/phonegap-nfc' diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 1209d0537..40531ecd6 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -30,7 +30,7 @@ import { Observable } from 'rxjs/Observable'; * */ @Plugin({ - name: 'OneSignal', + pluginName: 'OneSignal', plugin: 'onesignal-cordova-plugin', pluginRef: 'plugins.OneSignal', repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK' diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index 0539dbf70..a424bc777 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -58,7 +58,7 @@ import { Plugin, Cordova } from './plugin'; * PayPalShippingAddress */ @Plugin({ - name: 'PayPal', + pluginName: 'PayPal', plugin: 'com.paypal.cordova.mobilesdk', pluginRef: 'PayPalMobile', repo: 'https://github.com/paypal/PayPal-Cordova-Plugin' diff --git a/src/plugins/photo-viewer.ts b/src/plugins/photo-viewer.ts index cca6e4039..d58cbcdb1 100644 --- a/src/plugins/photo-viewer.ts +++ b/src/plugins/photo-viewer.ts @@ -12,7 +12,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'PhotoViewer', + pluginName: 'PhotoViewer', plugin: 'com-sarriaroman-photoviewer', pluginRef: 'PhotoViewer', repo: 'https://github.com/sarriaroman/photoviewer' diff --git a/src/plugins/pin-dialog.ts b/src/plugins/pin-dialog.ts index ba7f50052..93350ae93 100644 --- a/src/plugins/pin-dialog.ts +++ b/src/plugins/pin-dialog.ts @@ -20,7 +20,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'PinDialog', + pluginName: 'PinDialog', plugin: 'cordova-plugin-pin-dialog', pluginRef: 'plugins.pinDialog', repo: 'https://github.com/Paldom/PinDialog' diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index f14fe2929..090afe719 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -19,7 +19,7 @@ export const getPlugin = function(pluginRef: string): any { * @param method */ export const pluginWarn = function(pluginObj: any, method?: string) { - let pluginName = pluginObj.name, plugin = pluginObj.plugin; + let pluginName = pluginObj.pluginName, plugin = pluginObj.plugin; if (method) { console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.'); } else { @@ -111,7 +111,7 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts if (!pluginInstance) { // Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation). if (!window.cordova) { - cordovaWarn(pluginObj.name, methodName); + cordovaWarn(pluginObj.pluginName, methodName); return { error: 'cordova_not_available' }; @@ -196,7 +196,7 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult); } } catch (e) { - console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName); + console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName); console.error(e); } }; @@ -223,7 +223,7 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) { } return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult); } catch (e) { - console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName); + console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName); console.error(e); } }; @@ -268,7 +268,7 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts: if (!pluginInstance) { // Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation). if (!window.cordova) { - cordovaWarn(pluginObj.name, methodName); + cordovaWarn(pluginObj.pluginName, methodName); observer.error({ error: 'cordova_not_available' }); @@ -326,7 +326,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) * @usage * ```typescript * @Plugin({ - * name: 'MyPlugin', + * pluginName: 'MyPlugin', * plugin: 'cordova-plugin-myplugin', * pluginRef: 'window.myplugin' * }) diff --git a/src/plugins/power-management.ts b/src/plugins/power-management.ts index e5dbf7129..abb5269b2 100644 --- a/src/plugins/power-management.ts +++ b/src/plugins/power-management.ts @@ -16,7 +16,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'PowerManagement', + pluginName: 'PowerManagement', plugin: 'cordova-plugin-powermanagement-orig', pluginRef: 'powerManagement', repo: 'https://github.com/Viras-/cordova-plugin-powermanagement' diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts index 72c5062a2..dc496167c 100644 --- a/src/plugins/printer.ts +++ b/src/plugins/printer.ts @@ -61,7 +61,7 @@ export interface PrintOptions { * ``` */ @Plugin({ - name: 'Printer', + pluginName: 'Printer', plugin: 'de.appplant.cordova.plugin.printer', pluginRef: 'cordova.plugins.printer', repo: 'https://github.com/katzer/cordova-plugin-printer.git', diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 10d452b31..f1b33cf7f 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -286,7 +286,7 @@ declare var PushNotification: { * ``` */ @Plugin({ - name: 'Push', + pluginName: 'Push', plugin: 'phonegap-plugin-push', pluginRef: 'PushNotification', repo: 'https://github.com/phonegap/phonegap-plugin-push' diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 12e009a7d..8abb169c5 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -39,7 +39,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'SafariViewController', + pluginName: 'SafariViewController', plugin: 'cordova-plugin-safariviewcontroller', pluginRef: 'SafariViewController', platforms: ['iOS', 'Android'], diff --git a/src/plugins/screen-orientation.ts b/src/plugins/screen-orientation.ts index a7d305f51..5a13ef437 100644 --- a/src/plugins/screen-orientation.ts +++ b/src/plugins/screen-orientation.ts @@ -37,7 +37,7 @@ declare var window; * */ @Plugin({ - name: 'ScreenOrientation', + pluginName: 'ScreenOrientation', plugin: 'cordova-plugin-screen-orientation', pluginRef: 'window.screen', repo: 'https://github.com/apache/cordova-plugin-screen-orientation', diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index 822876c69..1952e7f45 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -17,7 +17,7 @@ declare var navigator: any; * ``` */ @Plugin({ - name: 'Screenshot', + pluginName: 'Screenshot', plugin: 'https://github.com/gitawego/cordova-screenshot.git', pluginRef: 'navigator.screenshot', repo: 'https://github.com/gitawego/cordova-screenshot.git' diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts index 8cf873243..bdd773ce4 100644 --- a/src/plugins/securestorage.ts +++ b/src/plugins/securestorage.ts @@ -40,7 +40,7 @@ declare var cordova: any; * ``` */ @Plugin({ - name: 'SecureStorage', + pluginName: 'SecureStorage', plugin: 'cordova-plugin-secure-storage', pluginRef: 'plugins.securestorage', repo: 'https://github.com/Crypho/cordova-plugin-secure-storage', diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts index 99df465b1..e99fa2030 100644 --- a/src/plugins/shake.ts +++ b/src/plugins/shake.ts @@ -15,7 +15,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'Shake', + pluginName: 'Shake', plugin: 'cordova-plugin-shake', pluginRef: 'shake', repo: 'https://github.com/leecrossley/cordova-plugin-shake' diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts index fe173d7a5..7e9118cbc 100644 --- a/src/plugins/sim.ts +++ b/src/plugins/sim.ts @@ -20,7 +20,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Sim', + pluginName: 'Sim', plugin: 'cordova-plugin-sim', pluginRef: 'plugins.sim', repo: 'https://github.com/pbakondy/cordova-plugin-sim', diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index b674ae00f..36eab1e1e 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -40,7 +40,7 @@ export interface SmsOptionsAndroid { * ``` */ @Plugin({ - name: 'SMS', + pluginName: 'SMS', plugin: 'cordova-sms-plugin', pluginRef: 'sms', repo: 'https://github.com/cordova-sms/cordova-sms-plugin', diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index c64ca8433..dedc54433 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -25,7 +25,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'SocialSharing', + pluginName: 'SocialSharing', plugin: 'cordova-plugin-x-socialsharing', pluginRef: 'plugins.socialsharing', repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin', diff --git a/src/plugins/spinnerdialog.ts b/src/plugins/spinnerdialog.ts index f2c9182cf..7cf33f9ac 100644 --- a/src/plugins/spinnerdialog.ts +++ b/src/plugins/spinnerdialog.ts @@ -15,7 +15,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'SpinnerDialog', + pluginName: 'SpinnerDialog', plugin: 'cordova-plugin-spinner-dialog', pluginRef: 'window.plugins.spinnerDialog', repo: 'https://github.com/Paldom/SpinnerDialog', diff --git a/src/plugins/splashscreen.ts b/src/plugins/splashscreen.ts index 974c03abe..ad55524f8 100644 --- a/src/plugins/splashscreen.ts +++ b/src/plugins/splashscreen.ts @@ -15,7 +15,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Splashscreen', + pluginName: 'Splashscreen', plugin: 'cordova-plugin-splashscreen', pluginRef: 'navigator.splashscreen', repo: 'https://github.com/apache/cordova-plugin-splashscreen' diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index ee9e25cae..70eb8851e 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -31,7 +31,7 @@ declare var sqlitePlugin; * */ @Plugin({ - name: 'SQLite', + pluginName: 'SQLite', pluginRef: 'sqlitePlugin', plugin: 'cordova-sqlite-storage', repo: 'https://github.com/litehelpers/Cordova-sqlite-storage' @@ -83,7 +83,7 @@ export class SQLite { }); } else { pluginWarn({ - name: 'SQLite', + pluginName: 'SQLite', plugin: 'cordova-sqlite-storage' }); } diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index 2bf89ed5d..16f81be1d 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -22,7 +22,7 @@ declare var window; * */ @Plugin({ - name: 'StatusBar', + pluginName: 'StatusBar', plugin: 'cordova-plugin-statusbar', pluginRef: 'StatusBar', repo: 'https://github.com/apache/cordova-plugin-statusbar', diff --git a/src/plugins/stepcounter.ts b/src/plugins/stepcounter.ts index d10e1f9a6..2959939ef 100644 --- a/src/plugins/stepcounter.ts +++ b/src/plugins/stepcounter.ts @@ -20,7 +20,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'Stepcounter', + pluginName: 'Stepcounter', plugin: 'https://github.com/texh/cordova-plugin-stepcounter', pluginRef: 'stepcounter', repo: 'https://github.com/texh/cordova-plugin-stepcounter', diff --git a/src/plugins/streaming-media.ts b/src/plugins/streaming-media.ts index 96534232c..365b085bf 100644 --- a/src/plugins/streaming-media.ts +++ b/src/plugins/streaming-media.ts @@ -19,7 +19,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'StreamingMedia', + pluginName: 'StreamingMedia', plugin: 'cordova-plugin-streaming-media', pluginRef: 'plugins.streamingMedia', repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media', diff --git a/src/plugins/text-to-speech.ts b/src/plugins/text-to-speech.ts index f6afd107e..56c762849 100644 --- a/src/plugins/text-to-speech.ts +++ b/src/plugins/text-to-speech.ts @@ -25,7 +25,7 @@ export interface TTSOptions { * ``` */ @Plugin({ - name: 'TextToSpeech', + pluginName: 'TextToSpeech', plugin: 'cordova-plugin-tts', pluginRef: 'TTS', repo: 'https://github.com/vilic/cordova-plugin-tts' diff --git a/src/plugins/themeable-browser.ts b/src/plugins/themeable-browser.ts index 8ce65868e..721aa82d5 100644 --- a/src/plugins/themeable-browser.ts +++ b/src/plugins/themeable-browser.ts @@ -144,7 +144,7 @@ export interface ThemeableBrowserOptions { * We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here. */ @Plugin({ - name: 'ThemeableBrowser', + pluginName: 'ThemeableBrowser', plugin: 'cordova-plugin-themeablebrowser', pluginRef: 'cordova.ThemeableBrowser', repo: 'https://github.com/initialxy/cordova-plugin-themeablebrowser' diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 3e1613479..8f5e5b555 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -57,7 +57,7 @@ export interface ToastOptions { * ToastOptions */ @Plugin({ - name: 'Toast', + pluginName: 'Toast', plugin: 'cordova-plugin-x-toast', pluginRef: 'plugins.toast', repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin', diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index 749d7b21e..a5ac8d609 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -45,7 +45,7 @@ import { Cordova, Plugin } from './plugin'; * - `-8` - TouchID is locked out from too many tries */ @Plugin({ - name: 'TouchID', + pluginName: 'TouchID', plugin: 'cordova-plugin-touch-id', pluginRef: 'plugins.touchid', repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id', diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index cd3a7730c..1ccd62097 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -27,7 +27,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'TwitterConnect', + pluginName: 'TwitterConnect', plugin: 'twitter-connect-plugin', pluginRef: 'TwitterConnect', repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin', diff --git a/src/plugins/vibration.ts b/src/plugins/vibration.ts index df09bcaeb..0833cd045 100644 --- a/src/plugins/vibration.ts +++ b/src/plugins/vibration.ts @@ -25,7 +25,7 @@ import { Cordova, Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'Vibration', + pluginName: 'Vibration', plugin: 'cordova-plugin-vibration', pluginRef: 'navigator', repo: 'https://github.com/apache/cordova-plugin-vibration', diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts index 0c9399a45..9c418c869 100644 --- a/src/plugins/video-editor.ts +++ b/src/plugins/video-editor.ts @@ -137,7 +137,7 @@ export interface VideoInfo { * ``` */ @Plugin({ - name: 'VideoEditor', + pluginName: 'VideoEditor', plugin: 'cordova-plugin-video-editor', pluginRef: 'VideoEditor', repo: 'https://github.com/jbavari/cordova-plugin-video-editor', diff --git a/src/plugins/video-player.ts b/src/plugins/video-player.ts index 47089b03b..053ad8507 100644 --- a/src/plugins/video-player.ts +++ b/src/plugins/video-player.ts @@ -38,7 +38,7 @@ export interface VideoOptions { * ``` */ @Plugin({ - name: 'VideoPlayer', + pluginName: 'VideoPlayer', plugin: 'cordova-plugin-videoplayer', pluginRef: 'VideoPlayer', repo: 'https://github.com/moust/cordova-plugin-videoplayer', diff --git a/src/plugins/webintent.ts b/src/plugins/webintent.ts index 8373dbe0a..098aee294 100644 --- a/src/plugins/webintent.ts +++ b/src/plugins/webintent.ts @@ -17,7 +17,7 @@ declare var window; * ``` */ @Plugin({ - name: 'WebIntent', + pluginName: 'WebIntent', plugin: 'https://github.com/Initsogar/cordova-webintent.git', pluginRef: 'window.plugins.webintent', repo: 'https://github.com/Initsogar/cordova-webintent.git', diff --git a/src/plugins/youtube-video-player.ts b/src/plugins/youtube-video-player.ts index 1c6e0e494..9e9fc2217 100644 --- a/src/plugins/youtube-video-player.ts +++ b/src/plugins/youtube-video-player.ts @@ -13,7 +13,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'YoutubeVideoPlayer', + pluginName: 'YoutubeVideoPlayer', plugin: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git', pluginRef: 'YoutubeVideoPlayer', repo: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer', diff --git a/src/plugins/z-bar.ts b/src/plugins/z-bar.ts index b33ba0854..1194bdd1c 100644 --- a/src/plugins/z-bar.ts +++ b/src/plugins/z-bar.ts @@ -39,7 +39,7 @@ import { Plugin, Cordova } from './plugin'; * */ @Plugin({ - name: 'ZBar', + pluginName: 'ZBar', plugin: 'cordova-plugin-cszbar', pluginRef: 'cloudSky.zBar', repo: 'https://github.com/tjwoon/csZBar', diff --git a/src/plugins/zip.ts b/src/plugins/zip.ts index 01dd6e972..7a2e431d5 100644 --- a/src/plugins/zip.ts +++ b/src/plugins/zip.ts @@ -18,7 +18,7 @@ import { Plugin, Cordova } from './plugin'; * ``` */ @Plugin({ - name: 'Zip', + pluginName: 'Zip', plugin: 'cordova-plugin-zip', pluginRef: 'zip', repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip', From ca43394185b156370341bf886024994378bd98ba Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Thu, 27 Oct 2016 20:51:21 -0200 Subject: [PATCH 326/382] fix(nfc): don't bind to name field, fix #740 (#749) --- src/plugins/nfc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index ca24acc62..77e10615c 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -161,7 +161,7 @@ export class Ndef { /** * @private */ - static name = 'NFC'; + static pluginName = 'NFC'; /** * @private */ From 489d86026417b8782c94048c7b19a0a52895a917 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 19:02:12 -0400 Subject: [PATCH 327/382] chore(): update changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 344892feb..fc9be0506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ + +## [2.2.5](https://github.com/driftyco/ionic-native/compare/v2.2.4...v2.2.5) (2016-10-27) + + +### Bug Fixes + +* **3dtouch:** add missing property ([#739](https://github.com/driftyco/ionic-native/issues/739)) ([757d096](https://github.com/driftyco/ionic-native/commit/757d096)) +* **geolocation:** fix watchPosition return type ([d5310b0](https://github.com/driftyco/ionic-native/commit/d5310b0)), closes [#741](https://github.com/driftyco/ionic-native/issues/741) +* **nfc:** fix Ndef class ([ac181c5](https://github.com/driftyco/ionic-native/commit/ac181c5)), closes [#713](https://github.com/driftyco/ionic-native/issues/713) +* **sqlite:** check if plugin exists before opening database ([6f47371](https://github.com/driftyco/ionic-native/commit/6f47371)) +* **sqlite:** check if plugin exists before opening database ([c98b4f4](https://github.com/driftyco/ionic-native/commit/c98b4f4)) +* **sqlite:** fix callback issue with transaction method ([a72cd59](https://github.com/driftyco/ionic-native/commit/a72cd59)), closes [#732](https://github.com/driftyco/ionic-native/issues/732) + + +### Features + +* **diagnostic:** add missing functions ([eb03de9](https://github.com/driftyco/ionic-native/commit/eb03de9)), closes [#743](https://github.com/driftyco/ionic-native/issues/743) +* **filepath:** add cordova-plugin-filepath ([#714](https://github.com/driftyco/ionic-native/issues/714)) ([0660a3b](https://github.com/driftyco/ionic-native/commit/0660a3b)) +* **plugins:** add name field ([9677656](https://github.com/driftyco/ionic-native/commit/9677656)) +* **sms:** add hasPermission method ([8fbf1f2](https://github.com/driftyco/ionic-native/commit/8fbf1f2)), closes [#721](https://github.com/driftyco/ionic-native/issues/721) + + + ## [2.2.4](https://github.com/driftyco/ionic-native/compare/v2.2.3...v2.2.4) (2016-10-15) From 6a412155a3a104a8554b16fb41b8b14f7c6faeb5 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 19:02:32 -0400 Subject: [PATCH 328/382] 2.2.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26b33d099..9d3921118 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.5", + "version": "2.2.6", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 17f2fcb8294d3853c5c9f1c275ca133e7ba89828 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 19:02:50 -0400 Subject: [PATCH 329/382] chore(): update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9be0506..84e35b110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## [2.2.6](https://github.com/driftyco/ionic-native/compare/v2.2.5...v2.2.6) (2016-10-27) + + +### Bug Fixes + +* **nfc:** don't bind to name field, fix [#740](https://github.com/driftyco/ionic-native/issues/740) ([#749](https://github.com/driftyco/ionic-native/issues/749)) ([ca43394](https://github.com/driftyco/ionic-native/commit/ca43394)) +* **plugin:** don't bind to name field. Fixes [#740](https://github.com/driftyco/ionic-native/issues/740) ([71916a8](https://github.com/driftyco/ionic-native/commit/71916a8)) + + + ## [2.2.5](https://github.com/driftyco/ionic-native/compare/v2.2.4...v2.2.5) (2016-10-27) From fd8f80e92b541f86ff04b662901db972d71c9032 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 19:04:59 -0400 Subject: [PATCH 330/382] test(): add mixpanel test back --- test/plugins/mixpanel.spec.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/plugins/mixpanel.spec.ts diff --git a/test/plugins/mixpanel.spec.ts b/test/plugins/mixpanel.spec.ts new file mode 100644 index 000000000..7eb43d0b4 --- /dev/null +++ b/test/plugins/mixpanel.spec.ts @@ -0,0 +1,28 @@ +import {Mixpanel} from '../../src/plugins/mixpanel'; +declare const window: any; + +window.mixpanel = { + people: { + identify: (args, success, error) => success('Success') + } +}; + +describe('Mixpanel', () => { + + it('should return MixpanelPeople', () => { + expect(Mixpanel.people).toBeDefined(); + expect(Mixpanel.people.identify).toBeDefined(); + }); + + it('should call a method of MixpanelPeople', (done) => { + const spy = spyOn(window.mixpanel.people, 'identify').and.callThrough(); + Mixpanel.people.identify('veryDistinctSuchIdVeryWow') + .then(result => { + expect(result).toEqual('Success'); + done(); + }); + expect(spy.calls.mostRecent().args[0]).toEqual('veryDistinctSuchIdVeryWow'); + expect(window.mixpanel.people.identify).toHaveBeenCalled(); + }); + +}); From c22747fa2e1e74bd9c75d6d0461e4223297d37c7 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 27 Oct 2016 19:18:29 -0400 Subject: [PATCH 331/382] chore(): go to SITE_DIR if checking out --- scripts/docs/prepare.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/docs/prepare.sh b/scripts/docs/prepare.sh index f41d4e097..ee1dd0f95 100755 --- a/scripts/docs/prepare.sh +++ b/scripts/docs/prepare.sh @@ -21,16 +21,17 @@ function run { ./git/clone.sh --repository="ionic-site" \ --directory="$SITE_DIR" \ --branch="master" - ls -al $SITE_DIR + cd $SITE_DIR + ls -al else echo "using existing" cd $SITE_DIR git reset --hard git pull origin master fi - + git rm -rf docs/v2/native/*/ - + } source $(dirname $0)/../utils.inc.sh From fa03fa544f29feccdabc4d7b384babce88c344c6 Mon Sep 17 00:00:00 2001 From: Andrew Mitchell Date: Tue, 1 Nov 2016 23:13:43 -0500 Subject: [PATCH 332/382] fix(datepicker): fix allowOldDates option (#761) --- src/plugins/datepicker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 22ce9473c..57bfe705f 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -59,7 +59,7 @@ export interface DatePickerOptions { /** * Shows or hide dates earlier then selected date. */ - allowOldDate?: boolean; + allowOldDates?: boolean; /** * Shows or hide dates after selected date. */ From e6beaa49a42ea7dc0c80dfddbb7cde34d4a41ff8 Mon Sep 17 00:00:00 2001 From: Shamsher Ansari Date: Wed, 2 Nov 2016 16:44:06 +0530 Subject: [PATCH 333/382] Update Example for Google Map --- src/plugins/googlemap.ts | 79 ++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/src/plugins/googlemap.ts b/src/plugins/googlemap.ts index 33a08d3e6..3be68e87d 100644 --- a/src/plugins/googlemap.ts +++ b/src/plugins/googlemap.ts @@ -41,46 +41,63 @@ export const GoogleMapsAnimation = { * @description This plugin uses the native Google Maps SDK * @usage * ``` - * import { GoogleMap, GoogleMapsEvent } from 'ionic-native'; + * import { + * GoogleMap, + * GoogleMapsEvent, + * GoogleMapsLatLng, + * CameraPosition, + * GoogleMapsMarkerOptions, + * GoogleMapsMarker + * } from 'ionic-native'; * - * // create a new map using element ID - * let map = new GoogleMap('elementID'); + * export class MapPage { + * constructor() {} * - * // or create a new map by passing HTMLElement - * let element: HTMLElement = document.getElementById('elementID'); + * // Load map only after view is initialize + * ngAfterViewInit() { + * this.loadMap(); + * } + * + * loadMap() { + * // make sure to create following structure in your view.html file + * // + * //
+ * //
* - * // In Angular 2 or Ionic 2, if we have this element in html:
- * // then we can use @ViewChild to find the element and pass it to GoogleMaps - * @ViewChild('map') mapElement; - * let map = new GoogleMap(mapElement); + * // create a new map by passing HTMLElement + * let element: HTMLElement = document.getElementById('map'); + * + * let map = new GoogleMap(element); * - * // listen to MAP_READY event - * map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!')); + * // listen to MAP_READY event + * map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!')); * + * // create LatLng object + * let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802); * - * // create LatLng object - * let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802); + * // create CameraPosition + * let position: CameraPosition = { + * target: ionic, + * zoom: 18, + * tilt: 30 + * }; * - * // create CameraPosition - * let position: CameraPosition = { - * target: ionic, - * zoom: 18, - * tilt: 30 - * }; + * // move the map's camera to position + * map.moveCamera(position); * - * // move the map's camera to position - * map.moveCamera(position); + * // create new marker + * let markerOptions: GoogleMapsMarkerOptions = { + * position: ionic, + * title: 'Ionic' + * }; * - * // create new marker - * let markerOptions: GoogleMapsMarkerOptions = { - * position: ionic, - * title: 'Ionic' - * }; - * - * map.addMarker(markerOptions) - * .then((marker: GoogleMapsMarker) => { - * marker.showInfoWindow(); - * }); + * map.addMarker(markerOptions) + * .then((marker: GoogleMapsMarker) => { + * marker.showInfoWindow(); + * }); + * } + * + * } * ``` */ @Plugin({ From 88f6ecf2507ad7082d0dadf2f1c1875b657bd2ff Mon Sep 17 00:00:00 2001 From: Mark McEahern Date: Wed, 2 Nov 2016 16:49:34 -0500 Subject: [PATCH 334/382] docs(inappbrowser): fix typo (#766) --- src/plugins/inappbrowser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index 3a82707a0..579543e96 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -39,7 +39,7 @@ export interface InAppBrowserEvent extends Event { export class InAppBrowser { static open(url: string, target?: string, options?: string): void { - console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.'); + console.warn('Native: Your current usage of the InAppBrowser plugin is deprecated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.'); } private _objectInstance: any; From 867400d1ac1471d0ab7c036ca471fcce557d7281 Mon Sep 17 00:00:00 2001 From: Sergii Stotskyi Date: Thu, 3 Nov 2016 06:16:08 +0200 Subject: [PATCH 335/382] refactor(file): add return value to be updated file entry in writeFile method Also remove code duplication in writeExistingFile --- src/plugins/file.ts | 49 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index d38ac8dec..44f58b5fc 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -171,6 +171,7 @@ export interface Flags { } export interface WriteOptions { + create?: boolean; replace?: boolean; append?: boolean; truncate?: number; // if present, number of bytes to truncate file to before writing @@ -667,19 +668,19 @@ export class File { * @param {string} fileName path relative to base path * @param {string | Blob} text content or blob to write * @param {WriteOptions} options replace file if set to true. See WriteOptions for more information. - * @returns {Promise} Returns a Promise that resolves or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. */ static writeFile(path: string, fileName: string, - text: string | Blob, options: WriteOptions): Promise { + text: string | Blob, options: WriteOptions = {}): Promise { if ((/^\//.test(fileName))) { - let err = new FileError(5); + const err = new FileError(5); err.message = 'file-name cannot start with \/'; return Promise.reject(err); } - let getFileOpts: Flags = { - create: true, - exclusive: options.replace + const getFileOpts: Flags = { + create: !('create' in options) || options.create, + exclusive: !!options.replace }; return File.resolveDirectoryUrl(path) @@ -687,10 +688,21 @@ export class File { return File.getFile(fse, fileName, getFileOpts); }) .then((fe) => { - return File.createWriter(fe); + return File.writeFileEntry(fe, text, options); }) - .then((writer) => { + } + /** Write content to FileEntry. + * + * @private + * @param {FileEntry} fe file entry object + * @param {string | Blob} text content or blob to write + * @param {WriteOptions} options replace file if set to true. See WriteOptions for more information. + * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. + */ + private static writeFileEntry(fe: FileEntry, text: string | Blob, options : WriteOptions) { + return File.createWriter(fe) + .then((writer) => { if (options.append) { writer.seek(writer.length); } @@ -700,9 +712,11 @@ export class File { } return File.write(writer, text); - }); + }) + .then(() => fe); } + /** Write to an existing file. * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above @@ -711,22 +725,7 @@ export class File { * @returns {Promise} Returns a Promise that resolves or rejects with an error. */ static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { - if ((/^\//.test(fileName))) { - let err = new FileError(5); - err.message = 'file-name cannot start with \/'; - return Promise.reject(err); - } - - return File.resolveDirectoryUrl(path) - .then((fse) => { - return File.getFile(fse, fileName, {create: false}); - }) - .then((fe) => { - return File.createWriter(fe); - }) - .then((writer) => { - return File.write(writer, text); - }); + return File.writeFile(path, fileName, text, { create: false }) } /** From e5b0365d0cf742ba33cb4acc9d1b61b95cef0b2f Mon Sep 17 00:00:00 2001 From: Valentin Klinghammer Date: Thu, 3 Nov 2016 10:41:41 +0100 Subject: [PATCH 336/382] Added basic usage description to AdMob --- src/plugins/admob.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index 67b8274f9..949725e02 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -5,6 +5,20 @@ import { Observable } from 'rxjs/Observable'; * @name AdMob * @description Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks. * @usage + * ```typescript + * import { AdMob } from 'ionic-native'; + * + * ionViewDidLoad() { + * AdMob.onBannerDismiss() + * .subscribe(() => { console.log('User returned from interstitial'); }); + * } + * + * public onClick() { + * AdMob.prepareInterstitial('YOUR_ADID') + * .then(() => { AdMob.showInterstitial(); }); + * } + * + * ``` * Please refer the the plugin's original repository for detailed usage. */ @Plugin({ From 01b30c68e1b3b9faa5ce67fcf79641182c27b1c1 Mon Sep 17 00:00:00 2001 From: Ramon Henrique Ornelas Date: Tue, 8 Nov 2016 20:01:38 -0200 Subject: [PATCH 337/382] fix(diagnostics): fix #776 (#777) --- src/plugins/diagnostic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index bac1ba937..dc5c11fa2 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -215,7 +215,7 @@ export class Diagnostic { * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". * @returns {Promise} */ - @Cordova({ platforms: ['Android', 'iOS'] }) + @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) static requestLocationAuthorization(mode?: string): Promise { return; } /** From 0c5fadee864e910165a97ec08f1c9419e5ced883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C4=B1l=20=C3=9CNAL?= Date: Wed, 9 Nov 2016 01:02:10 +0300 Subject: [PATCH 338/382] docs(apprate): update usage (#778) --- src/plugins/apprate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/apprate.ts b/src/plugins/apprate.ts index 40399dd06..da0b56227 100644 --- a/src/plugins/apprate.ts +++ b/src/plugins/apprate.ts @@ -19,7 +19,7 @@ declare var window; * android: 'market://details?id=', * }; * - * AppRate.promptForRating(); + * AppRate.promptForRating(false); * ``` * * @advanced From 2dacec0cb5c6a5306f6af0ac949b7d47f2bb4f91 Mon Sep 17 00:00:00 2001 From: mhartington Date: Wed, 9 Nov 2016 14:14:26 -0500 Subject: [PATCH 339/382] docs(): hide old open method --- src/plugins/inappbrowser.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index 579543e96..2397e51a2 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -38,6 +38,9 @@ export interface InAppBrowserEvent extends Event { }) export class InAppBrowser { + /** + * @private + */ static open(url: string, target?: string, options?: string): void { console.warn('Native: Your current usage of the InAppBrowser plugin is deprecated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.'); } From e46f10878e6af5755683f1e549fc1812004644b9 Mon Sep 17 00:00:00 2001 From: Shane Smith Date: Wed, 16 Nov 2016 14:35:59 -0500 Subject: [PATCH 340/382] docs(media-capture): fix documentation mixup --- src/plugins/media-capture.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index de3126789..72ea7f370 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -29,7 +29,7 @@ declare var navigator: any; }) export class MediaCapture { /** - * The audio recording formats supported by the device. + * The recording image sizes and formats supported by the device. * @returns {ConfigurationData[]} */ @CordovaProperty @@ -38,7 +38,7 @@ export class MediaCapture { } /** - * The recording image sizes and formats supported by the device. + * The audio recording formats supported by the device. * @returns {ConfigurationData[]} */ @CordovaProperty From dd2ccef0c72680d04e1bd1abefc3ddbe683addf4 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Thu, 17 Nov 2016 09:53:24 -0800 Subject: [PATCH 341/382] docs(camera preview): update to correct repo * docs(camera preview): update to correct repo * docs(camera preview): fix typo * docs(camera preview): Update to other repo --- src/plugins/camera-preview.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 1dac77910..bd07cc2a3 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -19,7 +19,7 @@ export interface CameraPreviewSize { * @description * Showing camera preview in HTML * - * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/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). * * @usage * ``` @@ -38,7 +38,7 @@ export interface CameraPreviewSize { * CameraPreview.startCamera( * cameraRect, // position and size of preview * 'front', // default camera - * true, // tape to take picture + * true, // tap to take picture * false, // disable drag * true // send the preview to the back of the screen so we can add overlaying elements * ); @@ -70,7 +70,7 @@ export interface CameraPreviewSize { */ @Plugin({ pluginName: 'CameraPreview', - plugin: 'cordova-plugin-camera-preview', + plugin: 'https://github.com/westonganger/cordova-plugin-camera-preview', pluginRef: 'cordova.plugins.camerapreview', repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', platforms: ['Android', 'iOS'] From 7b8b2d71364c759715c68a8ef7f18c11f1fb5660 Mon Sep 17 00:00:00 2001 From: Brett Morrison Date: Thu, 17 Nov 2016 16:14:02 -0800 Subject: [PATCH 342/382] GoogleAnalytics TS file updated to include 'Browser', now that 'Browser' is supported: https://github.com/danwilson/google-analytics-plugin/pull/313 --- src/plugins/googleanalytics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 79b1161ae..8fa185fc8 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -17,7 +17,7 @@ declare var window; plugin: 'cordova-plugin-google-analytics', pluginRef: 'ga', repo: 'https://github.com/danwilson/google-analytics-plugin', - platforms: ['Android', 'iOS'] + platforms: ['Android', 'iOS', 'Browser'] }) export class GoogleAnalytics { /** From 8988fad713bf3e700a6b5417e3b71c0dbe90f8e4 Mon Sep 17 00:00:00 2001 From: Nakul Gulati Date: Fri, 18 Nov 2016 17:08:42 +0530 Subject: [PATCH 343/382] Plugin reference fix The plugin reference is available as part of the global `cordova` object and not the global `plugins` object. This caused the plugin to `Plugin not installed warning` even though the plugin is installed and works when using through `cordova.plugins.market.open(appId);` --- src/plugins/market.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/market.ts b/src/plugins/market.ts index 70a97bca4..197ac6ab1 100644 --- a/src/plugins/market.ts +++ b/src/plugins/market.ts @@ -15,7 +15,7 @@ import { Plugin, Cordova } from './plugin'; @Plugin({ pluginName: 'Market', plugin: 'cordova-plugin-market', - pluginRef: 'plugins.market', + pluginRef: 'cordova.plugins.market', repo: 'https://github.com/xmartlabs/cordova-plugin-market' }) export class Market { From b5cc14c54670dcf2c47dfd155d5958146711d33e Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 18 Nov 2016 14:30:06 -0800 Subject: [PATCH 344/382] docs(camera preview): update to correct repo * docs(camera preview): update to correct repo * docs(camera preview): fix typo * docs(camera preview): Update to other repo * fix(camera preview): revert to old plugin and update repo to matching repo --- src/plugins/camera-preview.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index bd07cc2a3..2a5146702 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -70,9 +70,9 @@ export interface CameraPreviewSize { */ @Plugin({ pluginName: 'CameraPreview', - plugin: 'https://github.com/westonganger/cordova-plugin-camera-preview', + 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 { From 5577c51dbc7c91d0fe1e1934bbd46e2a3ced33cb Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sun, 20 Nov 2016 07:54:38 -0600 Subject: [PATCH 345/382] fix(camera-preview): formatting. Closes #790 --- 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 2a5146702..13ce195ad 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -23,7 +23,7 @@ export interface CameraPreviewSize { * * @usage * ``` - * import { CameraPreview } from 'ionic-native'; + * import { CameraPreview, CameraPreviewRect } from 'ionic-native'; * * // camera options (Size and location) * let cameraRect: CameraPreviewRect = { From 695099b2b097a2c5d25dc2eed20f29456d6e94dc Mon Sep 17 00:00:00 2001 From: Yasin Simsek Date: Wed, 23 Nov 2016 10:48:08 +0100 Subject: [PATCH 346/382] fix(3dTouch): fixes onHomeIconPressed (#813) --- src/plugins/3dtouch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/3dtouch.ts b/src/plugins/3dtouch.ts index 40d1fc885..52526839c 100644 --- a/src/plugins/3dtouch.ts +++ b/src/plugins/3dtouch.ts @@ -108,7 +108,7 @@ export class ThreeDeeTouch { */ static onHomeIconPressed(): Observable { return new Observable(observer => { - if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) { + if (window.ThreeDeeTouch) { window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer); } else { observer.error('3dTouch plugin is not available.'); From bdef1daba5eaf68d5c900fbf90b8a152242f9cf3 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:01:10 -0500 Subject: [PATCH 347/382] docs(backgroundmode): remove anchor from repo link --- src/plugins/backgroundmode.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 04fc99eed..0259ece0e 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -6,7 +6,7 @@ import { Observable } from 'rxjs/Observable'; * @name Background Mode * @description * Cordova plugin to prevent the app from going to sleep while in background. -* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization +* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode *@usage * ```typescript * import { BackgroundMode } from 'ionic-native'; From b719a0372bdfbde162ec3945245f9d3c5e873ae9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:05:04 -0500 Subject: [PATCH 348/382] fix(native-audio): completeCallback is optional on play method closes #792 --- src/plugins/native-audio.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts index 11588ec77..a6121d5fc 100644 --- a/src/plugins/native-audio.ts +++ b/src/plugins/native-audio.ts @@ -10,6 +10,10 @@ import { Plugin, Cordova } from './plugin'; * NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError); * * NativeAudio.play('uniqueId1').then(onSuccess, onError); + * + * // can optionally pass a callback to be called when the file is done playing + * NativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing')); + * * NativeAudio.loop('uniqueId2').then(onSuccess, onError); * * NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError); @@ -57,7 +61,7 @@ export class NativeAudio { successIndex: 1, errorIndex: 2 }) - static play(id: string, completeCallback: Function): Promise {return; } + static play(id: string, completeCallback?: Function): Promise {return; } /** * Stops playing an audio From 6ad54ecf860d517bbc76eb33dae8fa3b53bc484c Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:16:02 -0500 Subject: [PATCH 349/382] feat(camera-preview): add disable method --- src/plugins/camera-preview.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 13ce195ad..36ce987e5 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -89,7 +89,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }; + static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { } /** * Stops the camera preview instance. @@ -97,7 +97,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static stopCamera(): void { }; + static stopCamera(): void { } /** * Take the picture, the parameter size is optional @@ -106,7 +106,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. @@ -114,7 +114,7 @@ export class CameraPreview { @Cordova({ observable: true }) - static setOnPictureTakenHandler(): Observable { return; }; + static setOnPictureTakenHandler(): Observable { return; } /** * Switch from the rear camera and front camera, if available. @@ -122,7 +122,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static switchCamera(): void { }; + static switchCamera(): void { } /** * Show the camera preview box. @@ -130,7 +130,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static show(): void { }; + static show(): void { } /** * Hide the camera preview box. @@ -138,7 +138,15 @@ export class CameraPreview { @Cordova({ sync: true }) - static hide(): void { }; + static hide(): void { } + + /** + * Disables the camera preview + */ + @Cordova({ + sync: true + }) + static disable(): void { } /** * Set camera color effect. @@ -146,5 +154,5 @@ export class CameraPreview { @Cordova({ sync: true }) - static setColorEffect(effect: string): void { }; + static setColorEffect(effect: string): void { } } From 0b39ff8b7db57d975422a3acc449a242d3dd0459 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:22:35 -0500 Subject: [PATCH 350/382] docs(push): fix install command closes #803 --- src/plugins/push.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index f1b33cf7f..51e1d6231 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -289,7 +289,8 @@ declare var PushNotification: { pluginName: 'Push', plugin: 'phonegap-plugin-push', pluginRef: 'PushNotification', - repo: 'https://github.com/phonegap/phonegap-plugin-push' + repo: 'https://github.com/phonegap/phonegap-plugin-push', + install: 'ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX' }) export class Push { From 24184a5a6a065455edb56fc8ee4d5fbaab1bc8db Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:23:55 -0500 Subject: [PATCH 351/382] chore(): tslint --- src/plugins/file.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 44f58b5fc..4513ba2b0 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -689,7 +689,7 @@ export class File { }) .then((fe) => { return File.writeFileEntry(fe, text, options); - }) + }); } /** Write content to FileEntry. @@ -700,7 +700,7 @@ export class File { * @param {WriteOptions} options replace file if set to true. See WriteOptions for more information. * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. */ - private static writeFileEntry(fe: FileEntry, text: string | Blob, options : WriteOptions) { + private static writeFileEntry(fe: FileEntry, text: string | Blob, options: WriteOptions) { return File.createWriter(fe) .then((writer) => { if (options.append) { @@ -725,7 +725,7 @@ export class File { * @returns {Promise} Returns a Promise that resolves or rejects with an error. */ static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { - return File.writeFile(path, fileName, text, { create: false }) + return File.writeFile(path, fileName, text, { create: false }); } /** From abd910de678c4388b50bcb8736e55fe4be9027a4 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:34:04 -0500 Subject: [PATCH 352/382] feat(google-analytics): new interval period parameter closes #816 --- src/plugins/googleanalytics.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 8fa185fc8..0bc0821bc 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -24,10 +24,11 @@ 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 + * @param {number} interval Optional dispatch period in seconds. Defaults to 30. * @return {Promise} */ @Cordova() - static startTrackerWithId(id: string): Promise { return; } + static startTrackerWithId(id: string, interval?: number): Promise { return; } /** * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more From 51ab03d097500c3c62e37af5425a1419d72a5ca6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:44:43 -0500 Subject: [PATCH 353/382] feat(google-map): add get and set methods to Marker class fixes #798 --- src/plugins/googlemap.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/plugins/googlemap.ts b/src/plugins/googlemap.ts index 3be68e87d..06169b887 100644 --- a/src/plugins/googlemap.ts +++ b/src/plugins/googlemap.ts @@ -41,7 +41,7 @@ export const GoogleMapsAnimation = { * @description This plugin uses the native Google Maps SDK * @usage * ``` - * import { + * import { * GoogleMap, * GoogleMapsEvent, * GoogleMapsLatLng, @@ -57,16 +57,16 @@ export const GoogleMapsAnimation = { * ngAfterViewInit() { * this.loadMap(); * } - * + * * loadMap() { * // make sure to create following structure in your view.html file * // - * //
+ * //
* //
* * // create a new map by passing HTMLElement * let element: HTMLElement = document.getElementById('map'); - * + * * let map = new GoogleMap(element); * * // listen to MAP_READY event @@ -96,7 +96,7 @@ export const GoogleMapsAnimation = { * marker.showInfoWindow(); * }); * } - * + * * } * ``` */ @@ -486,6 +486,21 @@ export class GoogleMapsMarker { ); } + /** + * Gets a value + * @param key + */ + @CordovaInstance({sync: true}) + get(key: string): any { return; } + + /** + * Sets a value + * @param key + * @param value + */ + @CordovaInstance({sync: true}) + set(key: string, value: any): void { } + @CordovaInstance({ sync: true }) isVisible(): boolean { return; } From 8439faf6b8d15f4aa1968d00cbeb08d5804fc9a7 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:51:04 -0500 Subject: [PATCH 354/382] docs(imagepicker): update repo url --- src/plugins/imagepicker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index 14539543e..af3c2532c 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -47,9 +47,9 @@ export interface ImagePickerOptions { */ @Plugin({ pluginName: 'ImagePicker', - plugin: 'cordova-plugin-image-picker', + plugin: 'https://github.com/Telerik-Verified-Plugins/ImagePicker', pluginRef: 'window.imagePicker', - repo: 'https://github.com/wymsee/cordova-imagePicker' + repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker' }) export class ImagePicker { /** From f07431a14c6e03482eb869c34400886850493813 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:53:20 -0500 Subject: [PATCH 355/382] fix(video-player): scalingMode is number fixes #774 --- src/plugins/video-player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/video-player.ts b/src/plugins/video-player.ts index 053ad8507..9a1087b71 100644 --- a/src/plugins/video-player.ts +++ b/src/plugins/video-player.ts @@ -13,7 +13,7 @@ export interface VideoOptions { * 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; + scalingMode?: number; } /** From 78b3ec5b1f24a1c78ee8e80ef1c81ec6fd386e5d Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 23 Nov 2016 08:55:49 -0500 Subject: [PATCH 356/382] fix(googlemap): fix typoe googledesic to geodesic fixes #765 --- src/plugins/googlemap.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/googlemap.ts b/src/plugins/googlemap.ts index 06169b887..775a10f3f 100644 --- a/src/plugins/googlemap.ts +++ b/src/plugins/googlemap.ts @@ -656,7 +656,7 @@ export class GoogleMapsCircle { export interface GoogleMapsPolylineOptions { points?: Array; visible?: boolean; - googledesic?: boolean; + geodesic?: boolean; color?: string; width?: number; zIndex?: number; From 156328c9de2dd3f1377b95909f202cba34e7ff5e Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 24 Nov 2016 05:19:12 -0500 Subject: [PATCH 357/382] refractor(): change return type of writeFile --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 4513ba2b0..d3b528b17 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -671,7 +671,7 @@ export class File { * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. */ static writeFile(path: string, fileName: string, - text: string | Blob, options: WriteOptions = {}): Promise { + text: string | Blob, options: WriteOptions = {}): Promise { if ((/^\//.test(fileName))) { const err = new FileError(5); err.message = 'file-name cannot start with \/'; From 9bd8997a315dd40f2605e4ecf5ebdef9be4bc38f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 24 Nov 2016 05:22:04 -0500 Subject: [PATCH 358/382] fix(file): correct writeFile flags fixes #789 --- src/plugins/file.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index d3b528b17..63e87e9fc 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -679,8 +679,8 @@ export class File { } const getFileOpts: Flags = { - create: !('create' in options) || options.create, - exclusive: !!options.replace + create: !options.append, + exclusive: !options.replace }; return File.resolveDirectoryUrl(path) From 08d66ead9bb8dc22e398c0f97a76bfc7eac4d03f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 24 Nov 2016 05:22:45 -0500 Subject: [PATCH 359/382] 2.2.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d3921118..637c6d9b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.6", + "version": "2.2.7", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From b64d61828a8df9bd81f7127087835fb2430e3da0 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 24 Nov 2016 05:25:14 -0500 Subject: [PATCH 360/382] chore(): update changelog --- CHANGELOG.md | 61 +++++++++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84e35b110..b1940766a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,26 @@ - -## [2.2.6](https://github.com/driftyco/ionic-native/compare/v2.2.5...v2.2.6) (2016-10-27) + +## [2.2.7](https://github.com/driftyco/ionic-native/compare/v2.2.5...v2.2.7) (2016-11-24) ### Bug Fixes +* **3dTouch:** fixes onHomeIconPressed ([#813](https://github.com/driftyco/ionic-native/issues/813)) ([695099b](https://github.com/driftyco/ionic-native/commit/695099b)) +* **camera-preview:** formatting. Closes [#790](https://github.com/driftyco/ionic-native/issues/790) ([5577c51](https://github.com/driftyco/ionic-native/commit/5577c51)) +* **datepicker:** fix allowOldDates option ([#761](https://github.com/driftyco/ionic-native/issues/761)) ([fa03fa5](https://github.com/driftyco/ionic-native/commit/fa03fa5)) +* **diagnostics:** fix [#776](https://github.com/driftyco/ionic-native/issues/776) ([#777](https://github.com/driftyco/ionic-native/issues/777)) ([01b30c6](https://github.com/driftyco/ionic-native/commit/01b30c6)) +* **file:** correct writeFile flags ([9bd8997](https://github.com/driftyco/ionic-native/commit/9bd8997)), closes [#789](https://github.com/driftyco/ionic-native/issues/789) +* **googlemap:** fix typoe googledesic to geodesic ([78b3ec5](https://github.com/driftyco/ionic-native/commit/78b3ec5)), closes [#765](https://github.com/driftyco/ionic-native/issues/765) +* **native-audio:** completeCallback is optional on play method ([b719a03](https://github.com/driftyco/ionic-native/commit/b719a03)), closes [#792](https://github.com/driftyco/ionic-native/issues/792) * **nfc:** don't bind to name field, fix [#740](https://github.com/driftyco/ionic-native/issues/740) ([#749](https://github.com/driftyco/ionic-native/issues/749)) ([ca43394](https://github.com/driftyco/ionic-native/commit/ca43394)) * **plugin:** don't bind to name field. Fixes [#740](https://github.com/driftyco/ionic-native/issues/740) ([71916a8](https://github.com/driftyco/ionic-native/commit/71916a8)) +* **video-player:** scalingMode is number ([f07431a](https://github.com/driftyco/ionic-native/commit/f07431a)), closes [#774](https://github.com/driftyco/ionic-native/issues/774) + + +### Features + +* **camera-preview:** add disable method ([6ad54ec](https://github.com/driftyco/ionic-native/commit/6ad54ec)) +* **google-analytics:** new interval period parameter ([abd910d](https://github.com/driftyco/ionic-native/commit/abd910d)), closes [#816](https://github.com/driftyco/ionic-native/issues/816) +* **google-map:** add get and set methods to Marker class ([51ab03d](https://github.com/driftyco/ionic-native/commit/51ab03d)), closes [#798](https://github.com/driftyco/ionic-native/issues/798) @@ -104,7 +119,6 @@ * **native-transitions:** add missing interface properties ([35c8bbd](https://github.com/driftyco/ionic-native/commit/35c8bbd)) * **onesignal:** update to match latest api ([#671](https://github.com/driftyco/ionic-native/issues/671)) ([7c6e6d8](https://github.com/driftyco/ionic-native/commit/7c6e6d8)), closes [#667](https://github.com/driftyco/ionic-native/issues/667) -* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175)) ### Features @@ -114,23 +128,15 @@ -## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.8...v2.1.9) (2016-10-09) - - -### Bug Fixes - -* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845)) -* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92)) - - - - -## [2.1.8](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.8) (2016-10-08) +## [2.1.9](https://github.com/driftyco/ionic-native/compare/v2.1.7...v2.1.9) (2016-10-09) ### Bug Fixes * **googlemaps:** fixes GoogleMapsLatLng class ([11653ce](https://github.com/driftyco/ionic-native/commit/11653ce)) +* **paypal:** add optional details param to paypalpayment ([7200845](https://github.com/driftyco/ionic-native/commit/7200845)) +* **paypal:** problems with selection of PayPal environment ([#662](https://github.com/driftyco/ionic-native/issues/662)) ([3dd6a92](https://github.com/driftyco/ionic-native/commit/3dd6a92)) +* **thmeable-browser:** fix the name of the plugin ([#663](https://github.com/driftyco/ionic-native/issues/663)) ([1368175](https://github.com/driftyco/ionic-native/commit/1368175)) @@ -145,27 +151,13 @@ -## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.5...v2.1.6) (2016-10-06) - - -### Bug Fixes - -* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657)) - - - - -## [2.1.5](https://github.com/driftyco/ionic-native/compare/v2.1.4...v2.1.5) (2016-10-06) - - - - -## [2.1.4](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.4) (2016-10-06) +## [2.1.6](https://github.com/driftyco/ionic-native/compare/v2.1.3...v2.1.6) (2016-10-06) ### Bug Fixes * **google-analytics:** specify successIndex and errorIndex for methods with optional params ([6f23bef](https://github.com/driftyco/ionic-native/commit/6f23bef)) +* **paypal:** fix helper classes ([f002657](https://github.com/driftyco/ionic-native/commit/f002657)) @@ -182,7 +174,7 @@ -## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.1...v2.1.2) (2016-10-06) +## [2.1.2](https://github.com/driftyco/ionic-native/compare/v2.1.0...v2.1.2) (2016-10-06) ### Bug Fixes @@ -196,11 +188,6 @@ - -## [2.1.1](https://github.com/driftyco/ionic-native/compare/v2.1.0...v2.1.1) (2016-10-03) - - - # [2.1.0](https://github.com/driftyco/ionic-native/compare/v2.0.3...v2.1.0) (2016-10-03) From fd0ac37ffccd368bcc82827380a12d19b3bb73da Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 24 Nov 2016 05:28:53 -0500 Subject: [PATCH 361/382] refractor(file): property filesystem of Entry is lowercase fixes #720 --- src/plugins/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 63e87e9fc..f11350ac0 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -25,7 +25,7 @@ export interface Entry { /** The full absolute path from the root to the entry. */ fullPath: string; /** The file system on which the entry resides. */ - fileSystem: FileSystem; + filesystem: FileSystem; nativeURL: string; /** * Look up metadata about this entry. From 87049e9582f0db11b783ab318a87597050186c43 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 25 Nov 2016 00:09:26 -0500 Subject: [PATCH 362/382] Update wrap.tmpl --- scripts/templates/wrap.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/templates/wrap.tmpl b/scripts/templates/wrap.tmpl index 1e00a120a..7bf61ae18 100644 --- a/scripts/templates/wrap.tmpl +++ b/scripts/templates/wrap.tmpl @@ -29,7 +29,7 @@ import { Observable } from 'rxjs/Observable'; * ``` */ @Plugin({ - name: 'PluginName', + pluginName: 'PluginName', plugin: '', // npm package name, example: cordova-plugin-camera pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation repo: '', // the github repository URL for the plugin From c987a06f9162c5afbc77148c9552f6ae694b7d76 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 25 Nov 2016 00:09:40 -0500 Subject: [PATCH 363/382] Update wrap-min.tmpl --- scripts/templates/wrap-min.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/templates/wrap-min.tmpl b/scripts/templates/wrap-min.tmpl index 396826dca..0a947901d 100644 --- a/scripts/templates/wrap-min.tmpl +++ b/scripts/templates/wrap-min.tmpl @@ -11,7 +11,7 @@ import { Plugin } from './plugin'; * ``` */ @Plugin({ - name: 'PluginName', + pluginName: 'PluginName', plugin: '', pluginRef: '', repo: '' From 00e68ca990a213e5ab1f41ca484b88538ea2caa3 Mon Sep 17 00:00:00 2001 From: Wyatt Arent Date: Mon, 28 Nov 2016 02:24:23 -0700 Subject: [PATCH 364/382] docs(camera-preview): add missing param (#830) * Update camera-preview.ts This missing parameter would cause TS to spew * Update camera-preview.ts Sending preview to back is initially confusing and causes it to appear to not work. --- src/plugins/camera-preview.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 36ce987e5..53171e1ad 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -40,7 +40,8 @@ export interface CameraPreviewSize { * 'front', // default camera * true, // tap to take picture * false, // disable drag - * true // send the preview to the back of the screen so we can add overlaying elements + * false, // Keep preview in front. Set to false (back of the screen) to apply overlaying elements + * 1 // set the preview alpha * ); * * // Set the handler to run every time we take a picture From 13216d1f04ce311bbb74251e99d00ebf845bd78f Mon Sep 17 00:00:00 2001 From: perry Date: Mon, 28 Nov 2016 10:53:24 -0600 Subject: [PATCH 365/382] attempting to eliminate the possibility for false positives when checking for docs changes --- scripts/docs/update_docs.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/docs/update_docs.sh b/scripts/docs/update_docs.sh index b63af8472..a6e4a84c0 100755 --- a/scripts/docs/update_docs.sh +++ b/scripts/docs/update_docs.sh @@ -23,10 +23,8 @@ function run { # CD in to the site dir to commit updated docs cd $SITE_DIR - CHANGES=$(git status --porcelain) - # if no changes, don't commit - if [[ "$CHANGES" == "" ]]; then + if [[ `git status --porcelain` ]]; then echo "-- No changes detected for the following commit, docs not updated." echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1" else From d76ad8803eec0dc9bc1a7d6ebd6cb223b5015e85 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Tue, 29 Nov 2016 10:22:32 -0600 Subject: [PATCH 366/382] docs(background mode): fix incorrect return types and typos --- src/plugins/backgroundmode.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 0259ece0e..3896602d9 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -53,14 +53,14 @@ export class BackgroundMode { /** * Checks if background mode is enabled or not. - * @returns {boolean} returns a true of false if the background mode is enabled. + * @returns {Promise} returns a true of false if the background mode is enabled. */ @Cordova() 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. + * @returns {Promise} returns true or false if the background mode is active. */ @Cordova() static isActive(): Promise { return; } @@ -87,18 +87,21 @@ export class BackgroundMode { /** * Called when background mode is activated. + * @returns {Observable} returns an observable that emits when background mode is activated */ @CordovaFunctionOverride() static onactivate(): Observable { return; }; /** * Called when background mode is deactivated. + * @returns {Observable} returns an observable that emits when background mode is deactivated */ @CordovaFunctionOverride() static ondeactivate(): Observable { return; }; /** * Called when background mode fails + * @returns {Observable} returns an observable that emits when background mode fails */ @CordovaFunctionOverride() static onfailure(): Observable { return; }; From 8d6c2dfb9abb5768c820ca80c7d1a7dfa80decb6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 29 Nov 2016 13:11:15 -0500 Subject: [PATCH 367/382] docs(datepicker): update docs --- src/plugins/datepicker.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 57bfe705f..ede2450cc 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -107,10 +107,6 @@ export interface DatePickerOptions { * @description * The DatePicker plugin allows the user to fetch date or time using native dialogs. * - * Platforms supported: iOS, Android, Windows - * - * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker). - * * @usage * ```typescript * import { DatePicker } from 'ionic-native'; @@ -131,7 +127,8 @@ export interface DatePickerOptions { pluginName: 'DatePicker', plugin: 'cordova-plugin-datepicker', pluginRef: 'datePicker', - repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker' + repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker', + platforms: ['Android', 'iOS', 'Windows'] }) export class DatePicker { From 785646800b3a1656328ed4e069d2355bb2cf45b3 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 29 Nov 2016 13:13:35 -0500 Subject: [PATCH 368/382] refractor(backgroundmode): fix return types --- src/plugins/backgroundmode.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index 3896602d9..ae697c257 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -49,7 +49,7 @@ export class BackgroundMode { * Once the background mode has been disabled, the app will be paused when in background. */ @Cordova() - static disable(): void { } + static disable(): Promise { return; } /** * Checks if background mode is enabled or not. @@ -73,7 +73,7 @@ export class BackgroundMode { @Cordova({ platforms: ['Android'] }) - static setDefaults(options?: Configure): void { } + static setDefaults(options?: Configure): Promise { return; } /** * Modify the displayed information. @@ -83,7 +83,7 @@ export class BackgroundMode { @Cordova({ platforms: ['Android'] }) - static configure(options?: Configure): void { } + static configure(options?: Configure): Promise { return; } /** * Called when background mode is activated. From 5b98a808286af671da3d341d87af68f40eb61651 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 29 Nov 2016 13:14:34 -0500 Subject: [PATCH 369/382] docs(backgroundmode): update docs --- src/plugins/backgroundmode.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/backgroundmode.ts b/src/plugins/backgroundmode.ts index ae697c257..a76e7fd57 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -53,14 +53,14 @@ export class BackgroundMode { /** * Checks if background mode is enabled or not. - * @returns {Promise} returns a true of false if the background mode is enabled. + * @returns {Promise} returns a promise that resolves with boolean that indicates if the background mode is enabled. */ @Cordova() static isEnabled(): Promise { return; } /** * Can be used to get the information if the background mode is active. - * @returns {Promise} returns true or false if the background mode is active. + * @returns {Promise} returns a promise that resolves with boolean that indicates if the background mode is active. */ @Cordova() static isActive(): Promise { return; } From efb2ee78807778bafe9dd0c64ff396ca2b188b39 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 29 Nov 2016 13:33:11 -0500 Subject: [PATCH 370/382] refractor(camera): remove public statements --- src/plugins/camera.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 2942162fd..d30cbe08e 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -121,7 +121,7 @@ export class Camera { * @private * @enum {number} */ - public static DestinationType = { + 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) */ @@ -134,7 +134,7 @@ export class Camera { * @private * @enum {number} */ - public static EncodingType = { + static EncodingType = { /** Return JPEG encoded image */ JPEG: 0, /** Return PNG encoded image */ @@ -144,7 +144,7 @@ export class Camera { * @private * @enum {number} */ - public static MediaType = { + 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 */ @@ -157,7 +157,7 @@ export class Camera { * @private * @enum {number} */ - public static PictureSourceType = { + static PictureSourceType = { /** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */ PHOTOLIBRARY: 0, /** Take picture from camera */ @@ -171,7 +171,7 @@ export class Camera { * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover. * @enum {number} */ - public static PopoverArrowDirection = { + static PopoverArrowDirection = { ARROW_UP: 1, ARROW_DOWN: 2, ARROW_LEFT: 4, @@ -183,7 +183,7 @@ export class Camera { * @private * @enum {number} */ - public static Direction = { + static Direction = { /** Use the back-facing camera */ BACK: 0, /** Use the front-facing camera */ From 1072ab115b382cb35df737ca4c00e305c0c2ed25 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 29 Nov 2016 14:28:26 -0500 Subject: [PATCH 371/382] fix(globalization): add missing parameter to numberToString function closes #835 --- src/plugins/globalization.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index 172ba6c67..fe4f880d5 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -93,13 +93,14 @@ export class Globalization { /** * Returns a number formatted as a string according to the client's user preferences. - * @param options + * @param number {Number} The number to convert + * @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency. */ @Cordova({ successIndex: 1, errorIndex: 2 }) - static numberToString(options: { type: string }): Promise<{ value: string }> { return; } + static numberToString(number: number, options: { type: string }): Promise<{ value: string }> { return; } /** * From 3da28317799efe7edc50d1f90a6e0d62cd5330a2 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Tue, 29 Nov 2016 16:40:50 -0600 Subject: [PATCH 372/382] docs(all): standardizes and adds return types, also some param fixes --- src/plugins/actionsheet.ts | 4 +- src/plugins/admob.ts | 5 ++ src/plugins/android-fingerprint-auth.ts | 1 + src/plugins/appversion.ts | 8 +-- src/plugins/background-geolocation.ts | 12 ++++ src/plugins/badge.ts | 12 ++-- src/plugins/barcodescanner.ts | 3 +- src/plugins/base64togallery.ts | 2 +- src/plugins/batterystatus.ts | 2 +- src/plugins/ble.ts | 16 +++--- src/plugins/bluetoothserial.ts | 34 ++++++------ src/plugins/brightness.ts | 4 +- src/plugins/calendar.ts | 22 ++++---- src/plugins/call-number.ts | 1 + src/plugins/camera-preview.ts | 1 + src/plugins/camera.ts | 4 +- src/plugins/card-io.ts | 3 + src/plugins/clipboard.ts | 4 +- src/plugins/code-push.ts | 6 ++ src/plugins/contacts.ts | 6 +- src/plugins/crop.ts | 2 +- src/plugins/dbmeter.ts | 6 +- src/plugins/deeplinks.ts | 4 +- src/plugins/device-feedback.ts | 1 + src/plugins/device.ts | 4 +- src/plugins/deviceaccounts.ts | 4 ++ src/plugins/devicemotion.ts | 2 +- src/plugins/diagnostic.ts | 9 ++- src/plugins/emailcomposer.ts | 2 +- src/plugins/estimote-beacons.ts | 46 ++++++++------- src/plugins/facebook.ts | 21 +++---- src/plugins/file-chooser.ts | 1 + src/plugins/file-opener.ts | 3 + src/plugins/file.ts | 34 ++++++------ src/plugins/filepath.ts | 1 + src/plugins/filetransfer.ts | 4 +- src/plugins/geofence.ts | 14 ++--- src/plugins/geolocation.ts | 6 +- src/plugins/globalization.ts | 23 ++++---- src/plugins/google-plus.ts | 4 ++ src/plugins/googleanalytics.ts | 32 +++++------ src/plugins/googlemap.ts | 48 ++++++++++++++-- src/plugins/hotspot.ts | 71 +++++++++++++++++++----- src/plugins/http.ts | 16 +++--- src/plugins/httpd.ts | 1 + src/plugins/ibeacon.ts | 74 ++++++++++++------------- src/plugins/imagepicker.ts | 2 +- src/plugins/imageresizer.ts | 3 + src/plugins/inappbrowser.ts | 8 ++- src/plugins/inapppurchase.ts | 9 +-- src/plugins/insomnia.ts | 4 +- src/plugins/instagram.ts | 6 +- src/plugins/is-debug.ts | 2 +- src/plugins/keyboard.ts | 2 + src/plugins/launchnavigator.ts | 22 ++++++++ src/plugins/localnotifications.ts | 54 +++++++++--------- src/plugins/market.ts | 2 +- src/plugins/media-capture.ts | 5 ++ src/plugins/media.ts | 8 +-- src/plugins/mixpanel.ts | 11 ++-- src/plugins/native-audio.ts | 6 +- src/plugins/native-page-transitions.ts | 5 ++ src/plugins/nativestorage.ts | 4 ++ src/plugins/nfc.ts | 24 ++++---- src/plugins/onesignal.ts | 11 +++- src/plugins/pay-pal.ts | 11 +++- src/plugins/photo-viewer.ts | 2 +- src/plugins/pin-dialog.ts | 1 + src/plugins/power-management.ts | 4 ++ src/plugins/printer.ts | 6 +- src/plugins/push.ts | 4 +- src/plugins/safari-view-controller.ts | 9 ++- src/plugins/screen-orientation.ts | 2 +- src/plugins/screenshot.ts | 2 + src/plugins/securestorage.ts | 4 ++ src/plugins/shake.ts | 1 + src/plugins/sim.ts | 2 +- src/plugins/socialsharing.ts | 26 ++++----- src/plugins/sqlite.ts | 49 ++++++++++++++-- src/plugins/stepcounter.ts | 12 ++-- src/plugins/themeable-browser.ts | 4 +- src/plugins/toast.ts | 24 +++++--- src/plugins/touchid.ts | 8 +-- src/plugins/twitter-connect.ts | 6 +- src/plugins/video-editor.ts | 8 +-- src/plugins/webintent.ts | 22 ++++++++ src/plugins/z-bar.ts | 2 +- src/plugins/zip.ts | 2 +- 88 files changed, 635 insertions(+), 347 deletions(-) diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index a6cb933f7..6c5ef6fc5 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -52,7 +52,7 @@ export class ActionSheet { /** * Show a native ActionSheet component. See below for options. * @param {options} Options See table below - * @returns {Promise} Returns a Promise that resolves with the index of the + * @returns {Promise} Returns a Promise that resolves with the index of the * button pressed (1 based, so 1, 2, 3, etc.) */ @Cordova() @@ -70,7 +70,7 @@ export class ActionSheet { /** * Progamtically hide the native ActionSheet - * @returns {Promise} Returns a Promise that resolves when the actionsheet is closed + * @returns {Promise} Returns a Promise that resolves when the actionsheet is closed */ @Cordova() static hide(options?: any): Promise { return; } diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts index 949725e02..9527db075 100644 --- a/src/plugins/admob.ts +++ b/src/plugins/admob.ts @@ -35,6 +35,7 @@ export class AdMob { /** * * @param adIdOrOptions + * @returns {Promise} Returns a Promise that resolves when the banner is created */ @Cordova() static createBanner(adIdOrOptions: any): Promise { return; } @@ -77,6 +78,7 @@ export class AdMob { /** * * @param adIdOrOptions + * @returns {Promise} Returns a Promise that resolves when interstitial is prepared */ @Cordova() static prepareInterstitial(adIdOrOptions: any): Promise { return; } @@ -91,6 +93,7 @@ export class AdMob { /** * + * @returns {Promise} Returns a Promise that resolves when the interstitial is ready */ @Cordova() static isInterstitialReady(): Promise { return; } @@ -98,6 +101,7 @@ export class AdMob { /** * Prepare a reward video ad * @param adIdOrOptions + * @returns {Promise} Returns a Promise that resolves when the ad is prepared */ @Cordova() static prepareRewardVideoAd(adIdOrOptions: any): Promise { return; } @@ -113,6 +117,7 @@ export class AdMob { /** * Sets the values for configuration and targeting * @param options Returns a promise that resolves if the options are set successfully + * @returns {Promise} Returns a Promise that resolves when the options have been set */ @Cordova() static setOptions(options: any): Promise { return; } diff --git a/src/plugins/android-fingerprint-auth.ts b/src/plugins/android-fingerprint-auth.ts index e98e7e421..f06634da1 100644 --- a/src/plugins/android-fingerprint-auth.ts +++ b/src/plugins/android-fingerprint-auth.ts @@ -71,6 +71,7 @@ export class AndroidFingerprintAuth { /** * Check if service is available + * @returns {Promise} Returns a Promise that resolves if fingerprint auth is available on the device */ @Cordova() static isAvailable(): Promise<{isAvailable: boolean}> {return; } diff --git a/src/plugins/appversion.ts b/src/plugins/appversion.ts index 364184f12..e299b35fa 100644 --- a/src/plugins/appversion.ts +++ b/src/plugins/appversion.ts @@ -28,28 +28,28 @@ import { Cordova, Plugin } from './plugin'; export class AppVersion { /** * Returns the name of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() static getAppName(): Promise { return; } /** * Returns the package name of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() static getPackageName(): Promise { return; } /** * Returns the build identifier of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() static getVersionCode(): Promise { return; } /** * Returns the version of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() static getVersionNumber(): Promise { return; } diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 35248243b..f9d91c420 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -346,12 +346,14 @@ export class BackgroundGeolocation { /** * Turn ON the background-geolocation system. * The user will be tracked whenever they suspend the app. + * @returns {Promise} */ @Cordova() static start(): Promise { return; } /** * Turn OFF background-tracking + * @returns {Promise} */ @Cordova() static stop(): Promise { return; } @@ -372,6 +374,7 @@ export class BackgroundGeolocation { /** * Setup configuration + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' @@ -381,6 +384,7 @@ export class BackgroundGeolocation { /** * Returns current stationaryLocation if available. null if not * NOTE: IOS, WP only + * @returns {Promise} */ @Cordova() static getStationaryLocation(): Promise { return; } @@ -389,6 +393,7 @@ export class BackgroundGeolocation { * Add a stationary-region listener. Whenever the devices enters "stationary-mode", * your #success callback will be executed with #location param containing #radius of region * NOTE: IOS, WP only + * @returns {Promise} */ @Cordova() static onStationary(): Promise { return; } @@ -418,6 +423,7 @@ export class BackgroundGeolocation { * If user enable or disable location services then success callback will be executed. * In case or error (SettingNotFoundException) fail callback will be executed. * NOTE: ANDROID only + * @returns {Promise} */ @Cordova() static watchLocationMode(): Promise { return; } @@ -437,12 +443,14 @@ export class BackgroundGeolocation { * or * - option.debug is true * NOTE: ANDROID only + * @returns {Promise} */ @Cordova() static getLocations(): Promise { return; } /**
 * Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
 + * @returns {Promise} */ @Cordova() static getValidLocations(): Promise { return; } @@ -450,6 +458,7 @@ export class BackgroundGeolocation { /** * Delete stored location by given locationId. * NOTE: ANDROID only + * @returns {Promise} */ @Cordova() static deleteLocation(locationId: number): Promise { return; } @@ -457,6 +466,7 @@ export class BackgroundGeolocation { /** * Delete all stored locations. * NOTE: ANDROID only + * @returns {Promise} */ @Cordova() static deleteAllLocations(): Promise { return; } @@ -474,6 +484,7 @@ export class BackgroundGeolocation { * NOTE: iOS only * * @param {number} See above.
 + * @returns {Promise} */ @Cordova() static switchMode(modeId: number): Promise { return; } @@ -483,6 +494,7 @@ export class BackgroundGeolocation { * @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
 * * @param {number} Limits the number of entries
 + * @returns {Promise} */ @Cordova() static getLogEntries(limit: number): Promise { return; } diff --git a/src/plugins/badge.ts b/src/plugins/badge.ts index 950124322..413940a27 100644 --- a/src/plugins/badge.ts +++ b/src/plugins/badge.ts @@ -28,6 +28,7 @@ export class Badge { /** * Clear the badge of the app icon. + * @returns {Promise} */ @Cordova() static clear(): Promise { return; } @@ -35,14 +36,14 @@ export class Badge { /** * Set the badge of the app icon. * @param {number} badgeNumber The new badge number. - * @returns {Promise} + * @returns {Promise} */ @Cordova() static set(badgeNumber: number): Promise { return; } /** * Get the badge of the app icon. - * @returns {Promise} + * @returns {Promise} */ @Cordova() static get(): Promise { return; } @@ -50,7 +51,7 @@ export class Badge { /** * Increase the badge number. * @param {number} increaseBy Count to add to the current badge number - * @returns {Promise} + * @returns {Promise} */ @Cordova() static increase(increaseBy: number): Promise { return; } @@ -58,20 +59,21 @@ export class Badge { /** * Decrease the badge number. * @param {number} decreaseBy Count to subtract from the current badge number - * @returns {Promise} + * @returns {Promise} */ @Cordova() static decrease(decreaseBy: number): Promise { return; } /** * Determine if the app has permission to show badges. + * @returns {Promise} */ @Cordova() static hasPermission(): Promise { return; } /** * Register permission to set badge notifications - * @returns {Promise} + * @returns {Promise} */ @Cordova() static registerPermission(): Promise { return; } diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index ae1656dfc..a88e0dea4 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -40,7 +40,7 @@ export class BarcodeScanner { /** * Open the barcode scanner. * @param options {Object} Optional options to pass to the scanner - * @return Returns a Promise that resolves with scanner data, or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with scanner data, or rejects with an error. */ @Cordova({ callbackOrder: 'reverse' @@ -52,6 +52,7 @@ export class BarcodeScanner { * NOTE: not well supported on Android * @param type {string} Type of encoding * @param data {any} Data to encode + * @returns {Promise} */ @Cordova() static encode(type: string, data: any): Promise { return; } diff --git a/src/plugins/base64togallery.ts b/src/plugins/base64togallery.ts index 035182274..324848ac1 100644 --- a/src/plugins/base64togallery.ts +++ b/src/plugins/base64togallery.ts @@ -26,7 +26,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 {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS. - * @returns {Promise} returns a promise that resolves when the image is saved. + * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova({ successIndex: 2, diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index 6526cc30e..eda912031 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -33,7 +33,7 @@ export class BatteryStatus { /** * Watch the change in battery level - * @returns {Observable} Returns an observable that pushes a status object + * @returns {Observable} Returns an observable that pushes a status object */ @Cordova({ eventObservable: true, diff --git a/src/plugins/ble.ts b/src/plugins/ble.ts index 9c776f1f0..011a22619 100644 --- a/src/plugins/ble.ts +++ b/src/plugins/ble.ts @@ -178,7 +178,7 @@ export class BLE { * ``` * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices * @param {number} seconds Number of seconds to run discovery - * @return Returns an Observable that notifies of each peripheral that is discovered during the specified time. + * @returns {Observable} Returns an Observable that notifies of each peripheral that is discovered during the specified time. */ @Cordova({ observable: true @@ -199,7 +199,7 @@ export class BLE { * }, 5000); * ``` * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices - * @return Returns an Observable that notifies of each peripheral discovered. + * @returns {Observable} Returns an Observable that notifies of each peripheral discovered. */ @Cordova({ observable: true, @@ -212,7 +212,7 @@ export class BLE { * Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports). * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices * @param options {any} - * @return Returns an Observable that notifies of each peripheral discovered. + * @returns {Observable} Returns an Observable that notifies of each peripheral discovered. */ @Cordova({ observable: true, @@ -373,7 +373,7 @@ export class BLE { * @param {string} deviceId UUID or MAC address of the peripheral * @param {string} serviceUUID UUID of the BLE service * @param {string} characteristicUUID UUID of the BLE characteristic - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static stopNotification( @@ -393,7 +393,7 @@ export class BLE { * ); * ``` * @param {string} deviceId UUID or MAC address of the peripheral - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static isConnected(deviceId: string): Promise { return; } @@ -401,7 +401,7 @@ export class BLE { /** * Report if bluetooth is enabled. * - * @return {Promise} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled. + * @returns {Promise} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled. */ @Cordova() static isEnabled(): Promise { return; } @@ -409,7 +409,7 @@ export class BLE { /** * Open System Bluetooth settings (Android only). * - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static showBluetoothSettings(): Promise { return; } @@ -417,7 +417,7 @@ export class BLE { /** * Enable Bluetooth on the device (Android only). * - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static enable(): Promise { return; } diff --git a/src/plugins/bluetoothserial.ts b/src/plugins/bluetoothserial.ts index 82809e66b..2a0c67d84 100644 --- a/src/plugins/bluetoothserial.ts +++ b/src/plugins/bluetoothserial.ts @@ -39,7 +39,7 @@ export class BluetoothSerial { /** * Connect to a Bluetooth device * @param {string} macAddress_or_uuid Identifier of the remote device - * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. + * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'], @@ -51,7 +51,7 @@ export class BluetoothSerial { /** * Connect insecurely to a Bluetooth device * @param {string} macAddress Identifier of the remote device - * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. + * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. */ @Cordova({ platforms: ['Android'], @@ -63,7 +63,7 @@ export class BluetoothSerial { /** * Writes data to the serial port * @param {any} data ArrayBuffer of data - * @returns {Promise} returns a promise when data has been written + * @returns {Promise} returns a promise when data has been written */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -72,7 +72,7 @@ export class BluetoothSerial { /** * Gets the number of bytes of data available - * @returns {Promise} returns a promise that contains the available bytes + * @returns {Promise} returns a promise that contains the available bytes */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -80,7 +80,7 @@ export class BluetoothSerial { /** * Reads data from the buffer - * @returns {Promise} returns a promise with data from the buffer + * @returns {Promise} returns a promise with data from the buffer */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -90,7 +90,7 @@ export class BluetoothSerial { /** * Reads data from the buffer until it reaches a delimiter * @param {string} delimiter string that you want to search until - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -100,7 +100,7 @@ export class BluetoothSerial { /** * Subscribe to be notified when data is received * @param {string} delimiter the string you want to watch for - * @returns {Observable} returns an observable. + * @returns {Observable} returns an observable. */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'], @@ -111,7 +111,7 @@ export class BluetoothSerial { /** * Subscribe to be notified when data is received - * @returns {Observable} returns an observable + * @returns {Observable} returns an observable */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'], @@ -122,7 +122,7 @@ export class BluetoothSerial { /** * Clears data in buffer - * @returns {Promise} returns a promise when completed + * @returns {Promise} returns a promise when completed */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -131,7 +131,7 @@ export class BluetoothSerial { /** * Lists bonded devices - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -140,7 +140,7 @@ export class BluetoothSerial { /** * Reports if bluetooth is enabled - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -149,7 +149,7 @@ export class BluetoothSerial { /** * Reports the connection status - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -158,7 +158,7 @@ export class BluetoothSerial { /** * Reads the RSSI from the connected peripheral - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -167,7 +167,7 @@ export class BluetoothSerial { /** * Show the Bluetooth settings on the device - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -176,7 +176,7 @@ export class BluetoothSerial { /** * Enable Bluetooth on the device - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -185,7 +185,7 @@ export class BluetoothSerial { /** * Discover unpaired devices - * @returns {Promise} returns a promise + * @returns {Promise} returns a promise */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'] @@ -194,7 +194,7 @@ export class BluetoothSerial { /** * Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function. - * @returns {Observable} Returns an observable + * @returns {Observable} Returns an observable */ @Cordova({ platforms: ['Android', 'iOS', 'Windows Phone'], diff --git a/src/plugins/brightness.ts b/src/plugins/brightness.ts index 8a5d7b228..cc323dc49 100644 --- a/src/plugins/brightness.ts +++ b/src/plugins/brightness.ts @@ -30,7 +30,7 @@ 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. + * @returns {Promise} Returns a Promise that resolves if setting brightness was successful. */ @Cordova() static setBrightness(value: number): Promise { return; } @@ -38,7 +38,7 @@ export class Brightness { /** * Reads the current brightness of the device display. * - * @returns {Promise} Returns a Promise that resolves with the + * @returns {Promise} Returns a Promise that resolves with the * brightness value of the device display (floating number between 0 and 1). */ @Cordova() diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index b389c8cd9..e6461b0eb 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -99,7 +99,7 @@ export class Calendar { * Create a calendar. (iOS only) * * @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 + * @returns {Promise} Returns a Promise */ @Cordova() static createCalendar( @@ -109,7 +109,7 @@ export class Calendar { /** * Delete a calendar. (iOS only) * @param {string} name Name of the calendar to delete. - * @return Returns a Promise + * @returns {Promise} Returns a Promise */ @Cordova() static deleteCalendar(name: string): Promise { return; } @@ -150,7 +150,7 @@ export class Calendar { * @param {string} [notes] The event notes * @param {Date} [startDate] The event start date * @param {Date} [endDate] The event end date - * @return Returns a Promise + * @returns {Promise} Returns a Promise */ @Cordova() static createEvent( @@ -170,7 +170,7 @@ export class Calendar { * @param {Date} [startDate] The event start date * @param {Date} [endDate] The event end date * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` - * @return Returns a Promise + * @returns {Promise} Returns a Promise */ @Cordova() static createEventWithOptions( @@ -190,7 +190,7 @@ export class Calendar { * @param {string} [notes] The event notes * @param {Date} [startDate] The event start date * @param {Date} [endDate] The event end date - * @return Returns a Promise + * @returns {Promise} Returns a Promise */ @Cordova() static createEventInteractively( @@ -210,7 +210,7 @@ export class Calendar { * @param {Date} [startDate] The event start date * @param {Date} [endDate] The event end date * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` - * @return Returns a Promise + * @returns {Promise} */ @Cordova() static createEventInteractivelyWithOptions( @@ -241,7 +241,7 @@ export class Calendar { * @param {string} [notes] The event notes * @param {Date} [startDate] The event start date * @param {Date} [endDate] The event end date - * @return Returns a Promise + * @returns {Promise} */ @Cordova() static findEvent( @@ -260,7 +260,7 @@ export class Calendar { * @param {Date} [startDate] The event start date * @param {Date} [endDate] The event end date * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` - * @return Returns a Promise that resolves with the event, or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the event, or rejects with an error. */ @Cordova() static findEventWithOptions( @@ -277,21 +277,21 @@ export class Calendar { * * @param {Date} [startDate] The start date * @param {Date} [endDate] The end date - * @return Returns a Promise that resolves with the list of events, or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the list of events, or rejects with an error. */ @Cordova() static listEventsInRange(startDate: Date, endDate: Date): Promise { return; } /** * Get a list of all calendars. - * @return A Promise that resolves with the list of calendars, or rejects with an error. + * @returns {Promise} A Promise that resolves with the list of calendars, or rejects with an error. */ @Cordova() static listCalendars(): Promise { return; } /** * Get a list of all future events in the specified calendar. (iOS only) - * @return Returns a Promise that resolves with the list of events, or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the list of events, or rejects with an error. */ @Cordova() static findAllEventsInNamedCalendar(calendarName: string): Promise { return; } diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts index 06367432b..e69c297ad 100644 --- a/src/plugins/call-number.ts +++ b/src/plugins/call-number.ts @@ -27,6 +27,7 @@ export class CallNumber { * Calls a phone number * @param numberToCall {string} The phone number to call as a string * @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer + * @return {Promise} */ @Cordova({ callbackOrder: 'reverse' diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 53171e1ad..14a97e8da 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -111,6 +111,7 @@ export class CameraPreview { /** * Register a callback function that receives the original picture and the image captured from the preview box. + * @returns {Observable} */ @Cordova({ observable: true diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index 2942162fd..eebd97621 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -193,7 +193,7 @@ export class Camera { /** * 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. Optional - * @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error. + * @returns {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error. */ @Cordova({ callbackOrder: 'reverse' @@ -203,7 +203,7 @@ export class Camera { /** * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. * Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI. - * @return Returns a Promise + * @returns {Promise} */ @Cordova({ platforms: ['iOS'] diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index 3e5a2b722..cde1a2ecd 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -36,6 +36,7 @@ export class CardIO { * Check whether card scanning is currently available. (May vary by * device, OS version, network connectivity, etc.) * + * @returns {Promise} */ @Cordova() static canScan(): Promise { return; } @@ -43,12 +44,14 @@ export class CardIO { /** * Scan a credit card with card.io. * @param {CardIOOptions} options Options for configuring the plugin + * @returns {Promise} */ @Cordova() static scan(options?: CardIOOptions): Promise { return; } /** * Retrieve the version of the card.io library. Useful when contacting support. + * @returns {Promise} */ @Cordova() static version(): Promise { return; } diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index 4443e99c0..f4d855d96 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -39,14 +39,14 @@ export class Clipboard { /** * Copies the given text * @param {string} text Text that gets copied on the system clipboard - * @returns {Promise} Returns a promise after the text has been copied + * @returns {Promise} Returns a promise after the text has been copied */ @Cordova() static copy(text: string): Promise { return; } /** * Pastes the text stored in clipboard - * @returns {Promise} Returns a promise after the text has been pasted + * @returns {Promise} Returns a promise after the text has been pasted */ @Cordova() static paste(): Promise { return; } diff --git a/src/plugins/code-push.ts b/src/plugins/code-push.ts index 7990dc9e7..23cf9af34 100644 --- a/src/plugins/code-push.ts +++ b/src/plugins/code-push.ts @@ -433,6 +433,7 @@ export class CodePush { * * @param packageSuccess Callback invoked with the currently deployed package information. * @param packageError Optional callback invoked in case of an error. + * @returns {Promise} */ @Cordova() static getCurrentPackage(): Promise { @@ -442,6 +443,7 @@ export class CodePush { /** * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. + * @returns {Promise} */ @Cordova() static getPendingPackage(): Promise { @@ -456,6 +458,7 @@ export class CodePush { * A null package means the application is up to date for the current native application version. * @param queryError Optional callback invoked in case of an error. * @param deploymentKey Optional deployment key that overrides the config.xml setting. + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' @@ -471,6 +474,7 @@ export class CodePush { * * @param notifySucceeded Optional callback invoked if the plugin was successfully notified. * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin. + * @returns {Promise} */ @Cordova() static notifyApplicationReady(): Promise { @@ -480,6 +484,7 @@ export class CodePush { /** * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application. + * @returns {Promise} */ @Cordova() static restartApplication(): Promise { @@ -504,6 +509,7 @@ export class CodePush { * @param syncCallback Optional callback to be called with the status of the sync operation. * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation. * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. + * @returns {Observable} * */ @Cordova({ diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 8648b032a..c0c28d73d 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -324,7 +324,7 @@ export class ContactFindOptions implements IContactFindOptions { export class Contacts { /** * Create a single contact. - * @return Returns a object Contact + * @returns {Contact} Returns a Contact object */ static create(): Contact { return new Contact(); @@ -342,7 +342,7 @@ export class Contacts { * desiredFields: Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. (DOMString[]) [Optional] * hasPhoneNumber(Android only): Filters the search to only return contacts with a phone number informed. (Boolean) (Default: false) * - * @return Returns a Promise that resolves with the search results (an array of Contact objects) + * @returns {Promise} Returns a Promise that resolves with the search results (an array of Contact objects) */ @Cordova({ successIndex: 1, @@ -352,7 +352,7 @@ export class Contacts { /** * Select a single Contact. - * @return Returns a Promise that resolves with the selected Contact + * @returns {Promise} Returns a Promise that resolves with the selected Contact */ @Cordova() static pickContact(): Promise { return; } diff --git a/src/plugins/crop.ts b/src/plugins/crop.ts index 8d5887111..939f82334 100644 --- a/src/plugins/crop.ts +++ b/src/plugins/crop.ts @@ -26,7 +26,7 @@ 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. + * @returns {Promise} Returns a promise that resolves with the new image path, or rejects if failed to crop. */ @Cordova({ callbackOrder: 'reverse' diff --git a/src/plugins/dbmeter.ts b/src/plugins/dbmeter.ts index ef85709fe..b96a5057c 100644 --- a/src/plugins/dbmeter.ts +++ b/src/plugins/dbmeter.ts @@ -41,7 +41,7 @@ export class DBMeter { /** * Starts listening - * @return {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. + * @returns {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. */ @Cordova({ observable: true, @@ -58,14 +58,14 @@ export class DBMeter { /** * 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 + * @returns {Promise} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening */ @Cordova() 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. + * @returns {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur. */ @Cordova() static delete(): Promise { return; } diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index 09c66712a..e84c18c79 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -75,7 +75,7 @@ export class Deeplinks { * paths takes an object of the form { 'path': data }. If a deeplink * matches the path, the resulting path-data pair will be returned in the * promise result which you can then use to navigate in the app as you see fit. - * @returns {Observable} Returns an Observable that is called each time a deeplink comes through, and + * @returns {Observable} Returns an Observable that is called each time a deeplink comes through, and * errors if a deeplink comes through that does not match a given path. */ @Cordova({ @@ -98,7 +98,7 @@ export class Deeplinks { * matches the path, the resulting path-data pair will be returned in the * promise result which you can then use to navigate in the app as you see fit. * - * @returns {Observable} Returns an Observable that resolves each time a deeplink comes through, and + * @returns {Observable} */ @Cordova() static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; } diff --git a/src/plugins/device.ts b/src/plugins/device.ts index 49a0beb0a..d3b908174 100644 --- a/src/plugins/device.ts +++ b/src/plugins/device.ts @@ -51,9 +51,9 @@ export class Device { /** * Returns the whole device object. * - * @returns {Object} The device object. + * @returns {Device} The device object. */ @CordovaProperty - static get device() { return window.device; } + static get device(): Device { return window.device; } } diff --git a/src/plugins/deviceaccounts.ts b/src/plugins/deviceaccounts.ts index 90a413676..8ea888098 100644 --- a/src/plugins/deviceaccounts.ts +++ b/src/plugins/deviceaccounts.ts @@ -12,24 +12,28 @@ export class DeviceAccounts { /** * Gets all accounts registered on the Android Device + * @returns {Promise} */ @Cordova() static get(): Promise { return; } /** * Get all accounts registered on Android device for requested type + * @returns {Promise} */ @Cordova() static getByType(type: string): Promise { return; } /** * Get all emails registered on Android device (accounts with 'com.google' type) + * @returns {Promise} */ @Cordova() static getEmails(): Promise { return; } /** * Get the first email registered on Android device + * @returns {Promise} */ @Cordova() static getEmail(): Promise { return; } diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 27dddabd6..486aa28dd 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -71,7 +71,7 @@ export class DeviceMotion { /** * Get the current acceleration along the x, y, and z axes. - * @returns {Promise} Returns object with x, y, z, and timestamp properties + * @returns {Promise} Returns object with x, y, z, and timestamp properties */ @Cordova() static getCurrentAcceleration(): Promise { return; } diff --git a/src/plugins/diagnostic.ts b/src/plugins/diagnostic.ts index dc5c11fa2..a1080743c 100644 --- a/src/plugins/diagnostic.ts +++ b/src/plugins/diagnostic.ts @@ -174,6 +174,7 @@ export class Diagnostic { * Enables/disables WiFi on the device. * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android * @param state {boolean} + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) static setWifiState(state: boolean): Promise { return; } @@ -182,6 +183,7 @@ export class Diagnostic { * Enables/disables Bluetooth on the device. * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android * @param state {boolean} + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) static setBluetoothState(state: boolean): Promise { return; } @@ -297,7 +299,7 @@ export class Diagnostic { * * Notes for iOS: * - This relates to Calendar Events (not Calendar Reminders) - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['Android', 'iOS'] }) static isCalendarAuthorized(): Promise { return; } @@ -366,7 +368,7 @@ export class Diagnostic { /** * Checks if high-accuracy locations are available to the app from GPS hardware. * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) static isGpsLocationAvailable(): Promise { return; } @@ -376,6 +378,7 @@ export class Diagnostic { * Returns true if Location mode is enabled and is set to either: * - Device only = GPS hardware only (high accuracy) * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) + * @returns {Promise} */ @Cordova({ platforms: ['Android'] }) static isGpsLocationEnabled(): Promise { return; } @@ -446,7 +449,7 @@ export class Diagnostic { * Note that only one request can be made concurrently because the native API cannot handle concurrent requests, * so the plugin will invoke the error callback if attempting to make more than one simultaneous request. * Multiple permission requests should be grouped into a single call since the native API is setup to handle batch requests of multiple permission groups. - * @return {boolean} + * @returns {boolean} */ @Cordova({ sync: true }) static isRequestingPermission(): boolean { return; } diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index 781b93b1a..512fafdf2 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -56,7 +56,7 @@ export class EmailComposer { * Verifies if sending emails is supported on the device. * * @param app {string?} An optional app id or uri scheme. - * @returns {Promise} Resolves if available, rejects if not available + * @returns {Promise} Resolves if available, rejects if not available */ static isAvailable(app?: string): Promise { return new Promise((resolve, reject) => { diff --git a/src/plugins/estimote-beacons.ts b/src/plugins/estimote-beacons.ts index 567b6a083..731b1d0d4 100644 --- a/src/plugins/estimote-beacons.ts +++ b/src/plugins/estimote-beacons.ts @@ -88,7 +88,7 @@ export class EstimoteBeacons { * ``` * * @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. + * @returns {Promise} */ @Cordova() static requestWhenInUseAuthorization(): Promise { return; } @@ -109,7 +109,7 @@ export class EstimoteBeacons { * ``` * * @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. + * @returns {Promise} */ @Cordova() static requestAlwaysAuthorization(): Promise { return; } @@ -128,7 +128,7 @@ export class EstimoteBeacons { * ``` * * @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. + * @returns {Promise} */ @Cordova() static authorizationStatus(): Promise { return; } @@ -148,7 +148,7 @@ export class EstimoteBeacons { * @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. + * @returns {Promise} */ @Cordova({ clearFunction: 'stopAdvertisingAsBeacon' @@ -166,7 +166,7 @@ export class EstimoteBeacons { * EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); }); * }, 5000); * ``` - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static stopAdvertisingAsBeacon(): Promise { return; } @@ -181,7 +181,7 @@ export class EstimoteBeacons { * EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); }); * ``` * @param enable {number} Boolean value to turn analytics on or off (mandatory). - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static enableAnalytics(enable: boolean): Promise { return; } @@ -195,7 +195,7 @@ export class EstimoteBeacons { * ``` * EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); }); * ``` - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static isAnalyticsEnabled(): Promise { return; } @@ -209,7 +209,7 @@ export class EstimoteBeacons { * ``` * EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); }); * ``` - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static isAuthorized(): Promise { return; } @@ -225,7 +225,7 @@ export class EstimoteBeacons { * ``` * @param appID {string} The App ID (mandatory). * @param appToken {string} The App Token (mandatory). - * @return Returns a Promise. + * @returns {Promise} */ @Cordova() static setupAppIDAndAppToken(appID: string, appToken: string): Promise { return; } @@ -243,7 +243,7 @@ export class EstimoteBeacons { * EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); }); * }, 5000); * ``` - * @return Returns an Observable that notifies of each beacon discovered. + * @returns {Observable} Returns an Observable that notifies of each beacon discovered. */ @Cordova({ observable: true, @@ -263,7 +263,7 @@ export class EstimoteBeacons { * EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); }); * }, 5000); * ``` - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static stopEstimoteBeaconDiscovery(): Promise { return; } @@ -282,7 +282,7 @@ export class EstimoteBeacons { * }, 5000); * ``` * @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory). - * @return Returns an Observable that notifies of each beacon discovered. + * @returns {Observable} Returns an Observable that notifies of each beacon discovered. */ @Cordova({ observable: true, @@ -305,7 +305,7 @@ export class EstimoteBeacons { * }, 5000); * ``` * @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory). - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise { return; } @@ -316,6 +316,7 @@ export class EstimoteBeacons { * {@link EstimoteBeacons.startRangingBeaconsInRegion}. * To use secure beacons set the App ID and App Token using * {@link EstimoteBeacons.setupAppIDAndAppToken}. + * @returns {Observable} */ @Cordova({ observable: true, @@ -328,6 +329,7 @@ export class EstimoteBeacons { * Stop ranging secure beacons. Available on iOS. * This function has the same parameters/behaviour as * {@link EstimoteBeacons.stopRangingBeaconsInRegion}. + * @returns {Promise} */ @Cordova() static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise { return; } @@ -347,7 +349,7 @@ export class EstimoteBeacons { * 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. + * @returns {Observable} Returns an Observable that notifies of each region state discovered. */ @Cordova({ observable: true, @@ -367,7 +369,7 @@ export class EstimoteBeacons { * EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); }); * ``` * @param region {EstimoteBeaconRegion} Dictionary with region properties (mandatory). - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise { return; } @@ -381,6 +383,7 @@ export class EstimoteBeacons { * @see {@link EstimoteBeacons.startMonitoringForRegion} * @param region {EstimoteBeaconRegion} Region * @param notifyEntryStateOnDisplay {boolean} + * @returns {Observable} */ @Cordova({ observable: true, @@ -396,7 +399,8 @@ export class EstimoteBeacons { * Stop monitoring secure beacons. Available on iOS. * This function has the same parameters/behaviour as * {@link EstimoteBeacons.stopMonitoringForRegion}. - * @param region {EstimoteBeaconRegion} Region + * @param region {EstimoteBeaconRegion} Region + * @returns {Promise} */ @Cordova() static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise { return; } @@ -416,7 +420,7 @@ export class EstimoteBeacons { * }); * ``` * @param beacon {Beacon} Beacon to connect to. - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static connectToBeacon(beacon: any): Promise { return; } @@ -428,7 +432,7 @@ export class EstimoteBeacons { * ``` * EstimoteBeacons.disconnectConnectedBeacon(); * ``` - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static disconnectConnectedBeacon(): Promise { return; } @@ -442,7 +446,7 @@ export class EstimoteBeacons { * EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID); * * @param uuid {string} String to write as new UUID - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static writeConnectedProximityUUID(uuid: any): Promise { return; } @@ -456,7 +460,7 @@ export class EstimoteBeacons { * EstimoteBeacons.writeConnectedMajor(1); * * @param major {number} number to write as new major - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static writeConnectedMajor(major: number): Promise { return; } @@ -470,7 +474,7 @@ export class EstimoteBeacons { * EstimoteBeacons.writeConnectedMinor(1); * * @param minor {number} number to write as new minor - * @return returns a Promise. + * @returns {Promise} */ @Cordova() static writeConnectedMinor(minor: number): Promise { return; } diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index a241b2d7d..2bf1699d9 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -90,6 +90,7 @@ export class Facebook { * Browser wrapper * @param {number} appId Your Facebook AppID from their dashboard * @param {string} version The version of API you may want to use. Optional + * @returns {Promise} */ @Cordova() static browserInit(appId: number, version?: string): Promise { @@ -114,7 +115,7 @@ export class Facebook { * ``` * * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in. - * @return {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. + * @returns {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; } @@ -123,7 +124,7 @@ export class Facebook { * Logout of Facebook. * * For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout) - * @return Returns a Promise that resolves on a successful logout, and rejects if logout fails. + * @returns {Promise} Returns a Promise that resolves on a successful logout, and rejects if logout fails. */ @Cordova() static logout(): Promise { return; } @@ -152,7 +153,7 @@ export class Facebook { * * For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus) * - * @return Returns a Promise that resolves with a status, or rejects with an error + * @returns {Promise} Returns a Promise that resolves with a status, or rejects with an error */ @Cordova() static getLoginStatus(): Promise { return; } @@ -160,7 +161,7 @@ export class Facebook { /** * Get a Facebook access token for using Facebook services. * - * @return Returns a Promise that resolves with an access token, or rejects with an error + * @returns {Promise} Returns a Promise that resolves with an access token, or rejects with an error */ @Cordova() static getAccessToken(): Promise { return; } @@ -179,8 +180,8 @@ export class Facebook { * ``` * * For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui) - * @options {Object} options The dialog options - * @return Returns a Promise that resolves with success data, or rejects with an error + * @param {Object} options The dialog options + * @returns {Promise} Returns a Promise that resolves with success data, or rejects with an error */ @Cordova() static showDialog(options: any): Promise { return; } @@ -196,7 +197,7 @@ export class Facebook { * * @param {string} requestPath Graph API endpoint you want to call * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request. - * @return Returns a Promise that resolves with the result of the request, or rejects with an error + * @returns {Promise} Returns a Promise that resolves with the result of the request, or rejects with an error */ @Cordova() static api(requestPath: string, permissions: string[]): Promise { return; } @@ -207,7 +208,7 @@ export class Facebook { * @param {string} name Name of the event * @param {Object} [params] An object containing extra data to log with the event * @param {number} [valueToSum] any value to be added to added to a sum on each event - * @return + * @returns {Promise} */ @Cordova() static logEvent( @@ -221,7 +222,7 @@ export class Facebook { * * @param {number} value Value of the purchase. * @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217) - * @return Returns a Promise + * @returns {Promise} */ @Cordova() static logPurchase(value: number, currency: string): Promise { return; } @@ -239,7 +240,7 @@ export class Facebook { * url: [App Link](https://developers.facebook.com/docs/applinks) to your app * picture: image to be displayed in the App Invite dialog * - * @return Returns a Promise that resolves with the result data, or rejects with an error + * @returns {Promise} Returns a Promise that resolves with the result data, or rejects with an error */ @Cordova() static appInvite(options: { diff --git a/src/plugins/file-chooser.ts b/src/plugins/file-chooser.ts index 16ea5ab87..c4dbefede 100644 --- a/src/plugins/file-chooser.ts +++ b/src/plugins/file-chooser.ts @@ -25,6 +25,7 @@ import { Plugin, Cordova } from './plugin'; export class FileChooser { /** * Open a file + * @returns {Promise} */ @Cordova() static open(): Promise { return; } diff --git a/src/plugins/file-opener.ts b/src/plugins/file-opener.ts index 4a113c049..9682ad203 100644 --- a/src/plugins/file-opener.ts +++ b/src/plugins/file-opener.ts @@ -23,6 +23,7 @@ export class FileOpener { * Open an file * @param filePath {string} File Path * @param fileMIMEType {string} File MIME Type + * @returns {Promise} */ @Cordova({ callbackStyle: 'object', @@ -34,6 +35,7 @@ export class FileOpener { /** * Uninstalls a package * @param packageId {string} Package ID + * @returns {Promise} */ @Cordova({ callbackStyle: 'object', @@ -45,6 +47,7 @@ export class FileOpener { /** * Check if an app is already installed * @param packageId {string} Package ID + * @returns {Promise} */ @Cordova({ callbackStyle: 'object', diff --git a/src/plugins/file.ts b/src/plugins/file.ts index f11350ac0..b4215294d 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -407,7 +407,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dir Name of directory to check - * @return {Promise} Returns a Promise that resolves to true if the directory exists or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to true if the directory exists or rejects with an error. */ static checkDir(path: string, dir: string): Promise { if ((/^\//.test(dir))) { @@ -431,7 +431,7 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dirName Name of directory to create * @param {boolean} replace If true, replaces file with same name. If false returns error - * @return {Promise} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. */ static createDir(path: string, dirName: string, replace: boolean): Promise { if ((/^\//.test(dirName))) { @@ -459,7 +459,7 @@ export class File { * * @param {string} path The path to the directory * @param {string} dirName The directory name - * @return {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ static removeDir(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { @@ -484,7 +484,7 @@ export class File { * @param {string} dirName The source directory name * @param {string} newPath The destionation path to the directory * @param {string} newDirName The destination directory name - * @return {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error. */ static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { newDirName = newDirName || dirName; @@ -514,7 +514,7 @@ export class File { * @param {string} dirName Name of directory to copy * @param {string} newPath Base FileSystem of new location * @param {string} newDirName New name of directory to copy to (leave blank to remain the same) - * @return {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. */ static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { if ((/^\//.test(newDirName))) { @@ -540,7 +540,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dirName Name of directory - * @return {Promise} Returns a Promise that resolves to an array of Entry objects or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to an array of Entry objects or rejects with an error. */ static listDir(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { @@ -564,7 +564,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} dirName Name of directory - * @return {Promise} Returns a Promise that resolves with a RemoveResult or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with a RemoveResult or rejects with an error. */ static removeRecursively(path: string, dirName: string): Promise { if ((/^\//.test(dirName))) { @@ -587,7 +587,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} file Name of file to check - * @return {Promise} Returns a Promise that resolves with a boolean or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with a boolean or rejects with an error. */ static checkFile(path: string, file: string): Promise { if ((/^\//.test(file))) { @@ -616,7 +616,7 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName Name of file to create * @param {boolean} replace If true, replaces file with same name. If false returns error - * @return {Promise} Returns a Promise that resolves to a FileEntry or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to a FileEntry or rejects with an error. */ static createFile(path: string, fileName: string, replace: boolean): Promise { if ((/^\//.test(fileName))) { @@ -644,7 +644,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} fileName Name of file to remove - * @return {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. */ static removeFile(path: string, fileName: string): Promise { if ((/^\//.test(fileName))) { @@ -668,7 +668,7 @@ export class File { * @param {string} fileName path relative to base path * @param {string | Blob} text content or blob to write * @param {WriteOptions} options replace file if set to true. See WriteOptions for more information. - * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. */ static writeFile(path: string, fileName: string, text: string | Blob, options: WriteOptions = {}): Promise { @@ -733,7 +733,7 @@ export class File { * * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} file Name of file, relative to path. - * @return {Promise} Returns a Promise that resolves with the contents of the file as string or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the contents of the file as string or rejects with an error. */ static readAsText(path: string, file: string): Promise { if ((/^\//.test(file))) { @@ -774,7 +774,7 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} file Name of file, relative to path. - * @return {Promise} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error. */ static readAsDataURL(path: string, file: string): Promise { if ((/^\//.test(file))) { @@ -816,7 +816,7 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} file Name of file, relative to path. - * @return {Promise} Returns a Promise that resolves with the contents of the file as string rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the contents of the file as string rejects with an error. */ static readAsBinaryString(path: string, file: string): Promise { if ((/^\//.test(file))) { @@ -857,7 +857,7 @@ export class File { * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above * @param {string} file Name of file, relative to path. - * @return {Promise} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error. */ static readAsArrayBuffer(path: string, file: string): Promise { if ((/^\//.test(file))) { @@ -900,7 +900,7 @@ export class File { * @param {string} fileName Name of file to move * @param {string} newPath Base FileSystem of new location * @param {string} newFileName New name of file to move to (leave blank to remain the same) - * @return {Promise} Returns a Promise that resolves to the new Entry or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to the new Entry or rejects with an error. */ static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { newFileName = newFileName || fileName; @@ -930,7 +930,7 @@ export class File { * @param {string} fileName Name of file to copy * @param {string} newPath Base FileSystem of new location * @param {string} newFileName New name of file to copy to (leave blank to remain the same) - * @return {Promise} Returns a Promise that resolves to an Entry or rejects with an error. + * @returns {Promise} Returns a Promise that resolves to an Entry or rejects with an error. */ static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { newFileName = newFileName || fileName; diff --git a/src/plugins/filepath.ts b/src/plugins/filepath.ts index 129c770f6..09e1a8558 100644 --- a/src/plugins/filepath.ts +++ b/src/plugins/filepath.ts @@ -29,6 +29,7 @@ export class FilePath { /** * Resolve native path for given content URL/path. * @param {String} path Content URL/path. + * @returns {Promise} */ @Cordova() static resolveNativePath(path: string): Promise {return; } diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 6b397a4c0..208b6c8a6 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -211,7 +211,7 @@ export class Transfer { * @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. - * @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError. + * @returns {Promise} Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError. */ @CordovaInstance({ successIndex: 2, @@ -228,7 +228,7 @@ export class Transfer { * @param {stirng} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device. * @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. * @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc). - * @return Returns a Promise that resolves to a FileEntry object. + * @returns {Promise} Returns a Promise that resolves to a FileEntry object. */ @CordovaInstance({ successIndex: 2, diff --git a/src/plugins/geofence.ts b/src/plugins/geofence.ts index b9727829d..d7609fdda 100644 --- a/src/plugins/geofence.ts +++ b/src/plugins/geofence.ts @@ -94,7 +94,7 @@ export class Geofence { /** * Initializes the plugin. User will be prompted to allow the app to use location and notifications. * - * @return {Promise} + * @returns {Promise} */ @Cordova() static initialize(): Promise { return; }; @@ -102,7 +102,7 @@ export class Geofence { /** * Adds a new geofence or array of geofences. For geofence object, see above. * - * @return {Promise} + * @returns {Promise} */ @Cordova() static addOrUpdate(geofences: Object | Array): Promise { return; }; @@ -111,7 +111,7 @@ export class Geofence { * Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the * geofence was created. * - * @return {Promise} + * @returns {Promise} */ @Cordova() static remove(geofenceId: string | Array): Promise { return; }; @@ -119,7 +119,7 @@ export class Geofence { /** * Removes all geofences. * - * @return {Promise} + * @returns {Promise} */ @Cordova() static removeAll(): Promise { return; }; @@ -127,7 +127,7 @@ export class Geofence { /** * Returns an array of geofences currently being monitored. * - * @return {Promise>} + * @returns {Promise>} */ @Cordova() static getWatched(): Promise { return; }; @@ -135,7 +135,7 @@ export class Geofence { /** * Called when a geofence is crossed in the direction specified by `TransitType`. * - * @return {Promise} + * @returns {Observable} */ static onTransitionReceived(): Observable { @@ -149,7 +149,7 @@ export class Geofence { /** * Called when the user clicks a geofence notification. iOS and Android only. * - * @return {Promise} + * @returns {Observable} */ static onNotificationClicked(): Observable { diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 3c0794d65..3bd9bab58 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -149,7 +149,7 @@ export class Geolocation { * Get the device's current position. * * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). - * @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error. */ @Cordova({ callbackOrder: 'reverse' @@ -172,9 +172,9 @@ export class Geolocation { * ``` * * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). - * @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors. + * @returns {Observable} Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors. */ - static watchPosition(options?: GeolocationOptions): Observable { + static watchPosition(options?: GeolocationOptions): Observable { return new Observable( (observer: any) => { let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options); diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index 172ba6c67..fc52cad8c 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -20,14 +20,14 @@ export class Globalization { /** * Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value. - * @return {Promise<{value: string}>} + * @returns {Promise<{value: string}>} */ @Cordova() 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}>} + * @returns {Promise<{value: string}>} */ @Cordova() static getLocaleName(): Promise<{ value: string }> { return; } @@ -36,7 +36,7 @@ export class Globalization { * Converts date to string * @param {Date} date Date you wish to convert * @param options Options for the converted date. Length, selector. - * @return {Promise<{value: string}>} Returns a promise when the date has been converted. + * @returns {Promise<{value: string}>} Returns a promise when the date has been converted. */ @Cordova({ successIndex: 1, @@ -48,7 +48,7 @@ export class Globalization { * Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object. * @param {string} dateString Date as a string to be converted * @param options Options for the converted date. Length, selector. - * @return {Promise<{value: string}>} Returns a promise when the date has been converted. + * @returns {Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }>} Returns a promise when the date has been converted. */ @Cordova({ successIndex: 1, @@ -59,7 +59,7 @@ export class Globalization { /** * Returns a pattern string to format and parse dates according to the client's user preferences. * @param options Object with the format length and selector - * @return {Promise<{value: string}>} Returns a promise. + * @returns {Promise<{pattern: string}>} Returns a promise. */ @Cordova({ callbackOrder: 'reverse' @@ -69,7 +69,7 @@ export class Globalization { /** * Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar. * @param options Object with type (narrow or wide) and item (month or days). - * @return {Promise<{value: string}>} Returns a promise. + * @returns {Promise<{value: Array}>} Returns a promise. */ @Cordova({ callbackOrder: 'reverse' @@ -79,14 +79,14 @@ export class Globalization { /** * Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar. * @param {data} date Date to process - * @returns {Promise} reutrns a promise with the value + * @returns {Promise<{dst: string}>} reutrns a promise with the value */ @Cordova() static isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; } /** * Returns the first day of the week according to the client's user preferences and calendar. - * @returns {Promise} reutrns a promise with the value + * @returns {Promise<{value: string}>} returns a promise with the value */ @Cordova() static getFirstDayOfWeek(): Promise<{ value: string }> { return; } @@ -94,6 +94,7 @@ export class Globalization { /** * Returns a number formatted as a string according to the client's user preferences. * @param options + * @returns {Promise<{value: string}>} */ @Cordova({ successIndex: 1, @@ -105,7 +106,7 @@ export class Globalization { * * @param {string} stringToConvert String you want to conver to a number * @param options The type of number you want to return. Can be decimal, percent, or currency. - * @returns {Promise} Returns a promise with the value. + * @returns {Promise<{ value: number | string }>} Returns a promise with the value. */ @Cordova({ successIndex: 1, @@ -116,7 +117,7 @@ export class Globalization { /** * Returns a pattern string to format and parse numbers according to the client's user preferences. * @param options Can be decimal, percent, or currency. - * @returns {Promise} returns a promise with the value. + * @returns {Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }>} */ @Cordova({ callbackOrder: 'reverse' @@ -126,7 +127,7 @@ export class Globalization { /** * Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code. * @param {string} currencyCode Currency Code.A - * @returns {Promise} returns a promise with the value + * @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>} */ @Cordova() static getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; } diff --git a/src/plugins/google-plus.ts b/src/plugins/google-plus.ts index 633828c8c..1a4d75db9 100644 --- a/src/plugins/google-plus.ts +++ b/src/plugins/google-plus.ts @@ -24,6 +24,7 @@ export class GooglePlus { /** * The login function walks the user through the Google Auth process. * @param options + * @returns {Promise} */ @Cordova() static login(options?: any): Promise { return; } @@ -31,18 +32,21 @@ export class GooglePlus { /** * 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 + * @returns {Promise} */ @Cordova() static trySilentLogin(options?: any): Promise { return; } /** * This will clear the OAuth2 token. + * @returns {Promise} */ @Cordova() 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. + * @returns {Promise} */ @Cordova() static disconnect(): Promise { return; } diff --git a/src/plugins/googleanalytics.ts b/src/plugins/googleanalytics.ts index 0bc0821bc..8461b4bbb 100644 --- a/src/plugins/googleanalytics.ts +++ b/src/plugins/googleanalytics.ts @@ -25,7 +25,7 @@ export class GoogleAnalytics { * https://developers.google.com/analytics/devguides/collection/analyticsjs/ * @param {string} id Your Google Analytics Mobile App property * @param {number} interval Optional dispatch period in seconds. Defaults to 30. - * @return {Promise} + * @returns {Promise} */ @Cordova() static startTrackerWithId(id: string, interval?: number): Promise { return; } @@ -33,7 +33,7 @@ export class GoogleAnalytics { /** * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more * @param allow {boolean} - * @return {Promise} + * @returns {Promise} */ @Cordova() static setAllowIDFACollection(allow: boolean): Promise { return; } @@ -42,7 +42,7 @@ export class GoogleAnalytics { * Set a UserId * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id * @param {string} id User ID - * @return {Promise} + * @returns {Promise} */ @Cordova() static setUserId(id: string): Promise { return; } @@ -50,7 +50,7 @@ export class GoogleAnalytics { /** * Set a anonymize Ip address * @param anonymize {boolean} Set to true to anonymize the IP Address - * @return {Promise} + * @returns {Promise} */ @Cordova() static setAnonymizeIp(anonymize: boolean): Promise { return; } @@ -58,7 +58,7 @@ export class GoogleAnalytics { /** * Sets the app version * @param appVersion {string} App version - * @return {Promise} + * @returns {Promise} */ @Cordova() static setAppVersion(appVersion: string): Promise { return; } @@ -66,14 +66,14 @@ export class GoogleAnalytics { /** * Set OptOut * @param optout {boolean} - * @return {Promise} + * @returns {Promise} */ @Cordova() static setOptOut(optout: boolean): Promise { return; } /** * Enable verbose logging - * @return {Promise} + * @returns {Promise} */ @Cordova() static debugMode(): Promise { return; } @@ -82,7 +82,7 @@ export class GoogleAnalytics { * Track custom metric * @param key {string} * @param value {any} - * @return {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 2, @@ -97,7 +97,7 @@ export class GoogleAnalytics { * @param title {string} Screen title * @param campaignUrl {string} Campaign url for measuring referrals * @param newSession {boolean} Set to true to create a new session - * @return {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 3, @@ -110,7 +110,7 @@ export class GoogleAnalytics { * https://developers.google.com/analytics/devguides/platform/customdimsmets * @param key {string} * @param value {string} - * @return {Promise} + * @returns {Promise} */ @Cordova() static addCustomDimension(key: number, value: string): Promise { return; } @@ -123,7 +123,7 @@ export class GoogleAnalytics { * @param label {string} * @param value {number} * @param newSession {boolean} Set to true to create a new session - * @return {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 5, @@ -135,7 +135,7 @@ export class GoogleAnalytics { * Track an exception * @param description {string} * @param fatal {boolean} - * @return {Promise} + * @returns {Promise} */ @Cordova() static trackException(description: string, fatal: boolean): Promise { return; } @@ -146,7 +146,7 @@ export class GoogleAnalytics { * @param intervalInMilliseconds {number} * @param variable {string} * @param label {string} - * @return {Promise} + * @returns {Promise} */ @Cordova() static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { return; } @@ -160,7 +160,7 @@ export class GoogleAnalytics { * @param tax {number} * @param shipping {number} * @param currencyCode {string} - * @return {Promise} + * @returns {Promise} */ @Cordova() static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise { return; } @@ -175,7 +175,7 @@ export class GoogleAnalytics { * @param {number} price * @param {number} quantity * @param {string} currencyCode - * @return {Promise} + * @returns {Promise} */ @Cordova() static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise { return; } @@ -183,7 +183,7 @@ export class GoogleAnalytics { /** * Enable/disable automatic reporting of uncaught exceptions * @param shouldEnable {boolean} - * @return {Promise} + * @returns {Promise} */ @Cordova() static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { return; } diff --git a/src/plugins/googlemap.ts b/src/plugins/googlemap.ts index 775a10f3f..d7058a2b9 100644 --- a/src/plugins/googlemap.ts +++ b/src/plugins/googlemap.ts @@ -113,7 +113,7 @@ export class GoogleMap { /** * Checks if a map object has been created and is available. * - * @return {Promise} + * @returns {Promise} */ @Cordova() static isAvailable(): Promise { return; } @@ -135,7 +135,7 @@ export class GoogleMap { /** * Listen to a map event. * - * @return {Observable} + * @returns {Observable} */ on(event: any): Observable { if (!this._objectInstance) { @@ -155,7 +155,7 @@ export class GoogleMap { /** * Listen to a map event only once. * - * @return {Promise} + * @returns {Promise} */ one(event: any): Promise { if (!this._objectInstance) { @@ -175,7 +175,7 @@ export class GoogleMap { /** * Get the position of the camera. * - * @return {Promise} + * @returns {Promise} */ @CordovaInstance() getCameraPosition(): Promise { return; } @@ -183,7 +183,7 @@ export class GoogleMap { /** * Get the location of the user. * - * @return {Promise} + * @returns {Promise} */ @CordovaInstance() getMyLocation(options?: MyLocationOptions): Promise { return; } @@ -191,7 +191,7 @@ export class GoogleMap { /** * Get the visible region. * - * @return {Promise} + * @returns {Promise} */ @CordovaInstance() getVisibleRegion(): Promise { return; } @@ -217,9 +217,15 @@ export class GoogleMap { @CordovaInstance({ sync: true }) setTilt(tiltLevel: number): void { } + /** + * @returns {Promise} + */ @CordovaInstance() animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } + /** + * @returns {Promise} + */ @CordovaInstance() moveCamera(cameraPosition: CameraPosition): Promise { return; } @@ -238,6 +244,9 @@ export class GoogleMap { @CordovaInstance({ sync: true }) setAllGesturesEnabled(enabled: boolean): void { } + /** + * @returns {Promise} + */ addMarker(options: GoogleMapsMarkerOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -255,6 +264,9 @@ export class GoogleMap { ); } + /** + * @returns {Promise} + */ addCircle(options: GoogleMapsCircleOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -272,6 +284,9 @@ export class GoogleMap { ); } + /** + * @returns {Promise} + */ addPolygon(options: GoogleMapsPolygonOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -289,6 +304,9 @@ export class GoogleMap { ); } + /** + * @returns {Promise} + */ addPolyline(options: GoogleMapsPolylineOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -306,6 +324,9 @@ export class GoogleMap { ); } + /** + * @returns {Promise} + */ addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -323,6 +344,9 @@ export class GoogleMap { ); } + /** + * @returns {Promise} + */ addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -340,6 +364,9 @@ export class GoogleMap { ); } + /** + * @returns {Promise} + */ addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise { if (!this._objectInstance) { return Promise.reject({ error: 'plugin_not_installed' }); @@ -378,12 +405,21 @@ export class GoogleMap { @CordovaInstance({ sync: true }) refreshLayout(): void { } + /** + * @returns {Promise} + */ @CordovaInstance() fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise { return; } + /** + * @returns {Promise} + */ @CordovaInstance() fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise { return; } + /** + * @returns {Promise} + */ @CordovaInstance() toDataURL(): Promise { return; } diff --git a/src/plugins/hotspot.ts b/src/plugins/hotspot.ts index f8d9a5511..8e26fa510 100644 --- a/src/plugins/hotspot.ts +++ b/src/plugins/hotspot.ts @@ -23,9 +23,15 @@ import { Cordova, Plugin } from './plugin'; }) export class Hotspot { + /** + * @returns {Promise} + */ @Cordova() static isAvailable(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static toggleWifi(): Promise { return; } @@ -36,7 +42,7 @@ export class Hotspot { * @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK) * @param {string} password - password for your new Access Point * - * @return {Promise} - Promise to call once hotspot is started, or reject upon failure + * @returns {Promise} - Promise to call once hotspot is started, or reject upon failure */ @Cordova() static createHotspot(ssid: string, mode: string, password: string): Promise { return; } @@ -44,7 +50,7 @@ export class Hotspot { /** * Turns on Access Point * - * @return {Promise} - true if AP is started + * @returns {Promise} - true if AP is started */ @Cordova() static startHotspot(): Promise { return; } @@ -56,7 +62,7 @@ export class Hotspot { * @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK) * @param {string} password - password for your new Access Point * - * @return {Promise} - Promise to call when hotspot is configured, or reject upon failure + * @returns {Promise} - Promise to call when hotspot is configured, or reject upon failure */ @Cordova() static configureHotspot(ssid: string, mode: string, password: string): Promise { return; } @@ -64,7 +70,7 @@ export class Hotspot { /** * Turns off Access Point * - * @return {Promise} - Promise to turn off the hotspot, true on success, false on failure + * @returns {Promise} - Promise to turn off the hotspot, true on success, false on failure */ @Cordova() static stopHotspot(): Promise { return; } @@ -72,11 +78,14 @@ export class Hotspot { /** * Checks if hotspot is enabled * - * @return {Promise} - Promise that hotspot is enabled, rejected if it is not enabled + * @returns {Promise} - Promise that hotspot is enabled, rejected if it is not enabled */ @Cordova() static isHotspotEnabled(): Promise { return; } + /** + * @returns {Promise>} + */ @Cordova() static getAllHotspotDevices(): Promise> { return; } @@ -88,7 +97,7 @@ export class Hotspot { * @param {string} password * password to use * - * @return {Promise} + * @returns {Promise} * Promise that connection to the WiFi network was successfull, rejected if unsuccessful */ @Cordova() @@ -106,7 +115,7 @@ export class Hotspot { * @param {string[]} encryption * Encryption modes to use (CCMP, TKIP, WEP104, WEP40) * - * @return {Promise} + * @returns {Promise} * Promise that connection to the WiFi network was successfull, rejected if unsuccessful */ @Cordova() @@ -122,7 +131,7 @@ export class Hotspot { * @param {string} password * Password for network * - * @return {Promise} + * @returns {Promise} * Promise that adding the WiFi network was successfull, rejected if unsuccessful */ @Cordova() @@ -134,45 +143,81 @@ export class Hotspot { * @param {string} ssid * SSID of network * - * @return {Promise} + * @returns {Promise} * Promise that removing the WiFi network was successfull, rejected if unsuccessful */ @Cordova() static removeWifiNetwork(ssid: string): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static isConnectedToInternet(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static isConnectedToInternetViaWifi(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static isWifiOn(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static isWifiSupported(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static isWifiDirectSupported(): Promise { return; } + /** + * @returns {Promise>} + */ @Cordova() static scanWifi(): Promise> { return; } + /** + * @returns {Promise>} + */ @Cordova() static scanWifiByLevel(): Promise> { return; } + /** + * @returns {Promise} + */ @Cordova() static startWifiPeriodicallyScan(interval: number, duration: number): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static stopWifiPeriodicallyScan(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static getNetConfig(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static getConnectionInfo(): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static pingHost(ip: string): Promise { return; } @@ -181,7 +226,7 @@ export class Hotspot { * * @param {string} ip - IP Address that you want the MAC Address of * - * @return {Promise} - A Promise for the MAC Address + * @returns {Promise} - A Promise for the MAC Address */ @Cordova() static getMacAddressOfHost(ip: string): Promise { return; } @@ -191,7 +236,7 @@ export class Hotspot { * * @param {string} ip - IP Address you want to test * - * @return {Promise} - A Promise for whether the IP Address is reachable + * @returns {Promise} - A Promise for whether the IP Address is reachable */ @Cordova() static isDnsLive(ip: string): Promise { return; } @@ -201,7 +246,7 @@ export class Hotspot { * * @param {string} ip - IP Address you want to test * - * @return {Promise} - A Promise for whether the IP Address is reachable + * @returns {Promise} - A Promise for whether the IP Address is reachable */ @Cordova() static isPortLive(ip: string): Promise { return; } @@ -209,7 +254,7 @@ export class Hotspot { /** * Checks if device is rooted * - * @return {Promise} - A Promise for whether the device is rooted + * @returns {Promise} - A Promise for whether the device is rooted */ @Cordova() static isRooted(): Promise { return; } diff --git a/src/plugins/http.ts b/src/plugins/http.ts index 6ab4af479..e6d0e6d95 100644 --- a/src/plugins/http.ts +++ b/src/plugins/http.ts @@ -45,7 +45,7 @@ export class HTTP { * This returns an object representing a basic HTTP Authorization header of the form. * @param username {string} Username * @param password {string} Password - * @return {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'} + * @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'} */ @Cordova({ sync: true }) static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; } @@ -73,7 +73,7 @@ export class HTTP { * * As an alternative, you can store your .cer files in the www/certificates folder. * @param enable {boolean} Set to true to enable - * @return {Promise} returns a promise that will resolve on success, and reject on failure + * @returns {Promise} returns a promise that will resolve on success, and reject on failure */ @Cordova() static enableSSLPinning(enable: boolean): Promise { return; } @@ -81,7 +81,7 @@ export class HTTP { /** * Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false. * @param accept {boolean} Set to true to accept - * @return {Promise} returns a promise that will resolve on success, and reject on failure + * @returns {Promise} returns a promise that will resolve on success, and reject on failure */ @Cordova() static acceptAllCerts(accept: boolean): Promise { return; } @@ -89,7 +89,7 @@ export class HTTP { /** * Whether or not to validate the domain name in the certificate. This defaults to true. * @param validate {boolean} Set to true to validate - * @return {Promise} returns a promise that will resolve on success, and reject on failure + * @returns {Promise} returns a promise that will resolve on success, and reject on failure */ @Cordova() static validateDomainName(validate: boolean): Promise { return; } @@ -99,7 +99,7 @@ export class HTTP { * @param url {string} The url to send the request to * @param body {Object} The body of the request * @param headers {Object} The headers to set for this request - * @return {Promise} returns a promise that resolve on success, and reject on failure + * @returns {Promise} returns a promise that resolve on success, and reject on failure */ @Cordova() static post(url: string, body: any, headers: any): Promise { return; } @@ -109,7 +109,7 @@ export class HTTP { * @param url {string} The url to send the request to * @param parameters {Object} Parameters to send with the request * @param headers {Object} The headers to set for this request - * @return {Promise} returns a promise that resolve on success, and reject on failure + * @returns {Promise} returns a promise that resolve on success, and reject on failure */ @Cordova() static get(url: string, parameters: any, headers: any): Promise { return; } @@ -121,7 +121,7 @@ export class HTTP { * @param headers {Object} The headers to set for this request * @param filePath {string} The local path of the file to upload * @param name {string} The name of the parameter to pass the file along as - * @return {Promise} returns a promise that resolve on success, and reject on failure + * @returns {Promise} returns a promise that resolve on success, and reject on failure */ @Cordova() static uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise { return; } @@ -132,7 +132,7 @@ export class HTTP { * @param body {Object} The body of the request * @param headers {Object} The headers to set for this request * @param filePath {string} The path to donwload the file to, including the file name. - * @return {Promise} returns a promise that resolve on success, and reject on failure + * @returns {Promise} returns a promise that resolve on success, and reject on failure */ @Cordova() static downloadFile(url: string, body: any, headers: any, filePath: string): Promise { return; } diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index 2d0f322e3..394b8ab26 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -35,6 +35,7 @@ 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} + * @returns {Observable} */ @Cordova({ observable: true, diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index 7f12553c9..78a722576 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -140,7 +140,7 @@ export interface Delegate { /** * An observable that publishes information about the location permission authorization status. * - * @return Returns a string. + * @returns {Observable} Returns a string. */ didChangeAuthorizationStatus(): Observable; @@ -151,7 +151,7 @@ export interface Delegate { * 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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ didDetermineStateForRegion(): Observable; @@ -163,7 +163,7 @@ export interface Delegate { * 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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ didEnterRegion(): Observable; @@ -175,7 +175,7 @@ export interface Delegate { * 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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ didExitRegion(): Observable; @@ -184,7 +184,7 @@ export interface Delegate { * 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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ didRangeBeaconsInRegion(): Observable; @@ -192,7 +192,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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ didStartMonitoringForRegion(): Observable; @@ -200,7 +200,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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ monitoringDidFailForRegionWithError(): Observable; @@ -208,7 +208,7 @@ 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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ peripheralManagerDidStartAdvertising(): Observable; @@ -217,7 +217,7 @@ export interface Delegate { * 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). + * @returns {Observable} Returns a PluginResult object with information about the event, region, and beacon(s). */ peripheralManagerDidUpdateState(): Observable; } @@ -380,14 +380,14 @@ export class IBeacon { * @param {Number} minor The minor value that you use to identify a specific beacon. * @param {BOOL} notifyEntryStateOnDisplay * - * @return Returns the BeaconRegion that was created + * @returns {BeaconRegion} Returns the BeaconRegion that was created */ static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay); } /** - * @return Returns the Delegate + * @returns {Delegate} Returns the Delegate */ @Cordova() static getDelegate(): Delegate { return; } @@ -395,7 +395,7 @@ export class IBeacon { /** * @param {Delegate} delegate An instance of a delegate to register with the native layer. * - * @return Returns the Delegate + * @returns {Delegate} Returns the Delegate */ @Cordova() static setDelegate(delegate: Delegate): Delegate { return; } @@ -417,7 +417,7 @@ export class IBeacon { * message get emitted in the native runtime and the DOM as well after a certain * period of time. * - * @return Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the request and started to send events. */ @Cordova({otherPromise: true}) @@ -425,7 +425,7 @@ export class IBeacon { /** * Determines if bluetooth is switched on, according to the native layer. - * @returns Returns a promise which is resolved with a {Boolean} + * @returns {Promise} Returns a promise which is resolved with a {Boolean} * indicating whether bluetooth is active. */ @Cordova({otherPromise: true}) @@ -434,7 +434,7 @@ export class IBeacon { /** * Enables Bluetooth using the native Layer. (ANDROID ONLY) * - * @returns Returns a promise which is resolved when Bluetooth + * @returns {Promise} Returns a promise which is resolved when Bluetooth * could be enabled. If not, the promise will be rejected with an error. */ @Cordova({otherPromise: true}) @@ -443,7 +443,7 @@ export class IBeacon { /** * Disables Bluetooth using the native Layer. (ANDROID ONLY) * - * @returns Returns a promise which is resolved when Bluetooth + * @returns {Promise} Returns a promise which is resolved when Bluetooth * could be enabled. If not, the promise will be rejected with an error. */ @Cordova({otherPromise: true}) @@ -463,7 +463,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 + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the monitoring request. */ @Cordova({otherPromise: true}) @@ -480,7 +480,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 + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ @Cordova({otherPromise: true}) @@ -496,7 +496,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 + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ @Cordova({otherPromise: true}) @@ -514,7 +514,7 @@ export class IBeacon { * @param {Region} region An instance of {BeaconRegion} which will be monitored * by the operating system. * - * @return Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the monitoring request. */ @Cordova({otherPromise: true}) @@ -531,7 +531,7 @@ export class IBeacon { * @param {Region} region An instance of {BeaconRegion} which will be monitored * by the operating system. * - * @return Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop monitoring. */ @Cordova({otherPromise: true}) @@ -540,7 +540,7 @@ export class IBeacon { /** * Queries the native layer to determine the current authorization in effect. * - * @returns Returns a promise which is resolved with the + * @returns {Promise} Returns a promise which is resolved with the * requested authorization status. */ @Cordova({otherPromise: true}) @@ -553,7 +553,7 @@ export class IBeacon { * requestAlwaysAuthorization * * 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. + * @returns {Promise} Returns a promise that is resolved when the request dialog is shown. */ @Cordova({otherPromise: true}) static requestWhenInUseAuthorization(): Promise { return; } @@ -562,7 +562,7 @@ export class IBeacon { /** * See the docuemntation of {@code requestWhenInUseAuthorization} for further details. * - * @returns Returns a promise which is resolved when the native layer + * @returns {Promise} Returns a promise which is resolved when the native layer * shows the request dialog. */ @Cordova({otherPromise: true}) @@ -570,7 +570,7 @@ export class IBeacon { /** * - * @returns Returns a promise which is resolved with an {Array} + * @returns {Promise} Returns a promise which is resolved with an {Array} * of {Region} instances that are being monitored by the native layer. */ @Cordova({otherPromise: true}) @@ -578,7 +578,7 @@ export class IBeacon { /** * - * @returns Returns a promise which is resolved with an {Array} + * @returns {Promise} Returns a promise which is resolved with an {Array} * of {Region} instances that are being ranged by the native layer. */ @Cordova({otherPromise: true}) @@ -586,7 +586,7 @@ export class IBeacon { /** * Determines if ranging is available or not, according to the native layer. - * @returns Returns a promise which is resolved with a {Boolean} + * @returns {Promise} Returns a promise which is resolved with a {Boolean} * indicating whether ranging is available or not. */ @Cordova({otherPromise: true}) @@ -598,7 +598,7 @@ export class IBeacon { * @param {Region} region An instance of {Region} which will be checked * by the operating system. * - * @returns Returns a promise which is resolved with a {Boolean} + * @returns {Promise} Returns a promise which is resolved with a {Boolean} * indicating whether the region type is supported or not. */ @Cordova({otherPromise: true}) @@ -618,7 +618,7 @@ export class IBeacon { * @param {Integer} measuredPower: Optional parameter, if left empty, the device will * use it's own default value. * - * @return Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the advertising request. */ @Cordova({otherPromise: true}) @@ -629,7 +629,7 @@ export class IBeacon { * * This is done asynchronously and may not be immediately reflected in isAdvertising. * - * @return Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer acknowledged the dispatch of the request to stop advertising. */ @Cordova({otherPromise: true}) @@ -637,7 +637,7 @@ export class IBeacon { /** * Determines if advertising is available or not, according to the native layer. - * @returns Returns a promise which is resolved with a {Boolean} + * @returns {Promise} Returns a promise which is resolved with a {Boolean} * indicating whether advertising is available or not. */ @Cordova({otherPromise: true}) @@ -645,7 +645,7 @@ export class IBeacon { /** * Determines if advertising is currently active, according to the native layer. - * @returns Returns a promise which is resolved with a {Boolean} + * @returns {Promise} Returns a promise which is resolved with a {Boolean} * indicating whether advertising is active. */ @Cordova({otherPromise: true}) @@ -655,7 +655,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 + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer has set the logging level accordingly. */ @Cordova({otherPromise: true}) @@ -666,7 +666,7 @@ export class IBeacon { * to allow the plugin the posting local notifications. * This can be very helpful when debugging how to apps behave when launched into the background. * - * @returns Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer has set the flag to enabled. */ @Cordova({otherPromise: true}) @@ -676,7 +676,7 @@ export class IBeacon { * Disables the posting of debug notifications in the native layer. Use this method if you want * to prevent the plugin from posting local notifications. * - * @returns Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer has set the flag to disabled. */ @Cordova({otherPromise: true}) @@ -686,7 +686,7 @@ export class IBeacon { * Enables debug logging in the native layer. Use this method if you want * a debug the inner workings of this plugin. * - * @returns Returns a promise which is resolved as soon as the + * @returns {Promise} Returns a promise which is resolved as soon as the * native layer has set the logging level accordingly. */ @Cordova({otherPromise: true}) @@ -698,7 +698,7 @@ export class IBeacon { * * @param {String} message The message to append to the device logs. * - * @returns Returns a promise which is resolved with the log + * @returns {Promise} Returns a promise which is resolved with the log * message received by the native layer for appending. The returned message * is expected to be equivalent to the one provided in the original call. */ diff --git a/src/plugins/imagepicker.ts b/src/plugins/imagepicker.ts index af3c2532c..4a47b0d79 100644 --- a/src/plugins/imagepicker.ts +++ b/src/plugins/imagepicker.ts @@ -55,7 +55,7 @@ export class ImagePicker { /** * Pick pictures from the library. * @param {ImagePickerOptions} options - * @return Returns a Promise that resolves the image file URI + * @returns {Promise} Returns a Promise that resolves the image file URI * otherwise rejects with an error. */ @Cordova({ diff --git a/src/plugins/imageresizer.ts b/src/plugins/imageresizer.ts index 382c11e8f..9abf68aca 100644 --- a/src/plugins/imageresizer.ts +++ b/src/plugins/imageresizer.ts @@ -73,6 +73,9 @@ export interface ImageResizerOptions { repo: 'https://github.com/protonet/cordova-plugin-image-resizer' }) export class ImageResizer { + /** + * @returns {Promise} + */ @Cordova() static resize(options: ImageResizerOptions): Promise { return; } } diff --git a/src/plugins/inappbrowser.ts b/src/plugins/inappbrowser.ts index 2397e51a2..34f37e219 100644 --- a/src/plugins/inappbrowser.ts +++ b/src/plugins/inappbrowser.ts @@ -80,13 +80,15 @@ export class InAppBrowser { /** * Injects JavaScript code into the InAppBrowser window. * @param script Details of the script to run, specifying either a file or code key. + * @returns {Promise} */ @CordovaInstance() executeScript(script: {file?: string, code?: string}): Promise {return; } /** * Injects CSS into the InAppBrowser window. - * @param css Details of the script to run, specifying either a file or code key. + * @param {Object} Details of the script to run, specifying either a file or code key. + * @returns {Promise} */ @CordovaInstance() insertCss(css: {file?: string, code?: string}): Promise {return; } @@ -96,8 +98,8 @@ export class InAppBrowser { /** * A method that allows you to listen to events happening in the browser. - * @param event Event name - * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. + * @param {string} name of the event + * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. */ on(event: string): Observable { return new Observable((observer) => { diff --git a/src/plugins/inapppurchase.ts b/src/plugins/inapppurchase.ts index 874970148..447bb3222 100644 --- a/src/plugins/inapppurchase.ts +++ b/src/plugins/inapppurchase.ts @@ -62,7 +62,7 @@ export class InAppPurchase { /** * Retrieves a list of full product data from Apple/Google. This method must be called before making purchases. * @param {array} productId an array of product ids. - * @returns {Promise} Returns a Promise that resolves with an array of objects. + * @returns {Promise} Returns a Promise that resolves with an array of objects. */ @Cordova({ otherPromise: true @@ -72,7 +72,7 @@ export class InAppPurchase { /** * Buy a product that matches the productId. * @param {string} productId A string that matches the product you want to buy. - * @returns {Promise} Returns a Promise that resolves with the transaction details. + * @returns {Promise<{transactionId: string, receipt: string, signature: string, productType: string}>} Returns a Promise that resolves with the transaction details. */ @Cordova({ otherPromise: true @@ -82,7 +82,7 @@ export class InAppPurchase { /** * Same as buy, but for subscription based products. * @param {string} productId A string that matches the product you want to subscribe to. - * @returns {Promise} Returns a Promise that resolves with the transaction details. + * @returns {Promise<{transactionId: string, receipt: string, signature: string, productType: string}>} Returns a Promise that resolves with the transaction details. */ @Cordova({ otherPromise: true @@ -94,6 +94,7 @@ export class InAppPurchase { * @param {string} productType * @param {string} receipt * @param {string} signature + * @returns {Promise} */ @Cordova({ otherPromise: true @@ -102,7 +103,7 @@ export class InAppPurchase { /** * Restore all purchases from the store - * @returns {Promise} Returns a promise with an array of purchases. + * @returns {Promise} Returns a promise with an array of purchases. */ @Cordova({ otherPromise: true diff --git a/src/plugins/insomnia.ts b/src/plugins/insomnia.ts index 1fde35b18..978412425 100644 --- a/src/plugins/insomnia.ts +++ b/src/plugins/insomnia.ts @@ -36,14 +36,14 @@ export class Insomnia { /** * Keeps awake the application - * @returns {Promise} + * @returns {Promise} */ @Cordova() static keepAwake(): Promise { return; } /** * Allows the application to sleep again - * @returns {Promise} + * @returns {Promise} */ @Cordova() static allowSleepAgain(): Promise { return; } diff --git a/src/plugins/instagram.ts b/src/plugins/instagram.ts index 9680acc0f..f92fb47d3 100644 --- a/src/plugins/instagram.ts +++ b/src/plugins/instagram.ts @@ -25,7 +25,7 @@ export class Instagram { /** * Detect if the Instagram application is installed on the device. * - * @return {Promise} Returns a promise that returns a boolean value if installed, or the app version on android + * @returns {Promise} Returns a promise that returns a boolean value if installed, or the app version on android */ @Cordova({ callbackStyle: 'node' @@ -38,7 +38,7 @@ export class Instagram { * * @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share * @param caption The caption of the image - * @return {Promise} Returns a promise that resolves if the image was shared + * @returns {Promise} Returns a promise that resolves if the image was shared */ @Cordova({ callbackStyle: 'node' @@ -48,7 +48,7 @@ export class Instagram { /** * Share a library asset or video * @param assetLocalIdentifier A local fileURI - * @return {Promise} Returns a promise that resolves if the image was shared + * @returns {Promise} Returns a promise that resolves if the image was shared */ @Cordova({ callbackOrder: 'reverse' diff --git a/src/plugins/is-debug.ts b/src/plugins/is-debug.ts index 25f1ab51b..839a79201 100644 --- a/src/plugins/is-debug.ts +++ b/src/plugins/is-debug.ts @@ -26,7 +26,7 @@ export class IsDebug { /** * Determine if an app was installed via xcode / eclipse / the ionic CLI etc - * @return {Promise} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user. + * @returns {Promise} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user. */ @Cordova() static getIsDebug(): Promise { diff --git a/src/plugins/keyboard.ts b/src/plugins/keyboard.ts index 8be9b2d36..aa076df2e 100644 --- a/src/plugins/keyboard.ts +++ b/src/plugins/keyboard.ts @@ -58,6 +58,7 @@ export class Keyboard { /** * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch. + * @returns {Observable} */ @Cordova({ eventObservable: true, @@ -68,6 +69,7 @@ export class Keyboard { /** * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch. + * @returns {Observable} */ @Cordova({ eventObservable: true, diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index b3bc546e7..f4ebf5912 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -107,12 +107,14 @@ export class LaunchNavigator { /** * Determines if the given app is installed and available on the current device. * @param app {string} + * @returns {Promise} */ @Cordova() static isAppAvailable(app: string): Promise { return; } /** * Returns a list indicating which apps are installed and available on the current device. + * @returns {Promise} */ @Cordova() static availableApps(): Promise { return; } @@ -120,6 +122,7 @@ export class LaunchNavigator { /** * Returns the display name of the specified app. * @param app {string} + * @returns {string} */ @Cordova({ sync: true }) static getAppDisplayName(app: string): string { return; } @@ -127,6 +130,7 @@ export class LaunchNavigator { /** * Returns list of supported apps on a given platform. * @param platform {string} + * @returns {string[]} */ @Cordova({ sync: true }) static getAppsForPlatform(platform: string): string[] { return; } @@ -135,6 +139,7 @@ export class LaunchNavigator { * 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} + * @returns {boolean} */ @Cordova({ sync: true }) static supportsTransportMode(app: string, platform: string): boolean { return; } @@ -143,6 +148,7 @@ export class LaunchNavigator { * Returns the list of transport modes supported by an app on a given platform. * @param app {string} * @param platform {string} + * @returns {string[]} */ @Cordova({ sync: true }) static getTransportModes(app: string, platform: string): string[] { return; } @@ -152,6 +158,7 @@ export class LaunchNavigator { * Note that currently only Google Maps on Android does. * @param app {string} * @param platform {string} + * @returns {boolean} */ @Cordova({ sync: true }) static supportsLaunchMode(app: string, platform: string): boolean { return; } @@ -160,16 +167,31 @@ export class LaunchNavigator { * Indicates if an app on a given platform supports specification of start location. * @param app {string} * @param platform {string} + * @returns {boolean} */ @Cordova({ sync: true }) static supportsStart(app: string, platform: string): boolean { return; } + /** + * @param app {string} + * @param platform {string} + * @returns {boolean} + */ @Cordova({ sync: true }) static supportsStartName(app: string, platform: string): boolean { return; } + /** + * @param app {string} + * @param platform {string} + * @returns {boolean} + */ @Cordova({ sync: true }) static supportsDestName(app: string, platform: string): boolean { return; } + /** + * @param destination {string | number[]} + * @param options {LaunchNavigatorOptions} + */ @Cordova({ sync: true }) static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { } diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index d6f517a01..4c19d9a48 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -54,7 +54,7 @@ export class LocalNotifications { /** * Schedules a single or multiple notifications - * @param options + * @param options {Notification | Array} optional */ @Cordova({ sync: true @@ -63,7 +63,7 @@ export class LocalNotifications { /** * Updates a previously scheduled notification. Must include the id in the options parameter. - * @param options + * @param options {Notification} optional */ @Cordova({ sync: true @@ -72,15 +72,15 @@ export class LocalNotifications { /** * Clears single or multiple notifications - * @param notificationId A single notification id, or an array of notification ids. - * @returns {Promise} Returns a promise when the notification had been cleared + * @param notificationId {any} A single notification id, or an array of notification ids. + * @returns {Promise} Returns a promise when the notification had been cleared */ @Cordova() static clear(notificationId: any): Promise { return; } /** * Clears all notifications - * @returns {Promise} Returns a promise when all notifications have cleared + * @returns {Promise} Returns a promise when all notifications have cleared */ @Cordova({ successIndex: 0, @@ -90,15 +90,15 @@ export class LocalNotifications { /** * Cancels single or multiple notifications - * @param notificationId A single notification id, or an array of notification ids. - * @returns {Promise} Returns a promise when the notification is canceled + * @param notificationId {any} A single notification id, or an array of notification ids. + * @returns {Promise} Returns a promise when the notification is canceled */ @Cordova() static cancel(notificationId: any): Promise { return; } /** * Cancels all notifications - * @returns {Promise} Returns a promise when all notifications are canceled + * @returns {Promise} Returns a promise when all notifications are canceled */ @Cordova({ successIndex: 0, @@ -108,61 +108,61 @@ export class LocalNotifications { /** * Checks presence of a notification - * @param notificationId - * @returns {Promise} Returns a promise + * @param notificationId {number} + * @returns {Promise} */ @Cordova() static isPresent(notificationId: number): Promise { return; } /** * Checks is a notification is scheduled - * @param notificationId - * @returns {Promise} Returns a promise + * @param notificationId {number} + * @returns {Promise} */ @Cordova() static isScheduled(notificationId: number): Promise { return; } /** * Checks if a notification is triggered - * @param notificationId - * @returns {Promise} Returns a promise + * @param notificationId {number} + * @returns {Promise} */ @Cordova() static isTriggered(notificationId: number): Promise { return; } /** * Get all the notification ids - * @returns {Promise} Returns a promise + * @returns {Promise>} */ @Cordova() static getAllIds(): Promise> { return; } /** * Get the ids of triggered notifications - * @returns {Promise} Returns a promise + * @returns {Promise>} */ @Cordova() static getTriggeredIds(): Promise> { return; } /** * Get the ids of scheduled notifications - * @returns {Promise} Returns a promise + * @returns {Promise>} Returns a promise */ @Cordova() static getScheduledIds(): Promise> { return; } /** * Get a notification object - * @param notificationId The id of the notification to get - * @returns {Promise} Returns a promise + * @param notificationId {any} The id of the notification to get + * @returns {Promise} */ @Cordova() static get(notificationId: any): Promise { return; } /** * Get a scheduled notification object - * @param notificationId The id of the notification to get - * @returns {Promise} Returns a promise + * @param notificationId {any} The id of the notification to get + * @returns {Promise} */ @Cordova() static getScheduled(notificationId: any): Promise { return; } @@ -170,42 +170,42 @@ export class LocalNotifications { /** * Get a triggered notification object * @param notificationId The id of the notification to get - * @returns {Promise} Returns a promise + * @returns {Promise} */ @Cordova() static getTriggered(notificationId: any): Promise { return; } /** * Get all notification objects - * @returns {Promise} Returns a promise + * @returns {Promise>} */ @Cordova() static getAll(): Promise> { return; } /** * Get all scheduled notification objects - * @returns {Promise} Returns a promise + * @returns {Promise>} */ @Cordova() static getAllScheduled(): Promise> { return; } /** * Get all triggered notification objects - * @returns {Promise} Returns a promise + * @returns {Promise>} */ @Cordova() static getAllTriggered(): Promise> { return; } /** * Register permission to show notifications if not already granted. - * @returns {Promise} Returns a promise + * @returns {Promise} */ @Cordova() static registerPermission(): Promise { return; } /** * Informs if the app has the permission to show notifications. - * @returns {Promise} Returns a promise + * @returns {Promise} */ @Cordova() static hasPermission(): Promise { return; } diff --git a/src/plugins/market.ts b/src/plugins/market.ts index 197ac6ab1..0ad90200e 100644 --- a/src/plugins/market.ts +++ b/src/plugins/market.ts @@ -22,7 +22,7 @@ export class Market { /** * Opens an app in Google Play / App Store * @param appId {string} Package name - * @param callbacks {Object} Optional callbacks + * @param callbacks {Object} Optional callbacks in the format {success?: Function, failure?: Function} */ @Cordova({sync: true}) static open(appId: string, callbacks?: {success?: Function, failure?: Function}): void { } diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 72ea7f370..b7dcafc41 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -58,6 +58,7 @@ export class MediaCapture { /** * Start the audio recorder application and return information about captured audio clip files. * @param options + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' @@ -67,6 +68,7 @@ export class MediaCapture { /** * Start the camera application and return information about captured image files. * @param options + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' @@ -76,6 +78,7 @@ export class MediaCapture { /** * Start the video recorder application and return information about captured video clip files. * @param options + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' @@ -84,6 +87,7 @@ export class MediaCapture { /** * is fired if the capture call is successful + * @returns {Observable} */ @Cordova({ eventObservable: true, @@ -93,6 +97,7 @@ export class MediaCapture { /** * is fired if the capture call is unsuccessful + * @returns {Observable} */ @Cordova({ eventObservable: true, diff --git a/src/plugins/media.ts b/src/plugins/media.ts index eb05933c1..92c4a77a4 100644 --- a/src/plugins/media.ts +++ b/src/plugins/media.ts @@ -140,21 +140,21 @@ export class MediaPlugin { /** * Get the current amplitude of the current recording. - * @returns {Promise} Returns a promise with the amplitude of the current recording + * @returns {Promise} Returns a promise with the amplitude of the current recording */ @CordovaInstance() getCurrentAmplitude(): Promise { return; } /** * Get the current position within an audio file. Also updates the Media object's position parameter. - * @returns {Promise} Returns a promise with the position of the current recording + * @returns {Promise} Returns a promise with the position of the current recording */ @CordovaInstance() getCurrentPosition(): Promise { return; } /** * Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. - * @returns {Promise} Returns a promise with the duration of the current recording + * @returns {number} Returns a promise with the duration of the current recording */ @CordovaInstance({ sync: true @@ -199,7 +199,7 @@ export class MediaPlugin { /** * Set the volume for an audio file. - * @param volume The volume to set for playback. The value must be within the range of 0.0 to 1.0. + * @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0. */ @CordovaInstance({ sync: true diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts index 972c6dd4b..44e623a4b 100644 --- a/src/plugins/mixpanel.ts +++ b/src/plugins/mixpanel.ts @@ -41,7 +41,7 @@ export class Mixpanel { static distinctId(): Promise { return; } /** - * + * @returns {Promise} */ @Cordova() static flush(): Promise { return; } @@ -52,7 +52,7 @@ export class Mixpanel { * @returns {Promise} */ @Cordova() - static identify(distinctId): Promise { return; } + static identify(distinctId: string): Promise { return; } /** * @@ -64,7 +64,7 @@ export class Mixpanel { /** * - * @param superProperties + * @param superProperties {any} * @returns {Promise} */ @Cordova() @@ -79,8 +79,9 @@ export class Mixpanel { /** * - * @param eventName - * @param eventProperties + * @param eventName {string} + * @param eventProperties {any} optional + * @returns {Promise} */ @Cordova() static track(eventName: string, eventProperties?: any): Promise { return; } diff --git a/src/plugins/native-audio.ts b/src/plugins/native-audio.ts index a6121d5fc..5af8a6d4c 100644 --- a/src/plugins/native-audio.ts +++ b/src/plugins/native-audio.ts @@ -55,7 +55,8 @@ export class NativeAudio { /** * Plays an audio asset * @param id {string} unique ID for the audio file - * @param completeCallback {Function} callback to be invoked when audio is done playing + * @param completeCallback {Function} optional. Callback to be invoked when audio is done playing + * @returns {Promise} */ @Cordova({ successIndex: 1, @@ -66,6 +67,7 @@ export class NativeAudio { /** * Stops playing an audio * @param id {string} unique ID for the audio file + * @returns {Promise} */ @Cordova() static stop(id: string): Promise {return; } @@ -81,6 +83,7 @@ export class NativeAudio { /** * Unloads an audio file from memory * @param id {string} unique ID for the audio file + * @returns {Promise} */ @Cordova() static unload(id: string): Promise {return; } @@ -89,6 +92,7 @@ export class NativeAudio { * Changes the volume for preloaded complex assets. * @param id {string} unique ID for the audio file * @param volume {number} the volume of the audio asset (0.1 to 1.0) + * @returns {Promise} */ @Cordova() static setVolumeForComplexAsset(id: string, volume: number): Promise {return; } diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts index 0783c7d48..a82599532 100644 --- a/src/plugins/native-page-transitions.ts +++ b/src/plugins/native-page-transitions.ts @@ -37,6 +37,7 @@ export class NativePageTransitions { /** * Perform a slide animation * @param options {TransitionOptions} Options for the transition + * @returns {Promise} */ @Cordova() static slide(options: TransitionOptions): Promise { return; } @@ -44,6 +45,7 @@ export class NativePageTransitions { /** * Perform a flip animation * @param options {TransitionOptions} Options for the transition + * @returns {Promise} */ @Cordova() static flip(options: TransitionOptions): Promise { return; } @@ -51,6 +53,7 @@ export class NativePageTransitions { /** * Perform a fade animation * @param options {TransitionOptions} Options for the transition + * @returns {Promise} */ @Cordova({platforms: ['iOS', 'Android']}) static fade(options: TransitionOptions): Promise { return; } @@ -59,6 +62,7 @@ export class NativePageTransitions { /** * Perform a slide animation * @param options {TransitionOptions} Options for the transition + * @returns {Promise} */ @Cordova({platforms: ['iOS', 'Android']}) static drawer(options: TransitionOptions): Promise { return; } @@ -68,6 +72,7 @@ export class NativePageTransitions { /** * Perform a slide animation * @param options {TransitionOptions} Options for the transition + * @returns {Promise} */ @Cordova({platforms: ['iOS']}) static curl(options: TransitionOptions): Promise { return; } diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 6da71c445..a0b0a2572 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -33,6 +33,7 @@ export class NativeStorage { * Stores a value * @param reference {string} * @param value + * @returns {Promise} */ @Cordova() static setItem(reference: string, value: any): Promise {return; } @@ -40,6 +41,7 @@ export class NativeStorage { /** * Gets a stored item * @param reference {string} + * @returns {Promise} */ @Cordova() static getItem(reference: string): Promise {return; } @@ -47,12 +49,14 @@ export class NativeStorage { /** * Removes a single stored item * @param reference {string} + * @returns {Promise} */ @Cordova() static remove(reference: string): Promise {return; } /** * Removes all stored values. + * @returns {Promise} */ @Cordova() static clear(): Promise {return; } diff --git a/src/plugins/nfc.ts b/src/plugins/nfc.ts index 77e10615c..7b0423856 100644 --- a/src/plugins/nfc.ts +++ b/src/plugins/nfc.ts @@ -34,7 +34,7 @@ export class NFC { * Registers an event listener for any NDEF tag. * @param onSuccess * @param onFailure - * @return {Promise} + * @returns {Observable} */ @Cordova({ observable: true, @@ -50,7 +50,7 @@ export class NFC { * @param mimeType * @param onSuccess * @param onFailure - * @return {Promise} + * @returns {Observable} */ @Cordova({ observable: true, @@ -65,7 +65,7 @@ export class NFC { * Registers an event listener for NDEF tags matching a specified MIME type. * @param onSuccess * @param onFailure - * @return {Promise} + * @returns {Observable} */ @Cordova({ observable: true, @@ -80,7 +80,7 @@ export class NFC { * Registers an event listener for formatable NDEF tags. * @param onSuccess * @param onFailure - * @return {Promise} + * @returns {Observable} */ @Cordova({ observable: true, @@ -92,13 +92,13 @@ export class NFC { /** * Qrites an NdefMessage to a NFC tag. * @param message {any[]} - * @return {Promise} + * @returns {Promise} */ @Cordova() static write(message: any[]): Promise {return; } /** * Makes a NFC tag read only. **Warning** this is permanent. - * @return {Promise} + * @returns {Promise} */ @Cordova() static makeReadyOnly(): Promise {return; } @@ -106,14 +106,14 @@ export class NFC { /** * Shares an NDEF Message via peer-to-peer. * @param message An array of NDEF Records. - * @return {Promise} + * @returns {Promise} */ @Cordova() static share(message: any[]): Promise {return; } /** * Stop sharing NDEF data via peer-to-peer. - * @return {Promise} + * @returns {Promise} */ @Cordova() static unshare(): Promise {return; } @@ -127,28 +127,28 @@ export class NFC { /** * Send a file to another device via NFC handover. * @param uris A URI as a String, or an array of URIs. - * @return {Promise} + * @returns {Promise} */ @Cordova() static handover(uris: string[]): Promise {return; } /** * Stop sharing NDEF data via NFC handover. - * @return {Promise} + * @returns {Promise} */ @Cordova() static stopHandover(): Promise {return; } /** * Show the NFC settings on the device. - * @return {Promise} + * @returns {Promise} */ @Cordova() static showSettings(): Promise {return; } /** * Check if NFC is available and enabled on this device. - * @return {Promise} + * @returns {Promise} */ @Cordova() static enabled(): Promise {return; } diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 40531ecd6..9a594fe80 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -51,6 +51,7 @@ export class OneSignal { * * @param {string} appId Your AppId from your OneSignal app * @param {string} googleProjectNumber The Google Project Number (which you can get from the Google Developer Portal) and the autoRegister option. + * @returns {any} */ @Cordova({ sync: true }) static startInit(appId: string, googleProjectNumber: string): any { return; } @@ -76,6 +77,7 @@ export class OneSignal { /** * * @param settings + * @returns {any} */ @Cordova({ sync: true }) static iOSSettings(settings: { @@ -83,13 +85,16 @@ export class OneSignal { kOSSettingsKeyAutoPrompt: boolean; }): any { return; } + /** + * @returns {any} + */ @Cordova({ sync: true }) static endInit(): any { return; } /** * 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. + * @returns {Promise} Returns a Promise that resolves when tags are recieved. */ @Cordova() static getTags(): Promise { return; } @@ -98,7 +103,7 @@ export class OneSignal { * 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. + * @returns {Promise} Returns a Promise that reolves if the device was successfully registered. * It returns a JSON with `userId`and `pushToken`. */ @Cordova() @@ -192,7 +197,7 @@ export class OneSignal { /** * * @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. + * @returns {Promise} Returns a Promise that resolves if the notification was send successfully. */ @Cordova() static postNotification(notificationObj: OneSignalNotification): Promise { return; } diff --git a/src/plugins/pay-pal.ts b/src/plugins/pay-pal.ts index a424bc777..ce20eca4a 100644 --- a/src/plugins/pay-pal.ts +++ b/src/plugins/pay-pal.ts @@ -66,6 +66,7 @@ import { Plugin, Cordova } from './plugin'; export class PayPal { /** * Retrieve the version of the PayPal iOS SDK library. Useful when contacting support. + * @returns {Promise} */ @Cordova() static version(): Promise {return; } @@ -77,6 +78,7 @@ export class PayPal { * the recommended time to preconnect is on page load. * * @param {PayPalEnvironment} clientIdsForEnvironments: set of client ids for environments + * @returns {Promise} */ @Cordova() static init(clientIdsForEnvironments: PayPalEnvironment): Promise {return; } @@ -88,7 +90,8 @@ export class PayPal { * * @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox" * @param {PayPalConfiguration} configuration: PayPalConfiguration object, for Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set - **/ + * @returns {Promise} + */ @Cordova() static prepareToRender(environment: string, configuration: PayPalConfiguration): Promise {return; } @@ -98,6 +101,7 @@ export class PayPal { * for more documentation of the params. * * @param {PayPalPayment} payment PayPalPayment object + * @returns {Promise} */ @Cordova() static renderSinglePaymentUI(payment: PayPalPayment): Promise {return; } @@ -110,12 +114,14 @@ export class PayPal { * This method MUST be called prior to initiating a pre-consented payment (a "future payment") from a mobile device. * Pass the result to your server, to include in the payment request sent to PayPal. * Do not otherwise cache or store this value. + * @returns {Promise} */ @Cordova() static clientMetadataID(): Promise {return; } /** * Please Read Docs on Future Payments at https://github.com/paypal/PayPal-iOS-SDK#future-payments + * @returns {Promise} */ @Cordova() static renderFuturePaymentUI(): Promise {return; } @@ -125,7 +131,8 @@ export class PayPal { * * @param {Array} scopes scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes * See https://developer.paypal.com/docs/integration/direct/identity/attributes/ for more details - **/ + * @returns {Promise} + */ @Cordova() static renderProfileSharingUI(scopes: string[]): Promise {return; } } diff --git a/src/plugins/photo-viewer.ts b/src/plugins/photo-viewer.ts index d58cbcdb1..26aeab94a 100644 --- a/src/plugins/photo-viewer.ts +++ b/src/plugins/photo-viewer.ts @@ -25,5 +25,5 @@ export class PhotoViewer { * @param options {any} */ @Cordova({sync: true}) - static show(url: string, title?: string, options?: {share?: boolean; }): void { } + static show(url: string, title?: string, options?: {share?: boolean}): void { } } diff --git a/src/plugins/pin-dialog.ts b/src/plugins/pin-dialog.ts index 93350ae93..7fd03603b 100644 --- a/src/plugins/pin-dialog.ts +++ b/src/plugins/pin-dialog.ts @@ -31,6 +31,7 @@ export class PinDialog { * @param {string} message Message to show the user * @param {string} title Title of the dialog * @param {string[]} buttons Buttons to show + * @returns {Promise<{ buttonIndex: number, input1: string }>} */ @Cordova({ successIndex: 1 diff --git a/src/plugins/power-management.ts b/src/plugins/power-management.ts index abb5269b2..3e60aff1f 100644 --- a/src/plugins/power-management.ts +++ b/src/plugins/power-management.ts @@ -24,18 +24,21 @@ import { Plugin, Cordova } from './plugin'; export class PowerManagement { /** * Acquire a wakelock by calling this. + * @returns {Promise} */ @Cordova() static acquire(): Promise {return; } /** * This acquires a partial wakelock, allowing the screen to be dimmed. + * @returns {Promise} */ @Cordova() static dim(): Promise {return; } /** * Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain. + * @returns {Promise} */ @Cordova() static release(): Promise {return; } @@ -44,6 +47,7 @@ export class PowerManagement { * By default, the plugin will automatically release a wakelock when your app is paused (e.g. when the screen is turned off, or the user switches to another app). * It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function. * @param set {boolean} + * @returns {Promise} */ @Cordova() static setReleaseOnPause(set: boolean): Promise {return; } diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts index dc496167c..3c7fec9bd 100644 --- a/src/plugins/printer.ts +++ b/src/plugins/printer.ts @@ -71,14 +71,16 @@ export class Printer { /** * Checks whether to device is capable of printing. + * @returns {Promise} */ @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 + * @param content {string | HTMLElement} 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 {PrintOptions} optional. The options to pass to the printer + * @returns {Promise} */ @Cordova() static print(content: string | HTMLElement, options?: PrintOptions): Promise { return; } diff --git a/src/plugins/push.ts b/src/plugins/push.ts index 51e1d6231..c3991f96b 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -312,7 +312,7 @@ export class Push { * ``` * * @param {PushOptions} options The Push [options](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#parameters). - * @return {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object. + * @returns {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object. */ @Cordova({ sync: true @@ -321,7 +321,7 @@ export class Push { /** * Check whether the push notification permission has been granted. - * @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted. + * @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted. */ @Cordova() static hasPermission(): Promise<{ isEnabled: boolean }> { return; } diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 8abb169c5..900673fa8 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -49,13 +49,15 @@ export class SafariViewController { /** * Checks if SafariViewController is available + * @returns {Promise} */ @Cordova() static isAvailable(): Promise { return; } /** * Shows Safari View Controller - * @param options + * @param options {SafariViewControllerOptions} optional + * @returns {Promise} */ @Cordova() static show(options?: SafariViewControllerOptions): Promise { return; } @@ -68,19 +70,22 @@ export class SafariViewController { /** * Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below. + * @returns {Promise} */ @Cordova() static connectToService(): Promise { return; } /** * Call this method whenever there's a chance the user will open an external url. + * @returns {Promise} */ @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 + * @param url{string} + * @returns {Promise} */ @Cordova() static mayLaunchUrl(url: string): Promise { return; } diff --git a/src/plugins/screen-orientation.ts b/src/plugins/screen-orientation.ts index 5a13ef437..80aa46ced 100644 --- a/src/plugins/screen-orientation.ts +++ b/src/plugins/screen-orientation.ts @@ -48,7 +48,7 @@ export class ScreenOrientation { /** * Lock the orientation to the passed value. * See below for accepted values - * @param {orientation} The orientation which should be locked. Accepted values see table below. + * @param orientation {string} The orientation which should be locked. Accepted values see table below. */ @Cordova({ sync: true }) static lockOrientation(orientation: string): void { } diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index 1952e7f45..e7982b61e 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -32,6 +32,7 @@ export class Screenshot { * @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 + * @returns {Promise} */ static save(format?: string, quality?: number, filename?: string): Promise { return new Promise( @@ -57,6 +58,7 @@ export class Screenshot { * * @param {number} quality. Determines the quality of the screenshot. * Default quality is set to 100. + * @returns {Promise} */ static URI(quality?: number): Promise { return new Promise( diff --git a/src/plugins/securestorage.ts b/src/plugins/securestorage.ts index bdd773ce4..8b88c60fa 100644 --- a/src/plugins/securestorage.ts +++ b/src/plugins/securestorage.ts @@ -55,6 +55,7 @@ export class SecureStorage { /** * Creates a namespaced storage. * @param store {string} + * @returns {Promise} */ create(store: string): Promise { return new Promise((res, rej) => { @@ -65,6 +66,7 @@ export class SecureStorage { /** * Gets a stored item * @param reference {string} + * @returns {Promise} */ @CordovaInstance({ callbackOrder: 'reverse' @@ -75,6 +77,7 @@ export class SecureStorage { * Stores a value * @param reference {string} * @param value {string} + * @returns {Promise} */ @CordovaInstance({ callbackOrder: 'reverse' @@ -84,6 +87,7 @@ export class SecureStorage { /** * Removes a single stored item * @param reference {string} + * @returns {Promise} */ @CordovaInstance({ callbackOrder: 'reverse' diff --git a/src/plugins/shake.ts b/src/plugins/shake.ts index e99fa2030..ba1d6940d 100644 --- a/src/plugins/shake.ts +++ b/src/plugins/shake.ts @@ -24,6 +24,7 @@ export class Shake { /** * Watch for shake gesture * @param sensitivity {number} Optional sensitivity parameter. Defaults to 40 + * @returns {Observable} */ @Cordova({ observable: true, diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts index 7e9118cbc..00789683b 100644 --- a/src/plugins/sim.ts +++ b/src/plugins/sim.ts @@ -29,7 +29,7 @@ import { Cordova, Plugin } from './plugin'; export class Sim { /** * Returns info from the SIM card. - * @returns {Promise} + * @returns {Promise} */ @Cordova() static getSimInfo(): Promise { return; } diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index dedc54433..f598426e1 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -38,7 +38,7 @@ export class SocialSharing { * @param subject {string} The subject * @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 - * @returns {Promise} + * @returns {Promise} */ @Cordova() static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise { return; } @@ -46,7 +46,7 @@ export class SocialSharing { /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) * @param options {object} The options object with the message, subject, files, url and chooserTitle properties. - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -60,7 +60,7 @@ export class SocialSharing { * @param subject {string} * @param image {string} * @param url {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 5, @@ -74,7 +74,7 @@ export class SocialSharing { * @param message {string} * @param image {string} * @param url {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 3, @@ -88,7 +88,7 @@ export class SocialSharing { * @param message {string} * @param image {string} * @param url {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 3, @@ -104,7 +104,7 @@ export class SocialSharing { * @param image {string} * @param url {string} * @param pasteMessageHint {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 4, @@ -117,7 +117,7 @@ export class SocialSharing { * Shares directly to Instagram * @param message {string} * @param image {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -129,7 +129,7 @@ export class SocialSharing { * @param message {string} * @param image {string} * @param url {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 3, @@ -144,7 +144,7 @@ export class SocialSharing { * @param message {string} Message to send * @param image {string} Image to send (does not work on iOS * @param url {string} Link to send - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 4, @@ -157,7 +157,7 @@ export class SocialSharing { * Share via SMS * @param messge {string} message to send * @param phoneNumber {string} Number or multiple numbers seperated by commas - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -166,7 +166,7 @@ export class SocialSharing { /** * Checks if you can share via email - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'] @@ -181,7 +181,7 @@ export class SocialSharing { * @param cc {string[]} Optional * @param bcc {string[]} Optional * @param files {string|string[]} Optional URL or local path to file(s) to attach - * @returns {Promise} + * @returns {Promise} */ @Cordova({ platforms: ['iOS', 'Android'], @@ -197,7 +197,7 @@ export class SocialSharing { * @param subject {string} * @param image {string} * @param url {string} - * @returns {Promise} + * @returns {Promise} */ @Cordova({ successIndex: 5, diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 70eb8851e..e652a6d71 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -51,6 +51,7 @@ export class SQLite { * 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. + * @returns {Promise} * @usage * * ```typescript @@ -95,12 +96,20 @@ export class SQLite { }) addTransaction(transaction: any): void { } + /** + * @param fn {any} + * @returns {Promise} + */ @CordovaInstance({ successIndex: 2, errorIndex: 1 }) transaction(fn: any): Promise { return; } + /** + * @param fn {any} + * @returns {Promise} + */ @CordovaInstance() readTransaction(fn: any): Promise { return; } @@ -109,6 +118,9 @@ export class SQLite { }) startNextTransaction(): void { } + /** + * @returns {Promise} + */ @CordovaInstance() close(): Promise { return; } @@ -129,13 +141,25 @@ export class SQLite { * // resultSet.rows.item(i) * }, (err) => {}) * ``` + * @param statement {string} + * @param params {any} + * @returns {Promise} */ @CordovaInstance() executeSql(statement: string, params: any): Promise { return; } + /** + * @param sql + * @param values + * @returns {Promise} + */ @CordovaInstance() addStatement(sql, values): Promise { return; } + /** + * @param sqlStatements {any} + * @returns {Promise} + */ @CordovaInstance() sqlBatch(sqlStatements: any): Promise { return; } @@ -144,12 +168,19 @@ export class SQLite { }) abortallPendingTransactions(): void { } + /** + @param handler + @param response + */ @CordovaInstance({ sync: true }) handleStatementSuccess(handler, response): void { } - + /** + * @param handler + * @param response + */ @CordovaInstance({ sync: true }) @@ -161,7 +192,9 @@ export class SQLite { }) run(): void { } - + /** + * @param txFailure + */ @CordovaInstance({ sync: true }) @@ -173,16 +206,24 @@ export class SQLite { }) finish(): void { } - + /** + * @param sqlerror + */ @CordovaInstance({ sync: true }) abortFromQ(sqlerror): void { } - + /** + * @returns {Promise} + */ @Cordova() static echoTest(): Promise { return; } + /** + * @param first + * @returns {Promise} + */ @Cordova() static deleteDatabase(first): Promise { return; } diff --git a/src/plugins/stepcounter.ts b/src/plugins/stepcounter.ts index 2959939ef..835cc2a4d 100644 --- a/src/plugins/stepcounter.ts +++ b/src/plugins/stepcounter.ts @@ -32,42 +32,42 @@ export class Stepcounter { * Start the step counter * * @param startingOffset {number} will be added to the total steps counted in this session - * @return {Promise} Returns a Promise that resolves on success or rejects on failure + * @returns {Promise} Returns a Promise that resolves on success or rejects on failure */ @Cordova() static start(startingOffset: number): Promise { return; } /** * Stop the step counter - * @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure + * @returns {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure */ @Cordova() static stop(): Promise { return; } /** * Get the amount of steps for today (or -1 if it no data given) - * @return {Promise} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure + * @returns {Promise} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure */ @Cordova() static getTodayStepCount(): Promise { return; } /** * Get the amount of steps since the start command has been called - * @return {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure + * @returns {Promise} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure */ @Cordova() static getStepCount(): Promise { return; } /** * Returns true/false if Android device is running >API level 19 && has the step counter API available - * @return {Promise} Returns a Promise that resolves on success, or rejects on failure + * @returns {Promise} Returns a Promise that resolves on success, or rejects on failure */ @Cordova() static deviceCanCountSteps(): Promise { return; } /** * Get the step history (JavaScript object) - * @return {Promise} Returns a Promise that resolves on success, or rejects on failure + * @returns {Promise} Returns a Promise that resolves on success, or rejects on failure */ @Cordova() static getHistory(): Promise { return; } diff --git a/src/plugins/themeable-browser.ts b/src/plugins/themeable-browser.ts index 721aa82d5..3e22fe982 100644 --- a/src/plugins/themeable-browser.ts +++ b/src/plugins/themeable-browser.ts @@ -183,6 +183,7 @@ export class ThemeableBrowser { /** * Injects JavaScript code into the browser window. * @param script Details of the script to run, specifying either a file or code key. + * @returns {Promise} */ @CordovaInstance() executeScript(script: {file?: string, code?: string}): Promise {return; } @@ -190,6 +191,7 @@ export class ThemeableBrowser { /** * Injects CSS into the browser window. * @param css Details of the script to run, specifying either a file or code key. + * @returns {Promise} */ @CordovaInstance() insertCss(css: {file?: string, code?: string}): Promise {return; } @@ -198,7 +200,7 @@ export class ThemeableBrowser { * A method that allows you to listen to events happening in the browser. * Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined` * @param event Event name - * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. + * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. */ on(event: string): Observable { return new Observable((observer) => { diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 8f5e5b555..0e874d31a 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -71,7 +71,7 @@ export class Toast { * @param {string} message The message to display. * @param {string} duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'. * @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -85,7 +85,7 @@ export class Toast { /** * Manually hide any currently visible toast. - * @return {Promise} Returns a Promise that resolves on success. + * @returns {Promise} Returns a Promise that resolves on success. */ @Cordova() static hide(): Promise { return; } @@ -99,7 +99,7 @@ export class Toast { * position Where to position the toast, either 'top', 'center', or 'bottom'. * addPixelsY Offset in pixels to move the toast up or down from its specified position. * - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -109,7 +109,8 @@ export class Toast { /** * Shorthand for `show(message, 'short', 'top')`. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @param message {string} + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -119,7 +120,8 @@ export class Toast { /** * Shorthand for `show(message, 'short', 'center')`. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @param message {string} + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -130,7 +132,8 @@ export class Toast { /** * Shorthand for `show(message, 'short', 'bottom')`. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @param message {string} + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -141,7 +144,8 @@ export class Toast { /** * Shorthand for `show(message, 'long', 'top')`. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @param message {string} + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -152,7 +156,8 @@ export class Toast { /** * Shorthand for `show(message, 'long', 'center')`. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @param message {string} + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, @@ -163,7 +168,8 @@ export class Toast { /** * Shorthand for `show(message, 'long', 'bottom')`. - * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. + * @param message {string} + * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. */ @Cordova({ observable: true, diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index a5ac8d609..c2e067a99 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -56,7 +56,7 @@ export class TouchID { /** * Checks Whether TouchID is available or not. * - * @return {Promise} Returns a Promise that resolves if yes, rejects if no. + * @returns {Promise} Returns a Promise that resolves if yes, rejects if no. */ @Cordova() static isAvailable(): Promise { return; } @@ -65,7 +65,7 @@ export class TouchID { * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen. * * @param {string} message The message to display - * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). + * @returns {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). */ @Cordova() static verifyFingerprint(message: string): Promise { return; } @@ -74,7 +74,7 @@ export class TouchID { * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above). * * @param {string} message The message to display - * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). + * @returns {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). */ @Cordova() static verifyFingerprintWithCustomPasswordFallback(message: string): Promise { return; } @@ -84,7 +84,7 @@ export class TouchID { * * @param {string} message The message to display * @param {string} enterPasswordLabel Custom text for the 'Enter Password' button - * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). + * @returns {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). */ @Cordova() static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise { return; } diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index 1ccd62097..c7ab762a5 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -36,20 +36,20 @@ import { Plugin, Cordova } from './plugin'; export class TwitterConnect { /** * Logs in - * @return {Promise} returns a promise that resolves if logged in and rejects if failed to login + * @returns {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 + * @returns {Promise} returns a promise that resolves if logged out and rejects if failed to logout */ @Cordova() static logout(): Promise {return; } /** * Returns user's profile information - * @return {Promise} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails + * @returns {Promise} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails */ @Cordova() static showUser(): Promise {return; } diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts index 9c418c869..f970655c4 100644 --- a/src/plugins/video-editor.ts +++ b/src/plugins/video-editor.ts @@ -160,7 +160,7 @@ export class VideoEditor { /** * Transcode a video * @param options {TranscodeOptions} Options - * @return {Promise} Returns a promise that resolves to the path of the transcoded video + * @returns {Promise} Returns a promise that resolves to the path of the transcoded video */ @Cordova({ callbackOrder: 'reverse' @@ -170,7 +170,7 @@ export class VideoEditor { /** * Trim a video * @param options {TrimOptions} Options - * @return {Promise} Returns a promise that resolves to the path of the trimmed video + * @returns {Promise} Returns a promise that resolves to the path of the trimmed video */ @Cordova({ callbackOrder: 'reverse', @@ -181,7 +181,7 @@ export class VideoEditor { /** * Create a JPEG thumbnail from a video * @param options {CreateThumbnailOptions} Options - * @return {Promise} Returns a promise that resolves to the path to the jpeg image on the device + * @returns {Promise} Returns a promise that resolves to the path to the jpeg image on the device */ @Cordova({ callbackOrder: 'reverse' @@ -191,7 +191,7 @@ export class VideoEditor { /** * Get info on a video (width, height, orientation, duration, size, & bitrate) * @param options {GetVideoInfoOptions} Options - * @return {Promise} Returns a promise that resolves to an object containing info on the video + * @returns {Promise} Returns a promise that resolves to an object containing info on the video */ @Cordova({ callbackOrder: 'reverse' diff --git a/src/plugins/webintent.ts b/src/plugins/webintent.ts index 098aee294..3d1cc7d45 100644 --- a/src/plugins/webintent.ts +++ b/src/plugins/webintent.ts @@ -35,21 +35,43 @@ export class WebIntent { return window.plugins.webintent.EXTRA_TEXT; } + /** + * @param options {Object} { action: any, url: string, type?: string } + * @returns {Promise} + */ @Cordova() static startActivity(options: { action: any, url: string, type?: string }): Promise { return; } + /** + * @param extra {any} + * @returns {Promise} + */ @Cordova() static hasExtra(extra: any): Promise { return; } + /** + * @param extra {any} + * @returns {Promise} + */ @Cordova() static getExtra(extra: any): Promise { return; } + /** + * @returns {Promise} + */ @Cordova() static getUri(): Promise { return; }; + /** + * @returns {Promise} + */ @Cordova() static onNewIntent(): Promise { return; }; + /** + * @param options {Object} { action: string, extras?: { option: boolean } } + * @returns {Promise} + */ @Cordova() static sendBroadcast(options: { action: string, extras?: { option: boolean } }): Promise { return; } diff --git a/src/plugins/z-bar.ts b/src/plugins/z-bar.ts index 1194bdd1c..5e571400a 100644 --- a/src/plugins/z-bar.ts +++ b/src/plugins/z-bar.ts @@ -50,7 +50,7 @@ export class ZBar { /** * Open the scanner * @param options { ZBarOptions } Scan options - * @return Returns a Promise that resolves with the scanned string, or rejects with an error. + * @returns {Promise} Returns a Promise that resolves with the scanned string, or rejects with an error. */ @Cordova() static scan(options: ZBarOptions): Promise { return; } diff --git a/src/plugins/zip.ts b/src/plugins/zip.ts index 7a2e431d5..a8b6643ad 100644 --- a/src/plugins/zip.ts +++ b/src/plugins/zip.ts @@ -29,7 +29,7 @@ export class Zip { * @param sourceZip {string} Source ZIP file * @param destUrl {string} Destination folder * @param onProgress {Function} optional callback to be called on progress update - * @return {Promise} returns a promise that resolves with a number. 0 is success, -1 is error + * @returns {Promise} returns a promise that resolves with a number. 0 is success, -1 is error */ @Cordova({ successIndex: 2, From bb321057d2566c32129d10cd98fe7541d3f92c1a Mon Sep 17 00:00:00 2001 From: Wyatt Arent Date: Wed, 30 Nov 2016 10:58:22 -0700 Subject: [PATCH 373/382] Update camera-preview.ts Minor typo fix & maintain lowercase convention. --- 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 14a97e8da..bd38e15f5 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -40,7 +40,7 @@ export interface CameraPreviewSize { * 'front', // default camera * true, // tap to take picture * false, // disable drag - * false, // Keep preview in front. Set to false (back of the screen) to apply overlaying elements + * false, // keep preview in front. Set to true (back of the screen) to apply overlaying elements * 1 // set the preview alpha * ); * From 9c8259f65990951d3b778dcada5829b91519e649 Mon Sep 17 00:00:00 2001 From: Abdelaziz Bennouna Date: Thu, 1 Dec 2016 14:36:56 +0000 Subject: [PATCH 374/382] Update camera.ts Fixes cameraDirection values DOC. Maybe doc should link also to os-specific quirks, e.g. https://github.com/apache/cordova-plugin-camera#module_Camera.Direction for cameraDirection? --- src/plugins/camera.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index dcca08ab9..fd7e4d898 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -56,8 +56,8 @@ export interface CameraOptions { /** * Choose the camera to use (front- or back-facing). * Defined in Camera.Direction. Default is BACK. - * FRONT: 0 - * BACK: 1 + * BACK: 0 + * FRONT: 1 */ cameraDirection?: number; /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */ From 9ab73602af99641716db9ce3dae3fd0462f298be Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Thu, 1 Dec 2016 09:50:21 -0600 Subject: [PATCH 375/382] docs(camera): Add link to platform-specific options quirks --- src/plugins/camera.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index fd7e4d898..ee9f654e7 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -192,7 +192,7 @@ export class Camera { /** * 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. Optional + * @param {CameraOptions?} options optional. Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-). * @returns {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error. */ @Cordova({ From e6700a360e03d68afe3ea0dbd66153e1a4362bf3 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:37:00 -0500 Subject: [PATCH 376/382] fix(card-io): fix typo in options --- src/plugins/card-io.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index 3e5a2b722..e38e2b878 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -57,7 +57,7 @@ export class CardIO { export interface CardIOOptions { requireExpiry?: boolean; - requireCCV?: boolean; + requireCVV?: boolean; requirePostalCode?: boolean; supressManual?: boolean; restrictPostalCodeToNumericOnly?: boolean; From 2e82320b4c408b5ab358e297aaa2c62c6b1486b7 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:45:02 -0500 Subject: [PATCH 377/382] feat(card-io): add typing for response --- src/plugins/card-io.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index e38e2b878..fec7fe8f7 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -45,7 +45,7 @@ export class CardIO { * @param {CardIOOptions} options Options for configuring the plugin */ @Cordova() - static scan(options?: CardIOOptions): Promise { return; } + static scan(options?: CardIOOptions): Promise { return; } /** * Retrieve the version of the card.io library. Useful when contacting support. @@ -73,3 +73,14 @@ export interface CardIOOptions { useCardIOLogo?: boolean; supressScan?: boolean; } + +export interface CardIOResponse { + cardType: string; + redactedCardNumber: string; + cardNumber: string; + expiryMonth: number; + expiryYear: number; + cvv: string; + postalCode: string; + cardholderName: string; +} From c4acbfe095bfb7586a6c43321c0912b88bb45b1b Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:47:27 -0500 Subject: [PATCH 378/382] chore(): tslint --- src/plugins/globalization.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index a7706b71e..f53aa1abd 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -93,14 +93,14 @@ export class Globalization { /** * Returns a number formatted as a string according to the client's user preferences. - * @param number {Number} The number to convert + * @param numberToConvert {Number} The number to convert * @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency. */ @Cordova({ successIndex: 1, errorIndex: 2 }) - static numberToString(number: number, options: { type: string }): Promise<{ value: string }> { return; } + static numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { return; } /** * From 914d1442b60f97d38ac035308516fe1c0cc7d27b Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:48:29 -0500 Subject: [PATCH 379/382] 2.2.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 637c6d9b1..a1ed2a541 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.7", + "version": "2.2.8", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 693d344deab4e2a241ba948e18912e44d7665257 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:48:52 -0500 Subject: [PATCH 380/382] chore(): update changelog --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1940766a..4b8e1e505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +## [2.2.8](https://github.com/driftyco/ionic-native/compare/v2.2.7...v2.2.8) (2016-12-01) + + +### Bug Fixes + +* **card-io:** fix typo in options ([e6700a3](https://github.com/driftyco/ionic-native/commit/e6700a3)) +* **globalization:** add missing parameter to numberToString function ([1072ab1](https://github.com/driftyco/ionic-native/commit/1072ab1)), closes [#835](https://github.com/driftyco/ionic-native/issues/835) + + +### Features + +* **card-io:** add typing for response ([2e82320](https://github.com/driftyco/ionic-native/commit/2e82320)) + + + ## [2.2.7](https://github.com/driftyco/ionic-native/compare/v2.2.5...v2.2.7) (2016-11-24) From 67e0713f18440c20643589fc1d290a4df2c1dc68 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:54:38 -0500 Subject: [PATCH 381/382] 2.2.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1ed2a541..c4cad5408 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.2.8", + "version": "2.2.9", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", From 717c1438c4da712b8c18bd19103c00c4aadb7fe1 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 1 Dec 2016 18:55:59 -0500 Subject: [PATCH 382/382] docs(deeplink): update broken return type --- src/plugins/deeplinks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/deeplinks.ts b/src/plugins/deeplinks.ts index e84c18c79..ecd44ce53 100644 --- a/src/plugins/deeplinks.ts +++ b/src/plugins/deeplinks.ts @@ -98,7 +98,7 @@ export class Deeplinks { * matches the path, the resulting path-data pair will be returned in the * promise result which you can then use to navigate in the app as you see fit. * - * @returns {Observable} Returns an Observable that resolves each time a deeplink comes through, and * errors if a deeplink comes through that does not match a given path. */ @Cordova({