From 9eb63a0d74102b6fb86d3f9e1963a483659055de Mon Sep 17 00:00:00 2001 From: mhartington Date: Fri, 8 Jul 2016 15:19:13 -0400 Subject: [PATCH 01/42] docs(): massive updates --- src/plugins/camera.ts | 12 ++++++-- src/plugins/card-io.ts | 4 +-- src/plugins/clipboard.ts | 12 ++++---- src/plugins/contacts.ts | 3 -- src/plugins/datepicker.ts | 5 ++-- src/plugins/deviceorientation.ts | 4 +-- src/plugins/dialogs.ts | 24 ++++++++-------- src/plugins/facebook.ts | 4 +-- src/plugins/globalization.ts | 48 +++++++++++++++++++------------- src/plugins/network.ts | 4 +++ 10 files changed, 67 insertions(+), 53 deletions(-) diff --git a/src/plugins/camera.ts b/src/plugins/camera.ts index aef94980..63203f3f 100644 --- a/src/plugins/camera.ts +++ b/src/plugins/camera.ts @@ -95,7 +95,7 @@ export interface CameraPopoverOptions { * @usage * ```js * import {Camera} from 'ionic-native'; - * + * * Camera.getPicture(options).then((imageData) => { * // imageData is either a base64 encoded string or a file URI * // If it's base64: @@ -113,8 +113,8 @@ export interface CameraPopoverOptions { export class Camera { /** * Take a picture or video, or load one from the library. - * @param {CameraOptions} options - * @return 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. + * @param {CameraOptions} options Options that you want to pass to the camera. Encoding type, quality, etc. + * @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. */ @Cordova({ callbackOrder: 'reverse' @@ -132,6 +132,7 @@ export class Camera { static cleanup() { }; /** + * @private * @enum {number} */ static DestinationType = { @@ -144,6 +145,7 @@ export class Camera { }; /** + * @private * @enum {number} */ static EncodingType = { @@ -153,6 +155,7 @@ export class Camera { PNG: 1 }; /** + * @private * @enum {number} */ static MediaType = { @@ -165,6 +168,7 @@ export class Camera { }; /** + * @private * @enum {number} */ static PictureSourceType = { @@ -177,6 +181,7 @@ export class Camera { }; /** + * @private * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover. * @enum {number} */ @@ -189,6 +194,7 @@ export class Camera { }; /** + * @private * @enum {number} */ static Direction = { diff --git a/src/plugins/card-io.ts b/src/plugins/card-io.ts index d5045e8c..77d0bc23 100644 --- a/src/plugins/card-io.ts +++ b/src/plugins/card-io.ts @@ -41,7 +41,7 @@ export class CardIO { /** * Scan a credit card with card.io. - * @param options + * @param {CardIOOptions} options Options for configuring the plugin */ @Cordova() static scan(options?: CardIOOptions): Promise {return; } @@ -70,4 +70,4 @@ export interface CardIOOptions { hideCardIOLogo?: boolean; useCardIOLogo?: boolean; supressScan?: boolean; -} \ No newline at end of file +} diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts index ab35b6f7..8c95da47 100644 --- a/src/plugins/clipboard.ts +++ b/src/plugins/clipboard.ts @@ -18,12 +18,12 @@ import {Plugin, Cordova} from './plugin'; * * Clipboard.paste().then( * (resolve : string) => { - * alert(resolve); -* }, + * alert(resolve); + * }, * (reject : string) => { * alert("Error: " + reject); * } -* ); + * ); * ); * ``` */ @@ -37,15 +37,15 @@ export class Clipboard { /** * Copies the given text - * @param text - * @returns {Promise} + * @param {string} text Text that gets copied on the system clipboard + * @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 {Promise} Returns a promise after the text has been pasted */ @Cordova() static paste(): Promise { return; } diff --git a/src/plugins/contacts.ts b/src/plugins/contacts.ts index 7cee7187..e079b69c 100644 --- a/src/plugins/contacts.ts +++ b/src/plugins/contacts.ts @@ -265,9 +265,6 @@ export class Contacts { } /** * Search for contacts in the Contacts list. - * - * Example: Contacts.find(['*'], { filter: 'Max' }) // will search for a displayName of 'Max' - * * @param fields {string[]} Contact fields to be used as a search qualifier. * A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR. * A contactFields value of "*" searches all contact fields. diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index 8e70adcb..222fcefd 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -77,7 +77,6 @@ export interface DatePickerOptions { * import {DatePicker} from 'ionic-native'; * * - * * DatePicker.show({ * date: new Date(), * mode: 'date' @@ -97,10 +96,10 @@ export class DatePicker { /** * Shows the date and/or time picker dialog(s) - * @param options + * @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; } -} \ No newline at end of file +} diff --git a/src/plugins/deviceorientation.ts b/src/plugins/deviceorientation.ts index a923d68b..916ad9df 100644 --- a/src/plugins/deviceorientation.ts +++ b/src/plugins/deviceorientation.ts @@ -83,8 +83,8 @@ export class DeviceOrientation { * Get the device current heading at a regular interval * * Stop the watch by unsubscribing from the observable - * @param options - * @returns {Observable} + * @param {CompassOptions} options Options for compass. Frequency and Filter. Optional + * @returns {Observable} Returns an observable that contains the compass heading */ @Cordova({ callbackOrder: 'reverse', diff --git a/src/plugins/dialogs.ts b/src/plugins/dialogs.ts index 835d8803..384e700a 100644 --- a/src/plugins/dialogs.ts +++ b/src/plugins/dialogs.ts @@ -40,9 +40,9 @@ export class Dialogs { /** * Shows a custom alert or dialog box. - * @param message Dialog message. (String) - * @param title Dialog title. (String) (Optional, defaults to Alert) - * @param buttonName Button name. (String) (Optional, defaults to OK) + * @param {string} message Dialog message. + * @param {string} title Dialog title. (Optional, defaults to Alert) + * @param {string} buttonName Button name. (Optional, defaults to OK) * @returns {Promise} Returns a blank promise once the user has dismissed the alert. */ @Cordova({ @@ -57,9 +57,9 @@ export class Dialogs { /** * Displays a customizable confirmation dialog box. - * @param message Dialog message. (String) - * @param title Dialog title. (String) (Optional, defaults to Confirm) - * @param buttonLabels Array of strings specifying button labels. (Array) (Optional, defaults to [OK,Cancel]) + * @param {string} message Dialog message. + * @param {string} title Dialog title. (Optional, defaults to Confirm) + * @param {Array} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel]) * @returns {Promise} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing. */ @Cordova({ @@ -74,10 +74,10 @@ export class Dialogs { /** * Displays a native dialog box that is more customizable than the browser's prompt function. - * @param message Dialog message. (String) - * @param title Dialog title (String) (Optional, defaults to Prompt) - * @param buttonLabels Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"]) - * @param defaultText Default textbox input value (String) (Optional, Default: empty string) + * @param {string} message Dialog message. + * @param {string} title Dialog title. (Optional, defaults to Prompt) + * @param {Array} buttonLabels Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"]) + * @param {string} defaultText Default textbox input value. (Optional, Default: empty string) * @returns {Promise} Returns a promise that resolves an object with the button index clicked and the text entered */ @Cordova({ @@ -94,11 +94,11 @@ export class Dialogs { /** * The device plays a beep sound. - * @param times The number of times to repeat the beep. (Number) + * @param {numbers} times The number of times to repeat the beep. */ @Cordova({ sync: true }) static beep(times: number): void {} -} \ No newline at end of file +} diff --git a/src/plugins/facebook.ts b/src/plugins/facebook.ts index 4ceaf43a..8047fa93 100644 --- a/src/plugins/facebook.ts +++ b/src/plugins/facebook.ts @@ -87,8 +87,8 @@ export class Facebook { /** * Browser wrapper - * @param appId - * @param version + * @param {number} appId Your Facebook AppID from their dashboard + * @param {string} version The version of API you may want to use. Optional */ @Cordova() static browserInit(appId: number, version?: string): Promise { diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts index bd43c954..b5ad6cf3 100644 --- a/src/plugins/globalization.ts +++ b/src/plugins/globalization.ts @@ -34,9 +34,9 @@ export class Globalization { /** * Converts date to string - * @param date - * @param options - * @return {Promise<{value: 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. */ @Cordova({ successIndex: 1, @@ -45,9 +45,10 @@ export class Globalization { static dateToString(date: Date, options: {formatLength: string, selector: string}): Promise<{value: string}> {return; } /** - * - * @param dateString - * @param options + * 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. */ @Cordova({ successIndex: 1, @@ -57,8 +58,9 @@ export class Globalization { /** - * - * @param options + * 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. */ @Cordova({ callbackOrder: 'reverse' @@ -67,8 +69,9 @@ export class Globalization { /** - * - * @param options + * 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. */ @Cordova({ callbackOrder: 'reverse' @@ -76,20 +79,22 @@ export class Globalization { static getDateNames(options: {type: string, item: string}): Promise<{value: Array}> {return; } /** - * Check if day light saving is active - * @param date + * 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 */ @Cordova() static isDayLightSavingsTime(date: Date): Promise<{dst: string}> {return; } /** - * Get first day of week + * Returns the first day of the week according to the client's user preferences and calendar. + * @returns {Promise} reutrns a promise with the value */ @Cordova() static getFirstDayOfWeek(): Promise<{value: string}> {return; } /** - * + * Returns a number formatted as a string according to the client's user preferences. * @param options */ @Cordova({ @@ -100,8 +105,9 @@ export class Globalization { /** * - * @param stringToConvert - * @param options + * @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. */ @Cordova({ successIndex: 1, @@ -110,8 +116,9 @@ export class Globalization { static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value: number|string}> {return; } /** - * - * @param options + * 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. */ @Cordova({ callbackOrder: 'reverse' @@ -119,8 +126,9 @@ export class Globalization { static getNumberPattern(options: {type: string}): Promise<{pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string}> {return; } /** - * - * @param currencyCode + * 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 */ @Cordova() static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; } diff --git a/src/plugins/network.ts b/src/plugins/network.ts index ba79dfef..25d2a4a8 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -76,6 +76,10 @@ export class Network { } + +/** + * @private + */ export class Connection { static get UNKNOWN() { return 'unknown'; } static get ETHERNET() { return 'ethernet'; } From dd97df19fe9a92879c63458348939eb1fb644adc Mon Sep 17 00:00:00 2001 From: Justin Schuldt Date: Mon, 11 Jul 2016 15:52:51 -0500 Subject: [PATCH 02/42] feat(ibeacon): add iBeacon plugin support (#270) * iBeacon hello-world * moar methods * added comments * comments and descriptions * removed debugging changes * removed dupe export * fixed misspellings and added more interface documentation --- src/index.ts | 3 + src/plugins/ibeacon.ts | 698 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 701 insertions(+) create mode 100644 src/plugins/ibeacon.ts diff --git a/src/index.ts b/src/index.ts index 68268c46..361b18ae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,7 @@ 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 {InAppBrowser} from './plugins/inappbrowser'; import {Insomnia} from './plugins/insomnia'; @@ -82,6 +83,7 @@ export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; export * from './plugins/googlemaps'; export * from './plugins/httpd'; +export * from './plugins/ibeacon'; export * from './plugins/imagepicker'; export * from './plugins/inappbrowser'; export * from './plugins/launchnavigator'; @@ -180,6 +182,7 @@ window['IonicNative'] = { GoogleAnalytics: GoogleAnalytics, Hotspot: Hotspot, Httpd: Httpd, + IBeacon: IBeacon, ImagePicker: ImagePicker, InAppBrowser: InAppBrowser, Keyboard: Keyboard, diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts new file mode 100644 index 00000000..2e89648b --- /dev/null +++ b/src/plugins/ibeacon.ts @@ -0,0 +1,698 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from 'rxjs/Observable'; + +declare var cordova: any; + +export interface Beacon { + /** + * The physical device's identifier. + */ + uuid: string; + + /** + * The beacon's major identifier number. + */ + major: number; + + /** + * The beacon's major identifier number. + */ + minor: number; + + /** + * The proximity of the beacon relative to the phone. + * + * Possible options are: + * ProximityImmediate + * ProximityNear + * ProximityFar + * ProximityUnknown + */ + proximity: 'ProximityImmediate' | 'ProximityNear' | 'ProximityFar' | 'ProximityUnknown'; + + /** + * Transmission Power of the beacon. A constant emitted by the beacon which indicates what's the expected RSSI at a distance of 1 meter to the beacon. + */ + tx: number; + + /** + * Received Signal Strength Indicator. The strength of the beacon's signal when it reaches the device. + * RSSI ranges from aprox -26 (a few inches) to -100 (40-50 m distance). + */ + rssi: number; + + /** + * The accuracy of the ranging. + */ + accuracy: number; + +} +export interface BeaconRegion { + /** + * A unique identifier for this region. + */ + identifier: string; + + /** + * The the beacon identifier the device will "watch" for. Many beacons can share the same uuid. + */ + uuid: string; + + /** + * The beacon's major identifier number. Optional, of nothing is supplied + * the plugin will treat it as a wildcard. + */ + major?: number; + + /** + * The beacon's major identifier number. Optional, of nothing is supplied + * the plugin will treat it as a wildcard. + */ + minor?: number; + + /** + * If set to true the device will scan for beacons and determine region state anytime + * the device's screen is turned on or off. Useful for debugging. + */ + notifyEntryStateOnDisplay?: boolean; +} +export interface CircularRegion { + /** + * A unique identifier for this region. + */ + identifier: string; + + /** + * The latitude of this region. + */ + latitude: number; + + /** + * The longitude of this region. + */ + longitude: number; + + /** + * The radius of the geofence for this region. + */ + radius: number; +} +export type Region = BeaconRegion | CircularRegion; + +export interface PluginResult { + + /** + * The name of the delegate function that produced the PluginResult object. + */ + eventType: string; + + /** + * The region that triggered the event. + */ + region: Region; + + /** + * An array of beacon objects + */ + beacons: Beacon[]; + + /** + * The status of the location permission for iOS. + */ + authorizationStatus: string; + + /** + * The state of the phone in relation to the region. Inside/outside for example. + */ + state: 'CLRegionStateInside' | 'CLRegionStateOutside'; +} +export interface Delegate { + /** + * An observable that publishes information about the location permission authorization status. + * + * @return Returns a string. + */ + didChangeAuthorizationStatus(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the native layer is able to determine the device's state. + * + * This event is called when the phone begins starts monitoring, + * when requestStateForRegion is called, etc. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + didDetermineStateForRegion(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the phone enters a region that it was asked to monitor. + * + * If the user has given the app Always-Location permission, this function + * will be called even when the app is not running on iOS. + * The app will run silently in the background for a small amount of time. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + didEnterRegion(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the phone exits a region that it was asked to monitor. + * + * If the user has given the app Always-Location permission, this function + * will be called even when the app is not running on iOS. + * The app will run silently in the background for a small amount of time. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + didExitRegion(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * each time that the device ranges beacons. Modern Android and iOS devices range + * aproximately once per second. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + didRangeBeaconsInRegion(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the device begins monitoring a region. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + didStartMonitoringForRegion(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the device fails to monitor a region. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + monitoringDidFailForRegionWithError(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the device begins advertising as an iBeacon. + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + peripheralManagerDidStartAdvertising(): Observable; + + /** + * An Observable that publishes event data to it's subscribers + * when the state of the peripheral manager's state updates. + * + * + * @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s). + */ + peripheralManagerDidUpdateState(): Observable; +} + +/** + * @name IBeacon + * @description + * This plugin provides functions for working with iBeacons. + * + * The plugin's API closely mimics the one exposed through the [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html) introduced in iOS 7. + * + * @usage + * + * ```ts + * import {IBeacon} from 'ionic-native'; + * + * + * // Request permission to use location on iOS + * IBeacon.requestAlwaysAuthorization(); + * // create a new delegate and register it with the native layer + * let delegate = IBeacon.Delegate(); + * + * // Subscribe to some of the delegate's event handlers + * delegate.didRangeBeaconsInRegion() + * .subscribe( + * data => {console.log('didRangeBeaconsInRegion: ', data)}, + * error => console.error + * ); + * delegate.didStartMonitoringForRegion() + * .subscribe( + * data => {console.log('didStartMonitoringForRegion: ', data)}, + * error => console.error + * ); + * delegate.didEnterRegion() + * .subscribe( + * data => { + * console.log('didEnterRegion: ', data); + * } + * ); + * + * let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E'); + * + * IBeacon.startMonitoringForRegion(beaconRegion) + * .then( + * () => console.log('Native layer recieved the request to monitoring'), + * error => console.error('Native layer failed to begin monitoring: ', error) + * ); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-ibeacon', + pluginRef: 'cordova.plugins.locationManager', + repo: 'https://github.com/petermetz/cordova-plugin-ibeacon', + platforms: ['Android', 'iOS'] +}) +export class IBeacon { + + + /** + * Instances of this class are delegates between the {@link LocationManager} and + * the code that consumes the messages generated on in the native layer. + * + * @returns {Delegate} An instance of the type {@type Delegate}. + */ + static Delegate(): Delegate { + let delegate = new cordova.plugins.locationManager.Delegate(); + + delegate.didChangeAuthorizationStatus = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.didChangeAuthorizationStatus = cb; + } + ); + }; + + delegate.didDetermineStateForRegion = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.didDetermineStateForRegion = cb; + } + ); + }; + + delegate.didEnterRegion = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.didEnterRegion = cb; + } + ); + }; + + delegate.didExitRegion = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.didExitRegion = cb; + } + ); + }; + + delegate.didRangeBeaconsInRegion = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.didRangeBeaconsInRegion = cb; + } + ); + }; + + delegate.didStartMonitoringForRegion = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.didStartMonitoringForRegion = cb; + } + ); + }; + + delegate.monitoringDidFailForRegionWithError = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.monitoringDidFailForRegionWithError = cb; + } + ); + }; + + delegate.peripheralManagerDidStartAdvertising = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.peripheralManagerDidStartAdvertising = cb; + } + ); + }; + + delegate.peripheralManagerDidUpdateState = (pluginResult?: PluginResult) => { + return new Observable( + (observer: any) => { + let cb = (data: PluginResult) => observer.next(data); + return delegate.peripheralManagerDidUpdateState = cb; + } + ); + }; + + cordova.plugins.locationManager.setDelegate(delegate); + return delegate; + } + + /** + * Creates a new BeaconRegion + * + * @param {String} identifier @see {CLRegion} + * @param {String} uuid The proximity ID of the beacon being targeted. + * This value must not be blank nor invalid as a UUID. + * @param {Number} major The major value that you use to identify one or more beacons. + * @param {Number} minor The minor value that you use to identify a specific beacon. + * @param {BOOL} notifyEntryStateOnDisplay + * + * @return Returns the BeaconRegion that was created + */ + static BeaconRegion(identifer: string, uuid: string, minor?: number, major?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { + return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, minor, major, notifyEntryStateOnDisplay); + } + + /** + * @return Returns the Delegate + */ + @Cordova() + static getDelegate(): Delegate { return; } + + /** + * @param {Delegate} delegate An instance of a delegate to register with the native layer. + * + * @return Returns the Delegate + */ + @Cordova() + static setDelegate(delegate: Delegate): Delegate { return; } + + /** + * Signals the native layer that the client side is ready to consume messages. + * Readiness here means that it has a {Delegate} set by the consumer javascript + * code. + * + * The {LocationManager.setDelegate()} will implicitly call this method as well, + * therefore the only case when you have to call this manually is if you don't + * wish to specify a {Delegate} of yours. + * + * The purpose of this signaling mechanism is to make the events work when the + * app is being woken up by the Operating System to give it a chance to handle + * region monitoring events for example. + * + * If you don't set a {Delegate} and don't call this method manually, an error + * message get emitted in the native runtime and the DOM as well after a certain + * period of time. + * + * @return Returns a promise which is resolved as soon as the + * native layer acknowledged the request and started to send events. + */ + @Cordova({sync: true}) + static onDomDelegateReady(): Promise { return; } + + /** + * Determines if bluetooth is switched on, according to the native layer. + * @returns Returns a promise which is resolved with a {Boolean} + * indicating whether bluetooth is active. + */ + @Cordova({sync: true}) + static isBluetoothEnabled(): Promise { return; } + + /** + * Enables Bluetooth using the native Layer. (ANDROID ONLY) + * + * @returns Returns a promise which is resolved when Bluetooth + * could be enabled. If not, the promise will be rejected with an error. + */ + @Cordova({sync: true}) + static enableBluetooth(): Promise { return; } + + /** + * Disables Bluetooth using the native Layer. (ANDROID ONLY) + * + * @returns Returns a promise which is resolved when Bluetooth + * could be enabled. If not, the promise will be rejected with an error. + */ + @Cordova({sync: true}) + static disableBluetooth(): Promise { return; } + + /** + * Start monitoring the specified region. + * + * If a region of the same type with the same identifier is already being + * monitored for this application, + * it will be removed from monitoring. For circular regions, the region + * monitoring service will prioritize + * regions by their size, favoring smaller regions over larger regions. + * + * This is done asynchronously and may not be immediately reflected in monitoredRegions. + * + * @param {Region} region An instance of {Region} which will be monitored + * by the operating system. + * + * @return Returns a promise which is resolved as soon as the + * native layer acknowledged the dispatch of the monitoring request. + */ + @Cordova({sync: true}) + static startMonitoringForRegion(region: BeaconRegion): Promise { return; } + + /** + * Stop monitoring the specified region. It is valid to call + * stopMonitoringForRegion: for a region that was registered for monitoring + * with a different location manager object, during this or previous + * launches of your application. + * + * This is done asynchronously and may not be immediately reflected in monitoredRegions. + * + * @param {Region} region An instance of {Region} which will be monitored + * by the operating system. + * + * @return Returns a promise which is resolved as soon as the + * native layer acknowledged the dispatch of the request to stop monitoring. + */ + @Cordova({sync: true}) + static stopMonitoringForRegion(region: BeaconRegion): Promise { return; } + + /** + * Request state the for specified region. When result is ready + * didDetermineStateForRegion is triggered. This can be any region, + * also those which is not currently monitored. + * + * This is done asynchronously and may not be immediately reflected in monitoredRegions. + * + * @param {Region} region An instance of {Region} which will be monitored + * by the operating system. + * + * @return Returns a promise which is resolved as soon as the + * native layer acknowledged the dispatch of the request to stop monitoring. + */ + @Cordova({sync: true}) + static requestStateForRegion(region: Region): Promise { return; } + + + /** + * Start ranging the specified beacon region. + * + * If a region of the same type with the same identifier is already being + * monitored for this application, it will be removed from monitoring. + * + * This is done asynchronously and may not be immediately reflected in rangedRegions. + * + * @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 + * native layer acknowledged the dispatch of the monitoring request. + */ + @Cordova({sync: true}) + static startRangingBeaconsInRegion(region: BeaconRegion): Promise { return; } + + /** + * Stop ranging the specified region. It is valid to call + * stopMonitoringForRegion: for a region that was registered for ranging + * with a different location manager object, during this or previous + * launches of your application. + * + * This is done asynchronously and may not be immediately reflected in rangedRegions. + * + * @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 + * native layer acknowledged the dispatch of the request to stop monitoring. + */ + @Cordova({sync: true}) + static stopRangingBeaconsInRegion(region: BeaconRegion): Promise { return; } + + /** + * Queries the native layer to determine the current authorization in effect. + * + * @returns Returns a promise which is resolved with the + * requested authorization status. + */ + @Cordova({sync: true}) + static getAuthorizationStatus(): Promise { return; } + + /** + * For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to + * explicitly request permissions via methods like these: + * requestWhenInUseAuthorization + * 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. + */ + @Cordova({sync: true}) + static requestWhenInUseAuthorization(): Promise { return; } + + + /** + * See the docuemntation of {@code requestWhenInUseAuthorization} for further details. + * + * @returns Returns a promise which is resolved when the native layer + * shows the request dialog. + */ + @Cordova({sync: true}) + static requestAlwaysAuthorization(): Promise { return; } + + /** + * + * @returns Returns a promise which is resolved with an {Array} + * of {Region} instances that are being monitored by the native layer. + */ + @Cordova({sync: true}) + static getMonitoredRegions(): Promise { return; } + + /** + * + * @returns Returns a promise which is resolved with an {Array} + * of {Region} instances that are being ranged by the native layer. + */ + @Cordova({sync: true}) + static getRangedRegions(): Promise { return; } + + /** + * Determines if ranging is available or not, according to the native layer. + * @returns Returns a promise which is resolved with a {Boolean} + * indicating whether ranging is available or not. + */ + @Cordova({sync: true}) + static isRangingAvailable(): Promise { return; } + + /** + * Determines if region type is supported or not, according to the native layer. + * + * @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} + * indicating whether the region type is supported or not. + */ + @Cordova({sync: true}) + static isMonitoringAvailableForClass(region: Region): Promise { return; } + + /** + * Start advertising the specified region. + * + * If a region a different identifier is already being advertised for + * this application, it will be replaced with the new identifier. + * + * This call will accept a valid beacon even when no BlueTooth is available, + * and will start when BlueTooth is powered on. See {Delegate.} + * + * @param {Region} region An instance of {Region} which will be advertised + * by the operating system. + * @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 + * native layer acknowledged the dispatch of the advertising request. + */ + @Cordova({sync: true}) + static startAdvertising(region: Region, measuredPower: number): Promise { return; } + + /** + * Stop advertising as a beacon. + * + * This is done asynchronously and may not be immediately reflected in isAdvertising. + * + * @return Returns a promise which is resolved as soon as the + * native layer acknowledged the dispatch of the request to stop advertising. + */ + @Cordova({sync: true}) + static stopAdvertising(region: Region): Promise { return; } + + /** + * Determines if advertising is available or not, according to the native layer. + * @returns Returns a promise which is resolved with a {Boolean} + * indicating whether advertising is available or not. + */ + @Cordova({sync: true}) + static isAdvertisingAvailable(): Promise { return; } + + /** + * Determines if advertising is currently active, according to the native layer. + * @returns Returns a promise which is resolved with a {Boolean} + * indicating whether advertising is active. + */ + @Cordova({sync: true}) + static isAdvertising(): Promise { return; } + + /** + * Disables debug logging in the native layer. Use this method if you want + * to prevent this plugin from writing to the device logs. + * + * @returns Returns a promise which is resolved as soon as the + * native layer has set the logging level accordingly. + */ + @Cordova({sync: true}) + static disableDebugLogs(): Promise { return; } + + /** + * Enables the posting of debug notifications in the native layer. Use this method if you want + * 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 + * native layer has set the flag to enabled. + */ + @Cordova({sync: true}) + static enableDebugNotifications(): Promise { return; } + + /** + * 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 + * native layer has set the flag to disabled. + */ + @Cordova({sync: true}) + static disableDebugNotifications(): Promise { return; } + + /** + * 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 + * native layer has set the logging level accordingly. + */ + @Cordova({sync: true}) + static enableDebugLogs(): Promise { return; } + + /** + * Appends the provided [message] to the device logs. + * Note: If debug logging is turned off, this won't do anything. + * + * @param {String} message The message to append to the device logs. + * + * @returns 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. + */ + @Cordova({sync: true}) + static appendToDeviceLog(message: string): Promise { return; } + +} \ No newline at end of file From 2b4e318072372144466bf00ec9cc6b769ea01700 Mon Sep 17 00:00:00 2001 From: DGoms Date: Mon, 11 Jul 2016 22:53:35 +0200 Subject: [PATCH 03/42] chore(): Update index.ts (#281) Unable to import interface like FileUploadOptions --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 361b18ae..c6fb2d01 100644 --- a/src/index.ts +++ b/src/index.ts @@ -81,6 +81,7 @@ export * from './plugins/datepicker'; export * from './plugins/device'; export * from './plugins/devicemotion'; export * from './plugins/deviceorientation'; +export * from './plugins/filetransfer'; export * from './plugins/googlemaps'; export * from './plugins/httpd'; export * from './plugins/ibeacon'; From 7c20bddd174a4ead1155673d8ebacfe0cc79eb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateo=20Tibaquir=C3=A1?= Date: Mon, 11 Jul 2016 16:15:11 -0500 Subject: [PATCH 04/42] docs(backgroundMode): fix plugin npm ID (#282) @ihadeed I meant this fix, `de.appplant.cordova.plugin.background-mode` doesn't exist on npm ;) --- 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 59afd65a..9bc7f9b8 100644 --- a/src/plugins/backgroundmode.ts +++ b/src/plugins/backgroundmode.ts @@ -26,7 +26,7 @@ import {Plugin, Cordova} from './plugin'; * */ @Plugin({ - plugin: 'de.appplant.cordova.plugin.background-mode', + plugin: 'cordova-plugin-background-mode', pluginRef: 'cordova.plugins.backgroundMode', repo: 'https://github.com/katzer/cordova-plugin-background-mode', platforms: ['Android', 'iOS', 'Windows Phone 8'] From 6229d4932e5c09c98781229177136f51b1ff71f1 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 17:15:34 -0400 Subject: [PATCH 05/42] refactor(network): remove Connection class closes #278 --- src/index.ts | 4 +--- src/plugins/network.ts | 24 +++++------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/index.ts b/src/index.ts index 68268c46..e030ed5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,7 +51,7 @@ import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; import {MediaPlugin} from './plugins/media'; -import {Network, Connection} from './plugins/network'; +import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; @@ -107,7 +107,6 @@ export { BLE, BluetoothSerial, Clipboard, - Connection, DBMeter, Deeplinks, DeviceAccounts, @@ -158,7 +157,6 @@ window['IonicNative'] = { Camera: Camera, CardIO: CardIO, Clipboard: Clipboard, - Connection: Connection, Contacts: Contacts, DatePicker: DatePicker, DBMeter: DBMeter, diff --git a/src/plugins/network.ts b/src/plugins/network.ts index 25d2a4a8..43bbba3d 100644 --- a/src/plugins/network.ts +++ b/src/plugins/network.ts @@ -10,7 +10,7 @@ declare var navigator: any; * * @usage * ```js - * import {Network, Connection} from 'ionic-native'; + * import {Network} from 'ionic-native'; * * // watch network for a disconnect * let disconnectSubscription = Network.onDisconnect().subscribe(() => { @@ -28,8 +28,7 @@ declare var navigator: any; *
// before we determine the connection type. Might need to wait
 * // prior to doing any api requests as well. * setTimeout(() => { - * console.log(Network.connection); - * if (Network.connection === Connection.WIFI) { + * if (Network.connection === 'wifi') { * console.log('we got a wifi connection, woohoo!'); * } * }, 3000); @@ -39,6 +38,8 @@ declare var navigator: any; * connectSubscription.unsubscribe(); * * ``` + * @advanced + * The `connection` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none` */ @Plugin({ plugin: 'cordova-plugin-network-information', @@ -52,7 +53,7 @@ export class Network { * Return the network connection type */ @CordovaProperty - static get connection(): Connection { return navigator.connection.type; } + static get connection(): String { return navigator.connection.type; } /** * Get notified when the device goes offline @@ -75,18 +76,3 @@ export class Network { static onConnect(): Observable { return; } } - - -/** - * @private - */ -export class Connection { - static get UNKNOWN() { return 'unknown'; } - static get ETHERNET() { return 'ethernet'; } - static get WIFI() { return 'wifi'; } - static get CELL_2G() { return '2g'; } - static get CELL_3G() { return '3g'; } - static get CELL_4G() { return '4g'; } - static get CELL() { return 'cellular'; } - static get NONE() { return 'none'; } -} From e150224cda22815abf23b254309469c5038e43c5 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 17:20:11 -0400 Subject: [PATCH 06/42] fix(socialsharing): all methods return Promises now closes #275 --- src/plugins/socialsharing.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/socialsharing.ts b/src/plugins/socialsharing.ts index f94d7554..c6053bad 100644 --- a/src/plugins/socialsharing.ts +++ b/src/plugins/socialsharing.ts @@ -28,10 +28,8 @@ export class SocialSharing { * @param file {string|Array} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone. * @param url {string} A URL to share */ - @Cordova({ - sync: true - }) - static share (message?: string, subject?: string, file?: string|Array, url?: string): void {} + @Cordova() + static share (message?: string, subject?: string, file?: string|Array, url?: string): Promise {return; } /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) @@ -58,10 +56,9 @@ export class SocialSharing { * @param url */ @Cordova({ - sync: true, platforms: ['iOS', 'Android'] }) - static shareViaTwitter (message: string, image?: string, url?: string): void {} + static shareViaTwitter (message: string, image?: string, url?: string): Promise {return; } /** * Shares directly to Facebook From 00d35c636b23370920c1c97346b7a4e836fad34c Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 17:22:45 -0400 Subject: [PATCH 07/42] chore(index): add background mode to IonicNative variable --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index e6b222fc..95a0eb0f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -150,6 +150,7 @@ window['IonicNative'] = { AppVersion: AppVersion, Badge: Badge, BackgroundGeolocation: BackgroundGeolocation, + BackgroundMode: BackgroundMode, BarcodeScanner: BarcodeScanner, Base64ToGallery: Base64ToGallery, BatteryStatus: BatteryStatus, From 4f0cd244765518b88c472fe22a366411fa8a4217 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 17:40:51 -0400 Subject: [PATCH 08/42] fix(geolocation): fix plugin reference closes #258 --- src/plugins/background-geolocation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index f4951530..28d4435b 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -177,7 +177,7 @@ export interface Config { * debug: true, // enable this hear sounds for background-geolocation life-cycle. * stopOnTerminate: false, // enable this to clear background location settings when the app terminates * }; - * + * * BackgroundGeolocation.configure(config) * .then((location) => { * console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude); @@ -202,7 +202,7 @@ export interface Config { */ @Plugin({ plugin: 'cordova-plugin-mauron85-background-geolocation', - pluginRef: 'plugins.backgroundGeoLocation', + pluginRef: 'plugins.backgroundGeolocation', repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation', platforms: ['iOS', 'Android', 'Windows Phone 8'] }) From b8a513301ea9e58691f98ae27e0d89e7e9b1eacd Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 17:42:11 -0400 Subject: [PATCH 09/42] fix(background-geolocation): fix pluginref again --- src/plugins/background-geolocation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/background-geolocation.ts b/src/plugins/background-geolocation.ts index 28d4435b..9ed15e67 100644 --- a/src/plugins/background-geolocation.ts +++ b/src/plugins/background-geolocation.ts @@ -202,7 +202,7 @@ export interface Config { */ @Plugin({ plugin: 'cordova-plugin-mauron85-background-geolocation', - pluginRef: 'plugins.backgroundGeolocation', + pluginRef: 'backgroundGeolocation', repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation', platforms: ['iOS', 'Android', 'Windows Phone 8'] }) From 360888563f4addd561a07f575e0ec125f57258c9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 17:44:02 -0400 Subject: [PATCH 10/42] refactor(push): add missing semicolumns --- src/plugins/push.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/push.ts b/src/plugins/push.ts index eec40e24..42cb47d3 100644 --- a/src/plugins/push.ts +++ b/src/plugins/push.ts @@ -191,24 +191,24 @@ export interface IOSPushOptions { * The data required in order to enable Action Buttons for iOS. * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1 */ - categories?: CategoryArray + categories?: CategoryArray; } export interface CategoryArray { - [name: string]: CategoryAction + [name: string]: CategoryAction; } export interface CategoryAction { - yes?: CategoryActionData - no?: CategoryActionData - maybe?: CategoryActionData + yes?: CategoryActionData; + no?: CategoryActionData; + maybe?: CategoryActionData; } export interface CategoryActionData { - callback: string - title: string - foreground: boolean - destructive: boolean + callback: string; + title: string; + foreground: boolean; + destructive: boolean; } export interface AndroidPushOptions { From 5c72340a37edb17d80656e68ecd95975f5600f9f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 18:36:13 -0400 Subject: [PATCH 11/42] 1.3.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 227d20a0..7d05ce6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.2", + "version": "1.3.3", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 9a28b24a0b7e4cbd68f03b0fe3c942a6c3576e72 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Jul 2016 18:36:51 -0400 Subject: [PATCH 12/42] chore(): update changelog --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9fbfa40..2c73e28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ + +## [1.3.3](https://github.com/driftyco/ionic-native/compare/v1.3.2...v1.3.3) (2016-07-11) + + +### Bug Fixes + +* remove unnecessary decorator ([#257](https://github.com/driftyco/ionic-native/issues/257)) ([25fab64](https://github.com/driftyco/ionic-native/commit/25fab64)) +* **actionsheet:** add missing optional parameter for hide function ([#262](https://github.com/driftyco/ionic-native/issues/262)) ([644e999](https://github.com/driftyco/ionic-native/commit/644e999)) +* **background-geolocation:** fix pluginref again ([b8a5133](https://github.com/driftyco/ionic-native/commit/b8a5133)) +* **geolocation:** fix plugin reference ([4f0cd24](https://github.com/driftyco/ionic-native/commit/4f0cd24)), closes [#258](https://github.com/driftyco/ionic-native/issues/258) +* **googlemaps:** use correct methods for addGroundOverlay and addKmlOverlay ([#268](https://github.com/driftyco/ionic-native/issues/268)) ([b8be1de](https://github.com/driftyco/ionic-native/commit/b8be1de)) +* **socialsharing:** all methods return Promises now ([e150224](https://github.com/driftyco/ionic-native/commit/e150224)), closes [#275](https://github.com/driftyco/ionic-native/issues/275) + + +### Features + +* **ibeacon:** add iBeacon plugin support ([#270](https://github.com/driftyco/ionic-native/issues/270)) ([dd97df1](https://github.com/driftyco/ionic-native/commit/dd97df1)) +* **onesignal:** added wrapper for the Cordova OneSignal Plugin ([#252](https://github.com/driftyco/ionic-native/issues/252)) ([ba20dbe](https://github.com/driftyco/ionic-native/commit/ba20dbe)) +* **push:** added support for Action Buttons on iOS with categories ([#273](https://github.com/driftyco/ionic-native/issues/273)) ([592feb4](https://github.com/driftyco/ionic-native/commit/592feb4)) + + + ## [1.3.2](https://github.com/driftyco/ionic-native/compare/v1.3.1...v1.3.2) (2016-06-27) From 0315e637829b5acbf9888c0f23e5b9734c8269b8 Mon Sep 17 00:00:00 2001 From: Nick Kenens Date: Wed, 13 Jul 2016 23:36:23 +0200 Subject: [PATCH 13/42] Update spinnerdialog.ts to fix wrong documentation (#287) Just implemented the SpinnerDialog into my app to use with Ionic Deploy. The cancelCallback still happens when set to "false", when setting it to "true, the cancelCallback doesn't get called and therefore the SpinnerDialog doesn't hide on Android. --- src/plugins/spinnerdialog.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/spinnerdialog.ts b/src/plugins/spinnerdialog.ts index 3f019609..b577ee57 100644 --- a/src/plugins/spinnerdialog.ts +++ b/src/plugins/spinnerdialog.ts @@ -27,7 +27,7 @@ export class SpinnerDialog { * Shows the spinner dialog * @param title {string} Spinner title (shows on Android only) * @param message {string} Spinner message - * @param cancelCallback {boolean|function} Set to false to set spinner not cancelable. Or provide a function to call when the user cancels the spinner. + * @param cancelCallback {boolean|function} Set to true to set spinner not cancelable. Or provide a function to call when the user cancels the spinner. * @param iOSOptions {object} Options for iOS only */ @Cordova({ @@ -50,4 +50,4 @@ export interface SpinnerDialogIOSOptions { textColorRed?: number; textColorGreen?: number; textColorBlue?: number; -} \ No newline at end of file +} From c23f5e90dc75176f6043f305c2b72d018ebd4c71 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 09:41:49 -0500 Subject: [PATCH 14/42] fix(touchid): make isAvailable static --- src/plugins/touchid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/touchid.ts b/src/plugins/touchid.ts index a84a0af6..86d0ccaf 100644 --- a/src/plugins/touchid.ts +++ b/src/plugins/touchid.ts @@ -53,7 +53,7 @@ export class TouchID { * @return {Promise} Returns a Promise that resolves if yes, rejects if no. */ @Cordova() - isAvailable(): Promise { return; } + static isAvailable(): Promise { return; } /** * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen. From 72ec500ffd59cf0587333ba9ba3649020dd96a02 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 09:43:49 -0500 Subject: [PATCH 15/42] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d05ce6f..31f195e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.3", + "version": "1.3.4", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From cdf9cdef542c0ff54067bdf28f6dc42d535f79ea Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 09:45:55 -0500 Subject: [PATCH 16/42] Update CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b71c11f..49b776d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,11 +2,11 @@ ## Feature request? -Have a plugin you'd like to see supported? Because Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whichever plugin you'd like to add. +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. -## Having an issue? +## 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 From e8f4b08f66bcf31a026c69485ca3dc91d922934b Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 09:50:00 -0500 Subject: [PATCH 17/42] chore(changelog): Update changelog --- CHANGELOG.md | 71 +++++++++++++++++++++------------------------------- 1 file changed, 29 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c73e28c..233261ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,42 +1,37 @@ - -## [1.3.3](https://github.com/driftyco/ionic-native/compare/v1.3.2...v1.3.3) (2016-07-11) - - -### Bug Fixes - -* remove unnecessary decorator ([#257](https://github.com/driftyco/ionic-native/issues/257)) ([25fab64](https://github.com/driftyco/ionic-native/commit/25fab64)) -* **actionsheet:** add missing optional parameter for hide function ([#262](https://github.com/driftyco/ionic-native/issues/262)) ([644e999](https://github.com/driftyco/ionic-native/commit/644e999)) -* **background-geolocation:** fix pluginref again ([b8a5133](https://github.com/driftyco/ionic-native/commit/b8a5133)) -* **geolocation:** fix plugin reference ([4f0cd24](https://github.com/driftyco/ionic-native/commit/4f0cd24)), closes [#258](https://github.com/driftyco/ionic-native/issues/258) -* **googlemaps:** use correct methods for addGroundOverlay and addKmlOverlay ([#268](https://github.com/driftyco/ionic-native/issues/268)) ([b8be1de](https://github.com/driftyco/ionic-native/commit/b8be1de)) -* **socialsharing:** all methods return Promises now ([e150224](https://github.com/driftyco/ionic-native/commit/e150224)), closes [#275](https://github.com/driftyco/ionic-native/issues/275) - - -### Features - -* **ibeacon:** add iBeacon plugin support ([#270](https://github.com/driftyco/ionic-native/issues/270)) ([dd97df1](https://github.com/driftyco/ionic-native/commit/dd97df1)) -* **onesignal:** added wrapper for the Cordova OneSignal Plugin ([#252](https://github.com/driftyco/ionic-native/issues/252)) ([ba20dbe](https://github.com/driftyco/ionic-native/commit/ba20dbe)) -* **push:** added support for Action Buttons on iOS with categories ([#273](https://github.com/driftyco/ionic-native/issues/273)) ([592feb4](https://github.com/driftyco/ionic-native/commit/592feb4)) - - - - -## [1.3.2](https://github.com/driftyco/ionic-native/compare/v1.3.1...v1.3.2) (2016-06-27) - - -### Bug Fixes - -* **build:** disable emitDecoratorMetadata option in tsconfig ([a5f3d7a](https://github.com/driftyco/ionic-native/commit/a5f3d7a)), closes [#251](https://github.com/driftyco/ionic-native/issues/251) - - - - -## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26) + +## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.4) (2016-07-14) ### 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) +* remove unnecessary decorator ([#257](https://github.com/driftyco/ionic-native/issues/257)) ([25fab64](https://github.com/driftyco/ionic-native/commit/25fab64)) +* **actionsheet:** add missing optional parameter for hide function ([#262](https://github.com/driftyco/ionic-native/issues/262)) ([644e999](https://github.com/driftyco/ionic-native/commit/644e999)) +* **background-geolocation:** fix pluginref again ([b8a5133](https://github.com/driftyco/ionic-native/commit/b8a5133)) +* **build:** disable emitDecoratorMetadata option in tsconfig ([a5f3d7a](https://github.com/driftyco/ionic-native/commit/a5f3d7a)), closes [#251](https://github.com/driftyco/ionic-native/issues/251) +* **geolocation:** fix plugin reference ([4f0cd24](https://github.com/driftyco/ionic-native/commit/4f0cd24)), closes [#258](https://github.com/driftyco/ionic-native/issues/258) +* **googlemaps:** use correct methods for addGroundOverlay and addKmlOverlay ([#268](https://github.com/driftyco/ionic-native/issues/268)) ([b8be1de](https://github.com/driftyco/ionic-native/commit/b8be1de)) +* **socialsharing:** all methods return Promises now ([e150224](https://github.com/driftyco/ionic-native/commit/e150224)), closes [#275](https://github.com/driftyco/ionic-native/issues/275) +* **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) +* **touchid:** make isAvailable static ([c23f5e9](https://github.com/driftyco/ionic-native/commit/c23f5e9)) + + +### Features + +* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) +* **ibeacon:** add iBeacon plugin support ([#270](https://github.com/driftyco/ionic-native/issues/270)) ([dd97df1](https://github.com/driftyco/ionic-native/commit/dd97df1)) +* **onesignal:** added wrapper for the Cordova OneSignal Plugin ([#252](https://github.com/driftyco/ionic-native/issues/252)) ([ba20dbe](https://github.com/driftyco/ionic-native/commit/ba20dbe)) +* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) +* **push:** added support for Action Buttons on iOS with categories ([#273](https://github.com/driftyco/ionic-native/issues/273)) ([592feb4](https://github.com/driftyco/ionic-native/commit/592feb4)) + + + + +# [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)) @@ -45,7 +40,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)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) ### Features @@ -53,13 +47,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 0cb79d1cd163a6d9b774145c0e546603a80b5683 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 09:59:41 -0500 Subject: [PATCH 18/42] revert(changelog): old changelog --- CHANGELOG.md | 71 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 233261ca..2c73e28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,37 +1,42 @@ - -## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.4) (2016-07-14) + +## [1.3.3](https://github.com/driftyco/ionic-native/compare/v1.3.2...v1.3.3) (2016-07-11) + + +### Bug Fixes + +* remove unnecessary decorator ([#257](https://github.com/driftyco/ionic-native/issues/257)) ([25fab64](https://github.com/driftyco/ionic-native/commit/25fab64)) +* **actionsheet:** add missing optional parameter for hide function ([#262](https://github.com/driftyco/ionic-native/issues/262)) ([644e999](https://github.com/driftyco/ionic-native/commit/644e999)) +* **background-geolocation:** fix pluginref again ([b8a5133](https://github.com/driftyco/ionic-native/commit/b8a5133)) +* **geolocation:** fix plugin reference ([4f0cd24](https://github.com/driftyco/ionic-native/commit/4f0cd24)), closes [#258](https://github.com/driftyco/ionic-native/issues/258) +* **googlemaps:** use correct methods for addGroundOverlay and addKmlOverlay ([#268](https://github.com/driftyco/ionic-native/issues/268)) ([b8be1de](https://github.com/driftyco/ionic-native/commit/b8be1de)) +* **socialsharing:** all methods return Promises now ([e150224](https://github.com/driftyco/ionic-native/commit/e150224)), closes [#275](https://github.com/driftyco/ionic-native/issues/275) + + +### Features + +* **ibeacon:** add iBeacon plugin support ([#270](https://github.com/driftyco/ionic-native/issues/270)) ([dd97df1](https://github.com/driftyco/ionic-native/commit/dd97df1)) +* **onesignal:** added wrapper for the Cordova OneSignal Plugin ([#252](https://github.com/driftyco/ionic-native/issues/252)) ([ba20dbe](https://github.com/driftyco/ionic-native/commit/ba20dbe)) +* **push:** added support for Action Buttons on iOS with categories ([#273](https://github.com/driftyco/ionic-native/issues/273)) ([592feb4](https://github.com/driftyco/ionic-native/commit/592feb4)) + + + + +## [1.3.2](https://github.com/driftyco/ionic-native/compare/v1.3.1...v1.3.2) (2016-06-27) + + +### Bug Fixes + +* **build:** disable emitDecoratorMetadata option in tsconfig ([a5f3d7a](https://github.com/driftyco/ionic-native/commit/a5f3d7a)), closes [#251](https://github.com/driftyco/ionic-native/issues/251) + + + + +## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26) ### Bug Fixes * **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232) -* remove unnecessary decorator ([#257](https://github.com/driftyco/ionic-native/issues/257)) ([25fab64](https://github.com/driftyco/ionic-native/commit/25fab64)) -* **actionsheet:** add missing optional parameter for hide function ([#262](https://github.com/driftyco/ionic-native/issues/262)) ([644e999](https://github.com/driftyco/ionic-native/commit/644e999)) -* **background-geolocation:** fix pluginref again ([b8a5133](https://github.com/driftyco/ionic-native/commit/b8a5133)) -* **build:** disable emitDecoratorMetadata option in tsconfig ([a5f3d7a](https://github.com/driftyco/ionic-native/commit/a5f3d7a)), closes [#251](https://github.com/driftyco/ionic-native/issues/251) -* **geolocation:** fix plugin reference ([4f0cd24](https://github.com/driftyco/ionic-native/commit/4f0cd24)), closes [#258](https://github.com/driftyco/ionic-native/issues/258) -* **googlemaps:** use correct methods for addGroundOverlay and addKmlOverlay ([#268](https://github.com/driftyco/ionic-native/issues/268)) ([b8be1de](https://github.com/driftyco/ionic-native/commit/b8be1de)) -* **socialsharing:** all methods return Promises now ([e150224](https://github.com/driftyco/ionic-native/commit/e150224)), closes [#275](https://github.com/driftyco/ionic-native/issues/275) -* **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) -* **touchid:** make isAvailable static ([c23f5e9](https://github.com/driftyco/ionic-native/commit/c23f5e9)) - - -### Features - -* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) -* **ibeacon:** add iBeacon plugin support ([#270](https://github.com/driftyco/ionic-native/issues/270)) ([dd97df1](https://github.com/driftyco/ionic-native/commit/dd97df1)) -* **onesignal:** added wrapper for the Cordova OneSignal Plugin ([#252](https://github.com/driftyco/ionic-native/issues/252)) ([ba20dbe](https://github.com/driftyco/ionic-native/commit/ba20dbe)) -* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) -* **push:** added support for Action Buttons on iOS with categories ([#273](https://github.com/driftyco/ionic-native/issues/273)) ([592feb4](https://github.com/driftyco/ionic-native/commit/592feb4)) - - - - -# [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)) @@ -40,6 +45,7 @@ * **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e)) * **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164) * **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f)) +* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) ### Features @@ -47,6 +53,13 @@ * **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde)) * **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115) * **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed)) +* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) +* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) + + + + +## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01) From a1ce39dfda67a36690ebc710cace3db5f0b5dde2 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 10:14:34 -0500 Subject: [PATCH 19/42] Changelog --- CHANGELOG.md | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c73e28c..1227f004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ + +## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14) + + +### Bug Fixes + +* **touchid:** make isAvailable static ([c23f5e9](https://github.com/driftyco/ionic-native/commit/c23f5e9)) + + +### Reverts + +* **changelog:** old changelog ([0cb79d1](https://github.com/driftyco/ionic-native/commit/0cb79d1)) + + + ## [1.3.3](https://github.com/driftyco/ionic-native/compare/v1.3.2...v1.3.3) (2016-07-11) @@ -31,12 +46,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)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) + + +### Features + +* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) +* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) + + + + +# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.3.0) (2016-06-13) + + +### Bug Fixes + * **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180) * **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212) * **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6)) @@ -45,7 +76,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)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) ### Features @@ -53,13 +83,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 be1725d2eb0af76e240a922dac5901579fe4e0aa Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 14 Jul 2016 10:42:56 -0500 Subject: [PATCH 20/42] chore(comments): explain sync --- src/plugins/plugin.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index b6dc607b..7a97b8bf 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -142,6 +142,7 @@ function callInstance(pluginObj: any, methodName: string, args: any[], opts: any function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) { return (...args) => { if (opts.sync) { + // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is return callInstance(pluginObj, methodName, args, opts); } else if (opts.observable) { return new Observable(observer => { @@ -190,6 +191,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {} return (...args) => { if (opts.sync) + // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is return callCordovaPlugin(pluginObj, methodName, args, opts); else if (opts.observable) From 2fe37c461cf209bd595aee3aefe40cc7c3caa7d4 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 15 Jul 2016 00:44:03 -0400 Subject: [PATCH 21/42] feat(pin-dialog): add pin dialog plugin (#291) --- src/index.ts | 3 +++ src/plugins/pin-dialog.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/plugins/pin-dialog.ts diff --git a/src/index.ts b/src/index.ts index 95a0eb0f..3e186783 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,6 +54,7 @@ import {LocalNotifications} from './plugins/localnotifications'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; +import {PinDialog} from './plugins/pin-dialog'; import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; import {SafariViewController} from './plugins/safari-view-controller'; @@ -128,6 +129,7 @@ export { Keyboard, Network, OneSignal, + PinDialog, Screenshot, SocialSharing, Splashscreen, @@ -193,6 +195,7 @@ window['IonicNative'] = { Printer: Printer, Push: Push, OneSignal: OneSignal, + PinDialog: PinDialog, SafariViewController: SafariViewController, Screenshot: Screenshot, SMS: SMS, diff --git a/src/plugins/pin-dialog.ts b/src/plugins/pin-dialog.ts new file mode 100644 index 00000000..bc6671fe --- /dev/null +++ b/src/plugins/pin-dialog.ts @@ -0,0 +1,37 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name Pin Dialog + * @description + * + * @usage + * ```typescript + * import {PinDialog} from 'ionic-native'; + * + * ... + * + * PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel']) + * .then( + * (result: any) => { + * if(result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1); + * else if(result.buttonIndex == 2) console.log('User cancelled'); + * } + * ); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-pin-dialog', + pluginRef: 'plugins.pinDialog', + repo: 'https://github.com/Paldom/PinDialog' +}) +export class PinDialog { + /** + * Show pin dialog + * @param {string} message Message to show the user + * @param {string} title Title of the dialog + * @param {string[]} buttons Buttons to show + */ + @Cordova({ + successIndex: 1 + }) + static prompt(message: string, title: string, buttons: string[]): Promise<{buttonIndex: number, input1: string}> {return; } +} From b5a2ffc6a53b6623e4e8aed11171e40140500598 Mon Sep 17 00:00:00 2001 From: Markus Wagner Date: Sat, 16 Jul 2016 05:28:05 +0200 Subject: [PATCH 22/42] fix(ibeacon): minor fixes * Order of major/minor parameters for BeaconRegion creater fixed * Property PluginResult.error added * comment for BeaconRegion.minor fixed --- src/plugins/ibeacon.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/ibeacon.ts b/src/plugins/ibeacon.ts index 2e89648b..89176da3 100644 --- a/src/plugins/ibeacon.ts +++ b/src/plugins/ibeacon.ts @@ -65,7 +65,7 @@ export interface BeaconRegion { major?: number; /** - * The beacon's major identifier number. Optional, of nothing is supplied + * The beacon's minor identifier number. Optional, of nothing is supplied * the plugin will treat it as a wildcard. */ minor?: number; @@ -125,6 +125,11 @@ export interface PluginResult { * The state of the phone in relation to the region. Inside/outside for example. */ state: 'CLRegionStateInside' | 'CLRegionStateOutside'; + + /** + * Error message, used only with monitoringDidFailForRegionWithError delegate. + */ + error: string; } export interface Delegate { /** @@ -372,8 +377,8 @@ export class IBeacon { * * @return Returns the BeaconRegion that was created */ - static BeaconRegion(identifer: string, uuid: string, minor?: number, major?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { - return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, minor, major, notifyEntryStateOnDisplay); + static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { + return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay); } /** From 2996da65c337deb135f99058a8b6b90e0798f9e3 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 17 Jul 2016 02:07:46 -0400 Subject: [PATCH 23/42] feat(googlemaps): add Geocoder class (#292) closes #280 --- src/plugins/googlemaps.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index dd8bbcfe..fbbb92ac 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -1005,3 +1005,38 @@ export class GoogleMapsLatLng { return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); } } +/** + * @private + */ +export interface GeocoderRequest { + address?: string; + position?: {lat: number; lng: number}; +} +/** + * @private + */ +export interface GeocoderResult { + position?: {lat: number; lng: number}; + subThoroughfare?: string; + thoroughfare?: string; + locality?: string; + adminArea?: string; + postalCode?: string; + country?: string; +} +/** + * @private + */ +export class Geocoder { + /** + * Converts position to address and vice versa + * @param {GeocoderRequest} request Request object with either an address or a position + * @returns {Promise} + */ + static geocode(request: GeocoderRequest): Promise { + return new Promise((resolve, reject) => { + if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) reject({error: 'plugin_not_installed'}); + else plugin.google.maps.Geocoder.geocode(request, resolve); + }); + } +} From daa6d4cbb9220a5924ccb0b479bc319e9b98a17e Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 17 Jul 2016 02:07:59 -0400 Subject: [PATCH 24/42] feat(media-capture): add media capture plugin (#293) closes #272 --- src/index.ts | 3 + src/plugins/media-capture.ts | 218 +++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 src/plugins/media-capture.ts diff --git a/src/index.ts b/src/index.ts index 3e186783..8ded70ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,6 +51,7 @@ import {Insomnia} from './plugins/insomnia'; import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; +import {MediaCapture} from './plugins/media-capture'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; @@ -91,6 +92,7 @@ export * from './plugins/inappbrowser'; export * from './plugins/launchnavigator'; export * from './plugins/localnotifications'; export * from './plugins/media'; +export * from './plugins/media-capture'; export * from './plugins/printer'; export * from './plugins/push'; export * from './plugins/safari-view-controller'; @@ -190,6 +192,7 @@ window['IonicNative'] = { Keyboard: Keyboard, LaunchNavigator: LaunchNavigator, LocalNotifications: LocalNotifications, + MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, Network: Network, Printer: Printer, diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts new file mode 100644 index 00000000..a3f354f8 --- /dev/null +++ b/src/plugins/media-capture.ts @@ -0,0 +1,218 @@ +import {Plugin, Cordova, CordovaProperty} from './plugin'; +import {Observable} from 'rxjs/Rx'; +/** + * @name Media Capture + * @description + * @usage + * ```typescript + * import {MediaCapture} from 'ionic-native'; + * + * ... + * + * let options: CaptureImageOptions = { limit: 3 }; + * MediaCapture.captureImage(options) + * .then( + * (data: MediaFile[]) => console.log(data), + * (err: CaptureError) => console.error(err) + * ); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-media-capture', + pluginRef: 'navigator.device.capture', + repo: 'https://github.com/apache/cordova-plugin-media-capture' +}) +export class MediaCapture { + /** + * The audio recording formats supported by the device. + * @returns {ConfigurationData[]} + */ + @CordovaProperty + static get supportedImageModes(): ConfigurationData[] { + return navigator.device.capture.supportedImageModes; + } + + /** + * The recording image sizes and formats supported by the device. + * @returns {ConfigurationData[]} + */ + @CordovaProperty + static get supportedAudioModes(): ConfigurationData[] { + return navigator.device.capture.supportedAudioModes; + } + + /** + * The recording video resolutions and formats supported by the device. + * @returns {ConfigurationData[]} + */ + @CordovaProperty + static get supportedVideoModes(): ConfigurationData[] { + return navigator.device.capture.supportedVideoModes; + } + + /** + * Start the audio recorder application and return information about captured audio clip files. + * @param options + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static captureAudio(options?: CaptureAudioOptions): Promise {return; } + + /** + * Start the camera application and return information about captured image files. + * @param options + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static captureImage(options?: CaptureImageOptions): Promise {return; } + + /** + * Start the video recorder application and return information about captured video clip files. + * @param options + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static captureVideo(options?: CaptureVideoOptions): Promise {return; } + + /** + * is fired if the capture call is successful + */ + @Cordova({ + eventObservable: true, + event: 'pendingcaptureresult' + }) + static onPendingCaptureResult(): Observable {return; } + + /** + * is fired if the capture call is unsuccessful + */ + @Cordova({ + eventObservable: true, + event: 'pendingcaptureerror' + }) + static onPendingCaptureError(): Observable {return; } + +} +/** + * Encapsulates properties of a media capture file. + */ +export interface MediaFile { + /** + * The name of the file, without path information. + */ + name: string; + /** + * The full path of the file, including the name. + */ + fullPath: string; + /** + * The file's mime type + */ + type: string; + /** + * The date and time when the file was last modified. + */ + lastModifiedDate: Date; + /** + * The size of the file, in bytes. + */ + size: number; + /** + * Retrieves the format information of the media file. + * @param {Function} successCallback + * @param {Function} errorCallback + */ + getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any); +} +/** + * Encapsulates format information about a media file. + */ +export interface MediaFileData { + /** + * The actual format of the audio and video content. + */ + codecs: string; + /** + * The average bitrate of the content. The value is zero for images. + */ + bitrate: number; + /** + * The height of the image or video in pixels. The value is zero for audio clips. + */ + height: number; + /** + * The width of the image or video in pixels. The value is zero for audio clips. + */ + width: number; + /** + * The length of the video or sound clip in seconds. The value is zero for images. + */ + duration: number; +} +/** + * Encapsulates the error code resulting from a failed media capture operation. + */ +export interface CaptureError { + code: string; +} +/** + * Encapsulates audio capture configuration options. + */ +export interface CaptureAudioOptions { + /** + * Maximum number of audio clips. Defaults to 1. + * On iOS you can only record one file. + */ + limit?: number; + /** + * Maximum duration of an audio sound clip, in seconds. This does not work on Android devices. + */ + duration?: number; +} +/** + * Encapsulates image capture configuration options. + */ +export interface CaptureImageOptions { + /** + * Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation. + */ + limit?: number; +} +/** + * Encapsulates video capture configuration options. + */ +export interface CaptureVideoOptions { + /** + * Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation. + */ + limit?: number; + /** + * Maximum duration per video clip. This will be ignored on BlackBerry. + */ + duration?: number; + /** + * Quality of the video. This parameter can only be used with Android. + */ + quality?: number; +} +/** + * Encapsulates a set of media capture parameters that a device supports. + */ +export interface ConfigurationData { + /** + * The ASCII-encoded lowercase string representing the media type. + */ + type: string; + /** + * The height of the image or video in pixels. The value is zero for sound clips. + */ + height: number; + /** + * The width of the image or video in pixels. The value is zero for sound clips. + */ + width: number; +} From 453374d4e788127a3a89aba03a478a3f804494ee Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:11:52 -0400 Subject: [PATCH 25/42] docs(sqlite): fix usage typo --- src/plugins/sqlite.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sqlite.ts b/src/plugins/sqlite.ts index 5a90ac1a..8d37a967 100644 --- a/src/plugins/sqlite.ts +++ b/src/plugins/sqlite.ts @@ -53,7 +53,7 @@ export class SQLite { * import { SQLite } from 'ionic-native'; * * let db = new SQLite(); - * db.openDatabse({ + * db.openDatabase({ * name: 'data.db', * location: 'default' // the location field is required * }).then(() => { From af5d4ad87f678fbae3fb2157e2c210f86eb01cab Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:32:19 -0400 Subject: [PATCH 26/42] feat(nativestorage): add NativeStorage plugin wrapper --- src/index.ts | 3 +++ src/plugins/nativestorage.ts | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/plugins/nativestorage.ts diff --git a/src/index.ts b/src/index.ts index 8ded70ce..ab277db3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,6 +52,7 @@ import {Keyboard} from './plugins/keyboard'; import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; import {MediaCapture} from './plugins/media-capture'; +import {NativeStorage} from './plugins/nativestorage'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; @@ -129,6 +130,7 @@ export { Hotspot, Insomnia, Keyboard, + NativeStorage, Network, OneSignal, PinDialog, @@ -194,6 +196,7 @@ window['IonicNative'] = { LocalNotifications: LocalNotifications, MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, + NativeStorage: NativeStorage, Network: Network, Printer: Printer, Push: Push, diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts new file mode 100644 index 00000000..46d513b7 --- /dev/null +++ b/src/plugins/nativestorage.ts @@ -0,0 +1,38 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name Native Storage + */ +@Plugin({ + plugin: 'cordova-plugin-nativestorage', + pluginRef: 'NativeStorage', + repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage' +}) +export class NativeStorage { + /** + * Stores a value + * @param reference + * @param value + */ + @Cordova() + static setItem(reference: string, value: any): Promise {return; } + + /** + * Gets a stored item + * @param reference + */ + @Cordova() + static getItem(reference: string): Promise {return; } + + /** + * Removes a single stored item + * @param reference + */ + @Cordova() + static remove(reference: string): Promise {return; } + + /** + * Removes all stored values. + */ + @Cordova() + static clear(): Promise {return; } +} From d03ff962e36f4411e245c50adf6bd4c37b3e5636 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:35:31 -0400 Subject: [PATCH 27/42] docs(nativestorage): add usage --- src/plugins/nativestorage.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/nativestorage.ts b/src/plugins/nativestorage.ts index 46d513b7..3a19ef6f 100644 --- a/src/plugins/nativestorage.ts +++ b/src/plugins/nativestorage.ts @@ -1,6 +1,24 @@ import {Plugin, Cordova} from './plugin'; /** * @name Native Storage + * @description + * + * @usage + * ```typescript + * import {NativeStorage} from 'ionic-native'; + * + * NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) + * .then( + * () => console.log('Stored item!'), + * error => console.error('Error storing item', error) + * ); + * + * NativeStorage.getItem('myitem') + * .then( + * data => console.log(data), + * error => console.error(error) + * ); + * ``` */ @Plugin({ plugin: 'cordova-plugin-nativestorage', From b4b3ec0d2a359effd51ffac8a5a427d5e6222db5 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:39:29 -0400 Subject: [PATCH 28/42] fix(safari-view-controller): fix wrappers --- src/plugins/safari-view-controller.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 397748f6..e6c80e9e 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -41,7 +41,7 @@ import {Plugin, Cordova} from './plugin'; @Plugin({ plugin: 'cordova-plugin-safariviewcontroller', pluginRef: 'SafariViewController', - platforms: ['iOS'], + platforms: ['iOS', 'Android'], repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller' }) export class SafariViewController { @@ -56,17 +56,13 @@ export class SafariViewController { * Shows Safari View Controller * @param options */ - @Cordova({ - callbackOrder: 'reverse' - }) + @Cordova() static show(options?: SafariViewControllerOptions): Promise {return; } /** * Hides Safari View Controller */ - @Cordova({ - sync: true - }) + @Cordova() static hide(): void {} /** From 40590350506f2aa16516b44dcf72d1ea3cab2ee6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:40:58 -0400 Subject: [PATCH 29/42] 1.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31f195e0..f1d985c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.4", + "version": "1.3.5", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 1dbfd70724b40db0d74c89f276cc4a38f42e8afa Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:43:05 -0400 Subject: [PATCH 30/42] chore(): update changelog --- CHANGELOG.md | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1227f004..516850df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ + +## [1.3.5](https://github.com/driftyco/ionic-native/compare/v1.3.4...v1.3.5) (2016-07-17) + + +### Bug Fixes + +* **ibeacon:** minor fixes ([b5a2ffc](https://github.com/driftyco/ionic-native/commit/b5a2ffc)) +* **safari-view-controller:** fix wrappers ([b4b3ec0](https://github.com/driftyco/ionic-native/commit/b4b3ec0)) + + +### Features + +* **googlemaps:** add Geocoder class ([#292](https://github.com/driftyco/ionic-native/issues/292)) ([2996da6](https://github.com/driftyco/ionic-native/commit/2996da6)), closes [#280](https://github.com/driftyco/ionic-native/issues/280) +* **media-capture:** add media capture plugin ([#293](https://github.com/driftyco/ionic-native/issues/293)) ([daa6d4c](https://github.com/driftyco/ionic-native/commit/daa6d4c)), closes [#272](https://github.com/driftyco/ionic-native/issues/272) +* **nativestorage:** add NativeStorage plugin wrapper ([af5d4ad](https://github.com/driftyco/ionic-native/commit/af5d4ad)) +* **pin-dialog:** add pin dialog plugin ([#291](https://github.com/driftyco/ionic-native/issues/291)) ([2fe37c4](https://github.com/driftyco/ionic-native/commit/2fe37c4)) + + + ## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14) @@ -46,28 +65,12 @@ -## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.1) (2016-06-26) +## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26) ### Bug Fixes * **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232) -* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) - - -### Features - -* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) -* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) - - - - -# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.3.0) (2016-06-13) - - -### Bug Fixes - * **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180) * **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212) * **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6)) @@ -76,6 +79,7 @@ * **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e)) * **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164) * **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f)) +* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235) ### Features @@ -83,6 +87,13 @@ * **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde)) * **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115) * **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed)) +* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427)) +* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae)) + + + + +## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01) From e55c0c3e15e813e91f3fdfa325b9f2fd97a30c3c Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:44:10 -0400 Subject: [PATCH 31/42] declare navigator to get rid of errors --- src/plugins/media-capture.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index a3f354f8..4366dc51 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -1,5 +1,6 @@ import {Plugin, Cordova, CordovaProperty} from './plugin'; import {Observable} from 'rxjs/Rx'; +declare var navigator: any; /** * @name Media Capture * @description @@ -8,7 +9,7 @@ import {Observable} from 'rxjs/Rx'; * import {MediaCapture} from 'ionic-native'; * * ... - * + * * let options: CaptureImageOptions = { limit: 3 }; * MediaCapture.captureImage(options) * .then( From de14b0ea150572d1ade768bfb3c99a0ec1071bee Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 02:49:44 -0400 Subject: [PATCH 32/42] fix(googlemaps): able to pass array of LatLng to GoogleMapsLatLngBounds constructor closes #298 --- src/plugins/googlemaps.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index fbbb92ac..5f80a699 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -951,8 +951,9 @@ export class GoogleMapsKmlOverlay { export class GoogleMapsLatLngBounds { private _objectInstance: any; - constructor(public southwest: GoogleMapsLatLng, public northeast: GoogleMapsLatLng) { - this._objectInstance = new plugin.google.maps.LatLngBounds([southwest, northeast]); + constructor(public southwestOrArrayOfLatLng: GoogleMapsLatLng|GoogleMapsLatLng[], public northeast?: GoogleMapsLatLng) { + let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng; + this._objectInstance = new plugin.google.maps.LatLngBounds(args); } @CordovaInstance({ sync: true }) From 6f625f92227512ef30e8f49066b8f376bce4e2a6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:07:51 -0400 Subject: [PATCH 33/42] fix(launch-navigator): fix the navigate function wrapper to match latest plugin API --- src/plugins/launchnavigator.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index b28ead09..d1c4a13c 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -44,6 +44,11 @@ export interface LaunchNavigatorOptions { */ navigationMode?: string; + /** + * Start point of the navigation + */ + start?: string|number[]; + } /** @@ -73,18 +78,16 @@ export class LaunchNavigator { /** * Launches navigator app - * @param destination Location name or coordinates - * @param start Location name or coordinates - * @param options + * @param destination {string|number[]} Location name or coordinates + * @param options {LaunchNavigatorOptions} * @returns {Promise} */ @Cordova({ - successIndex: 2, - errorIndex: 3 + successIndex: 1, + errorIndex: 2 }) static navigate( - destination: any, - start: any = null, + destination: string|number[], options?: LaunchNavigatorOptions ): Promise { return; } From 29de6b394e34aa9e9d87bb8bcce6b8cbc98bb4c8 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:43:12 -0400 Subject: [PATCH 34/42] feat(launch-navigator): add new methods and constants to match latest plugin API --- src/plugins/launchnavigator.ts | 179 +++++++++++++++++++++++++-------- 1 file changed, 139 insertions(+), 40 deletions(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index d1c4a13c..5cec5a09 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -3,52 +3,54 @@ import {Plugin, Cordova} from './plugin'; export interface LaunchNavigatorOptions { /** - * iOS, Android, Windows - * If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false. + * name of the navigation app to use for directions. Specify using launchnavigator.APP constants. If not specified, defaults to User Selection. */ - disableAutoGeolocation?: boolean; + app?: string; /** - * iOS, Android, Windows - * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. + * nickname to display in app for destination. e.g. "Bob's House". */ - transportMode?: string; - - /** - * iOS - * If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps. - */ - preferGoogleMaps?: boolean; - - /** - * iOS - * If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app. - */ - urlScheme?: string; - - /** - * iOS - * If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified. - */ - backButtonText?: string; - - /** - * iOS - * If true, debug log output will be generated by the plugin. Defaults to false. - */ - enableDebug?: boolean; - - /** - * Android - * Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. - */ - navigationMode?: string; + destinationName?: string; /** * Start point of the navigation */ start?: string|number[]; + /** + * nickname to display in app for start . e.g. "My House". + */ + startName?: string; + + /** + * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. + */ + transportMode?: string; + + /** + * If true, debug log output will be generated by the plugin. Defaults to false. + */ + enableDebug?: boolean; + + /** + * a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}` + */ + extras?: any; + + /** + * (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants. + */ + launchMode?: string; + + /** + * text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified. + */ + appSelectionDialogHeader?: string; + + /** + * text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified. + */ + appSelectionCancelButton?: string; } /** @@ -57,12 +59,17 @@ export interface LaunchNavigatorOptions { * Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator). * * @usage + * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper. + * * ```js - * import {LaunchNavigator} from 'ionic-native'; + * import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native'; * + * let options: LaunchNavigatorOptions = { + * start: 'London, ON', + * app: LaunchNavigator.APPS.UBER + * }; * - * - * LaunchNavigator.navigate("Toronto, ON", "London, ON") + * LaunchNavigator.navigate("Toronto, ON", options) * .then( * success => console.log("Launched navigator"), * error => console.log("Error launching navigator", error) @@ -78,7 +85,7 @@ export class LaunchNavigator { /** * Launches navigator app - * @param destination {string|number[]} Location name or coordinates + * @param destination {string|number[]} Location name or coordinates (as string or array) * @param options {LaunchNavigatorOptions} * @returns {Promise} */ @@ -91,4 +98,96 @@ export class LaunchNavigator { options?: LaunchNavigatorOptions ): Promise { return; } + /** + * Determines if the given app is installed and available on the current device. + * @param app {string} + */ + @Cordova() + static isAppAvailable(app: string): Promise {return; } + + /** + * Returns a list indicating which apps are installed and available on the current device. + */ + @Cordova() + static availableApps(): Promise {return; } + + /** + * Returns the display name of the specified app. + * @param app {string} + */ + @Cordova({sync: true}) + static getAppDisplayName(app: string): string {return; } + + /** + * Returns list of supported apps on a given platform. + * @param platform {string} + */ + @Cordova({sync: true}) + static getAppsForPlatform(platform: string): string[] {return; } + + /** + * Indicates if an app on a given platform supports specification of transport mode. + * @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS` + * @param platform {string} + */ + @Cordova({sync: true}) + static supportsTransportMode(app: string, platform: string): boolean {return; } + + /** + * Returns the list of transport modes supported by an app on a given platform. + * @param app {string} + * @param platform {string} + */ + @Cordova({sync: true}) + static getTransportModes(app: string, platform: string): string[] {return; } + + /** + * Indicates if an app on a given platform supports specification of launch mode. + * Note that currently only Google Maps on Android does. + * @param app {string} + * @param platform {string} + */ + @Cordova({sync: true}) + static supportsLaunchMode(app: string, platform: string): boolean {return; } + + /** + * Indicates if an app on a given platform supports specification of start location. + * @param app {string} + * @param platform {string} + */ + @Cordova({sync: true}) + static supportsStart(app: string, platform: string): boolean {return; } + + @Cordova({sync: true}) + static supportsStartName(app: string, platform: string): boolean {return; } + + @Cordova({sync: true}) + static supportsDestName(app: string, platform: string): boolean {return; } + + @Cordova({sync: true}) + static userSelect(destination: string|number[], options: LaunchNavigatorOptions): void { } + + static APP: any = { + USER_SELECT: 'user_select', + APPLE_MAPS: 'apple_maps', + GOOGLE_MAPS: 'google_maps', + WAZE: 'waze', + CITYMAPPER: 'citymapper', + NAVIGON: 'navigon', + TRANSIT_APP: 'transit_app', + YANDEX: 'yandex', + UBER: 'uber', + TOMTOM: 'tomtom', + BING_MAPS: 'bing_maps', + SYGIC: 'sygic', + HERE_MAPS: 'here_maps', + MOOVIT: 'moovit' + }; + + static TRANSPORT_MODE: any = { + DRIVING: 'driving', + WALKING: 'walking', + BICYCLING: 'bicycling', + TRANSIT: 'transit' + }; } From 3a1a3ceabc8997b1299b3b4623831d9eadac0fac Mon Sep 17 00:00:00 2001 From: Rodrigue BOULEAU Date: Sun, 17 Jul 2016 10:50:18 +0200 Subject: [PATCH 35/42] feat(camera-preview): add wrapper for camera-preview (#301) * feat(camera-preview): add camera-preview * feat(camera-preview): add camera-preview --- src/index.ts | 3 + src/plugins/camera-preview.ts | 129 ++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 src/plugins/camera-preview.ts diff --git a/src/index.ts b/src/index.ts index ab277db3..cbc91cfd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ import {BLE} from './plugins/ble'; import {BluetoothSerial} from './plugins/bluetoothserial'; import {Calendar} from './plugins/calendar'; import {Camera} from './plugins/camera'; +import {CameraPreview} from './plugins/camera-preview'; import {CardIO} from './plugins/card-io'; import {Clipboard} from './plugins/clipboard'; import {Contacts} from './plugins/contacts'; @@ -113,6 +114,7 @@ export { Brightness, BLE, BluetoothSerial, + CameraPreview, Clipboard, DBMeter, Deeplinks, @@ -165,6 +167,7 @@ window['IonicNative'] = { BluetoothSerial: BluetoothSerial, Calendar: Calendar, Camera: Camera, + CameraPreview: CameraPreview, CardIO: CardIO, Clipboard: Clipboard, Contacts: Contacts, diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts new file mode 100644 index 00000000..72cf1b2d --- /dev/null +++ b/src/plugins/camera-preview.ts @@ -0,0 +1,129 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from 'rxjs/Observable'; + +export interface CameraPreviewOptions { + x: number; + y: number; + width: number; + height: number; + /** + * Choose the camera to use (front- or back-facing). + * 'front' for front camera + * 'rear' for rear camera + */ + camera: string; + /** Take photo on tap */ + tapPhoto: boolean; + /** */ + previewDrag: boolean; + /** */ + toBack: boolean; + /** Alpha use when toBack is set to true */ + alpha: number; +} + +export interface CameraPreviewSize { + maxWidth: number; + maxHeight: number; +} + +/** + * @name CameraPreview + * @description + * Showing camera preview in HTML + * + * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera-preview`. For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview). + * + */ +@Plugin({ + plugin: 'cordova-plugin-camera-preview', + pluginRef: 'cordova.plugins.camerapreview', + repo: 'https://github.com/westonganger/cordova-plugin-camera-preview', + platforms: ['Android', 'iOS'] +}) +export class CameraPreview { + + /** + * Starts the camera preview instance. + * @param {CameraPreviewOptions} options for the preview + */ + @Cordova({ + sync: true + }) + static startCamera(options: CameraPreviewOptions): void {}; + + /** + * Stops the camera preview instance. + */ + @Cordova({ + sync: true + }) + static stopCamera(): void {}; + + /** + * Take the picture, the parameter size is optional + */ + @Cordova({ + sync: true + }) + static takePicture(size: CameraPreviewSize): void {}; + + /** + * Register a callback function that receives the original picture and the image captured from the preview box. + */ + @Cordova({ + observable: true + }) + static setOnPictureTakenHandler(): Observable { return; }; + + /** + * Switch from the rear camera and front camera, if available. + */ + @Cordova({ + sync: true + }) + static switchCamera(): void {}; + + /** + * Show the camera preview box. + */ + @Cordova({ + sync: true + }) + static show(): void {}; + + /** + * Hide the camera preview box. + */ + @Cordova({ + sync: true + }) + static hide(): void {}; + + /** + * Set the default mode for the Flash. + */ + @Cordova({ + sync: true + }) + static setFlashMode(mode: number): void {}; + + /** + * Set camera color effect. + */ + @Cordova({ + sync: true + }) + static setColorEffect(effect: string): void {}; + + /** + * @private + * @enum {number} + */ + static FlashMode = { + OFF: 0, + ON: 1, + AUTO: 2 + }; + +} From 6ee645a976b6e7d5d2dbfa81d4bf72ed904e17ae Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:53:50 -0400 Subject: [PATCH 36/42] refactor(launchnavigator): add successCallback and errorCallback to options interface these are currently needed to use the userSelect function --- src/plugins/launchnavigator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/launchnavigator.ts b/src/plugins/launchnavigator.ts index 5cec5a09..ae931918 100644 --- a/src/plugins/launchnavigator.ts +++ b/src/plugins/launchnavigator.ts @@ -51,6 +51,10 @@ export interface LaunchNavigatorOptions { * text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified. */ appSelectionCancelButton?: string; + + successCallback?: Function; + + errorCallback?: Function; } /** @@ -60,7 +64,7 @@ export interface LaunchNavigatorOptions { * * @usage * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper. - * + * * ```js * import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native'; * From 46e3a0ecb33748c7981275be9d37d4b0d527023f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:54:33 -0400 Subject: [PATCH 37/42] 1.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1d985c8..4b349181 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "1.3.5", + "version": "1.3.6", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/index.js", "files": [ From 8bd906c1a7290a0225e5c99d4f29e3aa00725aab Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 04:55:20 -0400 Subject: [PATCH 38/42] chore(changelog): update changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 516850df..80112298 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [1.3.6](https://github.com/driftyco/ionic-native/compare/v1.3.5...v1.3.6) (2016-07-17) + + +### Bug Fixes + +* **googlemaps:** able to pass array of LatLng to GoogleMapsLatLngBounds constructor ([de14b0e](https://github.com/driftyco/ionic-native/commit/de14b0e)), closes [#298](https://github.com/driftyco/ionic-native/issues/298) +* **launch-navigator:** fix the navigate function wrapper to match latest plugin API ([6f625f9](https://github.com/driftyco/ionic-native/commit/6f625f9)) + + +### Features + +* **camera-preview:** add wrapper for camera-preview ([#301](https://github.com/driftyco/ionic-native/issues/301)) ([3a1a3ce](https://github.com/driftyco/ionic-native/commit/3a1a3ce)) +* **launch-navigator:** add new methods and constants to match latest plugin API ([29de6b3](https://github.com/driftyco/ionic-native/commit/29de6b3)) + + + ## [1.3.5](https://github.com/driftyco/ionic-native/compare/v1.3.4...v1.3.5) (2016-07-17) From 4f85110f7521e0e97c3824da8d29e41bdbc510a0 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Sun, 17 Jul 2016 12:56:41 +0200 Subject: [PATCH 39/42] feat(sim): Add sim plugin (#317) * Add sim plugin * Fix pluginRef --- src/index.ts | 3 +++ src/plugins/sim.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/plugins/sim.ts diff --git a/src/index.ts b/src/index.ts index cbc91cfd..45a511cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ import {Printer} from './plugins/printer'; import {Push} from './plugins/push'; import {SafariViewController} from './plugins/safari-view-controller'; import {Screenshot} from './plugins/screenshot'; +import {Sim} from './plugins/sim'; import {SMS} from './plugins/sms'; import {SocialSharing} from './plugins/socialsharing'; import {SpinnerDialog} from './plugins/spinnerdialog'; @@ -138,6 +139,7 @@ export { PinDialog, Screenshot, SocialSharing, + Sim, Splashscreen, SQLite, StatusBar, @@ -207,6 +209,7 @@ window['IonicNative'] = { PinDialog: PinDialog, SafariViewController: SafariViewController, Screenshot: Screenshot, + Sim: Sim, SMS: SMS, SocialSharing: SocialSharing, SpinnerDialog: SpinnerDialog, diff --git a/src/plugins/sim.ts b/src/plugins/sim.ts new file mode 100644 index 00000000..7155cb7a --- /dev/null +++ b/src/plugins/sim.ts @@ -0,0 +1,35 @@ +import {Plugin, Cordova} from './plugin'; + +/** + * @name Sim + * @description + * Gets info from the Sim card like the carrier name, mcc, mnc and country code and other system dependent info. + * + * Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim). + * + * @usage + * ```js + * import {Sim} from 'ionic-native'; + * + * + * Sim.getSimInfo().then( + * (info) => console.log('Sim info:', info), + * (err) => console.log('Unable to get sim info:', err) + * ); + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-sim', + pluginRef: 'plugins.sim', + repo: 'https://github.com/pbakondy/cordova-plugin-sim', + platforms: ['Android', 'iOS', 'Windows Phone'] +}) +export class Sim { + /** + * Returns info from the SIM card. + * @returns {Promise} + */ + @Cordova() + static getSimInfo(): Promise { return; } + +} From 965d742bb6b693d1c0e9d3517f35c7963a5c4b9a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 08:35:20 -0400 Subject: [PATCH 40/42] refactor(google-maps): use observer.next.bind instead of manual way --- src/plugins/googlemaps.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 5f80a699..4952c54e 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -77,8 +77,7 @@ export class GoogleMap { on(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.on(event, cb); + this._objectInstance.on(event, observer.next.bind); return () => this._objectInstance.off(event); } ); @@ -389,10 +388,7 @@ export class GoogleMapsMarker { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = (data: any) => { - observer.next(data); - }; - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); @@ -537,8 +533,7 @@ export class GoogleMapsCircle { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); @@ -629,8 +624,7 @@ export class GoogleMapsPolyline { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); @@ -721,8 +715,7 @@ export class GoogleMapsPolygon { addEventListener(event: any): Observable { return new Observable( (observer) => { - let cb = data => observer.next(data); - this._objectInstance.addEventListener(event, cb); + this._objectInstance.addEventListener(event, observer.next.bind); return () => this._objectInstance.removeEventListener(event, cb); } ); From 0c0456ada6d502ceded22fab7e901205c67f529a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 08:37:00 -0400 Subject: [PATCH 41/42] refactor(google-maps): fix mistake in previous commit --- src/plugins/googlemaps.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 4952c54e..65d7433f 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -389,7 +389,7 @@ export class GoogleMapsMarker { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } @@ -534,7 +534,7 @@ export class GoogleMapsCircle { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } @@ -625,7 +625,7 @@ export class GoogleMapsPolyline { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } @@ -716,7 +716,7 @@ export class GoogleMapsPolygon { return new Observable( (observer) => { this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, cb); + return () => this._objectInstance.removeEventListener(event, observer.next.bind); } ); } From 4841f31a92be5ef9e265046b4d6ccb066f777071 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sun, 17 Jul 2016 08:54:39 -0400 Subject: [PATCH 42/42] refactor(project): fix and optimize observables --- src/plugins/geolocation.ts | 3 +-- src/plugins/googlemaps.ts | 18 +++++++++--------- src/plugins/plugin.ts | 5 ++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/plugins/geolocation.ts b/src/plugins/geolocation.ts index 8c059f99..60d28a7e 100644 --- a/src/plugins/geolocation.ts +++ b/src/plugins/geolocation.ts @@ -154,8 +154,7 @@ export class Geolocation { static watchPosition(options?: GeolocationOptions): Observable { return new Observable( (observer: any) => { - let cb = (data: Geoposition) => observer.next(data); - let watchId = navigator.geolocation.watchPosition(cb, options); + let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), options); return () => navigator.geolocation.clearWatch(watchId); } ); diff --git a/src/plugins/googlemaps.ts b/src/plugins/googlemaps.ts index 65d7433f..c0378efe 100644 --- a/src/plugins/googlemaps.ts +++ b/src/plugins/googlemaps.ts @@ -77,7 +77,7 @@ export class GoogleMap { on(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.on(event, observer.next.bind); + this._objectInstance.on(event, observer.next.bind(observer)); return () => this._objectInstance.off(event); } ); @@ -388,8 +388,8 @@ export class GoogleMapsMarker { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } @@ -533,8 +533,8 @@ export class GoogleMapsCircle { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } @@ -624,8 +624,8 @@ export class GoogleMapsPolyline { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } @@ -715,8 +715,8 @@ export class GoogleMapsPolygon { addEventListener(event: any): Observable { return new Observable( (observer) => { - this._objectInstance.addEventListener(event, observer.next.bind); - return () => this._objectInstance.removeEventListener(event, observer.next.bind); + this._objectInstance.addEventListener(event, observer.next.bind(observer)); + return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); } ); } diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 7a97b8bf..99b99c0e 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -174,9 +174,8 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) { */ function wrapEventObservable (event: string): Observable { return new Observable(observer => { - let callback = (status: any) => observer.next(status); - window.addEventListener(event, callback, false); - return () => window.removeEventListener(event, callback, false); + window.addEventListener(event, observer.next.bind(observer), false); + return () => window.removeEventListener(event, observer.next.bind(observer), false); }); }