From 0daab8c31d69324a46205005b825db5b9e963164 Mon Sep 17 00:00:00 2001 From: quentin Date: Fri, 6 Oct 2017 20:12:39 +0200 Subject: [PATCH 01/44] docs(spinner-dialog): improve options documentation --- src/@ionic-native/plugins/spinner-dialog/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/@ionic-native/plugins/spinner-dialog/index.ts b/src/@ionic-native/plugins/spinner-dialog/index.ts index 25905669f..7b032b0f8 100644 --- a/src/@ionic-native/plugins/spinner-dialog/index.ts +++ b/src/@ionic-native/plugins/spinner-dialog/index.ts @@ -2,9 +2,24 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; export interface SpinnerDialogIOSOptions { + /** + * Opacity of the overlay, between 0 (transparent) and 1 (opaque). Default: 0.35 + */ overlayOpacity?: number; + + /** + * Red component of the text color, between 0 and 1. Default: 1 + */ textColorRed?: number; + + /** + * Green component of the text color, between 0 and 1. Default: 1 + */ textColorGreen?: number; + + /** + * Blue component of the text color, between 0 and 1. Default: 1 + */ textColorBlue?: number; } From eaa87fae9b3d6b1ef9a709ba9ae4cda17fa880ea Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 25 Jan 2018 11:25:30 -0600 Subject: [PATCH 02/44] chore(): update changelog --- CHANGELOG.md | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 589a050b2..56c0c47fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ + +## [4.5.2](https://github.com/ionic-team/ionic-native/compare/v5.0.0-beta.3...v4.5.2) (2018-01-25) + + +### Bug Fixes + +* **pro:** proper callback type and guard for plugin instantiate. [#2136](https://github.com/ionic-team/ionic-native/issues/2136) [#2127](https://github.com/ionic-team/ionic-native/issues/2127) ([61293c3](https://github.com/ionic-team/ionic-native/commit/61293c3)) + + + + +# [5.0.0-beta.3](https://github.com/ionic-team/ionic-native/compare/v4.5.1...v5.0.0-beta.3) (2017-12-29) + + +### Bug Fixes + +* **push:** fix finish method ([995fd56](https://github.com/ionic-team/ionic-native/commit/995fd56)) + + +### Features + +* **crop:** add targetHeight and targetWidth options ([#2213](https://github.com/ionic-team/ionic-native/issues/2213)) ([9990df8](https://github.com/ionic-team/ionic-native/commit/9990df8)) + + + -## [4.5.1](https://github.com/ionic-team/ionic-native/compare/v4.5.0...v4.5.1) (2017-12-12) +## [4.5.1](https://github.com/ionic-team/ionic-native/compare/v5.0.0-beta.0...v4.5.1) (2017-12-12) ### Bug Fixes @@ -8,8 +33,8 @@ - -# [4.5.0](https://github.com/ionic-team/ionic-native/compare/v4.4.2...v4.5.0) (2017-12-08) + +# [5.0.0-beta.0](https://github.com/ionic-team/ionic-native/compare/v4.5.0...v5.0.0-beta.0) (2017-12-08) ### Bug Fixes @@ -70,7 +95,7 @@ -## [4.3.3](https://github.com/ionic-team/ionic-native/compare/v4.3.2...v4.3.3) (2017-11-01) +## [4.3.3](https://github.com/ionic-team/ionic-native/compare/4.3.2...v4.3.3) (2017-11-01) ### Bug Fixes @@ -79,11 +104,6 @@ - -## [4.3.2](https://github.com/ionic-team/ionic-native/compare/4.3.2...v4.3.2) (2017-10-18) - - - ## [4.3.2](https://github.com/ionic-team/ionic-native/compare/4.3.1...4.3.2) (2017-10-17) @@ -125,6 +145,7 @@ * **google-maps:** convert JS classes to Ionic Native ([#1956](https://github.com/ionic-team/ionic-native/issues/1956)) ([57af5c5](https://github.com/ionic-team/ionic-native/commit/57af5c5)) * **google-maps:** fix icons property of MarkerClusterOptions ([#1937](https://github.com/ionic-team/ionic-native/issues/1937)) ([8004790](https://github.com/ionic-team/ionic-native/commit/8004790)) +* **google-maps:** fix issue when creating new instance of BaseArrayClass ([#1931](https://github.com/ionic-team/ionic-native/issues/1931)) ([957396b](https://github.com/ionic-team/ionic-native/commit/957396b)) * **google-maps:** the zoom option is missing in the GoogleMapOptions class ([#1948](https://github.com/ionic-team/ionic-native/issues/1948)) ([ef898ef](https://github.com/ionic-team/ionic-native/commit/ef898ef)) * **http:** fix plugin ref ([#1934](https://github.com/ionic-team/ionic-native/issues/1934)) ([3a1034e](https://github.com/ionic-team/ionic-native/commit/3a1034e)) * **launch-navigator:** fix navigate method ([#1940](https://github.com/ionic-team/ionic-native/issues/1940)) ([a150d4d](https://github.com/ionic-team/ionic-native/commit/a150d4d)) @@ -149,16 +170,6 @@ - -## [4.2.1](https://github.com/ionic-team/ionic-native/compare/v4.2.0...v4.2.1) (2017-08-29) - - -### Bug Fixes - -* **google-maps:** fix issue when creating new instance of BaseArrayClass ([#1931](https://github.com/ionic-team/ionic-native/issues/1931)) ([957396b](https://github.com/ionic-team/ionic-native/commit/957396b)) - - - # [4.2.0](https://github.com/ionic-team/ionic-native/compare/v4.1.0...v4.2.0) (2017-08-26) From c8ecee01d6abc6b32594d7ff42306fe9fd2632f9 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 25 Jan 2018 11:35:19 -0600 Subject: [PATCH 03/44] fix(pro): Tweak to pro plugin. #2136 #2127 --- src/@ionic-native/plugins/pro/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/pro/index.ts b/src/@ionic-native/plugins/pro/index.ts index bbdb6258e..776f0f9a9 100644 --- a/src/@ionic-native/plugins/pro/index.ts +++ b/src/@ionic-native/plugins/pro/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, CordovaInstance, IonicNativePlugin } from '@ionic-native/core'; +import { Plugin, Cordova, CordovaCheck, CordovaInstance, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; /** @@ -130,10 +130,16 @@ export class ProDeploy { }) @Injectable() export class Pro extends IonicNativePlugin { + _deploy: ProDeploy; + /** * Ionic Pro Deploy .js API. */ - deploy: ProDeploy = new ProDeploy((Pro.getPlugin() || {}).deploy); + @CordovaCheck() + deploy(): ProDeploy { + if (this._deploy) return this._deploy; + else return this._deploy = new ProDeploy(Pro.getPlugin().deploy); + } /** * Not yet implemented From f419db5d8087472f11238a694e9a87ca967a6ad8 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 25 Jan 2018 11:39:17 -0600 Subject: [PATCH 04/44] fix(Pro): CordovaCheck should sync. #2136 #2127 --- src/@ionic-native/plugins/pro/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/pro/index.ts b/src/@ionic-native/plugins/pro/index.ts index 776f0f9a9..f773a6e97 100644 --- a/src/@ionic-native/plugins/pro/index.ts +++ b/src/@ionic-native/plugins/pro/index.ts @@ -135,7 +135,7 @@ export class Pro extends IonicNativePlugin { /** * Ionic Pro Deploy .js API. */ - @CordovaCheck() + @CordovaCheck({ sync: true }) deploy(): ProDeploy { if (this._deploy) return this._deploy; else return this._deploy = new ProDeploy(Pro.getPlugin().deploy); From 954bd876de022fc641c5df73aa32b8924be96e77 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 25 Jan 2018 11:44:58 -0600 Subject: [PATCH 05/44] Tweaked pro constructor --- src/@ionic-native/plugins/pro/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/pro/index.ts b/src/@ionic-native/plugins/pro/index.ts index f773a6e97..f11477798 100644 --- a/src/@ionic-native/plugins/pro/index.ts +++ b/src/@ionic-native/plugins/pro/index.ts @@ -137,8 +137,12 @@ export class Pro extends IonicNativePlugin { */ @CordovaCheck({ sync: true }) deploy(): ProDeploy { - if (this._deploy) return this._deploy; - else return this._deploy = new ProDeploy(Pro.getPlugin().deploy); + if (this._deploy) { + return this._deploy; + } else { + this._deploy = new ProDeploy(Pro.getPlugin().deploy); + return this._deploy; + } } /** From f11be24f7463e342d314cd7218519bae101ed07a Mon Sep 17 00:00:00 2001 From: "Pedro L.C.A" Date: Mon, 26 Feb 2018 09:52:58 -0300 Subject: [PATCH 06/44] feat(google-maps): update to match latest plugin version (#2320) * Update index.ts * Update index.ts * Add missing features, and bug fix of methods * update: classname must be in pascal case * remove: duplicated class definition * export encode and spherical static classes * Add comma * Fix Encoding and Spherical * Add convenience methods * Fix decorators for Encoding and Spherical * Update: getMap() methods return the instance of the wrapper plugin * Update: getMap() methods return the instance of the wrapper plugin * Remove `@CordovaInstance` decorators from getMap() * Update: GoogleMapOptions (all fields are not optional). * Follow up: version `2.0.0-beta2-20170719-2226` of cordova-plugin-googlemaps * Fix: tslint error * Fix: tslint error * No more isAvailable() method. * Bug fix: description is incorrect * Bug fix: example code was wrong. * Bug fix: HtmlInfoWindow does not work https://github.com/ionic-team/ionic-native/pull/1815#issuecomment-318909795 * Bug fix: HtmlInfoWindow does not work * Bug fix: HtmlInfoWindow does not work * Bug fix: HtmlInfoWindow does not work * Bug fix: HtmlInfoWindow does not work * It seems the ionViewDidLoad() is enough delayed after platform.ready() * Bug fix: map.setDiv() * Bug fix: HtmlInfoWindow does not work * Bug fix: BaseArrayClass definition is incorrect * Bug fix: BaseArrayClass constructor is wrong * Bug fix: Geocoder class does not work * Bug fix: LatLngBounds constructor is wrong * update: noNotify option is not declared * Bug fix: Geocoder.geocode() returns array of GeocoderResult * Update: clarify acceptable parameters of BaseArrayClass * Add: AnimateCameraOption.padding is missing * Revert: BaseClass.empty() method does not have the noNotify option * Add `destruct` option to the CordovaOption. - This allows BaseClass.on() is able to pass multiple retuned values from the cordova plugin side to the event lister. * A semicolon is mixing * update: event names * Update: BaseClass.addEventListener(), addEventListenerOnce(), on(), and one() * Add: destruct option for otherPromise Change: inside event names (must use the version 2.0.0-beta3-20170808-1950 or higher) * Build for working group * Bug fix: map.getCameraTarget() definition is incorrect * Bug fix: The definition of VisibleRegion interface is incorrect * Fix: LatLng, LatLngBounds, and PolylineOptions classes Update: map.getVisibleRegion() Add: VisibleRegion class * Bug fix: the definition of map.clear() method is incorrect * Fix: map.fromLatLngToPoint() * Ignore the dist directory on the master branch * Remove the dist folder on the master branch * fixes and tweaks * use union types for CameraPosition fixes issue mentioned on slack by @wf9a5m75 * fix types * update AnimateCameraOptions interface * remove AnimateCameraOptions interface * add MarkerCluster class * Bug fix: Can not create an instance of BaseArrayClass * Bug fix: the icons property of MarkerClusterOptions * Bug fix: the zoom option is missing https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1712 * Update index.ts * fix: need to convert instance type from the JS class to the wrapper class https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1706 * remove test file * fix: Error: Illegal use of "@private" tag. * fix: The Environment, Encode, and Spherical are static class * fix: convert JS instance to the ionic instance add: BaseClass.destroy() add: getId() method for all instance classes * Documentation Error https://github.com/ionic-team/ionic-native/issues/1994 * Need to create another way to convert the instance for marker cluster * save * Remove the instance of wrapper class if the JS instance is removed. * Bug fix: HtmlInfoWindow missing .on and .one methods https://github.com/ionic-team/ionic-native/issues/2034 * Bug fix: HtmlInfoWindow constructor cause the error https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1661 * Fix: Error when removing map https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1823 * Add: the cssOptions argument for HtmlInfoWindow.setContent() method * Bug fix: Polyline.getPoints(), Polygon.getPoints() and Polygon.getHoles() Those methods need to create new instance of BaseArrayClass of wrapper plugin. * Add: forEachAsync(), mapAsync(), and filterAsync() methods into BaseArray class * update: use document.querySelector() instead of document.getElementById() if the passed element is string update: map.setDiv() Bug fix: can not create empty GoogleMap (pure JS version is available way) * Fix: wait until the page is fully ready * Fix: missing `clickable` option for PolygonOptions and PolylineOptions * Add: accept own properties for `addMarker()` and others #2087 Fix: some properties are required, but specified as optional. Add: descriptions for properties * Bug fix: Static classes are defined as non static class https://stackoverflow.com/questions/47083289/ionic-native-google-maps-plugin-set-app-background-color/47165721#47165721 * Add: poly class (plugin.google.maps.geometory.poly namespace) * Bug fix: Ionic native googlemaps decodePath() returns undefined https://forum.ionicframework.com/t/ionic-native-googlemaps-decodepath-returns-undefined/118624/ * PR #2254 https://github.com/ionic-team/ionic-native/pull/2254 * PR #2199 https://github.com/ionic-team/ionic-native/pull/2199 * Change defined event names for the cordova-plugin-googlemaps v2.0 * Change defined event names for the cordova-plugin-googlemaps v2.2.0 * Add Geolocation class * Implement the `setMyLocationButtonEnabled()` method * add: baseArrayClass.mapSeries() method update: change internal methods * update: implementation of the LocationService * Implement the map.addKmlOverlay() method * Update for the cordova-plugin-googlemaps v2.2.x --- .../plugins/google-maps/index.ts | 685 +++++++++++------- 1 file changed, 440 insertions(+), 245 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index fee5b298f..3d875b2b5 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -91,100 +91,146 @@ export class LatLngBounds implements ILatLngBounds { getCenter(): LatLng { return; } } +export interface GoogleMapControlOptions { + + /** + * Turns the compass on or off. + */ + compass?: boolean; + + /** + * Turns the myLocation button on or off. If turns on this button, the application displays a permission dialog to obtain the geolocation data. + */ + myLocationButton?: boolean; + + /** + * Turns the myLocation control(blue dot) on or off. If turns on this control, the application displays a permission dialog to obtain the geolocation data. + */ + myLocation?: boolean; + + /** + * Turns the indoor picker on or off. + */ + indoorPicker?: boolean; + + /** + * **Android** + * Turns the map toolbar on or off. + */ + mapToolbar?: boolean; + + /** + * **Android** + * Turns the zoom controller on or off. + */ + zoom?: boolean; + + /** + * Accept extra properties for future updates + */ + [key: string]: any; +} + +export interface GoogleMapGestureOptions { + + /** + * Set false to disable the scroll gesture (default: true) + */ + scroll?: boolean; + + /** + * Set false to disable the tilt gesture (default: true) + */ + tilt?: boolean; + + /** + * Set false to disable the zoom gesture (default: true) + */ + zoom?: boolean; + + /** + * Set false to disable the rotate gesture (default: true) + */ + rotate?: boolean; + + /** + * Accept extra properties for future updates + */ + [key: string]: any; +} + +export interface GoogleMapZoomOptions { + minZoom?: number; + maxZoom?: number; +} + +export interface GoogleMapPaddingOptions { + left?: number; + top?: number; + bottom?: number; + right?: number; +} + +export interface GoogleMapPreferenceOptions { + + /** + * Minimum and maximum zoom levels for zooming gestures. + */ + zoom?: GoogleMapZoomOptions; + + /** + * Paddings of controls. + */ + padding?: GoogleMapPaddingOptions; + + /** + * Turns the 3D buildings layer on or off. + */ + building?: boolean; + + /** + * Accept extra properties for future updates + */ + [key: string]: any; +} + export interface GoogleMapOptions { /** - * MapType + * mapType [options] */ mapType?: MapType; - controls?: { - - /** - * Turns the compass on or off. - */ - compass?: boolean; - - /** - * Turns the myLocation picker on or off. If turns on this button, the application displays a permission dialog to obtain the geolocation data. - */ - myLocationButton?: boolean; - - /** - * Turns the indoor picker on or off. - */ - indoorPicker?: boolean; - - /** - * Turns the map toolbar on or off. This option is for Android only. - */ - mapToolbar?: boolean; - - /** - * Turns the zoom controller on or off. This option is for Android only. - */ - zoom?: boolean; - }; - - gestures?: { - - /** - * Set false to disable the scroll gesture (default: true) - */ - scroll?: boolean; - - /** - * Set false to disable the tilt gesture (default: true) - */ - tilt?: boolean; - - /** - * Set false to disable the zoom gesture (default: true) - */ - zoom?: boolean; - - /** - * Set false to disable the rotate gesture (default: true) - */ - rotate?: boolean; - }; + /** + * controls [options] + */ + controls?: GoogleMapControlOptions; /** - * Map styles + * gestures [options] + */ + gestures?: GoogleMapGestureOptions; + + /** + * Map styles [options] * @ref https://developers.google.com/maps/documentation/javascript/style-reference */ styles?: any[]; /** - * Initial camera position + * Initial camera position [options] */ camera?: CameraPosition; - preferences?: { + /** + * preferences [options] + */ + preferences?: GoogleMapPreferenceOptions; - /** - * Minimum and maximum zoom levels for zooming gestures. - */ - zoom?: { - minZoom?: number; - maxZoom?: number; - }; - - /** - * Paddings of controls. - */ - padding?: { - left?: number; - top?: number; - bottom?: number; - right?: number; - }; - - /** - * Turns the 3D buildings layer on or off. - */ - building?: boolean - }; + /** + * Accept extra properties for future updates + */ + [key: string]: any; } export interface CameraPosition { @@ -679,6 +725,39 @@ export interface TileOverlayOptions { [key: string]: any; } +export interface ToDataUrlOptions { + /** + * True if you want get high quality map snapshot + */ + uncompress?: boolean; +} + + +/** + * Options for map.addKmlOverlay() method + */ +export interface KmlOverlayOptions { + /* + * The url or file path of KML file. KMZ format is not supported. + */ + url: string; + + /* + * Do not fire the KML_CLICK event if false. Default is true. + */ + clickable?: boolean; + + /* + * Do not display the default infoWindow if true. Default is false. + */ + suppressInfoWindows?: boolean; + + /** + * Accept own properties for future update + */ + [key: string]: any; +} + /** * @hidden @@ -686,12 +765,41 @@ export interface TileOverlayOptions { export class VisibleRegion implements ILatLngBounds { private _objectInstance: any; + /** + * The northeast of the bounds that contains the farLeft, farRight, nearLeft and nearRight. + * Since the map view is able to rotate, the farRight is not the same as the northeast. + */ @InstanceProperty northeast: ILatLng; + + /** + * The southwest of the bounds that contains the farLeft, farRight, nearLeft and nearRight. + * Since the map view is able to rotate, the nearLeft is not the same as the southwest. + */ @InstanceProperty southwest: ILatLng; + + /** + * The nearRight indicates the lat/lng of the top-left of the map view. + */ @InstanceProperty farLeft: ILatLng; + + /** + * The nearRight indicates the lat/lng of the top-right of the map view. + */ @InstanceProperty farRight: ILatLng; + + /** + * The nearRight indicates the lat/lng of the bottom-left of the map view. + */ @InstanceProperty nearLeft: ILatLng; + + /** + * The nearRight indicates the lat/lng of the bottom-right of the map view. + */ @InstanceProperty nearRight: ILatLng; + + /** + * constant value : `VisibleRegion` + */ @InstanceProperty type: string; constructor(southwest: LatLngBounds, northeast: LatLngBounds, farLeft: ILatLng, farRight: ILatLng, nearLeft: ILatLng, nearRight: ILatLng) { @@ -729,9 +837,10 @@ export class VisibleRegion implements ILatLngBounds { */ export const GoogleMapsEvent = { MAP_READY: 'map_ready', - MAP_LOADED: 'map_loaded', MAP_CLICK: 'map_click', MAP_LONG_CLICK: 'map_long_click', + POI_CLICK: 'poi_click', + MY_LOCATION_CLICK: 'my_location_click', MY_LOCATION_BUTTON_CLICK: 'my_location_button_click', INDOOR_BUILDING_FOCUSED: 'indoor_building_focused', INDOOR_LEVEL_ACTIVATED: 'indoor_level_activated', @@ -747,14 +856,14 @@ export const GoogleMapsEvent = { INFO_LONG_CLICK: 'info_long_click', INFO_CLOSE: 'info_close', INFO_OPEN: 'info_open', - CLUSTER_CLICK: 'cluster_click', MARKER_CLICK: 'marker_click', MARKER_DRAG: 'marker_drag', MARKER_DRAG_START: 'marker_drag_start', MARKER_DRAG_END: 'marker_drag_end', MAP_DRAG: 'map_drag', MAP_DRAG_START: 'map_drag_start', - MAP_DRAG_END: 'map_drag_end' + MAP_DRAG_END: 'map_drag_end', + KML_CLICK: 'kml_click' }; /** @@ -801,7 +910,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * }) * export class HomePage { * map: GoogleMap; - * constructor(private googleMaps: GoogleMaps) { } + * constructor() { } * * ionViewDidLoad() { * this.loadMap(); @@ -820,7 +929,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * } * }; * - * this.map = this.googleMaps.create('map_canvas', mapOptions); + * this.map = GoogleMaps.create('map_canvas', mapOptions); * * // Wait the MAP_READY before using any methods. * this.map.one(GoogleMapsEvent.MAP_READY) @@ -865,6 +974,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * Polygon * Polyline * Spherical + * KmlOverlay * Poly * TileOverlay * BaseClass @@ -886,6 +996,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * PolygonOptions * PolylineOptions * TileOverlayOptions + * KmlOverlayOptions * VisibleRegion */ @Plugin({ @@ -893,6 +1004,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { pluginRef: 'plugin.google.maps', plugin: 'cordova-plugin-googlemaps', repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', + document: 'https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/README.md', install: 'ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"', installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'], platforms: ['Android', 'iOS'] @@ -903,7 +1015,7 @@ export class GoogleMaps extends IonicNativePlugin { /** * Creates a new GoogleMap instance * @param element {string | HTMLElement} Element ID or reference to attach the map to - * @param options {any} Options + * @param options {GoogleMapOptions} [options] Options * @return {GoogleMap} */ static create(element: string | HTMLElement | GoogleMapOptions, options?: GoogleMapOptions): GoogleMap { @@ -947,7 +1059,7 @@ export class BaseClass { /** * Adds an event listener. - * + * @param eventName {string} event name you want to observe. * @return {Observable} */ @InstanceCheck({ observable: true }) @@ -981,7 +1093,7 @@ export class BaseClass { /** * Adds an event listener that works once. - * + * @param eventName {string} event name you want to observe. * @return {Promise} */ @InstanceCheck() @@ -1015,32 +1127,33 @@ export class BaseClass { /** * Gets a value - * @param key + * @param key {any} */ @CordovaInstance({ sync: true }) get(key: string): any { return; } /** * Sets a value - * @param key - * @param value + * @param key {string} The key name for the value. `(key)_changed` will be fired when you set value through this method. + * @param value {any} + * @param noNotify {boolean} [options] True if you want to prevent firing the `(key)_changed` event. */ @CordovaInstance({ sync: true }) set(key: string, value: any, noNotify?: boolean): void { } /** * Bind a key to another object - * @param key {string} - * @param target {any} - * @param targetKey? {string} - * @param noNotify? {boolean} + * @param key {string} The property name you want to observe. + * @param target {any} The target object you want to observe. + * @param targetKey? {string} [options] The property name you want to observe. If you omit this, the `key` argument is used. + * @param noNotify? {boolean} [options] True if you want to prevent `(key)_changed` event when you bind first time, because the internal status is changed from `undefined` to something. */ @CordovaInstance({ sync: true }) bindTo(key: string, target: any, targetKey?: string, noNotify?: boolean): void { } /** - * Listen to a map event. - * + * Alias of `addEventListener` + * @param key {string} The property name you want to observe. * @return {Observable} */ @InstanceCheck({ observable: true }) @@ -1073,8 +1186,8 @@ export class BaseClass { } /** - * Listen to a map event only once. - * + * Alias of `addEventListenerOnce` + * @param key {string} The property name you want to observe. * @return {Promise} */ @InstanceCheck() @@ -1114,6 +1227,8 @@ export class BaseClass { /** * Dispatch event. + * @param eventName {string} Event name + * @param parameters {any} [options] The data you want to pass to event listerners. */ @CordovaInstance({ sync: true }) trigger(eventName: string, ...parameters: any[]): void {} @@ -1130,6 +1245,32 @@ export class BaseClass { } this._objectInstance.remove(); } + + /** + * Remove event listener(s) + * The `removeEventListener()` has three usages: + * - removeEventListener("eventName", listenerFunction); + * This removes one particular event listener + * - removeEventListener("eventName"); + * This removes the event listeners that added for the event name. + * - removeEventListener(); + * This removes all listeners. + * + * @param eventName {string} [options] Event name + * @param listener {Function} [options] Event listener + */ + @CordovaInstance({ sync: true }) + removeEventListener(eventName?: string, listener?: (...parameters: any[]) => void): void {} + + /** + * Alias of `removeEventListener` + * + * @param eventName {string} [options] Event name + * @param listener {Function} [options] Event listener + */ + @CordovaInstance({ sync: true }) + off(eventName?: string, listener?: (...parameters: any[]) => void): void {} + } /** @@ -1155,7 +1296,7 @@ export class BaseArrayClass extends BaseClass { /** * Removes all elements from the array. - * @param noNotify? {boolean} Set true to prevent remove_at events. + * @param noNotify? {boolean} [options] Set true to prevent remove_at events. */ @CordovaInstance({ sync: true }) empty(noNotify?: boolean): void {} @@ -1163,7 +1304,6 @@ export class BaseArrayClass extends BaseClass { /** * Iterate over each element, calling the provided callback. * @param fn {Function} - * @param callback? {Function} */ @CordovaInstance({ sync: true }) forEach(fn: (element: T, index?: number) => void): void {} @@ -1176,7 +1316,7 @@ export class BaseArrayClass extends BaseClass { @CordovaCheck() forEachAsync(fn: ((element: T, callback: () => void) => void)): Promise { return new Promise((resolve) => { - this._objectInstance.forEach(fn, resolve); + this._objectInstance.forEachAsync(fn, resolve); }); } @@ -1184,7 +1324,6 @@ export class BaseArrayClass extends BaseClass { * Iterate over each element, then return a new value. * Then you can get the results of each callback. * @param fn {Function} - * @param callback? {Function} * @return {Array} returns a new array with the results */ @CordovaInstance({ sync: true }) @@ -1194,20 +1333,32 @@ export class BaseArrayClass extends BaseClass { * Iterate over each element, calling the provided callback. * Then you can get the results of each callback. * @param fn {Function} - * @param callback? {Function} + * @param callback {Function} * @return {Promise} returns a new array with the results */ @CordovaCheck() mapAsync(fn: ((element: T, callback: (newElement: any) => void) => void)): Promise { return new Promise((resolve) => { - this._objectInstance.map(fn, resolve); + this._objectInstance.mapAsync(fn, resolve); + }); + } + + /** + * Same as `mapAsync`, but keep the execution order + * @param fn {Function} + * @param callback {Function} + * @return {Promise} returns a new array with the results + */ + @CordovaCheck() + mapSeries(fn: ((element: T, callback: (newElement: any) => void) => void)): Promise { + return new Promise((resolve) => { + this._objectInstance.mapSeries(fn, resolve); }); } /** * The filter() method creates a new array with all elements that pass the test implemented by the provided function. * @param fn {Function} - * @param callback? {Function} * @return {Array} returns a new filtered array */ @CordovaInstance({ sync: true }) @@ -1216,13 +1367,13 @@ export class BaseArrayClass extends BaseClass { /** * The filterAsync() method creates a new array with all elements that pass the test implemented by the provided function. * @param fn {Function} - * @param callback? {Function} + * @param callback {Function} * @return {Promise} returns a new filtered array */ @CordovaCheck() filterAsync(fn: (element: T, callback: (result: boolean) => void) => void): Promise { return new Promise((resolve) => { - this._objectInstance.filter(fn, resolve); + this._objectInstance.filterAsync(fn, resolve); }); } @@ -1272,7 +1423,7 @@ export class BaseArrayClass extends BaseClass { * Inserts an element at the specified index. * @param index {number} * @param element {Object} - * @param noNotify? {boolean} Set true to prevent insert_at events. + * @param noNotify? {boolean} [options] Set true to prevent insert_at events. * @return {Object} */ @CordovaInstance({ sync: true }) @@ -1280,7 +1431,7 @@ export class BaseArrayClass extends BaseClass { /** * Removes the last element of the array and returns that element. - * @param noNotify? {boolean} Set true to prevent remove_at events. + * @param noNotify? {boolean} [options] Set true to prevent remove_at events. * @return {Object} */ @CordovaInstance({ sync: true }) @@ -1297,7 +1448,7 @@ export class BaseArrayClass extends BaseClass { /** * Removes an element from the specified index. * @param index {number} - * @param noNotify? {boolean} Set true to prevent insert_at events. + * @param noNotify? {boolean} [options] Set true to prevent remove_at events. */ @CordovaInstance({ sync: true }) removeAt(index: number, noNotify?: boolean): void {} @@ -1306,7 +1457,7 @@ export class BaseArrayClass extends BaseClass { * Sets an element at the specified index. * @param index {number} * @param element {object} - * @param noNotify? {boolean} Set true to prevent set_at events. + * @param noNotify? {boolean} [options] Set true to prevent set_at events. */ @CordovaInstance({ sync: true }) setAt(index: number, element: T, noNotify?: boolean): void {} @@ -1337,7 +1488,7 @@ export class Circle extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } /** * Change the center position. @@ -1578,6 +1729,28 @@ export class Geocoder { } } +/** + * @hidden + */ +@Plugin({ + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.LocationService', + plugin: 'cordova-plugin-googlemaps', + repo: '' +}) +export class LocationService { + + /** + * Get the current device location without map + * @return {Promise} + */ + static getMyLocation(options?: MyLocationOptions): Promise { + return new Promise((resolve, reject) => { + GoogleMaps.getPlugin().LocationService.getMyLocation(options, resolve); + }); + } +} + /** * @hidden */ @@ -1593,7 +1766,7 @@ export class Encoding { * @deprecation * @hidden */ - decodePath(encoded: string, precision?: number): LatLng { + decodePath(encoded: string, precision?: number): Array { console.error('GoogleMaps', '[deprecated] This method is static. Please use Encoding.decodePath()'); return Encoding.decodePath(encoded, precision); } @@ -1611,16 +1784,20 @@ export class Encoding { * Decodes an encoded path string into a sequence of LatLngs. * @param encoded {string} an encoded path string * @param precision? {number} default: 5 - * @return {LatLng} + * @return {ILatLng[]} */ - static decodePath(encoded: string, precision?: number): LatLng { return; } + static decodePath(encoded: string, precision?: number): Array { + return GoogleMaps.getPlugin().geometry.encoding.decodePath(encoded, precision); + } /** * Encodes a sequence of LatLngs into an encoded path string. * @param path {Array | BaseArrayClass} a sequence of LatLngs * @return {string} */ - static encodePath(path: Array | BaseArrayClass): string { return; } + static encodePath(path: Array | BaseArrayClass): string { + return GoogleMaps.getPlugin().geometry.encoding.encodePath(path); + } } /** @@ -1904,7 +2081,7 @@ export class GoogleMap extends BaseClass { /** * Changes the map div - * @param domNode + * @param domNode {HTMLElement | string} [options] If you want to display the map in an html element, you need to specify an element or id. If omit this argument, the map is detached from webview. */ @InstanceCheck() setDiv(domNode?: HTMLElement | string): void { @@ -2112,12 +2289,19 @@ export class GoogleMap extends BaseClass { fromPointToLatLng(point: any): Promise { return; } /** - * Set true if you want to show the MyLocation button + * Set true if you want to show the MyLocation control (blue dot) * @param enabled {boolean} */ @CordovaInstance({ sync: true }) setMyLocationEnabled(enabled: boolean): void {} + /** + * Set true if you want to show the MyLocation button + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setMyLocationButtonEnabled(enabled: boolean): void {} + /** * Get the currently focused building * @return {Promise} @@ -2179,6 +2363,7 @@ export class GoogleMap extends BaseClass { /** * Adds a marker + * @param options {MarkerOptions} options * @return {Promise} */ @InstanceCheck() @@ -2203,6 +2388,11 @@ export class GoogleMap extends BaseClass { }); } + /** + * Adds a marker cluster + * @param options {MarkerClusterOptions} options + * @return {Promise} + */ @InstanceCheck() addMarkerCluster(options: MarkerClusterOptions): Promise { return new Promise((resolve, reject) => { @@ -2228,6 +2418,7 @@ export class GoogleMap extends BaseClass { /** * Adds a circle + * @param options {CircleOptions} options * @return {Promise} */ @InstanceCheck() @@ -2254,6 +2445,7 @@ export class GoogleMap extends BaseClass { /** * Adds a polygon + * @param options {PolygonOptions} options * @return {Promise} */ @InstanceCheck() @@ -2279,7 +2471,8 @@ export class GoogleMap extends BaseClass { } /** - * + * Adds a polyline + * @param options {PolylineOptions} options * @return {Promise} */ @InstanceCheck() @@ -2305,6 +2498,8 @@ export class GoogleMap extends BaseClass { } /** + * Adds a tile overlay + * @param options {TileOverlayOptions} options * @return {Promise} */ @InstanceCheck() @@ -2330,6 +2525,8 @@ export class GoogleMap extends BaseClass { } /** + * Adds a ground overlay + * @param options {GroundOverlayOptions} options * @return {Promise} */ @InstanceCheck() @@ -2355,33 +2552,39 @@ export class GoogleMap extends BaseClass { } /** - * Refreshes layout. - * You can execute it, but you don't need to do that. The plugin does this automatically. + * Adds a kml overlay + * @param options {KmlOverlayOptions} options + * @return {Promise} */ - @CordovaInstance({ sync: true }) - refreshLayout(): void {} + @InstanceCheck() + addKmlOverlay(options: KmlOverlayOptions): Promise { + return new Promise((resolve, reject) => { + this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => { + if (kmlOverlay) { + let overlayId: string = kmlOverlay.getId(); + const overlay = new KmlOverlay(this, kmlOverlay); + this.get('_overlays')[overlayId] = overlay; + kmlOverlay.one(overlayId + '_remove', () => { + if (this.get('_overlays')) { + this.get('_overlays')[overlayId] = null; + overlay.destroy(); + } + }); + resolve(overlay); + } else { + reject(); + } + }); + }); + } /** - * @return {Promise} + * Returns the base64 encoded screen capture of the map. + * @param options {ToDataUrlOptions} [options] options + * @return {Promise} */ @CordovaInstance() - toDataURL(): Promise { return; } - - // /** - // * @return {Promise} - // */ - // @InstanceCheck() - // addKmlOverlay(options: KmlOverlayOptions): Promise { - // return new Promise((resolve, reject) => { - // this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => { - // if (kmlOverlay) { - // resolve(new KmlOverlay(kmlOverlay)); - // } else { - // reject(); - // } - // }); - // }); - // } + toDataURL(params?: ToDataUrlOptions): Promise { return; } } @@ -2409,7 +2612,7 @@ export class GroundOverlay extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } /** * Change the bounds of the GroundOverlay @@ -2575,7 +2778,7 @@ export class Marker extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } /** * Set the marker position. @@ -2790,12 +2993,24 @@ export class MarkerCluster extends BaseClass { @CordovaInstance({ sync: true }) getId(): string { return; } + /** + * Add one marker location + * @param marker {MarkerOptions} one location + * @param skipRedraw? {boolean} marker cluster does not redraw the marker cluster if true. + */ @CordovaInstance({ sync: true }) - addMarker(marker: MarkerOptions): void {} + addMarker(marker: MarkerOptions, skipRedraw?: boolean): void {} + /** + * Add marker locations + * @param markers {MarkerOptions[]} multiple locations + */ @CordovaInstance({ sync: true }) addMarkers(markers: MarkerOptions[]): void {} + /** + * Remove the marker cluster + */ @InstanceCheck() remove(): void { this._objectInstance.set('_overlays', undefined); @@ -2808,7 +3023,7 @@ export class MarkerCluster extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } } @@ -2836,7 +3051,7 @@ export class Polygon extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } /** * Change the polygon points. @@ -3008,7 +3223,7 @@ export class Polyline extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } /** * Change the polyline points. @@ -3145,7 +3360,7 @@ export class TileOverlay extends BaseClass { * Return the map instance. * @return {GoogleMap} */ - getMap(): any { return this._map; } + getMap(): GoogleMap { return this._map; } /** * Set whether the tiles should fade in. @@ -3220,102 +3435,82 @@ export class TileOverlay extends BaseClass { } } -// /** -// * @hidden -// */ -// export interface KmlOverlayOptions { -// url?: string; -// preserveViewport?: boolean; -// animation?: boolean; -// } -// /** -// * @hidden -// */ -// export class KmlOverlay { -// -// constructor(private _objectInstance: any) { } -// -// /** -// * Adds an event listener. -// * -// * @return {Observable} -// */ -// addEventListener(eventName: string): Observable { -// return Observable.fromEvent(this._objectInstance, eventName); -// } -// -// /** -// * Adds an event listener that works once. -// * -// * @return {Promise} -// */ -// addListenerOnce(eventName: string): Promise { -// if (!this._objectInstance) { -// return Promise.reject({ error: 'plugin_not_installed' }); -// } -// return new Promise( -// resolve => this._objectInstance.addListenerOnce(eventName, resolve) -// ); -// } -// -// /** -// * Gets a value -// * @param key -// */ -// @CordovaInstance({ sync: true }) -// get(key: string): any { return; } -// -// /** -// * Sets a value -// * @param key -// * @param value -// */ -// @CordovaInstance({ sync: true }) -// set(key: string, value: any): void { } -// -// /** -// * Listen to a map event. -// * -// * @return {Observable} -// */ -// on(eventName: string): Observable { -// if (!this._objectInstance) { -// return new Observable((observer) => { -// observer.error({ error: 'plugin_not_installed' }); -// }); -// } -// -// return new Observable( -// (observer) => { -// this._objectInstance.on(eventName, observer.next.bind(observer)); -// return () => this._objectInstance.off(event); -// } -// ); -// } -// -// /** -// * Listen to a map event only once. -// * -// * @return {Promise} -// */ -// one(eventName: string): Promise { -// if (!this._objectInstance) { -// return Promise.reject({ error: 'plugin_not_installed' }); -// } -// return new Promise( -// resolve => this._objectInstance.one(eventName, resolve) -// ); -// } -// -// /** -// * Clears all stored values -// */ -// @CordovaInstance({ sync: true }) -// empty(): void { } -// -// @CordovaInstance({ sync: true }) -// remove(): void { } -// -// @CordovaInstance({ sync: true }) -// getOverlays(): Array { return; } -// } +/** + * @hidden + */ +export class KmlOverlay extends BaseClass { + + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { + super(); + this._map = _map; + this._objectInstance = _objectInstance; + + Object.defineProperty(self, 'camera', { + value: this._objectInstance.camera, + writable: false + }); + Object.defineProperty(self, 'kmlData', { + value: this._objectInstance.kmlData, + writable: false + }); + } + + /** + * Returns the viewport to contains all overlays + */ + @CordovaInstance({ sync: true }) + getDefaultViewport(): CameraPosition { return; } + + /** + * Return the ID of instance. + * @return {string} + */ + @CordovaInstance({ sync: true }) + getId(): string { return; } + + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): GoogleMap { return this._map; } + + /** + * Change visibility of the polyline + * @param visible {boolean} + */ + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void {} + + /** + * Return true if the polyline is visible + * @return {boolean} + */ + @CordovaInstance({ sync: true }) + getVisible(): boolean { return; } + + /** + * Change clickablity of the KmlOverlay + * @param clickable {boolean} + */ + @CordovaInstance({ sync: true }) + setClickable(clickable: boolean): void {} + + /** + * Return true if the KmlOverlay is clickable + * @return {boolean} + */ + @CordovaInstance({ sync: true }) + getClickable(): boolean { return; } + + /** + * Remove the KmlOverlay + */ + @InstanceCheck() + remove(): void { + delete this._objectInstance.getMap().get('_overlays')[this.getId()]; + this._objectInstance.remove(); + this.destroy(); + } +} From 2e711b94bb1a93b9a37ff0330f21f49ad7bf6c17 Mon Sep 17 00:00:00 2001 From: Andrew Lively Date: Mon, 12 Mar 2018 11:00:31 -0400 Subject: [PATCH 07/44] Added setAnalyticsCollectionEnabled to Firebase plugin --- src/@ionic-native/plugins/firebase/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/@ionic-native/plugins/firebase/index.ts b/src/@ionic-native/plugins/firebase/index.ts index bee4737f5..60d29c219 100644 --- a/src/@ionic-native/plugins/firebase/index.ts +++ b/src/@ionic-native/plugins/firebase/index.ts @@ -300,4 +300,14 @@ export class Firebase extends IonicNativePlugin { verifyPhoneNumber(phoneNumber: string, timeoutDuration: number): Promise { return; } + + /** + * Allows the user to enable/disable analytics collection + * @param enabled {booleab} value to set collection + * @returns {Promise} + */ + @Cordova() + setAnalyticsCollectionEnabled(enabled: boolean): Promise { + return; + } } From 42fd1f2400780a248a8d8ab40c2c51107160236e Mon Sep 17 00:00:00 2001 From: musou1500 Date: Wed, 14 Mar 2018 22:28:21 +0900 Subject: [PATCH 08/44] fix(firebase-analytics): add `sync` option for all methods --- src/@ionic-native/plugins/firebase-analytics/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/firebase-analytics/index.ts b/src/@ionic-native/plugins/firebase-analytics/index.ts index a6ef388dd..5cdac8fd4 100644 --- a/src/@ionic-native/plugins/firebase-analytics/index.ts +++ b/src/@ionic-native/plugins/firebase-analytics/index.ts @@ -43,7 +43,7 @@ export class FirebaseAnalytics extends IonicNativePlugin { * @param params {any} Some param to configure something * @return {Promise} Returns a promise */ - @Cordova() + @Cordova({ sync: true }) logEvent(name: string, params: any): Promise { return; } /** @@ -52,7 +52,7 @@ export class FirebaseAnalytics extends IonicNativePlugin { * @param id {string} The user ID * @return {Promise} Returns a promise */ - @Cordova() + @Cordova({ sync: true }) setUserId(id: string): Promise { return; } /** @@ -62,7 +62,7 @@ export class FirebaseAnalytics extends IonicNativePlugin { * @param value {string} The property value * @return {Promise} Returns a promise */ - @Cordova() + @Cordova({ sync: true }) setUserProperty(name: string, value: string): Promise { return; } /** @@ -70,7 +70,7 @@ export class FirebaseAnalytics extends IonicNativePlugin { * @param enabled {boolean} * @return {Promise} Returns a promise */ - @Cordova() + @Cordova({ sync: true }) setEnabled(enabled: boolean): Promise { return; } /** @@ -79,7 +79,7 @@ export class FirebaseAnalytics extends IonicNativePlugin { * @param name {string} The name of the screen * @return {Promise} Returns a promise */ - @Cordova() + @Cordova({ sync: true }) setCurrentScreen(name: string): Promise { return; } } From ee3a0c7c6ac5a153554046f32c96913974ab539c Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 17:00:54 +0100 Subject: [PATCH 09/44] refactor(WheelSelector): add union type for theme --- src/@ionic-native/plugins/wheel-selector/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/@ionic-native/plugins/wheel-selector/index.ts b/src/@ionic-native/plugins/wheel-selector/index.ts index b97a9d326..ad687c50e 100644 --- a/src/@ionic-native/plugins/wheel-selector/index.ts +++ b/src/@ionic-native/plugins/wheel-selector/index.ts @@ -42,7 +42,7 @@ export interface WheelSelectorOptions { * Android only - theme color, 'light' or 'dark'. * Default: light */ - theme?: string; + theme?: 'light' | 'dark' /** * Whether to have the wheels 'wrap' (Android only) @@ -76,7 +76,7 @@ export interface WheelSelectorData { * * ... * - * let jsonData = { + * const jsonData = { * numbers: [ * { description: "1" }, * { description: "2" }, @@ -105,7 +105,7 @@ export interface WheelSelectorData { * * ... * - * //basic number selection, index is always returned in the result + * // basic number selection, index is always returned in the result * selectANumber() { * this.selector.show({ * title: "How Many?", @@ -122,7 +122,7 @@ export interface WheelSelectorData { * * ... * - * //basic selection, setting initial displayed default values: '3' 'Banana' + * // basic selection, setting initial displayed default values: '3' 'Banana' * selectFruit() { * this.selector.show({ * title: "How Much?", @@ -145,8 +145,8 @@ export interface WheelSelectorData { * * ... * - * //more complex as overrides which key to display - * //then retrieve properties from original data + * // more complex as overrides which key to display + * // then retrieve properties from original data * selectNamesUsingDisplayKey() { * this.selector.show({ * title: "Who?", From e612c5fcc373e52df3e596552b801f8cd0852119 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 17:29:25 +0100 Subject: [PATCH 10/44] fix linter --- src/@ionic-native/plugins/wheel-selector/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/wheel-selector/index.ts b/src/@ionic-native/plugins/wheel-selector/index.ts index ad687c50e..5f5f787fa 100644 --- a/src/@ionic-native/plugins/wheel-selector/index.ts +++ b/src/@ionic-native/plugins/wheel-selector/index.ts @@ -42,7 +42,7 @@ export interface WheelSelectorOptions { * Android only - theme color, 'light' or 'dark'. * Default: light */ - theme?: 'light' | 'dark' + theme?: 'light' | 'dark'; /** * Whether to have the wheels 'wrap' (Android only) From 15bb350d8e346a035bfbfb0ab4f4370b5f4a3980 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 17:42:38 +0100 Subject: [PATCH 11/44] feat(web-intent): add startService function --- src/@ionic-native/plugins/web-intent/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/@ionic-native/plugins/web-intent/index.ts b/src/@ionic-native/plugins/web-intent/index.ts index a41f063b6..2306bfa2a 100644 --- a/src/@ionic-native/plugins/web-intent/index.ts +++ b/src/@ionic-native/plugins/web-intent/index.ts @@ -6,6 +6,7 @@ import { Observable } from 'rxjs/Observable'; * @beta * @name Web Intent * @description + * This Plugin provides a general purpose shim layer for the Android intent mechanism, exposing various ways to handle sending and receiving intents. * @usage * For usage information please refer to the plugin's Github repo. * @@ -161,6 +162,14 @@ export class WebIntent extends IonicNativePlugin { */ @Cordova() sendBroadcast(options: { action: string, extras?: { option: boolean } }): Promise { return; } + + /** + * Request that a given application service be started + * @param options {Object} { action: string, extras?: { option: boolean } } + * @returns {Promise} + */ + @Cordova() + startService(options: { action: string, extras?: { option: boolean } }): Promise { return; } /** * Registers a broadcast receiver for the specified filters From ec14e179c6dc92c9c31696e261db8ee75e1e39f9 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 17:44:16 +0100 Subject: [PATCH 12/44] Update index.ts --- src/@ionic-native/plugins/web-intent/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/@ionic-native/plugins/web-intent/index.ts b/src/@ionic-native/plugins/web-intent/index.ts index 2306bfa2a..963832160 100644 --- a/src/@ionic-native/plugins/web-intent/index.ts +++ b/src/@ionic-native/plugins/web-intent/index.ts @@ -3,7 +3,6 @@ import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-nati import { Observable } from 'rxjs/Observable'; /** - * @beta * @name Web Intent * @description * This Plugin provides a general purpose shim layer for the Android intent mechanism, exposing various ways to handle sending and receiving intents. From 95822aeac2771cc2ddeabb072c418d550f98f4e7 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 18:02:35 +0100 Subject: [PATCH 13/44] feat(badge) add isSupported function --- src/@ionic-native/plugins/badge/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/@ionic-native/plugins/badge/index.ts b/src/@ionic-native/plugins/badge/index.ts index 7da09cf74..d7398cb3d 100644 --- a/src/@ionic-native/plugins/badge/index.ts +++ b/src/@ionic-native/plugins/badge/index.ts @@ -69,6 +69,13 @@ export class Badge extends IonicNativePlugin { */ @Cordova() decrease(decreaseBy: number): Promise { return; } + + /** + * Check support to show badges. + * @returns {Promise} + */ + @Cordova() + isSupported(): Promise { return; } /** * Determine if the app has permission to show badges. From 6d07cf1a844f1f5813fd52d3df26f2c9326e4942 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 18:05:09 +0100 Subject: [PATCH 14/44] fix lint --- src/@ionic-native/plugins/web-intent/index.ts | 111 ++++++++++-------- 1 file changed, 65 insertions(+), 46 deletions(-) diff --git a/src/@ionic-native/plugins/web-intent/index.ts b/src/@ionic-native/plugins/web-intent/index.ts index 963832160..7bd06c562 100644 --- a/src/@ionic-native/plugins/web-intent/index.ts +++ b/src/@ionic-native/plugins/web-intent/index.ts @@ -35,77 +35,65 @@ import { Observable } from 'rxjs/Observable'; }) @Injectable() export class WebIntent extends IonicNativePlugin { + /** + * Convenience constant for actions + * @type {string} + */ + @CordovaProperty ACTION_SEND: string; /** * Convenience constant for actions * @type {string} */ - @CordovaProperty - ACTION_SEND: string; - - /** - * Convenience constant for actions - * @type {string} - */ - @CordovaProperty - ACTION_VIEW: string; + @CordovaProperty ACTION_VIEW: string; /** * Convenience constant for extras * @type {string} */ - @CordovaProperty - EXTRA_TEXT: string; + @CordovaProperty EXTRA_TEXT: string; /** * Convenience constant for extras * @type {string} */ - @CordovaProperty - EXTRA_SUBJECT: string; + @CordovaProperty EXTRA_SUBJECT: string; /** * Convenience constant for extras * @type {string} */ - @CordovaProperty - EXTRA_STREAM: string; + @CordovaProperty EXTRA_STREAM: string; /** * Convenience constant for extras * @type {string} */ - @CordovaProperty - EXTRA_EMAIL: string; + @CordovaProperty EXTRA_EMAIL: string; /** * Convenience constant for actions * @type {string} */ - @CordovaProperty - ACTION_CALL: string; + @CordovaProperty ACTION_CALL: string; /** * Convenience constant for actions * @type {string} */ - @CordovaProperty - ACTION_SENDTO: string; + @CordovaProperty ACTION_SENDTO: string; /** * Convenience constant for actions * @type {string} */ - @CordovaProperty - ACTION_GET_CONTENT: string; + @CordovaProperty ACTION_GET_CONTENT: string; /** * Convenience constant for actions * @type {string} */ - @CordovaProperty - ACTION_PICK: string; - + @CordovaProperty ACTION_PICK: string; /** * Launches an Android intent @@ -113,7 +101,13 @@ export class WebIntent extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - startActivity(options: { action: any, url: string, type?: string }): Promise { return; } + startActivity(options: { + action: any; + url: string; + type?: string; + }): Promise { + return; + } /** * Starts a new activity and return the result to the application @@ -121,7 +115,13 @@ export class WebIntent extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - startActivityForResult(options: { action: any, url: string, type?: string }): Promise { return; } + startActivityForResult(options: { + action: any; + url: string; + type?: string; + }): Promise { + return; + } /** * Checks if this app was invoked with specified extra @@ -129,7 +129,9 @@ export class WebIntent extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - hasExtra(extra: string): Promise { return; } + hasExtra(extra: string): Promise { + return; + } /** * Gets the extra that this app was invoked with @@ -137,14 +139,18 @@ export class WebIntent extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - getExtra(extra: string): Promise { return; } + getExtra(extra: string): Promise { + return; + } /** * Gets the Uri the app was invoked with * @returns {Promise} */ @Cordova() - getUri(): Promise { return; }; + getUri(): Promise { + return; + } /** * @returns {Observable} @@ -152,7 +158,9 @@ export class WebIntent extends IonicNativePlugin { @Cordova({ observable: true }) - onNewIntent(): Observable { return; }; + onNewIntent(): Observable { + return; + } /** * Sends a custom intent passing optional extras @@ -160,45 +168,56 @@ export class WebIntent extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - sendBroadcast(options: { action: string, extras?: { option: boolean } }): Promise { return; } - - /** + sendBroadcast(options: { + action: string; + extras?: { option: boolean }; + }): Promise { + return; + } + + /** * Request that a given application service be started * @param options {Object} { action: string, extras?: { option: boolean } } * @returns {Promise} */ @Cordova() - startService(options: { action: string, extras?: { option: boolean } }): Promise { return; } + startService(options: { + action: string; + extras?: { option: boolean }; + }): Promise { + return; + } /** * Registers a broadcast receiver for the specified filters * @param filters {any} */ @Cordova({ sync: true }) - registerBroadcastReceiver(filters: any): void { } + registerBroadcastReceiver(filters: any): void {} /** * Unregisters a broadcast receiver */ @Cordova({ sync: true }) - unregisterBroadcastReceiver(): void { } + unregisterBroadcastReceiver(): void {} /** - * Returns the content of the intent used whenever the application activity is launched - */ + * Returns the content of the intent used whenever the application activity is launched + */ @Cordova({ sync: true }) - onIntent(): void { } + onIntent(): void {} /** - * - */ + * + */ @Cordova({ sync: true }) - onActivityResult(): void { } + onActivityResult(): void {} /** * @returns {Promise} */ @Cordova() - getIntent(): Promise { return; }; - + getIntent(): Promise { + return; + } } From bebc5c2a5060648baee859fde61f78b2e313267d Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 18:06:25 +0100 Subject: [PATCH 15/44] fix lint --- src/@ionic-native/plugins/badge/index.ts | 37 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/badge/index.ts b/src/@ionic-native/plugins/badge/index.ts index d7398cb3d..eb4828fe5 100644 --- a/src/@ionic-native/plugins/badge/index.ts +++ b/src/@ionic-native/plugins/badge/index.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; - /** * @name Badge * @description @@ -31,13 +30,14 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class Badge extends IonicNativePlugin { - /** * Clear the badge of the app icon. * @returns {Promise} */ @Cordova() - clear(): Promise { return; } + clear(): Promise { + return; + } /** * Set the badge of the app icon. @@ -45,14 +45,18 @@ export class Badge extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - set(badgeNumber: number): Promise { return; } + set(badgeNumber: number): Promise { + return; + } /** * Get the badge of the app icon. * @returns {Promise} */ @Cordova() - get(): Promise { return; } + get(): Promise { + return; + } /** * Increase the badge number. @@ -60,7 +64,9 @@ export class Badge extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - increase(increaseBy: number): Promise { return; } + increase(increaseBy: number): Promise { + return; + } /** * Decrease the badge number. @@ -68,27 +74,34 @@ export class Badge extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - decrease(decreaseBy: number): Promise { return; } - + decrease(decreaseBy: number): Promise { + return; + } + /** * Check support to show badges. * @returns {Promise} */ @Cordova() - isSupported(): Promise { return; } + isSupported(): Promise { + return; + } /** * Determine if the app has permission to show badges. * @returns {Promise} */ @Cordova() - hasPermission(): Promise { return; } + hasPermission(): Promise { + return; + } /** * Register permission to set badge notifications * @returns {Promise} */ @Cordova() - registerPermission(): Promise { return; } - + registerPermission(): Promise { + return; + } } From 4bf55d3b1a22e1c74bb37f6844e19ad0cd72ab83 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 21:30:07 +0100 Subject: [PATCH 16/44] fix(printer): add correct npm repository --- src/@ionic-native/plugins/printer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/printer/index.ts b/src/@ionic-native/plugins/printer/index.ts index 4598ce909..bffe3f474 100644 --- a/src/@ionic-native/plugins/printer/index.ts +++ b/src/@ionic-native/plugins/printer/index.ts @@ -67,7 +67,7 @@ export interface PrintOptions { */ @Plugin({ pluginName: 'Printer', - plugin: 'de.appplant.cordova.plugin.printer', + plugin: 'cordova-plugin-printer', pluginRef: 'cordova.plugins.printer', repo: 'https://github.com/katzer/cordova-plugin-printer', platforms: ['Android', 'iOS', 'Windows'] From ff0008e7eba66355206f8f5884a73b2079526a6c Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 22:02:58 +0100 Subject: [PATCH 17/44] feat(google-analytics): add missing functions --- .../plugins/google-analytics/index.ts | 129 +++++++++++++++--- 1 file changed, 111 insertions(+), 18 deletions(-) diff --git a/src/@ionic-native/plugins/google-analytics/index.ts b/src/@ionic-native/plugins/google-analytics/index.ts index 9af3c62e5..1b7fe31ee 100644 --- a/src/@ionic-native/plugins/google-analytics/index.ts +++ b/src/@ionic-native/plugins/google-analytics/index.ts @@ -38,7 +38,6 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class GoogleAnalytics extends IonicNativePlugin { - /** * In your 'deviceready' handler, set up your Analytics tracker. * https://developers.google.com/analytics/devguides/collection/analyticsjs/ @@ -50,7 +49,9 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 2, errorIndex: 3 }) - startTrackerWithId(id: string, interval?: number): Promise { return; } + startTrackerWithId(id: string, interval?: number): Promise { + return; + } /** * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more @@ -58,7 +59,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setAllowIDFACollection(allow: boolean): Promise { return; } + setAllowIDFACollection(allow: boolean): Promise { + return; + } /** * Set a UserId @@ -67,7 +70,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setUserId(id: string): Promise { return; } + setUserId(id: string): Promise { + return; + } /** * Set a anonymize Ip address @@ -75,15 +80,40 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setAnonymizeIp(anonymize: boolean): Promise { return; } + setAnonymizeIp(anonymize: boolean): Promise { + return; + } /** - * Sets the app version + * Set the app version * @param appVersion {string} App version * @returns {Promise} */ @Cordova() - setAppVersion(appVersion: string): Promise { return; } + setAppVersion(appVersion: string): Promise { + return; + } + + /** + * Get a variable + * @param key {string} Variable + * @returns {Promise} + */ + @Cordova() + getVar(key: string): Promise { + return; + } + + /** + * Set a variable + * @param key {string} Variable + * @param value {string} Parameter + * @returns {Promise} + */ + @Cordova() + setVar(key: string, value: string): Promise { + return; + } /** * Set OptOut @@ -91,14 +121,18 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - setOptOut(optout: boolean): Promise { return; } + setOptOut(optout: boolean): Promise { + return; + } /** * Enable verbose logging * @returns {Promise} */ @Cordova() - debugMode(): Promise { return; } + debugMode(): Promise { + return; + } /** * Track custom metric @@ -110,7 +144,9 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 2, errorIndex: 3 }) - trackMetric(key: number, value?: number): Promise { return; } + trackMetric(key: number, value?: number): Promise { + return; + } /** * Track a screen @@ -125,7 +161,13 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 3, errorIndex: 4 }) - trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise { return; } + trackView( + title: string, + campaignUrl?: string, + newSession?: boolean + ): Promise { + return; + } /** * Add a Custom Dimension @@ -135,7 +177,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - addCustomDimension(key: number, value: string): Promise { return; } + addCustomDimension(key: number, value: string): Promise { + return; + } /** * Track an event @@ -151,7 +195,15 @@ export class GoogleAnalytics extends IonicNativePlugin { successIndex: 5, errorIndex: 6 }) - trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise { return; } + trackEvent( + category: string, + action: string, + label?: string, + value?: number, + newSession?: boolean + ): Promise { + return; + } /** * Track an exception @@ -160,7 +212,9 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - trackException(description: string, fatal: boolean): Promise { return; } + trackException(description: string, fatal: boolean): Promise { + return; + } /** * Track User Timing (App Speed) @@ -171,7 +225,14 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { return; } + trackTiming( + category: string, + intervalInMilliseconds: number, + variable: string, + label: string + ): Promise { + return; + } /** * Add a Transaction (Ecommerce) @@ -185,7 +246,16 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise { return; } + addTransaction( + id: string, + affiliation: string, + revenue: number, + tax: number, + shipping: number, + currencyCode: string + ): Promise { + return; + } /** * Add a Transaction Item (Ecommerce) @@ -200,7 +270,17 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise { return; } + addTransactionItem( + id: string, + name: string, + sku: string, + category: string, + price: number, + quantity: number, + currencyCode: string + ): Promise { + return; + } /** * Enable/disable automatic reporting of uncaught exceptions @@ -208,6 +288,19 @@ export class GoogleAnalytics extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { return; } + enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { + return; + } + /** + * Manually dispatch any data + * @returns {Promise} + * @platform + */ + @Cordova({ + platforms: ['Android', 'iOS', 'Windows'] + }) + dispatch(): Promise { + return; + } } From 1b237aa996044a8589bd5b3e22463657579208ea Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Thu, 15 Mar 2018 22:12:36 +0100 Subject: [PATCH 18/44] fix(push): Android senderID as optional --- src/@ionic-native/plugins/push/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/push/index.ts b/src/@ionic-native/plugins/push/index.ts index 0d5d866da..b58cfbadb 100644 --- a/src/@ionic-native/plugins/push/index.ts +++ b/src/@ionic-native/plugins/push/index.ts @@ -134,7 +134,7 @@ export interface AndroidPushOptions { /** * Maps to the project number in the Google Developer Console. */ - senderID: string; + senderID?: string; /** * The name of a drawable resource to use as the small-icon. The name should From fc0338a1c5901f55c79016aa3f633954b1e3b33e Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 08:49:49 +0100 Subject: [PATCH 19/44] feat(one-signal): add clearOneSignalNotifications function --- src/@ionic-native/plugins/onesignal/index.ts | 112 ++++++++++++------- 1 file changed, 69 insertions(+), 43 deletions(-) diff --git a/src/@ionic-native/plugins/onesignal/index.ts b/src/@ionic-native/plugins/onesignal/index.ts index 7356e8c17..a0e5de2af 100644 --- a/src/@ionic-native/plugins/onesignal/index.ts +++ b/src/@ionic-native/plugins/onesignal/index.ts @@ -97,13 +97,13 @@ export enum OSLockScreenVisibility { * Fully visible (default) */ Public = 1, - /** - * Contents are hidden - */ + /** + * Contents are hidden + */ Private = 0, - /** - * Not shown - */ + /** + * Not shown + */ Secret = -1 } @@ -115,13 +115,13 @@ export enum OSDisplayType { * notification is silent, or inFocusDisplaying is disabled. */ None = 0, - /** - * (**DEFAULT**) - native alert dialog display. - */ + /** + * (**DEFAULT**) - native alert dialog display. + */ InAppAlert = 1, - /** - * native notification display. - */ + /** + * native notification display. + */ Notification = 2 } @@ -397,14 +397,13 @@ export enum OSActionType { }) @Injectable() export class OneSignal extends IonicNativePlugin { - /** * constants to use in inFocusDisplaying() */ OSInFocusDisplayOption = { None: 0, - InAppAlert : 1, - Notification : 2 + InAppAlert: 1, + Notification: 2 }; /** @@ -415,7 +414,9 @@ export class OneSignal extends IonicNativePlugin { * @returns {any} */ @Cordova({ sync: true }) - startInit(appId: string, googleProjectNumber?: string): any { return; } + startInit(appId: string, googleProjectNumber?: string): any { + return; + } /** * Callback to run when a notification is received, whether it was displayed or not. @@ -425,7 +426,9 @@ export class OneSignal extends IonicNativePlugin { @Cordova({ observable: true }) - handleNotificationReceived(): Observable { return; } + handleNotificationReceived(): Observable { + return; + } /** * Callback to run when a notification is tapped on from the notification shade (**ANDROID**) or notification @@ -437,7 +440,9 @@ export class OneSignal extends IonicNativePlugin { @Cordova({ observable: true }) - handleNotificationOpened(): Observable { return; } + handleNotificationOpened(): Observable { + return; + } /** * **iOS** - Settings for iOS apps @@ -457,7 +462,9 @@ export class OneSignal extends IonicNativePlugin { iOSSettings(settings: { kOSSettingsKeyAutoPrompt: boolean; kOSSettingsKeyInAppLaunchURL: boolean; - }): any { return; } + }): any { + return; + } /** * Must be called after `startInit` to complete initialization of OneSignal. @@ -465,7 +472,9 @@ export class OneSignal extends IonicNativePlugin { * @returns {any} */ @Cordova({ sync: true }) - endInit(): any { return; } + endInit(): any { + return; + } /** * Prompt the user for notification permissions. Callback fires as soon as the user accepts or declines notifications. @@ -474,7 +483,9 @@ export class OneSignal extends IonicNativePlugin { @Cordova({ platforms: ['iOS'] }) - promptForPushNotificationsWithUserResponse(): Promise { return; } + promptForPushNotificationsWithUserResponse(): Promise { + return; + } /** * Retrieve a list of tags that have been set on the user from the OneSignal server. @@ -484,7 +495,9 @@ export class OneSignal extends IonicNativePlugin { * @returns {Promise} Returns a Promise that resolves when tags are recieved. */ @Cordova() - getTags(): Promise { return; } + getTags(): Promise { + return; + } /** * Lets you retrieve the OneSignal user id and device token. @@ -497,8 +510,9 @@ export class OneSignal extends IonicNativePlugin { * pushToken {string} A push token is a Google/Apple assigned identifier(unique per device per app). */ @Cordova() - getIds(): Promise<{userId: string; pushToken: string}> { return; } - + getIds(): Promise<{ userId: string; pushToken: string }> { + return; + } /** * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. @@ -508,7 +522,7 @@ export class OneSignal extends IonicNativePlugin { * @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag. */ @Cordova({ sync: true }) - sendTag(key: string, value: string): void { } + sendTag(key: string, value: string): void {} /** * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. @@ -517,7 +531,7 @@ export class OneSignal extends IonicNativePlugin { * @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"} */ @Cordova({ sync: true }) - sendTags(json: any): void { } + sendTags(json: any): void {} /** * Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one. @@ -525,7 +539,7 @@ export class OneSignal extends IonicNativePlugin { * @param {string} Key to remove. */ @Cordova({ sync: true }) - deleteTag(key: string): void { } + deleteTag(key: string): void {} /** * Deletes tags that were previously set on a user with `sendTag` or `sendTags`. @@ -533,14 +547,14 @@ export class OneSignal extends IonicNativePlugin { * @param {Array} Keys to remove. */ @Cordova({ sync: true }) - deleteTags(keys: string[]): void { } + deleteTags(keys: string[]): void {} /** * Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt. * Only works if you set `kOSSettingsAutoPrompt` to `false` in `iOSSettings` */ @Cordova({ sync: true }) - registerForPushNotifications(): void { } + registerForPushNotifications(): void {} /** * Warning: @@ -552,7 +566,7 @@ export class OneSignal extends IonicNativePlugin { * @param {boolean} false to disable vibrate, true to re-enable it. */ @Cordova({ sync: true }) - enableVibrate(enable: boolean): void { } + enableVibrate(enable: boolean): void {} /** * Warning: @@ -564,7 +578,7 @@ export class OneSignal extends IonicNativePlugin { * @param {boolean} false to disable sound, true to re-enable it. */ @Cordova({ sync: true }) - enableSound(enable: boolean): void { } + enableSound(enable: boolean): void {} /** * @@ -574,7 +588,9 @@ export class OneSignal extends IonicNativePlugin { * @returns {any} */ @Cordova({ sync: true }) - inFocusDisplaying(displayOption: OSDisplayType): any { return; } + inFocusDisplaying(displayOption: OSDisplayType): any { + return; + } /** * You can call this method with false to opt users out of receiving all notifications through OneSignal. @@ -583,7 +599,7 @@ export class OneSignal extends IonicNativePlugin { * @param {boolean} enable */ @Cordova({ sync: true }) - setSubscription(enable: boolean): void { } + setSubscription(enable: boolean): void {} /** * Get the current notification and permission state. Returns a OSPermissionSubscriptionState type described below. @@ -591,7 +607,9 @@ export class OneSignal extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - getPermissionSubscriptionState(): Promise { return; } + getPermissionSubscriptionState(): Promise { + return; + } /** * @@ -599,7 +617,9 @@ export class OneSignal extends IonicNativePlugin { * @returns {Promise} Returns a Promise that resolves if the notification was send successfully. */ @Cordova() - postNotification(notificationObj: OSNotification): Promise { return; } + postNotification(notificationObj: OSNotification): Promise { + return; + } /** * Cancels a single OneSignal notification based on its Android notification integer id. Use instead of NotificationManager.cancel(id); otherwise the notification will be restored when your app is restarted. @@ -612,14 +632,14 @@ export class OneSignal extends IonicNativePlugin { * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard. */ @Cordova({ sync: true }) - promptLocation(): void { } + promptLocation(): void {} /** * * @param email {string} */ @Cordova({ sync: true }) - syncHashedEmail(email: string): void { } + syncHashedEmail(email: string): void {} /** * Enable logging to help debug if you run into an issue setting up OneSignal. @@ -630,10 +650,7 @@ export class OneSignal extends IonicNativePlugin { * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages) */ @Cordova({ sync: true }) - setLogLevel(logLevel: { - logLevel: number, - visualLevel: number - }): void { } + setLogLevel(logLevel: { logLevel: number; visualLevel: number }): void {} /** * The passed in function will be fired when a notification permission setting changes. @@ -646,7 +663,9 @@ export class OneSignal extends IonicNativePlugin { @Cordova({ observable: true }) - addPermissionObserver(): Observable { return; } + addPermissionObserver(): Observable { + return; + } /** * The passed in function will be fired when a notification subscription property changes. @@ -660,6 +679,13 @@ export class OneSignal extends IonicNativePlugin { @Cordova({ observable: true }) - addSubscriptionObserver(): Observable { return; } + addSubscriptionObserver(): Observable { + return; + } + /** + * Clears all OneSignla notifications + */ + @Cordova({ sync: true }) + clearOneSignalNotifications(): void {} } From 1e0d5ce30d07cc37509b6fb61d96f4199ed0d519 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 09:00:47 +0100 Subject: [PATCH 20/44] ref(crop): add options interface --- src/@ionic-native/plugins/crop/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/crop/index.ts b/src/@ionic-native/plugins/crop/index.ts index ab5242ffd..acd609899 100644 --- a/src/@ionic-native/plugins/crop/index.ts +++ b/src/@ionic-native/plugins/crop/index.ts @@ -1,6 +1,12 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +export interface CropOptions { + quality: number; + targetHeight: number; + targetWidth: number; +} + /** * @name Crop * @description Crops images @@ -18,6 +24,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * error => console.error('Error cropping image', error) * ); * ``` + * @classes + * CropOptions */ @Plugin({ pluginName: 'Crop', @@ -28,7 +36,6 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class Crop extends IonicNativePlugin { - /** * Crops an image * @param pathToImage @@ -38,6 +45,7 @@ export class Crop extends IonicNativePlugin { @Cordova({ callbackOrder: 'reverse' }) - crop(pathToImage: string, options?: { quality: number, targetHeight: number, targetWidth: number }): Promise { return; } - + crop(pathToImage: string, options?: CropOptions): Promise { + return; + } } From 504838556ea79061cd02534925292fff9e4b548f Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 09:01:33 +0100 Subject: [PATCH 21/44] Update index.ts --- src/@ionic-native/plugins/crop/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/crop/index.ts b/src/@ionic-native/plugins/crop/index.ts index acd609899..412946ecf 100644 --- a/src/@ionic-native/plugins/crop/index.ts +++ b/src/@ionic-native/plugins/crop/index.ts @@ -2,9 +2,9 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; export interface CropOptions { - quality: number; - targetHeight: number; - targetWidth: number; + quality?: number; + targetHeight?: number; + targetWidth?: number; } /** From 270678fb55dc85e7ce681c4c225cba5853ce0d77 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 09:09:19 +0100 Subject: [PATCH 22/44] fix(index-app-content): remove onItemPressed function --- .../plugins/index-app-content/index.ts | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/@ionic-native/plugins/index-app-content/index.ts b/src/@ionic-native/plugins/index-app-content/index.ts index 250245ef2..354bd1abc 100644 --- a/src/@ionic-native/plugins/index-app-content/index.ts +++ b/src/@ionic-native/plugins/index-app-content/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, CordovaFunctionOverride, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; export interface IndexItem { @@ -72,7 +72,6 @@ export interface IndexItem { }) @Injectable() export class IndexAppContent extends IonicNativePlugin { - /** * The option to index app content might not be available at all due to device limitations or user settings. * Therefore it's highly recommended to check upfront if indexing is possible. @@ -93,16 +92,6 @@ export class IndexAppContent extends IonicNativePlugin { return; } - /** - * If user taps on a search result in spotlight then the app will be launched. - * You can register a Javascript handler to get informed when this happens. - * @returns {Observable} returns an observable that notifies you when he user presses on the home screen icon - */ - @CordovaFunctionOverride() - onItemPressed(): Observable { - return; - } - /** * Clear all items stored for a given array of domains * @param {Array} Array of domains to clear @@ -132,5 +121,4 @@ export class IndexAppContent extends IonicNativePlugin { setIndexingInterval(intervalMinutes: number) { return; } - } From 679ad2cefca2663d6f5f23325d47d96204572c3f Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 09:11:59 +0100 Subject: [PATCH 23/44] fix lint --- src/@ionic-native/plugins/index-app-content/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/index-app-content/index.ts b/src/@ionic-native/plugins/index-app-content/index.ts index 354bd1abc..3e8e8399c 100644 --- a/src/@ionic-native/plugins/index-app-content/index.ts +++ b/src/@ionic-native/plugins/index-app-content/index.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, CordovaFunctionOverride, IonicNativePlugin, Plugin } from '@ionic-native/core'; -import { Observable } from 'rxjs/Observable'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface IndexItem { domain: string; From 50f40bc46b5b6cf3fa5521cba79a975c0aa2c6a2 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 11:29:20 +0100 Subject: [PATCH 24/44] docs(debug): Improve example --- src/@ionic-native/plugins/is-debug/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/is-debug/index.ts b/src/@ionic-native/plugins/is-debug/index.ts index 59233a7a6..4fda44f9c 100644 --- a/src/@ionic-native/plugins/is-debug/index.ts +++ b/src/@ionic-native/plugins/is-debug/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name Is Debug @@ -16,8 +16,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * ... * * this.isDebug.getIsDebug() - * .then((isDebug: boolean) => console.log('Is debug:', isDebug)) - * .catch((error: any) => console.error(error)); + * .then(isDebug => console.log('Is debug:', isDebug)) + * .catch(err => console.error(err)); * * ``` */ @@ -30,7 +30,6 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class IsDebug extends IonicNativePlugin { - /** * Determine if an app was installed via xcode / eclipse / the ionic CLI etc * @returns {Promise} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user. @@ -39,5 +38,4 @@ export class IsDebug extends IonicNativePlugin { getIsDebug(): Promise { return; } - } From b616e0f0bff4730e856532fbce60d0da3512a980 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 13:22:33 +0100 Subject: [PATCH 25/44] ref(action-sheet): add corrent types --- src/@ionic-native/plugins/action-sheet/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/action-sheet/index.ts b/src/@ionic-native/plugins/action-sheet/index.ts index 28c33d829..5273f8d0c 100644 --- a/src/@ionic-native/plugins/action-sheet/index.ts +++ b/src/@ionic-native/plugins/action-sheet/index.ts @@ -21,7 +21,7 @@ export interface ActionSheetOptions { /** * Theme to be used on Android */ - androidTheme?: number; + androidTheme?: 1 | 2 | 3 | 4 | 5; /** * Enable a cancel on Android @@ -46,7 +46,7 @@ export interface ActionSheetOptions { /** * On an iPad, set the X,Y position */ - position?: number[]; + position?: [number, number]; /** * Choose if destructive button will be the last @@ -123,7 +123,7 @@ export class ActionSheet extends IonicNativePlugin { * button pressed (1 based, so 1, 2, 3, etc.) */ @Cordova() - show(options?: ActionSheetOptions): Promise { return; } + show(options?: ActionSheetOptions): Promise { return; } /** From e44229471ef66be53f1fb6e39bbf9b53f473d1c7 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 13:26:49 +0100 Subject: [PATCH 26/44] Update index.ts --- src/@ionic-native/plugins/crop/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/crop/index.ts b/src/@ionic-native/plugins/crop/index.ts index 412946ecf..928675009 100644 --- a/src/@ionic-native/plugins/crop/index.ts +++ b/src/@ionic-native/plugins/crop/index.ts @@ -24,7 +24,7 @@ export interface CropOptions { * error => console.error('Error cropping image', error) * ); * ``` - * @classes + * @interfaces * CropOptions */ @Plugin({ From bd72bbc87fdd614d85b968eebb31cbed4c87c6e4 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 13:36:12 +0100 Subject: [PATCH 27/44] ref(android-full-screen): remove unsupported flag --- src/@ionic-native/plugins/android-full-screen/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/@ionic-native/plugins/android-full-screen/index.ts b/src/@ionic-native/plugins/android-full-screen/index.ts index 8971f6dad..e0d023a98 100644 --- a/src/@ionic-native/plugins/android-full-screen/index.ts +++ b/src/@ionic-native/plugins/android-full-screen/index.ts @@ -14,8 +14,6 @@ export enum AndroidSystemUiFlags { HideNavigation = 2, /** View has requested to go into the normal fullscreen mode so that its content can take over the screen while still allowing the user to interact with the application. SYSTEM_UI_FLAG_FULLSCREEN */ Fullscreen = 4, - /** Requests the navigation bar to draw in a mode that is compatible with light navigation bar backgrounds. SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR */ - LightNavigationBar = 16, /** When using other layout flags, we would like a stable view of the content insets given to fitSystemWindows(Rect). SYSTEM_UI_FLAG_LAYOUT_STABLE */ LayoutStable = 256, /** View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_HIDE_NAVIGATION, even if it currently hasn't. SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION */ @@ -45,8 +43,8 @@ export enum AndroidSystemUiFlags { * ... * * this.androidFullScreen.isImmersiveModeSupported() - * .then(() => this.androidFullScreen.immersiveMode()) - * .catch((error: any) => console.log(error)); + * .then(() => console.log('Immersive mode supported')) + * .catch(err => console.log(error)); * * ``` */ From 2a18dbcf3e0c09165f65effe9eb1c191dc581ac4 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 13:46:08 +0100 Subject: [PATCH 28/44] feat(app-rate): add custom locale interface --- src/@ionic-native/plugins/app-rate/index.ts | 47 +++++++++++++++------ 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/@ionic-native/plugins/app-rate/index.ts b/src/@ionic-native/plugins/app-rate/index.ts index 6eb6b2cb6..170ee7b4a 100644 --- a/src/@ionic-native/plugins/app-rate/index.ts +++ b/src/@ionic-native/plugins/app-rate/index.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface AppRatePreferences { - /** * Custom BCP 47 language tag */ @@ -41,7 +40,7 @@ export interface AppRatePreferences { /** * Custom locale object */ - customLocale?: any; + customLocale?: AppRateCustomLocale; /** * Callbacks for events @@ -52,11 +51,38 @@ export interface AppRatePreferences { * App Store URLS */ storeAppURL?: AppUrls; +} +export interface AppRateCustomLocale { + /** Title */ + title?: string; + + /** Message */ + message?: string; + + /** Cancel button label */ + cancelButtonLabel?: string; + + /** Later button label */ + laterButtonLabel?: string; + + /** Rate button label */ + rateButtonLabel?: string; + + /** Yes button label */ + yesButtonLabel?: string; + + /** No button label */ + noButtonLabel?: string; + + /** App rate promt title */ + appRatePromptTitle?: string; + + /** Feedback prompt title */ + feedbackPromptTitle?: string; } export interface AppRateCallbacks { - /** * call back function. called when user clicked on rate-dialog buttons */ @@ -70,11 +96,9 @@ export interface AppRateCallbacks { * call back function. called when user clicked on negative feedback */ handleNegativeFeedback?: Function; - } export interface AppUrls { - /** * application id in AppStore */ @@ -99,7 +123,6 @@ export interface AppUrls { * application URL in WindowsStore */ windows8?: string; - } /** @@ -142,6 +165,7 @@ export interface AppUrls { * AppRatePreferences * AppUrls * AppRateCallbacks + * AppRateCustomLocal * */ @Plugin({ @@ -153,25 +177,22 @@ export interface AppUrls { }) @Injectable() export class AppRate extends IonicNativePlugin { - /** * Configure various settings for the Rating View. * See table below for options */ - @CordovaProperty - preferences: AppRatePreferences; + @CordovaProperty preferences: AppRatePreferences; /** * Prompts the user for rating * @param {boolean} immediately Show the rating prompt immediately. */ @Cordova() - promptForRating(immediately: boolean): void { }; + promptForRating(immediately: boolean): void {} /** * Immediately send the user to the app store rating page */ @Cordova() - navigateToAppStore(): void { }; - + navigateToAppStore(): void {} } From 0f325ed77225feecf5ae6f5de9339be432a47718 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 13:53:28 +0100 Subject: [PATCH 29/44] feat(app-update): add app update options --- src/@ionic-native/plugins/app-update/index.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/@ionic-native/plugins/app-update/index.ts b/src/@ionic-native/plugins/app-update/index.ts index 3b2158ac6..0da8452f1 100644 --- a/src/@ionic-native/plugins/app-update/index.ts +++ b/src/@ionic-native/plugins/app-update/index.ts @@ -1,5 +1,11 @@ -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface AppUpdateOptions { + authType: string; + username?: string; + password?: string; +} /** * @name App Update @@ -24,13 +30,15 @@ import { Injectable } from '@angular/core'; * * constructor(private appUpdate: AppUpdate) { * - * const updateUrl = 'http://your-remote-api.com/update.xml'; - * this.appUpdate.checkAppUpdate(updateUrl); + * const updateUrl = 'https://your-remote-api.com/update.xml'; + * this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') }); * * } * ``` * * The plugin will compare the app version and update it automatically if the API has a newer version to install. + * @interfaces + * AppUpdateOptions */ @Plugin({ pluginName: 'AppUpdate', @@ -49,5 +57,7 @@ export class AppUpdate extends IonicNativePlugin { @Cordova({ callbackOrder: 'reverse' }) - checkAppUpdate(updateUrl: string): Promise { return; } + checkAppUpdate(updateUrl: string, options?: AppUpdateOptions): Promise { + return; + } } From 7e1630f5e51d7a932cd1027d79a5e8ac70927ac7 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 13:57:44 +0100 Subject: [PATCH 30/44] ref(app-versionn): add corrent return types --- src/@ionic-native/plugins/app-version/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/app-version/index.ts b/src/@ionic-native/plugins/app-version/index.ts index 1962cdebd..a612159d2 100644 --- a/src/@ionic-native/plugins/app-version/index.ts +++ b/src/@ionic-native/plugins/app-version/index.ts @@ -38,30 +38,30 @@ export class AppVersion extends IonicNativePlugin { /** * Returns the name of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getAppName(): Promise { return; } + getAppName(): Promise { return; } /** * Returns the package name of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getPackageName(): Promise { return; } + getPackageName(): Promise { return; } /** * Returns the build identifier of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getVersionCode(): Promise { return; } + getVersionCode(): Promise { return; } /** * Returns the version of the app - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getVersionNumber(): Promise { return; } + getVersionNumber(): Promise { return; } } From 796176880382c272ab5f8c74ed013a44551e8e51 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:13:26 +0100 Subject: [PATCH 31/44] ref(background-mode): fix wront types --- .../plugins/background-mode/index.ts | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/@ionic-native/plugins/background-mode/index.ts b/src/@ionic-native/plugins/background-mode/index.ts index 2d7159290..a807319d7 100644 --- a/src/@ionic-native/plugins/background-mode/index.ts +++ b/src/@ionic-native/plugins/background-mode/index.ts @@ -2,27 +2,26 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; - /** * Configurations items that can be updated. */ export interface BackgroundModeConfiguration { - /** * Title of the background task */ - title?: String; + title?: string; /** * Description of background task */ - text?: String; + text?: string; /** * This will look for `.png` in platforms/android/res/drawable|mipmap */ icon?: string; + /** Color */ color?: string; /** @@ -30,20 +29,21 @@ export interface BackgroundModeConfiguration { */ resume?: boolean; + /** Hidden */ hidden?: boolean; + /** Big text */ bigText?: boolean; /** * The text that scrolls itself on statusbar */ - ticker?: String; + ticker?: string; /** * if true plugin will not display a notification. Default is false. */ silent?: boolean; - } /** @@ -74,7 +74,6 @@ export interface BackgroundModeConfiguration { }) @Injectable() export class BackgroundMode extends IonicNativePlugin { - /** * Enable the background mode. * Once called, prevents the app from being paused while in background. @@ -82,14 +81,16 @@ export class BackgroundMode extends IonicNativePlugin { @Cordova({ sync: true }) - enable(): void { } + enable(): void {} /** * Disable the background mode. * Once the background mode has been disabled, the app will be paused when in background. */ @Cordova() - disable(): Promise { return; } + disable(): Promise { + return; + } /** * Checks if background mode is enabled or not. @@ -98,7 +99,9 @@ export class BackgroundMode extends IonicNativePlugin { @Cordova({ sync: true }) - isEnabled(): boolean { return; } + isEnabled(): boolean { + return; + } /** * Can be used to get the information if the background mode is active. @@ -107,7 +110,9 @@ export class BackgroundMode extends IonicNativePlugin { @Cordova({ sync: true }) - isActive(): boolean { return; } + isActive(): boolean { + return; + } /** * Override the default title, ticker and text. @@ -117,7 +122,9 @@ export class BackgroundMode extends IonicNativePlugin { @Cordova({ platforms: ['Android'] }) - setDefaults(options?: BackgroundModeConfiguration): Promise { return; } + setDefaults(options?: BackgroundModeConfiguration): Promise { + return; + } /** * Modify the displayed information. @@ -140,7 +147,9 @@ export class BackgroundMode extends IonicNativePlugin { clearFunction: 'un', clearWithArgs: true }) - on(event: string): Observable { return; } + on(event: string): Observable { + return; + } /** * Android allows to programmatically move from foreground to background. @@ -149,7 +158,7 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - moveToBackground(): void { } + moveToBackground(): void {} /** * Enable GPS-tracking in background (Android). @@ -158,7 +167,7 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - disableWebViewOptimizations (): void { } + disableWebViewOptimizations(): void {} /** * Android allows to programmatically move from background to foreground. @@ -167,7 +176,7 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - moveToForeground(): void { } + moveToForeground(): void {} /** * Override the back button on Android to go to background instead of closing the app. @@ -176,7 +185,7 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - overrideBackButton(): void { } + overrideBackButton(): void {} /** * Exclude the app from the recent task list. Works on Android 5.0+. @@ -185,7 +194,7 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - excludeFromTaskList(): void { } + excludeFromTaskList(): void {} /** * The method works async instead of isActive() or isEnabled(). @@ -193,7 +202,9 @@ export class BackgroundMode extends IonicNativePlugin { @Cordova({ platforms: ['Android'] }) - isScreenOff(): Promise { return; } + isScreenOff(): Promise { + return; + } /** * Turn screen on @@ -202,7 +213,7 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - wakeUp(): void { } + wakeUp(): void {} /** * Turn screen on and show app even locked @@ -211,6 +222,5 @@ export class BackgroundMode extends IonicNativePlugin { platforms: ['Android'], sync: true }) - unlock(): void { } - + unlock(): void {} } From 1546cec69455463912c25b12ed685dc5e85e9139 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:19:16 +0100 Subject: [PATCH 32/44] doc(barcode-scanner): optimize example code --- .../plugins/barcode-scanner/index.ts | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/barcode-scanner/index.ts b/src/@ionic-native/plugins/barcode-scanner/index.ts index f55f76a01..467d613cf 100644 --- a/src/@ionic-native/plugins/barcode-scanner/index.ts +++ b/src/@ionic-native/plugins/barcode-scanner/index.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface BarcodeScannerOptions { - /** * Prefer front camera. Supported on iOS and Android. */ @@ -52,11 +51,26 @@ export interface BarcodeScannerOptions { * Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only. */ resultDisplayDuration?: number; - } export interface BarcodeScanResult { - format: 'QR_CODE' | 'DATA_MATRIX' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'ITF' | 'RSS14' | 'RSS_EXPANDED' | 'PDF417' | 'AZTEC' | 'MSI'; + format: + | 'QR_CODE' + | 'DATA_MATRIX' + | 'UPC_E' + | 'UPC_A' + | 'EAN_8' + | 'EAN_13' + | 'CODE_128' + | 'CODE_39' + | 'CODE_93' + | 'CODABAR' + | 'ITF' + | 'RSS14' + | 'RSS_EXPANDED' + | 'PDF417' + | 'AZTEC' + | 'MSI'; cancelled: boolean; text: string; } @@ -77,10 +91,10 @@ export interface BarcodeScanResult { * ... * * - * this.barcodeScanner.scan().then((barcodeData) => { - * // Success! Barcode data is here - * }, (err) => { - * // An error occurred + * this.barcodeScanner.scan().then(barcodeData => { + * console.log('Barcode data', barcodeData); + * }).catch(err => { + * console.log('Error', err); * }); * ``` * @interfaces @@ -96,7 +110,6 @@ export interface BarcodeScanResult { }) @Injectable() export class BarcodeScanner extends IonicNativePlugin { - Encode: { TEXT_TYPE: string; EMAIL_TYPE: string; @@ -117,7 +130,9 @@ export class BarcodeScanner extends IonicNativePlugin { @Cordova({ callbackOrder: 'reverse' }) - scan(options?: BarcodeScannerOptions): Promise { return; } + scan(options?: BarcodeScannerOptions): Promise { + return; + } /** * Encodes data into a barcode. @@ -127,6 +142,7 @@ export class BarcodeScanner extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - encode(type: string, data: any): Promise { return; } - + encode(type: string, data: any): Promise { + return; + } } From 11d516fb28ac3220abd05798ccaa6cb1bad284f8 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:23:50 +0100 Subject: [PATCH 33/44] feat(base64-to-gallery): add options interface --- .../plugins/base64-to-gallery/index.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/base64-to-gallery/index.ts b/src/@ionic-native/plugins/base64-to-gallery/index.ts index 0acc4da06..c4ac50c78 100644 --- a/src/@ionic-native/plugins/base64-to-gallery/index.ts +++ b/src/@ionic-native/plugins/base64-to-gallery/index.ts @@ -1,5 +1,15 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface Base64ToGalleryOptions { + /** Saved file name prefix */ + prefix: string; + /** + * On Android runs Media Scanner after file creation. + * On iOS if true the file will be added to camera roll, otherwise will be saved to a library folder. + */ + mediaScanner: boolean; +} /** * @name Base64 To Gallery @@ -19,6 +29,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * err => console.log('Error saving image to gallery ', err) * ); * ``` + * @interfaces + * Base64ToGalleryOptions */ @Plugin({ pluginName: 'Base64ToGallery', @@ -29,19 +41,20 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class Base64ToGallery extends IonicNativePlugin { - /** * Converts a base64 string to an image file in the device gallery * @param {string} data The actual base64 string that you want to save - * @param {any} [options] An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS. + * @param {any} [options] An object with properties * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova({ successIndex: 2, errorIndex: 3 }) - base64ToGallery(data: string, options?: { prefix?: string; mediaScanner?: boolean }): Promise { + base64ToGallery( + data: string, + options?: Base64ToGalleryOptions + ): Promise { return; } - } From 957f278738dc8120e87a7bc24d1d563b879e0e74 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:26:33 +0100 Subject: [PATCH 34/44] docs(battery-status): refactored example code --- .../plugins/battery-status/index.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/battery-status/index.ts b/src/@ionic-native/plugins/battery-status/index.ts index d3999a49e..d096bdad1 100644 --- a/src/@ionic-native/plugins/battery-status/index.ts +++ b/src/@ionic-native/plugins/battery-status/index.ts @@ -1,9 +1,8 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; export interface BatteryStatusResponse { - /** * The battery charge percentage */ @@ -13,7 +12,6 @@ export interface BatteryStatusResponse { * A boolean that indicates whether the device is plugged in */ isPlugged: boolean; - } /** @@ -31,11 +29,9 @@ export interface BatteryStatusResponse { * * * // watch change in battery status - * let subscription = this.batteryStatus.onChange().subscribe( - * (status: BatteryStatusResponse) => { + * const subscription = this.batteryStatus.onChange().subscribe(status => { * console.log(status.level, status.isPlugged); - * } - * ); + * }); * * // stop watch * subscription.unsubscribe(); @@ -53,7 +49,6 @@ export interface BatteryStatusResponse { }) @Injectable() export class BatteryStatus extends IonicNativePlugin { - /** * Watch the change in battery level * @returns {Observable} Returns an observable that pushes a status object @@ -62,7 +57,9 @@ export class BatteryStatus extends IonicNativePlugin { eventObservable: true, event: 'batterystatus' }) - onChange(): Observable { return; } + onChange(): Observable { + return; + } /** * Watch when the battery level goes low @@ -72,7 +69,9 @@ export class BatteryStatus extends IonicNativePlugin { eventObservable: true, event: 'batterylow' }) - onLow(): Observable { return; } + onLow(): Observable { + return; + } /** * Watch when the battery level goes to critial @@ -82,6 +81,7 @@ export class BatteryStatus extends IonicNativePlugin { eventObservable: true, event: 'batterycritical' }) - onCritical(): Observable { return; } - + onCritical(): Observable { + return; + } } From e345fed09fd2c843a7ed1671989f2465be32e16b Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:30:32 +0100 Subject: [PATCH 35/44] feat(ble): add scan options interface --- src/@ionic-native/plugins/ble/index.ts | 87 +++++++++++++++++++------- 1 file changed, 65 insertions(+), 22 deletions(-) diff --git a/src/@ionic-native/plugins/ble/index.ts b/src/@ionic-native/plugins/ble/index.ts index 1a2688bfb..3deff7a1a 100644 --- a/src/@ionic-native/plugins/ble/index.ts +++ b/src/@ionic-native/plugins/ble/index.ts @@ -1,7 +1,12 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; +export interface BLEScanOptions { + /** true if duplicate devices should be reported, false (default) if devices should only be reported once. */ + reportDuplicates?: boolean; +} + /** * @name BLE * @description @@ -167,6 +172,8 @@ import { Observable } from 'rxjs/Observable'; * * UUIDs are always strings and not numbers. Some 16-bit UUIDs, such as '2220' look like integers, but they're not. (The integer 2220 is 0x8AC in hex.) This isn't a problem with 128 bit UUIDs since they look like strings 82b9e6e1-593a-456f-be9b-9215160ebcac. All 16-bit UUIDs should also be passed to methods as strings. * + * @interfaces + * BLEScanOptions */ @Plugin({ pluginName: 'BLE', @@ -177,7 +184,6 @@ import { Observable } from 'rxjs/Observable'; }) @Injectable() export class BLE extends IonicNativePlugin { - /** * Scan and discover BLE peripherals for the specified amount of time. * @@ -194,7 +200,9 @@ export class BLE extends IonicNativePlugin { @Cordova({ observable: true }) - scan(services: string[], seconds: number): Observable { return; } + scan(services: string[], seconds: number): Observable { + return; + } /** * Scan and discover BLE peripherals until `stopScan` is called. @@ -217,7 +225,9 @@ export class BLE extends IonicNativePlugin { clearFunction: 'stopScan', clearWithArgs: false }) - startScan(services: string[]): Observable { return; } + startScan(services: string[]): Observable { + return; + } /** * Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports). @@ -230,7 +240,12 @@ export class BLE extends IonicNativePlugin { clearFunction: 'stopScan', clearWithArgs: false }) - startScanWithOptions(services: string[], options: { reportDuplicates?: boolean } | any): Observable { return; } + startScanWithOptions( + services: string[], + options: BLEScanOptions + ): Observable { + return; + } /** * Stop a scan started by `startScan`. @@ -247,7 +262,9 @@ export class BLE extends IonicNativePlugin { * @return returns a Promise. */ @Cordova() - stopScan(): Promise { return; } + stopScan(): Promise { + return; + } /** * Connect to a peripheral. @@ -268,7 +285,9 @@ export class BLE extends IonicNativePlugin { clearFunction: 'disconnect', clearWithArgs: true }) - connect(deviceId: string): Observable { return; } + connect(deviceId: string): Observable { + return; + } /** * Disconnect from a peripheral. @@ -282,7 +301,9 @@ export class BLE extends IonicNativePlugin { * @return Returns a Promise */ @Cordova() - disconnect(deviceId: string): Promise { return; } + disconnect(deviceId: string): Promise { + return; + } /** * Read the value of a characteristic. @@ -297,7 +318,9 @@ export class BLE extends IonicNativePlugin { deviceId: string, serviceUUID: string, characteristicUUID: string - ): Promise { return; }; + ): Promise { + return; + } /** * Write the value of a characteristic. @@ -333,7 +356,9 @@ export class BLE extends IonicNativePlugin { serviceUUID: string, characteristicUUID: string, value: ArrayBuffer - ): Promise { return; } + ): Promise { + return; + } /** * Write the value of a characteristic without waiting for confirmation from the peripheral. @@ -350,7 +375,9 @@ export class BLE extends IonicNativePlugin { serviceUUID: string, characteristicUUID: string, value: ArrayBuffer - ): Promise { return; } + ): Promise { + return; + } /** * Register to be notified when the value of a characteristic changes. @@ -376,7 +403,9 @@ export class BLE extends IonicNativePlugin { deviceId: string, serviceUUID: string, characteristicUUID: string - ): Observable { return; } + ): Observable { + return; + } /** * Stop being notified when the value of a characteristic changes. @@ -391,7 +420,9 @@ export class BLE extends IonicNativePlugin { deviceId: string, serviceUUID: string, characteristicUUID: string - ): Promise { return; } + ): Promise { + return; + } /** * Report the connection status. @@ -407,7 +438,9 @@ export class BLE extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - isConnected(deviceId: string): Promise { return; } + isConnected(deviceId: string): Promise { + return; + } /** * Report if bluetooth is enabled. @@ -415,7 +448,9 @@ export class BLE extends IonicNativePlugin { * @returns {Promise} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled. */ @Cordova() - isEnabled(): Promise { return; } + isEnabled(): Promise { + return; + } /** * Register to be notified when Bluetooth state changes on the device. @@ -434,7 +469,9 @@ export class BLE extends IonicNativePlugin { clearFunction: 'stopStateNotifications', clearWithArgs: false }) - startStateNotifications(): Observable { return; } + startStateNotifications(): Observable { + return; + } /** * Stop state notifications. @@ -442,7 +479,9 @@ export class BLE extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - stopStateNotifications(): Promise { return; } + stopStateNotifications(): Promise { + return; + } /** * Open System Bluetooth settings (Android only). @@ -450,7 +489,9 @@ export class BLE extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - showBluetoothSettings(): Promise { return; } + showBluetoothSettings(): Promise { + return; + } /** * Enable Bluetooth on the device (Android only). @@ -458,7 +499,9 @@ export class BLE extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - enable(): Promise { return; } + enable(): Promise { + return; + } /** * Read the RSSI value on the device connection. @@ -468,7 +511,7 @@ export class BLE extends IonicNativePlugin { *@returns {Promise} */ @Cordova() - readRSSI( - deviceId: string, - ): Promise { return; } + readRSSI(deviceId: string): Promise { + return; + } } From 447f00a202746b9a2ec97916b34abc0d9bf818a7 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:34:51 +0100 Subject: [PATCH 36/44] docs(brightness): add correct types --- src/@ionic-native/plugins/brightness/index.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/brightness/index.ts b/src/@ionic-native/plugins/brightness/index.ts index d6a4aa677..76119f69c 100644 --- a/src/@ionic-native/plugins/brightness/index.ts +++ b/src/@ionic-native/plugins/brightness/index.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; - +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name Brightness @@ -31,15 +30,16 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class Brightness extends IonicNativePlugin { - /** * Sets the brightness of the display. * - * @param {value} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness. + * @param value {number} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness. * @returns {Promise} Returns a Promise that resolves if setting brightness was successful. */ @Cordova() - setBrightness(value: number): Promise { return; } + setBrightness(value: number): Promise { + return; + } /** * Reads the current brightness of the device display. @@ -48,12 +48,13 @@ export class Brightness extends IonicNativePlugin { * brightness value of the device display (floating number between 0 and 1). */ @Cordova() - getBrightness(): Promise { return; } + getBrightness(): Promise { + return; + } /** - * Keeps the screen on. Prevents the device from setting the screen to sleep. - */ + * Keeps the screen on. Prevents the device from setting the screen to sleep. + */ @Cordova() - setKeepScreenOn(value: boolean): void { } - + setKeepScreenOn(value: boolean): void {} } From 5f88ff02f2fe4415064cbfb5bf19e7348e31aad6 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:35:12 +0100 Subject: [PATCH 37/44] Update index.ts --- src/@ionic-native/plugins/brightness/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/brightness/index.ts b/src/@ionic-native/plugins/brightness/index.ts index 76119f69c..54120ab96 100644 --- a/src/@ionic-native/plugins/brightness/index.ts +++ b/src/@ionic-native/plugins/brightness/index.ts @@ -16,7 +16,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; * * ... * - * let brightnessValue: number = 0.8; + * let brightnessValue = 0.8; * this.brightness.setBrightness(brightnessValue); * ``` * From 13765d2d6a9a20dd6cef670cc0e5b8f7d2ff0160 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:42:22 +0100 Subject: [PATCH 38/44] feat(calendar): add getCreateCalendarOptions function --- src/@ionic-native/plugins/calendar/index.ts | 119 +++++++++++++++----- 1 file changed, 91 insertions(+), 28 deletions(-) diff --git a/src/@ionic-native/plugins/calendar/index.ts b/src/@ionic-native/plugins/calendar/index.ts index 329df3666..5854ce0e1 100644 --- a/src/@ionic-native/plugins/calendar/index.ts +++ b/src/@ionic-native/plugins/calendar/index.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface CalendarOptions { - /** * Id */ @@ -47,7 +46,14 @@ export interface CalendarOptions { * URL */ url?: string; +} +export interface NameOrOptions { + /** Calendar name */ + calendarName?: string; + + /** Calendar color as a HEX string */ + calendarColor?: string; } /** @@ -72,6 +78,7 @@ export interface CalendarOptions { * ``` * @interfaces * CalendarOptions + * NameOrOptions */ @Plugin({ pluginName: 'Calendar', @@ -82,7 +89,6 @@ export interface CalendarOptions { }) @Injectable() export class Calendar extends IonicNativePlugin { - /** * This function checks if we have permission to read/write from/to the calendar. * The promise will resolve with `true` when: @@ -95,51 +101,65 @@ export class Calendar extends IonicNativePlugin { * @returns {Promise} */ @Cordova() - hasReadWritePermission(): Promise { return; } + hasReadWritePermission(): Promise { + return; + } /** * Check if we have read permission * @returns {Promise} */ @Cordova() - hasReadPermission(): Promise { return; } + hasReadPermission(): Promise { + return; + } /** * Check if we have write permission * @returns {Promise} */ @Cordova() - hasWritePermission(): Promise { return; } + hasWritePermission(): Promise { + return; + } /** * Request write permission * @returns {Promise} */ @Cordova() - requestWritePermission(): Promise { return; } + requestWritePermission(): Promise { + return; + } /** * Request read permission * @returns {Promise} */ @Cordova() - requestReadPermission(): Promise { return; } + requestReadPermission(): Promise { + return; + } /** * Requests read/write permissions * @returns {Promise} */ @Cordova() - requestReadWritePermission(): Promise { return; } + requestReadWritePermission(): Promise { + return; + } /** * Create a calendar. (iOS only) * - * @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string + * @param {string | CalendarOptions} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string * @returns {Promise} Returns a Promise */ @Cordova() - createCalendar(nameOrOptions: string | any): Promise { return; } + createCalendar(nameOrOptions: string | CalendarOptions): Promise { + return; + } /** * Delete a calendar. (iOS only) @@ -147,7 +167,9 @@ export class Calendar extends IonicNativePlugin { * @returns {Promise} Returns a Promise */ @Cordova() - deleteCalendar(name: string): Promise { return; } + deleteCalendar(name: string): Promise { + return; + } /** * Returns the default calendar options. @@ -157,7 +179,21 @@ export class Calendar extends IonicNativePlugin { @Cordova({ sync: true }) - getCalendarOptions(): CalendarOptions { return; } + getCalendarOptions(): CalendarOptions { + return; + } + + /** + * Returns options for a custom calender with sepcific colord + * + * @return {NameOrOptions} Returns an object with the default options + */ + @Cordova({ + sync: true + }) + getCreateCalendarOptions(): NameOrOptions { + return; + } /** * Silently create an event. @@ -175,7 +211,9 @@ export class Calendar extends IonicNativePlugin { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { + return; + } /** * Silently create an event with additional options. @@ -196,7 +234,9 @@ export class Calendar extends IonicNativePlugin { startDate?: Date, endDate?: Date, options?: CalendarOptions - ): Promise { return; } + ): Promise { + return; + } /** * Interactively create an event. @@ -215,7 +255,9 @@ export class Calendar extends IonicNativePlugin { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { + return; + } /** * Interactively create an event with additional options. @@ -236,7 +278,9 @@ export class Calendar extends IonicNativePlugin { startDate?: Date, endDate?: Date, options?: CalendarOptions - ): Promise { return; } + ): Promise { + return; + } /** * Find an event. @@ -255,7 +299,9 @@ export class Calendar extends IonicNativePlugin { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { + return; + } /** * Find an event with additional options. @@ -275,7 +321,9 @@ export class Calendar extends IonicNativePlugin { startDate?: Date, endDate?: Date, options?: CalendarOptions - ): Promise { return; } + ): Promise { + return; + } /** * Find a list of events within the specified date range. (Android only) @@ -287,14 +335,18 @@ export class Calendar extends IonicNativePlugin { @Cordova({ platforms: ['Android'] }) - listEventsInRange(startDate: Date, endDate: Date): Promise { return; } + listEventsInRange(startDate: Date, endDate: Date): Promise { + return; + } /** * Get a list of all calendars. * @returns {Promise} A Promise that resolves with the list of calendars, or rejects with an error. */ @Cordova() - listCalendars(): Promise { return; } + listCalendars(): Promise { + return; + } /** * Get a list of all future events in the specified calendar. (iOS only) @@ -303,7 +355,9 @@ export class Calendar extends IonicNativePlugin { @Cordova({ platforms: ['iOS'] }) - findAllEventsInNamedCalendar(calendarName: string): Promise { return; } + findAllEventsInNamedCalendar(calendarName: string): Promise { + return; + } /** * Modify an event. (iOS only) @@ -334,7 +388,9 @@ export class Calendar extends IonicNativePlugin { newNotes?: string, newStartDate?: Date, newEndDate?: Date - ): Promise { return; } + ): Promise { + return; + } /** * Modify an event with additional options. (iOS only) @@ -369,7 +425,9 @@ export class Calendar extends IonicNativePlugin { newEndDate?: Date, filterOptions?: CalendarOptions, newOptions?: CalendarOptions - ): Promise { return; } + ): Promise { + return; + } /** * Delete an event. @@ -388,7 +446,9 @@ export class Calendar extends IonicNativePlugin { notes?: string, startDate?: Date, endDate?: Date - ): Promise { return; } + ): Promise { + return; + } /** * Delete an event from the specified Calendar. (iOS only) @@ -411,7 +471,9 @@ export class Calendar extends IonicNativePlugin { startDate?: Date, endDate?: Date, calendarName?: string - ): Promise { return; } + ): Promise { + return; + } /** * Open the calendar at the specified date. @@ -419,6 +481,7 @@ export class Calendar extends IonicNativePlugin { * @return {Promise} Promise returns a promise */ @Cordova() - openCalendar(date: Date): Promise { return; } - + openCalendar(date: Date): Promise { + return; + } } From ac303d6f7fa85b61ba3c7b201f80c7f1b86072f7 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:45:03 +0100 Subject: [PATCH 39/44] docs(call-number): add return values to example --- src/@ionic-native/plugins/call-number/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/@ionic-native/plugins/call-number/index.ts b/src/@ionic-native/plugins/call-number/index.ts index aa78c34a5..77a5ddd77 100644 --- a/src/@ionic-native/plugins/call-number/index.ts +++ b/src/@ionic-native/plugins/call-number/index.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + /** * @name Call Number * @description @@ -16,8 +17,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * * * this.callNumber.callNumber("18001010101", true) - * .then(() => console.log('Launched dialer!')) - * .catch(() => console.log('Error launching dialer')); + * .then(res => console.log('Launched dialer!', res)) + * .catch(err => console.log('Error launching dialer', err)); * * ``` */ @@ -30,7 +31,6 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class CallNumber extends IonicNativePlugin { - /** * Calls a phone number * @param numberToCall {string} The phone number to call as a string From a393e5c55d436604517093dc87b6430d7d0c2faf Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:56:22 +0100 Subject: [PATCH 40/44] date-picker(date-picker): fix some typos --- src/@ionic-native/plugins/date-picker/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/@ionic-native/plugins/date-picker/index.ts b/src/@ionic-native/plugins/date-picker/index.ts index 5c6667864..110e14f4e 100644 --- a/src/@ionic-native/plugins/date-picker/index.ts +++ b/src/@ionic-native/plugins/date-picker/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface DatePickerOptions { /** @@ -21,13 +21,13 @@ export interface DatePickerOptions { /** * Maximum date - * Default?: empty String + * Default: empty String */ maxDate?: Date | string | number; /** * Label for the dialog title. If empty, uses android default (Set date/Set time). - * Default?: empty String + * Default: empty String */ titleText?: string; @@ -116,7 +116,6 @@ export interface DatePickerOptions { * Force locale for datePicker. */ locale?: string; - } /** @@ -155,7 +154,6 @@ export interface DatePickerOptions { }) @Injectable() export class DatePicker extends IonicNativePlugin { - /** * @hidden */ @@ -176,5 +174,4 @@ export class DatePicker extends IonicNativePlugin { show(options: DatePickerOptions): Promise { return; } - } From 03c219936c6b8b7cc255a3c36b7e8f4bade747d2 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 15:00:45 +0100 Subject: [PATCH 41/44] docs(db-meter): refactored example --- src/@ionic-native/plugins/db-meter/index.ts | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/db-meter/index.ts b/src/@ionic-native/plugins/db-meter/index.ts index 01e54bd83..b413617fc 100644 --- a/src/@ionic-native/plugins/db-meter/index.ts +++ b/src/@ionic-native/plugins/db-meter/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; /** @@ -21,7 +21,7 @@ import { Observable } from 'rxjs/Observable'; * * // Check if we are listening * this.dbMeter.isListening().then( - * (isListening: boolean) => console.log(isListening) + * isListening => console.log(isListening) * ); * * // Stop listening @@ -43,7 +43,6 @@ import { Observable } from 'rxjs/Observable'; }) @Injectable() export class DBMeter extends IonicNativePlugin { - /** * Starts listening * @returns {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. @@ -52,27 +51,34 @@ export class DBMeter extends IonicNativePlugin { observable: true, clearFunction: 'stop' }) - start(): Observable { return; } + start(): Observable { + return; + } /** * Stops listening * @hidden */ @Cordova() - stop(): Promise { return; } + stop(): Promise { + return; + } /** * Check if the DB Meter is listening * @returns {Promise} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening */ @Cordova() - isListening(): Promise { return; } + isListening(): Promise { + return; + } /** * Delete the DB Meter instance * @returns {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur. */ @Cordova() - delete(): Promise { return; } - + delete(): Promise { + return; + } } From d2261b643202df5fa2face83a178eb848a6f7829 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 15:11:08 +0100 Subject: [PATCH 42/44] feat(device-accounts): add android account interface --- .../plugins/device-accounts/index.ts | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/device-accounts/index.ts b/src/@ionic-native/plugins/device-accounts/index.ts index ec345c165..903ddc380 100644 --- a/src/@ionic-native/plugins/device-accounts/index.ts +++ b/src/@ionic-native/plugins/device-accounts/index.ts @@ -1,5 +1,16 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface AndroidAccount { + /** Account creator */ + CREATOR: AndroidAccount; + + /** Account name */ + name: string; + + /** Account type */ + type: string; +} /** * @name Device Accounts @@ -19,6 +30,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * .catch(error => console.error(error)); * * ``` + * @interfaces + * AndroidAccount */ @Plugin({ pluginName: 'DeviceAccounts', @@ -29,33 +42,39 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class DeviceAccounts extends IonicNativePlugin { - /** * Gets all accounts registered on the Android Device - * @returns {Promise} + * @returns {Promise} */ @Cordova() - get(): Promise { return; } + get(): Promise { + return; + } /** * Get all accounts registered on Android device for requested type - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getByType(type: string): Promise { return; } + getByType(type: string): Promise { + return; + } /** * Get all emails registered on Android device (accounts with 'com.google' type) - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getEmails(): Promise { return; } + getEmails(): Promise { + return; + } /** * Get the first email registered on Android device - * @returns {Promise} + * @returns {Promise} */ @Cordova() - getEmail(): Promise { return; } - + getEmail(): Promise { + return; + } } From 7cafebd0e88c828daa562364f8a390ab695ee6a8 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 15:17:29 +0100 Subject: [PATCH 43/44] feat(device-feedback): add feedback interface --- .../plugins/device-feedback/index.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/device-feedback/index.ts b/src/@ionic-native/plugins/device-feedback/index.ts index 5246e4e6d..132c523f8 100644 --- a/src/@ionic-native/plugins/device-feedback/index.ts +++ b/src/@ionic-native/plugins/device-feedback/index.ts @@ -1,5 +1,14 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface DeviceFeedbackEnabled { + /** Haptic Feedback */ + haptic: boolean; + + /** Acoustic Feedback */ + acoustic: boolean; +} + /** * @name Device Feedback * @description @@ -19,8 +28,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * * this.deviceFeedback.haptic(0); * - * this.deviceFeedback.isFeedbackEnabled() - * .then((feedback) => { + * this.deviceFeedback.isFeedbackEnabled().then(feedback => { * console.log(feedback); * // { * // acoustic: true, @@ -29,6 +37,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * }); * * ``` + * @innterfaces + * DeviceFeedbackEnabled */ @Plugin({ pluginName: 'DeviceFeedback', @@ -39,25 +49,25 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class DeviceFeedback extends IonicNativePlugin { - /** * Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do. */ @Cordova({ sync: true }) - acoustic(): void { } + acoustic(): void {} /** * Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do. - * @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap. + * @param type {number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap. */ @Cordova({ sync: true }) - haptic(type: number): void { } + haptic(type: number): void {} /** * Check if haptic and acoustic feedback is enabled by user settings. - * @returns {Promise} + * @returns {Promise} */ @Cordova() - isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; } - + isFeedbackEnabled(): Promise { + return; + } } From 8d2681a9fc3a0b88db3110b2a0261e7df24860bb Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 16:32:43 +0100 Subject: [PATCH 44/44] ref(device-orientation): add missing type --- src/@ionic-native/plugins/device-orientation/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/device-orientation/index.ts b/src/@ionic-native/plugins/device-orientation/index.ts index bbddc0339..ffd4e52aa 100644 --- a/src/@ionic-native/plugins/device-orientation/index.ts +++ b/src/@ionic-native/plugins/device-orientation/index.ts @@ -22,7 +22,7 @@ export interface DeviceOrientationCompassHeading { /** * The time at which this heading was determined. (DOMTimeStamp) */ - timestamp: any; + timestamp: number; }