From e8a9bf7206d68b107c97106ce4d33a3f72c73189 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 00:57:43 -0400 Subject: [PATCH 01/34] update google maps --- .../plugins/google-maps/index.ts | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 68a4933d56..c88db94079 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -10,24 +10,27 @@ declare const plugin: any; * You can listen to these events where appropriate */ export const GoogleMapsEvent = { - MAP_CLICK: 'click', - MAP_LONG_CLICK: 'long_click', - MY_LOCATION_CHANGE: 'my_location_change', + MAP_READY: 'map_ready', + MAP_CLICK: 'map_click', + MAP_LONG_CLICK: 'map_long_click', MY_LOCATION_BUTTON_CLICK: 'my_location_button_click', INDOOR_BUILDING_FOCUSED: 'indoor_building_focused', INDOOR_LEVEL_ACTIVATED: 'indoor_level_activated', - CAMERA_CHANGE: 'camera_change', - CAMERA_IDLE: 'camera_idle', - MAP_READY: 'map_ready', - MAP_LOADED: 'map_loaded', - MAP_WILL_MOVE: 'will_move', - MAP_CLOSE: 'map_close', - MARKER_CLICK: 'click', - OVERLAY_CLICK: 'overlay_click', + CAMERA_MOVE_START: 'camera_move_start', + CAMERA_MOVE: 'camera_move', + CAMERA_MOVE_END: 'camera_move_end', + POLYGON_CLICK: 'polygon_click', + POLYLINE_CLICK: 'polyline_click', + CIRCLE_CLICK: 'circle_click', + GROUND_OVERLAY_CLICK: 'ground_overlay_click', INFO_CLICK: 'info_click', - MARKER_DRAG: 'drag', - MARKER_DRAG_START: 'drag_start', - MARKER_DRAG_END: 'drag_end' + INFO_LONG_CLICK: 'info_long_click', + INFO_CLOSE: 'info_close', + INFO_OPEN: 'info_open', + MARKER_CLICK: 'marker_click', + MARKER_DRAG: 'marker_drag', + MARKER_DRAG_START: 'marker_drag_start', + MARKER_DRAG_END: 'marker_drag_end' }; /** @@ -144,6 +147,13 @@ export class GoogleMap { @CordovaInstance() getCameraPosition(): Promise { return; } + /** + * + * @return {Promise} + */ + @CordovaInstance() + getCameraTarget(): Promise { return; } + /** * Get the location of the user. * @@ -170,16 +180,16 @@ export class GoogleMap { getLicenseInfo(): Promise { return; } @CordovaInstance({ sync: true }) - setCenter(latLng: LatLng): void { } + setCameraTarget(latLng: LatLng): void { } @CordovaInstance({ sync: true }) - setZoom(zoomLevel: number): void { } + setCameraZoom(zoomLevel: number): void { } @CordovaInstance({ sync: true }) setMapTypeId(mapTypeId: string): void { } @CordovaInstance({ sync: true }) - setTilt(tiltLevel: number): void { } + setCameraTilt(tiltLevel: number): void { } /** * @returns {Promise} @@ -596,16 +606,6 @@ export interface MarkerOptions { * Set to true to disable auto panning when the marker is clicked. */ disableAutoPan?: boolean; - - /** - * Function to be invoked when the user clicks on the marker - */ - markerClick?: Function; - - /** - * Function to be invoked when the user clicks on the info box - */ - infoClick?: Function; } /** From 5fa28c2b5403a4bdaf4b7cc0992dc48dad194eba Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 01:05:03 -0400 Subject: [PATCH 02/34] more updates --- .../plugins/google-maps/index.ts | 257 +++++++++--------- 1 file changed, 127 insertions(+), 130 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index c88db94079..1d3de47a84 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -170,15 +170,6 @@ export class GoogleMap { @CordovaInstance() getVisibleRegion(): Promise { return; } - @CordovaInstance({ sync: true }) - showDialog(): void { } - - @CordovaInstance({ sync: true }) - closeDialog(): void { } - - @CordovaInstance() - getLicenseInfo(): Promise { return; } - @CordovaInstance({ sync: true }) setCameraTarget(latLng: LatLng): void { } @@ -314,21 +305,21 @@ export class GoogleMap { }); } - /** - * @returns {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(); - } - }); - }); - } + // /** + // * @returns {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(); + // } + // }); + // }); + // } @CordovaInstance({ sync: true }) setDiv(domNode: HTMLElement): void { } @@ -339,9 +330,6 @@ export class GoogleMap { @CordovaInstance({ sync: true }) setOptions(options: any): void { } - @CordovaInstance({ sync: true }) - setBackgroundColor(backgroundColor: string): void { } - @CordovaInstance({ sync: true }) setPadding(top?: number, right?: number, bottom?: number, left?: number): void { } @@ -374,6 +362,15 @@ export class GoogleMap { @CordovaInstance({ sync: true }) panBy(x: string | number, y: string | number): void { } + + setCameraBearing() {} + + getCameraZoom() {} + + getCameraBearing() {} + + getCameraTilt() {} + } /** @@ -464,8 +461,8 @@ export class GoogleMap { pluginName: 'GoogleMaps', pluginRef: 'plugin.google.maps.Map', plugin: 'cordova-plugin-googlemaps', - repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps', - 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"', + repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps', + install: 'ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --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'] }) @@ -1311,7 +1308,7 @@ export class Polygon { * @hidden */ export interface TileOverlayOptions { - tileUrlFormat?: string; + getTile?: Function; visible?: boolean; zIndex?: number; tileSize?: number; @@ -1558,106 +1555,106 @@ export class GroundOverlay { } -/** - * @hidden - */ -export interface KmlOverlayOptions { - url?: string; - preserveViewport?: boolean; - animation?: boolean; -} - -/** - * @hidden - */ -export class KmlOverlay { - - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } - - /** - * Adds an event listener that works once. - * - * @returns {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. - * - * @returns {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. - * - * @returns {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 interface KmlOverlayOptions { +// url?: string; +// preserveViewport?: boolean; +// animation?: boolean; +// } + +// /** +// * @hidden +// */ +// export class KmlOverlay { +// +// constructor(private _objectInstance: any) { } +// +// /** +// * Adds an event listener. +// * +// * @returns {Observable} +// */ +// addEventListener(eventName: string): Observable { +// return Observable.fromEvent(this._objectInstance, eventName); +// } +// +// /** +// * Adds an event listener that works once. +// * +// * @returns {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. +// * +// * @returns {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. +// * +// * @returns {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 From 3a200888df40c360629678988422b6c5c5c4f59b Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 01:15:35 -0400 Subject: [PATCH 03/34] add BaseClass --- .../plugins/google-maps/index.ts | 912 +++++------------- 1 file changed, 218 insertions(+), 694 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 1d3de47a84..b1b54b6075 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -5,6 +5,162 @@ import 'rxjs/add/observable/fromEvent'; declare const plugin: any; +/** + * @hidden + */ +export interface CircleOptions { + center?: LatLng; + radius?: number; + strokeColor?: string; + strokeWidth?: number; + fillColor?: string; + visible?: boolean; + zIndex?: number; +} + +export interface AnimateCameraOptions { + target?: LatLng | Array | LatLngBounds; + tilt?: number; + zoom?: number; + bearing?: number; + duration?: number; +} + +export interface CameraPosition { + target?: LatLng | LatLngBounds | LatLng[]; + zoom?: number; + tilt?: number; + bearing?: number; +} + +export interface MyLocation { + latLng?: LatLng; + speed?: number; + time?: string; + bearing?: number; +} + +export interface MyLocationOptions { + enableHighAccuracy?: boolean; +} + +export interface VisibleRegion { + northeast?: any; + southwest?: any; +} + +export interface MarkerOptions { + /** + * The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64 + */ + icon?: any; + + /** + * The content of the infoWindow. + */ + title?: string; + + /** + * The snippet of the infoWindow. + */ + snippet?: string; + + /** + * The position of the marker. + */ + position?: LatLng; + + /** + * Specify the anchor of the InfoWindow + */ + infoWindowAnchor?: number[]; + + /** + * Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker. + */ + draggable?: boolean; + + /** + * Set true if you want to use a flat marker. (Default: false) + */ + flat?: boolean; + + /** + * Set rotation angle. (Default: 0) + */ + rotation?: number; + + /** + * Set false if you want to hide. (Default: true) + */ + visible?: boolean; + + /** + * Specify the options for title. + */ + styles?: any; + + /** + * Which animation to play when marker is added to a map. + */ + animation?: string; + + /** + * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect) + */ + zIndex?: number; + + /** + * Set to true to disable auto panning when the marker is clicked. + */ + disableAutoPan?: boolean; +} + +export interface MarkerIcon { + url?: string; + size?: { + width?: number; + height?: number; + }; +} + +export interface PolylineOptions { + points?: Array; + visible?: boolean; + geodesic?: boolean; + color?: string; + width?: number; + zIndex?: number; +} + +export interface PolygonOptions { + points?: Array; + geodesic?: boolean; + strokeColor?: string; + strokeWidth?: number; + fillColor?: string; + visible?: boolean; + zIndex?: number; + addHole?: Array; +} + +export interface TileOverlayOptions { + getTile?: Function; + visible?: boolean; + zIndex?: number; + tileSize?: number; + opacity?: number; +} + +export interface GroundOverlayOptions { + url?: string; + bounds?: Array; + visible?: boolean; + opacity?: number; + bearing?: number; + zIndex?: number; +} + /** * @hidden * You can listen to these events where appropriate @@ -56,21 +212,8 @@ export const GoogleMapsMapTypeId = { /** * @hidden */ -@Plugin({ - pluginName: 'GoogleMaps', - plugin: 'cordova-plugin-googlemaps' -}) -export class GoogleMap { - _objectInstance: any; - - constructor(element: string | HTMLElement, options?: any) { - if (checkAvailability('plugin.google.maps.Map', null, 'GoogleMaps') === true) { - if (typeof element === 'string') { - element = document.getElementById(element); - } - this._objectInstance = plugin.google.maps.Map.getMap(element, options); - } - } +export class BaseClass { + protected _objectInstance: any; /** * Adds an event listener. @@ -133,6 +276,29 @@ export class GoogleMap { @CordovaInstance({ sync: true }) empty(): void { } + @CordovaInstance({ sync: true }) + trigger(eventName: string, ...parameters: any[]): void {} +} + +/** + * @hidden + */ +@Plugin({ + pluginName: 'GoogleMaps', + plugin: 'cordova-plugin-googlemaps' +}) +export class GoogleMap extends BaseClass { + + constructor(element: string | HTMLElement, options?: any) { + super(); + if (checkAvailability('plugin.google.maps.Map', null, 'GoogleMaps') === true) { + if (typeof element === 'string') { + element = document.getElementById(element); + } + this._objectInstance = plugin.google.maps.Map.getMap(element, options); + } + } + @CordovaInstance({ sync: true }) setDebuggable(isDebuggable: boolean): void { } @@ -492,237 +658,35 @@ export class GoogleMaps extends IonicNativePlugin { /** * @hidden */ -export interface AnimateCameraOptions { - target?: LatLng | Array | LatLngBounds; - tilt?: number; - zoom?: number; - bearing?: number; - duration?: number; -} - -/** - * @hidden - */ -export interface CameraPosition { - target?: LatLng | LatLngBounds | LatLng[]; - zoom?: number; - tilt?: number; - bearing?: number; -} - -/** - * @hidden - */ -export interface MyLocation { - latLng?: LatLng; - speed?: number; - time?: string; - bearing?: number; -} - -/** - * @hidden - */ -export interface MyLocationOptions { - enableHighAccuracy?: boolean; -} +export class Marker extends BaseClass { -/** - * @hidden - */ -export interface VisibleRegion { - northeast?: any; - southwest?: any; -} + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; + } -/** - * @hidden - */ -export interface MarkerOptions { /** - * The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64 + * Return true if the marker is visible */ - icon?: any; + @CordovaInstance({ sync: true }) + isVisible(): boolean { return; } /** - * The content of the infoWindow. + * Set false if you want to hide the marker. + * @param visible */ - title?: string; + @CordovaInstance() + setVisible(visible: boolean): void { } /** - * The snippet of the infoWindow. + * Return the marker hash code. + * @return {string} Marker hash code */ - snippet?: string; + @CordovaInstance({ sync: true }) + getHashCode(): string { return; } /** - * The position of the marker. - */ - position?: LatLng; - - /** - * Specify the anchor of the InfoWindow - */ - infoWindowAnchor?: number[]; - - /** - * Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker. - */ - draggable?: boolean; - - /** - * Set true if you want to use a flat marker. (Default: false) - */ - flat?: boolean; - - /** - * Set rotation angle. (Default: 0) - */ - rotation?: number; - - /** - * Set false if you want to hide. (Default: true) - */ - visible?: boolean; - - /** - * Specify the options for title. - */ - styles?: any; - - /** - * Which animation to play when marker is added to a map. - */ - animation?: string; - - /** - * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect) - */ - zIndex?: number; - - /** - * Set to true to disable auto panning when the marker is clicked. - */ - disableAutoPan?: boolean; -} - -/** - * @hidden - */ -export interface MarkerIcon { - url?: string; - size?: { - width?: number; - height?: number; - }; -} - -/** - * @hidden - */ -export class Marker { - - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } - - /** - * Adds an event listener that works once. - * - * @returns {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. - * - * @returns {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. - * - * @returns {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 { } - - /** - * Return true if the marker is visible - */ - @CordovaInstance({ sync: true }) - isVisible(): boolean { return; } - - /** - * Set false if you want to hide the marker. - * @param visible - */ - @CordovaInstance() - setVisible(visible: boolean): void { } - - /** - * Return the marker hash code. - * @return {string} Marker hash code - */ - @CordovaInstance({ sync: true }) - getHashCode(): string { return; } - - /** - * Remove the marker completely. + * Remove the marker completely. */ @CordovaInstance({ sync: true }) remove(): void { } @@ -881,102 +845,13 @@ export class Marker { /** * @hidden */ -export interface CircleOptions { - center?: LatLng; - radius?: number; - strokeColor?: string; - strokeWidth?: number; - fillColor?: string; - visible?: boolean; - zIndex?: number; -} - -/** - * @hidden - */ - -export class Circle { - - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } - - /** - * Adds an event listener that works once. - * - * @returns {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. - * - * @returns {Observable} - */ - on(eventName: string): Observable { - if (!this._objectInstance) { - return new Observable((observer) => { - observer.error({ error: 'plugin_not_installed' }); - }); - } +export class Circle extends BaseClass { - return new Observable( - (observer) => { - this._objectInstance.on(eventName, observer.next.bind(observer)); - return () => this._objectInstance.off(event); - } - ); - } - - /** - * Listen to a map event only once. - * - * @returns {Promise} - */ - one(eventName: string): Promise { - if (!this._objectInstance) { - return Promise.reject({ error: 'plugin_not_installed' }); - } - return new Promise( - resolve => this._objectInstance.one(eventName, resolve) - ); + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; } - /** - * Clears all stored values - */ - @CordovaInstance({ sync: true }) - empty(): void { } - @CordovaInstance({ sync: true }) getCenter(): LatLng { return; } @@ -1023,100 +898,12 @@ export class Circle { /** * @hidden */ -export interface PolylineOptions { - points?: Array; - visible?: boolean; - geodesic?: boolean; - color?: string; - width?: number; - zIndex?: number; -} - -/** - * @hidden - */ - -export class Polyline { - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); +export class Polyline extends BaseClass { + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; } - /** - * Adds an event listener that works once. - * - * @returns {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. - * - * @returns {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. - * - * @returns {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 }) getPoints(): Array { return; } @@ -1161,103 +948,13 @@ export class Polyline { /** * @hidden */ -export interface PolygonOptions { - points?: Array; - geodesic?: boolean; - strokeColor?: string; - strokeWidth?: number; - fillColor?: string; - visible?: boolean; - zIndex?: number; - addHole?: Array; -} - -/** - * @hidden - */ - -export class Polygon { - - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } - - /** - * Adds an event listener that works once. - * - * @returns {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. - * - * @returns {Observable} - */ - on(eventName: string): Observable { - if (!this._objectInstance) { - return new Observable((observer) => { - observer.error({ error: 'plugin_not_installed' }); - }); - } +export class Polygon extends BaseClass { - return new Observable( - (observer) => { - this._objectInstance.on(eventName, observer.next.bind(observer)); - return () => this._objectInstance.off(event); - } - ); - } - - /** - * Listen to a map event only once. - * - * @returns {Promise} - */ - one(eventName: string): Promise { - if (!this._objectInstance) { - return Promise.reject({ error: 'plugin_not_installed' }); - } - return new Promise( - resolve => this._objectInstance.one(eventName, resolve) - ); + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; } - /** - * Clears all stored values - */ - @CordovaInstance({ sync: true }) - empty(): void { } - @CordovaInstance({ sync: true }) getPoints(): Array { return; } @@ -1307,99 +1004,13 @@ export class Polygon { /** * @hidden */ -export interface TileOverlayOptions { - getTile?: Function; - visible?: boolean; - zIndex?: number; - tileSize?: number; - opacity?: number; -} - -/** - * @hidden - */ -export class TileOverlay { - - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } +export class TileOverlay extends BaseClass { - /** - * Adds an event listener that works once. - * - * @returns {Promise} - */ - addListenerOnce(eventName: string): Promise { - if (!this._objectInstance) { - return Promise.reject({ error: 'plugin_not_installed' }); - } - return new Promise( - resolve => this._objectInstance.addListenerOnce(eventName, resolve) - ); + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; } - /** - * 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. - * - * @returns {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. - * - * @returns {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 }) getVisible(): boolean { return; } @@ -1435,100 +1046,13 @@ export class TileOverlay { /** * @hidden */ -export interface GroundOverlayOptions { - url?: string; - bounds?: Array; - visible?: boolean; - opacity?: number; - bearing?: number; - zIndex?: number; -} - -/** - * @hidden - */ -export class GroundOverlay { - - constructor(private _objectInstance: any) { } - - /** - * Adds an event listener. - * - * @returns {Observable} - */ - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } +export class GroundOverlay extends BaseClass { - /** - * Adds an event listener that works once. - * - * @returns {Promise} - */ - addListenerOnce(eventName: string): Promise { - if (!this._objectInstance) { - return Promise.reject({ error: 'plugin_not_installed' }); - } - return new Promise( - (resolve: Function) => this._objectInstance.addListenerOnce(eventName, resolve) - ); + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; } - /** - * 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. - * - * @returns {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. - * - * @returns {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 }) setBearing(bearing: number): void { } From 0a297894c6cabc5c967b7d514057758d71106e94 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 01:25:09 -0400 Subject: [PATCH 04/34] add BaseArrayClass --- .../plugins/google-maps/index.ts | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index b1b54b6075..49bd922a9f 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -280,6 +280,73 @@ export class BaseClass { trigger(eventName: string, ...parameters: any[]): void {} } +/** + * @hidden + */ +export class BaseArrayClass { + /** + * Removes all elements from the array. + */ + empty() {} + + /** + * Iterate over each element, calling the provided callback. + * @param fn {Function} + * @param callback {Function} + */ + forEach(fn: Function, callback?: Function) {} + + /** + * Iterate over each element, calling the provided callback. + * Then you can get the results of each callback. + * @param fn {Function} + * @param callback {Function} + */ + map(fn: Function, callback?: Function) {} + + /** + * Returns a reference to the underlying Array. + */ + getArray() {} + + /** + * Returns the element at the specified index. + * @param index {number} + */ + getAt(index: number) {} + + /** + * Inserts an element at the specified index. + * @param index {number} + * @param element {object} + */ + insertAt(index: number, element: any) {} + + /** + * Removes the last element of the array and returns that element. + */ + pop() {} + + /** + * Adds one element to the end of the array and returns the new length of the array. + * @param element {object} + */ + push(element: any) {} + + /** + * Removes an element from the specified index. + * @param index {number} + */ + remoteAt(index: number) {} + + /** + * Sets an element at the specified index. + * @param index {number} + * @param element {object} + */ + setAt(index: number, element: any) {} +} + /** * @hidden */ From 6f7e6006ad22f109c8ebaf264f0116fda510834b Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 01:32:46 -0400 Subject: [PATCH 05/34] add BaseArrayClass constructor --- .../plugins/google-maps/index.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 49bd922a9f..5ec6882d32 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -283,7 +283,22 @@ export class BaseClass { /** * @hidden */ -export class BaseArrayClass { +@Plugin({ + plugin: 'GoogleMaps', + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.BaseArrayClass', + repo: '' +}) +export class BaseArrayClass extends IonicNativePlugin { + private _objectInstance: any; + + constructor(initialData: any[]) { + super(); + if (checkAvailability(BaseArrayClass.getPluginRef(), null, BaseArrayClass.getPluginName()) === true) { + this._objectInstance = new (BaseArrayClass.getPlugin())(initialData); + } + } + /** * Removes all elements from the array. */ @@ -358,7 +373,7 @@ export class GoogleMap extends BaseClass { constructor(element: string | HTMLElement, options?: any) { super(); - if (checkAvailability('plugin.google.maps.Map', null, 'GoogleMaps') === true) { + if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { if (typeof element === 'string') { element = document.getElementById(element); } From 6d8c0afa2f77715a403e1da8c9fc5b3ecf24541f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 01:45:24 -0400 Subject: [PATCH 06/34] finish up BaseArrayClass --- .../plugins/google-maps/index.ts | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 5ec6882d32..49b9accff5 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; +import { Observer } from 'rxjs/Observer'; import 'rxjs/add/observable/fromEvent'; declare const plugin: any; @@ -299,67 +300,95 @@ export class BaseArrayClass extends IonicNativePlugin { } } + /** + * Add an event listener + * @param event {string} name of the event. Can be `insert_at`, `remove_at`, or `set_at`. + * @returns {Observable} returns an Observable + */ + @InstanceCheck({ observable: true }) + on(event: 'insert_at' | 'remove_at' | 'set_at') { + return new Observable((observer: Observer) => { + this._objectInstance.on(event, observer.next.bind(observer)); + return () => this._objectInstance.off(event, observer.next.bind(observer)); + }); + } + /** * Removes all elements from the array. */ - empty() {} + @CordovaInstance({ sync: true }) + empty(): void {} /** * Iterate over each element, calling the provided callback. * @param fn {Function} * @param callback {Function} */ - forEach(fn: Function, callback?: Function) {} + @CordovaInstance({ sync: true }) + forEach(fn: Function, callback?: Function): void {} /** * Iterate over each element, calling the provided callback. * Then you can get the results of each callback. * @param fn {Function} * @param callback {Function} + * @return {Array} returns a new array with the results */ - map(fn: Function, callback?: Function) {} + @CordovaInstance({ sync: true }) + map(fn: Function, callback?: Function): any[] { return; } /** * Returns a reference to the underlying Array. + * @return {Array} */ - getArray() {} + @CordovaInstance({ sync: true }) + getArray(): any[] { return; } /** * Returns the element at the specified index. * @param index {number} + * @return {Object} */ - getAt(index: number) {} + @CordovaInstance({ sync: true }) + getAt(index: number): any {} /** * Inserts an element at the specified index. * @param index {number} - * @param element {object} + * @param element {Object} + * @return {Object} */ + @CordovaInstance({ sync: true }) insertAt(index: number, element: any) {} /** * Removes the last element of the array and returns that element. + * @return {Object} */ - pop() {} + @CordovaInstance({ sync: true }) + pop(): any {} /** * Adds one element to the end of the array and returns the new length of the array. * @param element {object} */ - push(element: any) {} + @CordovaInstance({ sync: true }) + push(element: any): void {} /** * Removes an element from the specified index. * @param index {number} */ - remoteAt(index: number) {} + @CordovaInstance({ sync: true }) + removeAt(index: number): void {} /** * Sets an element at the specified index. * @param index {number} * @param element {object} */ - setAt(index: number, element: any) {} + @CordovaInstance({ sync: true }) + setAt(index: number, element: any): void {} } /** From d5d69cba460decf6e5fab0c1c0dc63de2a99be43 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 01:51:53 -0400 Subject: [PATCH 07/34] add Environment class --- .../plugins/google-maps/index.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 49b9accff5..7378d4b558 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -766,6 +766,33 @@ export class GoogleMaps extends IonicNativePlugin { } +/** + * @hidden + */ +@Plugin({ + plugin: 'GoogleMaps', + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.environment', + repo: '' +}) +export class Environment extends IonicNativePlugin { + + /** + * Get the open source software license information for Google Maps Android API v2 and Google Maps SDK for iOS. + * @returns {Promise} + */ + @Cordova() + getLicenseInfo(): Promise { return; } + + /** + * Specifies the background color of the app. + * @param color + */ + @Cordova() + setBackgroundColor(color: string): void {} + +} + /** * @hidden */ From 146ddc9324d5eb47a72bc4f37892b7741124ca9c Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 02:16:07 -0400 Subject: [PATCH 08/34] improve docs and add missing functions to GoogleMap class --- .../plugins/google-maps/index.ts | 277 +++++++++++++----- 1 file changed, 201 insertions(+), 76 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 7378d4b558..2644506af6 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -399,7 +399,6 @@ export class BaseArrayClass extends IonicNativePlugin { plugin: 'cordova-plugin-googlemaps' }) export class GoogleMap extends BaseClass { - constructor(element: string | HTMLElement, options?: any) { super(); if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { @@ -410,83 +409,244 @@ export class GoogleMap extends BaseClass { } } + /** + * Changes the map div + * @param domNode + */ @CordovaInstance({ sync: true }) - setDebuggable(isDebuggable: boolean): void { } + setDiv(domNode: HTMLElement): void { } + /** + * Changes the map type id + * @param mapTypeId {string} + */ @CordovaInstance({ sync: true }) - setClickable(isClickable: boolean): void { } + setMapTypeId(mapTypeId: string): void { } + + /** + * Moves the camera with animation + * @returns {Promise} + */ + @CordovaInstance() + animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } + + /** + * Zooming in the camera with animation + */ + @CordovaInstance() + animateCameraZoomIn(): void {} + + /** + * Zooming out the camera with animation + */ + @CordovaInstance() + animateCameraZoomOut(): void {} + + /** + * Moves the camera without animation + * @returns {Promise} + */ + @CordovaInstance() + moveCamera(cameraPosition: CameraPosition): Promise { return; } + + /** + * Zooming in the camera without animation + */ + @CordovaInstance() + moveCameraZoomIn(): void {} + + /** + * Zooming out the camera without animation + */ + @CordovaInstance() + moveCameraZoomOut(): void {} /** * Get the position of the camera. - * * @returns {Promise} */ @CordovaInstance() getCameraPosition(): Promise { return; } /** - * + * Get the current camera target position * @return {Promise} */ @CordovaInstance() getCameraTarget(): Promise { return; } /** - * Get the location of the user. - * - * @returns {Promise} + * Get the current camera zoom level + * @return {number} */ - @CordovaInstance() - getMyLocation(options?: MyLocationOptions): Promise { return; } + @CordovaInstance({ sync: true }) + getCameraZoom(): number { return; } /** - * Get the visible region. - * + * Get the current camera bearing + * @return {number} + */ + @CordovaInstance({ sync: true }) + getCameraBearing(): number { return; } + + /** + * Get the current camera tilt (view angle) + * @return {number} + */ + @CordovaInstance({ sync: true }) + getCameraTilt(): number { return; } + + /** + * Set the center position of the camera view + * @param latLng {LatLng} + */ + @CordovaInstance({ sync: true }) + setCameraTarget(latLng: LatLng): void { } + + /** + * Set zoom level of the camera + * @param zoomLevel {number} Zoom level + */ + @CordovaInstance({ sync: true }) + setCameraZoom(zoomLevel: number): void {} + + /** + * Set the camera view angle + * @param tiltLevel {number} Tilt level + */ + @CordovaInstance({ sync: true }) + setCameraTilt(tiltLevel: number): void {} + + /** + * Set camera bearing + * @param bearing {any} + */ + @CordovaInstance({ sync: true }) + setCameraBearing(bearing: any): void {} + + /** + * Change the center of the map by the given distance in pixels + * @param x {any} + * @param y {any} + */ + @CordovaInstance({ sync: true }) + panBy(x: string | number, y: string | number): void { } + + /** + * Get the current visible region (sw and ne) * @returns {Promise} */ @CordovaInstance() getVisibleRegion(): Promise { return; } - @CordovaInstance({ sync: true }) - setCameraTarget(latLng: LatLng): void { } + /** + * Get the current device location + * @returns {Promise} + */ + @CordovaInstance() + getMyLocation(options?: MyLocationOptions): Promise { return; } + /** + * Set false to ignore all clicks on the map + * @param isClickable {boolean} + */ @CordovaInstance({ sync: true }) - setCameraZoom(zoomLevel: number): void { } + setClickable(isClickable: boolean): void {} + /** + * Destroy a map completely + */ @CordovaInstance({ sync: true }) - setMapTypeId(mapTypeId: string): void { } + remove(): void {} + /** + * Remove all overlays, such as marker + */ @CordovaInstance({ sync: true }) - setCameraTilt(tiltLevel: number): void { } + clear(): void {} /** + * Convert the unit from LatLng to the pixels from the left/top of the map div * @returns {Promise} */ @CordovaInstance() - animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } + fromLatLngToPoint(latLng: LatLng): Promise { return; } /** - * @returns {Promise} + * Convert the unit from the pixels from the left/top to the LatLng + * @returns {Promise} */ @CordovaInstance() - moveCamera(cameraPosition: CameraPosition): Promise { return; } + fromPointToLatLng(point: any): Promise { return; } + + /** + * Set true if you want to show the MyLocation button + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setMyLocationEnabled(enabled: boolean): void {} + + /** + * Get the currently focused building + * @return {Promise} + */ + @CordovaInstance() + getFocusedBuilding(): Promise { return; } + + /** + * Set true if you want to show the indoor map + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setIndoorEnabled(enabled: boolean): void {} + + /** + * Set true if you want to show the traffic layer + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setTrafficEnabled(enabled: boolean): void {} + /** + * Set true if you want to show the compass button + * @param enabled {boolean} + */ @CordovaInstance({ sync: true }) - setMyLocationEnabled(enabled: boolean): void { } + setCompassEnabled(enabled: boolean): void {} + /** + * Sets the preference for whether all gestures should be enabled or disabled + * @param enabled {boolean} + */ @CordovaInstance({ sync: true }) - setIndoorEnabled(enabled: boolean): void { } + setAllGesturesEnabled(enabled: boolean): void {} + /** + * Set visiblity of the map + * @param visible {boolean} + */ @CordovaInstance({ sync: true }) - setTrafficEnabled(enabled: boolean): void { } + setVisible(visible: boolean): void {} + /** + * Adjust the map padding + * @param top {number} + * @param right {number} + * @param left {number} + * @param bottom {number} + */ @CordovaInstance({ sync: true }) - setCompassEnabled(enabled: boolean): void { } + setPadding(top?: number, right?: number, bottom?: number, left?: number): void { } + /** + * Set options + * @param options + */ @CordovaInstance({ sync: true }) - setAllGesturesEnabled(enabled: boolean): void { } + setOptions(options: any): void {} /** + * Adds a marker * @returns {Promise} */ @InstanceCheck() @@ -503,6 +663,7 @@ export class GoogleMap extends BaseClass { } /** + * Adds a circle * @returns {Promise} */ @InstanceCheck() @@ -519,6 +680,7 @@ export class GoogleMap extends BaseClass { } /** + * Adds a polygon * @returns {Promise} */ @InstanceCheck() @@ -535,6 +697,7 @@ export class GoogleMap extends BaseClass { } /** + * * @returns {Promise} */ @InstanceCheck() @@ -582,6 +745,19 @@ export class GoogleMap extends BaseClass { }); } + /** + * Refreshes layout. + * You can execute it, but you don't need to do that. The plugin does this automatically. + */ + @CordovaInstance({ sync: true }) + refreshLayout(): void {} + + /** + * @returns {Promise} + */ + @CordovaInstance() + toDataURL(): Promise { return; } + // /** // * @returns {Promise} // */ @@ -597,57 +773,6 @@ export class GoogleMap extends BaseClass { // }); // }); // } - - @CordovaInstance({ sync: true }) - setDiv(domNode: HTMLElement): void { } - - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } - - @CordovaInstance({ sync: true }) - setOptions(options: any): void { } - - @CordovaInstance({ sync: true }) - setPadding(top?: number, right?: number, bottom?: number, left?: number): void { } - - @CordovaInstance({ sync: true }) - clear(): void { } - - @CordovaInstance({ sync: true }) - refreshLayout(): void { } - - /** - * @returns {Promise} - */ - @CordovaInstance() - fromLatLngToPoint(latLng: LatLng, point: any): Promise { return; } - - /** - * @returns {Promise} - */ - @CordovaInstance() - fromPointToLatLng(point: any): Promise { return; } - - /** - * @returns {Promise} - */ - @CordovaInstance() - toDataURL(): Promise { return; } - - @CordovaInstance({ sync: true }) - remove(): void { } - - @CordovaInstance({ sync: true }) - panBy(x: string | number, y: string | number): void { } - - setCameraBearing() {} - - getCameraZoom() {} - - getCameraBearing() {} - - getCameraTilt() {} - } /** From 7af1b599128555cd7e88f573ba5885794062d008 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 02:19:37 -0400 Subject: [PATCH 09/34] improve TileOverlayOptions interface --- src/@ionic-native/plugins/google-maps/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 2644506af6..54dc6d00f4 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -146,7 +146,7 @@ export interface PolygonOptions { } export interface TileOverlayOptions { - getTile?: Function; + getTile: (x: number, y: number, zoom: number) => string; visible?: boolean; zIndex?: number; tileSize?: number; From 054e2fc26db16df2a4141290c8cbcaf21b811e94 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 02:21:41 -0400 Subject: [PATCH 10/34] add types to constants --- src/@ionic-native/plugins/google-maps/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 54dc6d00f4..d928aba3a9 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -166,7 +166,7 @@ export interface GroundOverlayOptions { * @hidden * You can listen to these events where appropriate */ -export const GoogleMapsEvent = { +export const GoogleMapsEvent: { [eventName: string]: string; } = { MAP_READY: 'map_ready', MAP_CLICK: 'map_click', MAP_LONG_CLICK: 'map_long_click', @@ -193,7 +193,7 @@ export const GoogleMapsEvent = { /** * @hidden */ -export const GoogleMapsAnimation = { +export const GoogleMapsAnimation: { [animationName: string]: string; } = { BOUNCE: 'BOUNCE', DROP: 'DROP' }; @@ -201,7 +201,7 @@ export const GoogleMapsAnimation = { /** * @hidden */ -export const GoogleMapsMapTypeId = { +export const GoogleMapsMapTypeId: { [mapType: string]: string; } = { HYBRID: 'MAP_TYPE_HYBRID', NONE: 'MAP_TYPE_NONE', NORMAL: 'MAP_TYPE_NORMAL', From 80a47b2024be54baadfc8d3e37c090e61748aad2 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 04:51:39 -0400 Subject: [PATCH 11/34] add ILatLng interface --- .../plugins/google-maps/index.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index d928aba3a9..9a981d6b30 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -145,6 +145,11 @@ export interface PolygonOptions { addHole?: Array; } +export interface ILatLng { + lat: number; + lng: number; +} + export interface TileOverlayOptions { getTile: (x: number, y: number, zoom: number) => string; visible?: boolean; @@ -302,11 +307,11 @@ export class BaseArrayClass extends IonicNativePlugin { /** * Add an event listener - * @param event {string} name of the event. Can be `insert_at`, `remove_at`, or `set_at`. + * @param event {string} name of the event. Can be `insert_at`, `remove_at`, `set_at`, or `finish`. * @returns {Observable} returns an Observable */ @InstanceCheck({ observable: true }) - on(event: 'insert_at' | 'remove_at' | 'set_at') { + on(event: 'insert_at' | 'remove_at' | 'set_at' | 'finish') { return new Observable((observer: Observer) => { this._objectInstance.on(event, observer.next.bind(observer)); return () => this._objectInstance.off(event, observer.next.bind(observer)); @@ -1477,8 +1482,7 @@ export class LatLngBounds { /** * @hidden */ - -export class LatLng { +export class LatLng implements ILatLng { lat: number; lng: number; @@ -1488,7 +1492,7 @@ export class LatLng { this.lng = lng; } - equals(other: LatLng): boolean { + equals(other: ILatLng): boolean { return this.lat === other.lat && this.lng === other.lng; } @@ -1502,14 +1506,15 @@ export class LatLng { return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); } } + /** * @hidden */ export interface GeocoderRequest { - address?: string; - bounds?: LatLng[]; + address?: string | string[]; position?: { lat: number; lng: number }; } + /** * @hidden */ @@ -1533,6 +1538,7 @@ export interface GeocoderResult { subThoroughfare?: string; thoroughfare?: string; } + /** * @hidden */ From c71094d8e95516e1d50a311e9b5dfa5af6ca7015 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 05:00:01 -0400 Subject: [PATCH 12/34] improve types in BaseArrayClass --- .../plugins/google-maps/index.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 9a981d6b30..8545450367 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -295,10 +295,10 @@ export class BaseClass { pluginRef: 'plugin.google.maps.BaseArrayClass', repo: '' }) -export class BaseArrayClass extends IonicNativePlugin { +export class BaseArrayClass extends IonicNativePlugin { private _objectInstance: any; - constructor(initialData: any[]) { + constructor(initialData: T[]) { super(); if (checkAvailability(BaseArrayClass.getPluginRef(), null, BaseArrayClass.getPluginName()) === true) { this._objectInstance = new (BaseArrayClass.getPlugin())(initialData); @@ -330,7 +330,7 @@ export class BaseArrayClass extends IonicNativePlugin { * @param callback {Function} */ @CordovaInstance({ sync: true }) - forEach(fn: Function, callback?: Function): void {} + forEach(fn: ((element: T, index?: number) => void) | ((element: T, callback: () => void) => void), callback?: () => void): void {} /** * Iterate over each element, calling the provided callback. @@ -340,14 +340,14 @@ export class BaseArrayClass extends IonicNativePlugin { * @return {Array} returns a new array with the results */ @CordovaInstance({ sync: true }) - map(fn: Function, callback?: Function): any[] { return; } + map(fn: Function, callback?: ((element: T, index: number) => T) | ((element: T, callback: (newElement: T) => void) => void)): T[] { return; } /** * Returns a reference to the underlying Array. * @return {Array} */ @CordovaInstance({ sync: true }) - getArray(): any[] { return; } + getArray(): T[] { return; } /** * Returns the element at the specified index. @@ -364,21 +364,21 @@ export class BaseArrayClass extends IonicNativePlugin { * @return {Object} */ @CordovaInstance({ sync: true }) - insertAt(index: number, element: any) {} + insertAt(index: number, element: T) {} /** * Removes the last element of the array and returns that element. * @return {Object} */ @CordovaInstance({ sync: true }) - pop(): any {} + pop(): T { return; } /** * Adds one element to the end of the array and returns the new length of the array. * @param element {object} */ @CordovaInstance({ sync: true }) - push(element: any): void {} + push(element: T): void {} /** * Removes an element from the specified index. @@ -393,7 +393,7 @@ export class BaseArrayClass extends IonicNativePlugin { * @param element {object} */ @CordovaInstance({ sync: true }) - setAt(index: number, element: any): void {} + setAt(index: number, element: T): void {} } /** @@ -1512,7 +1512,7 @@ export class LatLng implements ILatLng { */ export interface GeocoderRequest { address?: string | string[]; - position?: { lat: number; lng: number }; + position?: ILatLng | ILatLng[]; } /** From 6683fb8c546fa6d0324070d7b9532c60959904f6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 05:03:02 -0400 Subject: [PATCH 13/34] fix geocoder return type --- src/@ionic-native/plugins/google-maps/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 8545450367..9051ba01c5 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1552,10 +1552,10 @@ export class Geocoder { /** * Converts position to address and vice versa * @param {GeocoderRequest} request Request object with either an address or a position - * @returns {Promise} + * @returns {Promise>} */ @CordovaCheck() - geocode(request: GeocoderRequest): Promise { + geocode(request: GeocoderRequest): Promise> { return new Promise((resolve: Function) => { plugin.google.maps.Geocoder.geocode(request, resolve); }); From 3a79cf36de35d5762111d3701954e1c2634a2dbd Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 21:33:03 -0400 Subject: [PATCH 14/34] use Cordova decorator for geocoder --- src/@ionic-native/plugins/google-maps/index.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 9051ba01c5..3a54830c91 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -290,7 +290,7 @@ export class BaseClass { * @hidden */ @Plugin({ - plugin: 'GoogleMaps', + plugin: 'cordova-plugin-googlemaps', pluginName: 'GoogleMaps', pluginRef: 'plugin.google.maps.BaseArrayClass', repo: '' @@ -900,7 +900,7 @@ export class GoogleMaps extends IonicNativePlugin { * @hidden */ @Plugin({ - plugin: 'GoogleMaps', + plugin: 'cordova-plugin-googlemaps', pluginName: 'GoogleMaps', pluginRef: 'plugin.google.maps.environment', repo: '' @@ -1543,7 +1543,7 @@ export interface GeocoderResult { * @hidden */ @Plugin({ - pluginName: 'Geocoder', + pluginName: 'GoogleMaps', pluginRef: 'plugin.google.maps.Geocoder', plugin: 'cordova-plugin-googlemaps', repo: '' @@ -1554,10 +1554,6 @@ export class Geocoder { * @param {GeocoderRequest} request Request object with either an address or a position * @returns {Promise>} */ - @CordovaCheck() - geocode(request: GeocoderRequest): Promise> { - return new Promise((resolve: Function) => { - plugin.google.maps.Geocoder.geocode(request, resolve); - }); - } + @Cordova() + geocode(request: GeocoderRequest): Promise> { return; } } From 29bc6d62aad93e79c80bef548799df881b31f940 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 21:36:23 -0400 Subject: [PATCH 15/34] document CameraPosition and add missing duration property --- src/@ionic-native/plugins/google-maps/index.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 3a54830c91..82d99335d7 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -28,10 +28,26 @@ export interface AnimateCameraOptions { } export interface CameraPosition { + /** + * The center location of the camera view. + */ target?: LatLng | LatLngBounds | LatLng[]; - zoom?: number; + /** + * View angle + */ tilt?: number; + /** + * Zoom level + */ + zoom?: number; + /** + * Map orientation + */ bearing?: number; + /** + * The duration of animation in milliseconds + */ + duration?: number; } export interface MyLocation { From c8dd0a6bb3d658ae25ab6ff6dea102103dc598f9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 21:49:15 -0400 Subject: [PATCH 16/34] document circle class and add update functions --- .../plugins/google-maps/index.ts | 95 ++++++++++++++++--- 1 file changed, 83 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 82d99335d7..6279711c22 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1131,52 +1131,123 @@ export class Marker extends BaseClass { */ export class Circle extends BaseClass { + @CordovaInstance({ sync: true }) + constructor(_objectInstance: any) { super(); this._objectInstance = _objectInstance; } + /** + * Change the center position. + * @param latLng {LatLng} + */ + @CordovaInstance({ sync: true }) + setCenter(latLng: LatLng): void {} + + /** + * Return the current center position + * @return {LatLng} + */ @CordovaInstance({ sync: true }) getCenter(): LatLng { return; } + /** + * Return the current circle radius. + * @return {number} + */ @CordovaInstance({ sync: true }) getRadius(): number { return; } + /** + * Change the circle radius. + * @param radius {number} + */ @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } + setRadius(radius: number): void {} + /** + * Change the filling color (inner color). + * @param color {string} + */ @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } + setFillColor(color: string): void {} + /** + * Return the current circle filling color (inner color). + * @return {string} + */ @CordovaInstance({ sync: true }) - getZIndex(): number { return; } + getFillColor(): string { return; } + /** + * Change the stroke width. + * @param strokeWidth {number} + */ @CordovaInstance({ sync: true }) - remove(): void { } + setStrokeWidth(strokeWidth: number): void {} + + /** + * Return the current circle stroke width (unit: pixel). + * @return {number} + */ + @CordovaInstance({ sync: true }) + getStrokeWidth(): number { return; } + /** + * Change the stroke color (outter color). + * @param strokeColor {string} + */ @CordovaInstance({ sync: true }) - setCenter(latLng: LatLng): void { } + setStrokeColor(strokeColor: string): void {} + /** + * Return the current circle stroke color (outer color). + * @return {string} + */ @CordovaInstance({ sync: true }) - setFillColor(fillColor: string): void { } + getStrokeColor(): string { return; } + /** + * Change clickablity of the circle. + * @param clickable {boolean} + */ @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void { } + setClickable(clickable: boolean): void {} + /** + * Return true if the circle is clickable. + * @return {boolean} + */ @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void { } + getClickable(): boolean { return; } + /** + * Change the circle zIndex order. + * @param zIndex {number} + */ @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } + setZIndex(zIndex: number): void {} + /** + * Return the current circle zIndex. + * @return {number} + */ @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { } + getZIndex(): number { return; } + /** + * Remove the circle. + */ @CordovaInstance({ sync: true }) - setRadius(radius: number): void { } + remove(): void {} + /** + * Return the latLngBounds (rectangle) that contains the circle. + * @return {LatLngBounds} + */ @CordovaInstance({ sync: true }) - getMap(): GoogleMap { return; } + getBounds(): LatLngBounds { return; } } /** From b37079583ac2b29f8d035b80e5643d504d7a395f Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 4 Jul 2017 21:50:39 -0400 Subject: [PATCH 17/34] tslint --- src/@ionic-native/plugins/google-maps/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 6279711c22..c4d1d3aa3d 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, CordovaInstance, Plugin, InstanceProperty, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; import 'rxjs/add/observable/fromEvent'; From 7816de04e5952ea553d34aa078071c547004d7c5 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 00:33:54 -0400 Subject: [PATCH 18/34] remove extra decorator --- src/@ionic-native/plugins/google-maps/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index c4d1d3aa3d..4826c63372 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1131,8 +1131,6 @@ export class Marker extends BaseClass { */ export class Circle extends BaseClass { - @CordovaInstance({ sync: true }) - constructor(_objectInstance: any) { super(); this._objectInstance = _objectInstance; From bf448e6cc78c8cd656b64ff9d40e22cb4708820b Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:00:54 -0400 Subject: [PATCH 19/34] add setVisible and getVisible to Circle class --- src/@ionic-native/plugins/google-maps/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 4826c63372..4f404014d5 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1246,6 +1246,20 @@ export class Circle extends BaseClass { */ @CordovaInstance({ sync: true }) getBounds(): LatLngBounds { return; } + + /** + * Set circle visibility + * @param visible {boolean} + */ + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void {} + + /** + * Returns a boolean that indicates whether the circle is visible + * @return {boolean} + */ + @CordovaInstance({ sync: true }) + getVisible(): boolean { return; } } /** From 7347e3899534bb88de3ee7a39faaf6fe7485bdc4 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:08:08 -0400 Subject: [PATCH 20/34] complete Environment class --- src/@ionic-native/plugins/google-maps/index.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 4f404014d5..682d69ade7 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -934,9 +934,23 @@ export class Environment extends IonicNativePlugin { * Specifies the background color of the app. * @param color */ - @Cordova() + @Cordova({ sync: true }) setBackgroundColor(color: string): void {} + /** + * Set maps to debuggable + * @param debug {boolean} + */ + @Cordova({ sync: true }) + setDebuggable(debug: boolean): void {} + + /** + * Checks if plugin is available + * @return {Promise} + */ + @Cordova() + isAvailable(): Promise { return; } + } /** From 84864b3a42f5ec2b3c9f839e4c9696c601bb0553 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:09:49 -0400 Subject: [PATCH 21/34] add convenience method to return instance of environment --- src/@ionic-native/plugins/google-maps/index.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 682d69ade7..40f83d623f 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -892,6 +892,11 @@ export class GoogleMap extends BaseClass { @Injectable() export class GoogleMaps extends IonicNativePlugin { + /** + * @hidden + */ + _environment: Environment = new Environment(); + /** * Checks if a map object has been created and is available. * @@ -910,6 +915,14 @@ export class GoogleMaps extends IonicNativePlugin { return new GoogleMap(element, options); } + /** + * Convenience method that returns an instance of Environment class + * @return {Object} + */ + environment(): Environment { + return this._environment; + } + } /** From d1469ecd9e118bce36cd16b2e72da2dc7eb1b5b4 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:10:35 -0400 Subject: [PATCH 22/34] add more classes to docs --- src/@ionic-native/plugins/google-maps/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 40f83d623f..86183c1b4e 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -869,6 +869,8 @@ export class GoogleMap extends BaseClass { * ``` * @classes * GoogleMap + * Circle + * Environment * Marker * LatLng * Geocoder From 3257d9b463976662882ec4a5d7b134e26402269e Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:20:17 -0400 Subject: [PATCH 23/34] re-organize plugin definition --- .../plugins/google-maps/index.ts | 1430 ++++++++--------- 1 file changed, 711 insertions(+), 719 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 86183c1b4e..da9e8364d2 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -4,21 +4,6 @@ import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; import 'rxjs/add/observable/fromEvent'; -declare const plugin: any; - -/** - * @hidden - */ -export interface CircleOptions { - center?: LatLng; - radius?: number; - strokeColor?: string; - strokeWidth?: number; - fillColor?: string; - visible?: boolean; - zIndex?: number; -} - export interface AnimateCameraOptions { target?: LatLng | Array | LatLngBounds; tilt?: number; @@ -50,20 +35,62 @@ export interface CameraPosition { duration?: number; } -export interface MyLocation { - latLng?: LatLng; - speed?: number; - time?: string; +export interface CircleOptions { + center?: LatLng; + radius?: number; + strokeColor?: string; + strokeWidth?: number; + fillColor?: string; + visible?: boolean; + zIndex?: number; +} + +export interface GeocoderRequest { + address?: string | string[]; + position?: ILatLng | ILatLng[]; +} + +export interface GeocoderResult { + adminArea?: string; + country?: string; + countryCode?: string; + extra?: { + featureName?: string; + lines?: Array; + permises?: string; + phone?: string; + url?: string + }; + locale?: string; + locality?: string; + position?: { lat: number; lng: number }; + postalCode?: string; + subAdminArea?: string; + subLocality?: string; + subThoroughfare?: string; + thoroughfare?: string; +} + +export interface GroundOverlayOptions { + url?: string; + bounds?: Array; + visible?: boolean; + opacity?: number; bearing?: number; + zIndex?: number; } -export interface MyLocationOptions { - enableHighAccuracy?: boolean; +export interface ILatLng { + lat: number; + lng: number; } -export interface VisibleRegion { - northeast?: any; - southwest?: any; +export interface MarkerIcon { + url?: string; + size?: { + width?: number; + height?: number; + }; } export interface MarkerOptions { @@ -133,21 +160,15 @@ export interface MarkerOptions { disableAutoPan?: boolean; } -export interface MarkerIcon { - url?: string; - size?: { - width?: number; - height?: number; - }; +export interface MyLocation { + latLng?: LatLng; + speed?: number; + time?: string; + bearing?: number; } -export interface PolylineOptions { - points?: Array; - visible?: boolean; - geodesic?: boolean; - color?: string; - width?: number; - zIndex?: number; +export interface MyLocationOptions { + enableHighAccuracy?: boolean; } export interface PolygonOptions { @@ -161,9 +182,13 @@ export interface PolygonOptions { addHole?: Array; } -export interface ILatLng { - lat: number; - lng: number; +export interface PolylineOptions { + points?: Array; + visible?: boolean; + geodesic?: boolean; + color?: string; + width?: number; + zIndex?: number; } export interface TileOverlayOptions { @@ -174,13 +199,9 @@ export interface TileOverlayOptions { opacity?: number; } -export interface GroundOverlayOptions { - url?: string; - bounds?: Array; - visible?: boolean; - opacity?: number; - bearing?: number; - zIndex?: number; +export interface VisibleRegion { + northeast?: any; + southwest?: any; } /** @@ -232,74 +253,134 @@ export const GoogleMapsMapTypeId: { [mapType: string]: string; } = { }; /** - * @hidden + * @name Google Maps + * @description This plugin uses the native Google Maps SDK + * @usage + * ```typescript + * import { + * GoogleMaps, + * GoogleMap, + * GoogleMapsEvent, + * LatLng, + * CameraPosition, + * MarkerOptions, + * Marker + * } from '@ionic-native/google-maps'; + * + * export class MapPage { + * constructor(private googleMaps: GoogleMaps) {} + * + * // Load map only after view is initialized + * ngAfterViewInit() { + * this.loadMap(); + * } + * + * loadMap() { + * // make sure to create following structure in your view.html file + * // and add a height (for example 100%) to it, else the map won't be visible + * // + * //
+ * //
+ * + * // create a new map by passing HTMLElement + * let element: HTMLElement = document.getElementById('map'); + * + * let map: GoogleMap = this.googleMaps.create(element); + * + * // listen to MAP_READY event + * // You must wait for this event to fire before adding something to the map or modifying it in anyway + * map.one(GoogleMapsEvent.MAP_READY).then( + * () => { + * console.log('Map is ready!'); + * // Now you can add elements to the map like the marker + * } + * ); + * + * // create LatLng object + * let ionic: LatLng = new LatLng(43.0741904,-89.3809802); + * + * // create CameraPosition + * let position: CameraPosition = { + * target: ionic, + * zoom: 18, + * tilt: 30 + * }; + * + * // move the map's camera to position + * map.moveCamera(position); + * + * // create new marker + * let markerOptions: MarkerOptions = { + * position: ionic, + * title: 'Ionic' + * }; + * + * const marker: Marker = map.addMarker(markerOptions) + * .then((marker: Marker) => { + * marker.showInfoWindow(); + * }); + * } + * + * } + * ``` + * @classes + * GoogleMap + * Circle + * Environment + * Marker + * LatLng + * Geocoder + * @interfaces + * AnimateCameraOptions + * MarkerOptions + * MyLocation + * MyLocationOptions + * VisibleRegion + * */ -export class BaseClass { - protected _objectInstance: any; +@Plugin({ + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps', + plugin: 'cordova-plugin-googlemaps', + repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps', + install: 'ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"', + installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'], + platforms: ['Android', 'iOS'] +}) +@Injectable() +export class GoogleMaps extends IonicNativePlugin { /** - * Adds an event listener. - * - * @returns {Observable} + * @hidden */ - @InstanceCheck() - addEventListener(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } + _environment: Environment = new Environment(); /** - * Adds an event listener that works once. + * Checks if a map object has been created and is available. * - * @returns {Promise} + * @returns {Promise} */ - @InstanceCheck() - addListenerOnce(eventName: string): Promise { - return new Promise(resolve => this._objectInstance.addListenerOnce(eventName, resolve)); - } + @Cordova() + isAvailable(): Promise { return; } /** - * Gets a value - * @param key + * Creates a new GoogleMap instance + * @param element {string | HTMLElement} Element ID or reference to attach the map to + * @param options {any} Options + * @returns {GoogleMap} */ - @CordovaInstance({ sync: true }) - get(key: string): any { return; } + create(element: string | HTMLElement, options?: any): GoogleMap { + return new GoogleMap(element, options); + } /** - * Sets a value - * @param key - * @param value + * Convenience method that returns an instance of Environment class + * @return {Object} */ - @CordovaInstance({ sync: true }) - set(key: string, value: any): void { } + environment(): Environment { + return this._environment; + } - /** - * Listen to a map event. - * - * @returns {Observable} - */ - @InstanceCheck({ observable: true }) - on(eventName: string): Observable { - return Observable.fromEvent(this._objectInstance, eventName); - } - - /** - * Listen to a map event only once. - * - * @returns {Promise} - */ - @InstanceCheck() - one(eventName: string): Promise { - return new Promise(resolve => this._objectInstance.one(eventName, resolve)); - } - - /** - * Clears all stored values - */ - @CordovaInstance({ sync: true }) - empty(): void { } - - @CordovaInstance({ sync: true }) - trigger(eventName: string, ...parameters: any[]): void {} } /** @@ -415,229 +496,496 @@ export class BaseArrayClass extends IonicNativePlugin { /** * @hidden */ -@Plugin({ - pluginName: 'GoogleMaps', - plugin: 'cordova-plugin-googlemaps' -}) -export class GoogleMap extends BaseClass { - constructor(element: string | HTMLElement, options?: any) { - super(); - if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { - if (typeof element === 'string') { - element = document.getElementById(element); - } - this._objectInstance = plugin.google.maps.Map.getMap(element, options); - } - } +export class BaseClass { + protected _objectInstance: any; /** - * Changes the map div - * @param domNode + * Adds an event listener. + * + * @returns {Observable} */ - @CordovaInstance({ sync: true }) - setDiv(domNode: HTMLElement): void { } + @InstanceCheck() + addEventListener(eventName: string): Observable { + return Observable.fromEvent(this._objectInstance, eventName); + } /** - * Changes the map type id - * @param mapTypeId {string} + * Adds an event listener that works once. + * + * @returns {Promise} */ - @CordovaInstance({ sync: true }) - setMapTypeId(mapTypeId: string): void { } + @InstanceCheck() + addListenerOnce(eventName: string): Promise { + return new Promise(resolve => this._objectInstance.addListenerOnce(eventName, resolve)); + } /** - * Moves the camera with animation - * @returns {Promise} + * Gets a value + * @param key */ - @CordovaInstance() - animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } + @CordovaInstance({ sync: true }) + get(key: string): any { return; } /** - * Zooming in the camera with animation + * Sets a value + * @param key + * @param value */ - @CordovaInstance() - animateCameraZoomIn(): void {} + @CordovaInstance({ sync: true }) + set(key: string, value: any): void { } /** - * Zooming out the camera with animation + * Listen to a map event. + * + * @returns {Observable} */ - @CordovaInstance() - animateCameraZoomOut(): void {} + @InstanceCheck({ observable: true }) + on(eventName: string): Observable { + return Observable.fromEvent(this._objectInstance, eventName); + } /** - * Moves the camera without animation + * Listen to a map event only once. + * * @returns {Promise} */ - @CordovaInstance() - moveCamera(cameraPosition: CameraPosition): Promise { return; } + @InstanceCheck() + one(eventName: string): Promise { + return new Promise(resolve => this._objectInstance.one(eventName, resolve)); + } /** - * Zooming in the camera without animation + * Clears all stored values */ - @CordovaInstance() - moveCameraZoomIn(): void {} + @CordovaInstance({ sync: true }) + empty(): void { } - /** - * Zooming out the camera without animation - */ - @CordovaInstance() - moveCameraZoomOut(): void {} + @CordovaInstance({ sync: true }) + trigger(eventName: string, ...parameters: any[]): void {} +} - /** - * Get the position of the camera. - * @returns {Promise} - */ - @CordovaInstance() - getCameraPosition(): Promise { return; } +/** + * @hidden + */ +export class Circle extends BaseClass { - /** - * Get the current camera target position - * @return {Promise} - */ - @CordovaInstance() - getCameraTarget(): Promise { return; } + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; + } /** - * Get the current camera zoom level - * @return {number} + * Change the center position. + * @param latLng {LatLng} */ @CordovaInstance({ sync: true }) - getCameraZoom(): number { return; } + setCenter(latLng: LatLng): void {} /** - * Get the current camera bearing - * @return {number} + * Return the current center position + * @return {LatLng} */ @CordovaInstance({ sync: true }) - getCameraBearing(): number { return; } + getCenter(): LatLng { return; } /** - * Get the current camera tilt (view angle) + * Return the current circle radius. * @return {number} */ @CordovaInstance({ sync: true }) - getCameraTilt(): number { return; } + getRadius(): number { return; } /** - * Set the center position of the camera view - * @param latLng {LatLng} + * Change the circle radius. + * @param radius {number} */ @CordovaInstance({ sync: true }) - setCameraTarget(latLng: LatLng): void { } + setRadius(radius: number): void {} /** - * Set zoom level of the camera - * @param zoomLevel {number} Zoom level + * Change the filling color (inner color). + * @param color {string} */ @CordovaInstance({ sync: true }) - setCameraZoom(zoomLevel: number): void {} + setFillColor(color: string): void {} /** - * Set the camera view angle - * @param tiltLevel {number} Tilt level + * Return the current circle filling color (inner color). + * @return {string} */ @CordovaInstance({ sync: true }) - setCameraTilt(tiltLevel: number): void {} + getFillColor(): string { return; } /** - * Set camera bearing - * @param bearing {any} + * Change the stroke width. + * @param strokeWidth {number} */ @CordovaInstance({ sync: true }) - setCameraBearing(bearing: any): void {} + setStrokeWidth(strokeWidth: number): void {} /** - * Change the center of the map by the given distance in pixels - * @param x {any} - * @param y {any} + * Return the current circle stroke width (unit: pixel). + * @return {number} */ @CordovaInstance({ sync: true }) - panBy(x: string | number, y: string | number): void { } - - /** - * Get the current visible region (sw and ne) - * @returns {Promise} - */ - @CordovaInstance() - getVisibleRegion(): Promise { return; } - - /** - * Get the current device location - * @returns {Promise} - */ - @CordovaInstance() - getMyLocation(options?: MyLocationOptions): Promise { return; } + getStrokeWidth(): number { return; } /** - * Set false to ignore all clicks on the map - * @param isClickable {boolean} + * Change the stroke color (outter color). + * @param strokeColor {string} */ @CordovaInstance({ sync: true }) - setClickable(isClickable: boolean): void {} + setStrokeColor(strokeColor: string): void {} /** - * Destroy a map completely + * Return the current circle stroke color (outer color). + * @return {string} */ @CordovaInstance({ sync: true }) - remove(): void {} + getStrokeColor(): string { return; } /** - * Remove all overlays, such as marker + * Change clickablity of the circle. + * @param clickable {boolean} */ @CordovaInstance({ sync: true }) - clear(): void {} - - /** - * Convert the unit from LatLng to the pixels from the left/top of the map div - * @returns {Promise} - */ - @CordovaInstance() - fromLatLngToPoint(latLng: LatLng): Promise { return; } + setClickable(clickable: boolean): void {} /** - * Convert the unit from the pixels from the left/top to the LatLng - * @returns {Promise} + * Return true if the circle is clickable. + * @return {boolean} */ - @CordovaInstance() - fromPointToLatLng(point: any): Promise { return; } + @CordovaInstance({ sync: true }) + getClickable(): boolean { return; } /** - * Set true if you want to show the MyLocation button - * @param enabled {boolean} + * Change the circle zIndex order. + * @param zIndex {number} */ @CordovaInstance({ sync: true }) - setMyLocationEnabled(enabled: boolean): void {} + setZIndex(zIndex: number): void {} /** - * Get the currently focused building - * @return {Promise} + * Return the current circle zIndex. + * @return {number} */ - @CordovaInstance() - getFocusedBuilding(): Promise { return; } + @CordovaInstance({ sync: true }) + getZIndex(): number { return; } /** - * Set true if you want to show the indoor map - * @param enabled {boolean} + * Remove the circle. */ @CordovaInstance({ sync: true }) - setIndoorEnabled(enabled: boolean): void {} + remove(): void {} /** - * Set true if you want to show the traffic layer - * @param enabled {boolean} + * Return the latLngBounds (rectangle) that contains the circle. + * @return {LatLngBounds} */ @CordovaInstance({ sync: true }) - setTrafficEnabled(enabled: boolean): void {} + getBounds(): LatLngBounds { return; } /** - * Set true if you want to show the compass button - * @param enabled {boolean} + * Set circle visibility + * @param visible {boolean} */ @CordovaInstance({ sync: true }) - setCompassEnabled(enabled: boolean): void {} + setVisible(visible: boolean): void {} /** - * Sets the preference for whether all gestures should be enabled or disabled - * @param enabled {boolean} + * Returns a boolean that indicates whether the circle is visible + * @return {boolean} + */ + @CordovaInstance({ sync: true }) + getVisible(): boolean { return; } +} + +/** + * @hidden + */ +@Plugin({ + plugin: 'cordova-plugin-googlemaps', + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.environment', + repo: '' +}) +export class Environment extends IonicNativePlugin { + + /** + * Get the open source software license information for Google Maps Android API v2 and Google Maps SDK for iOS. + * @returns {Promise} + */ + @Cordova() + getLicenseInfo(): Promise { return; } + + /** + * Specifies the background color of the app. + * @param color + */ + @Cordova({ sync: true }) + setBackgroundColor(color: string): void {} + + /** + * Set maps to debuggable + * @param debug {boolean} + */ + @Cordova({ sync: true }) + setDebuggable(debug: boolean): void {} + + /** + * Checks if plugin is available + * @return {Promise} + */ + @Cordova() + isAvailable(): Promise { return; } + +} + +/** + * @hidden + */ +@Plugin({ + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.Geocoder', + plugin: 'cordova-plugin-googlemaps', + repo: '' +}) +export class Geocoder { + /** + * Converts position to address and vice versa + * @param {GeocoderRequest} request Request object with either an address or a position + * @returns {Promise>} + */ + @Cordova() + geocode(request: GeocoderRequest): Promise> { return; } +} + +/** + * @hidden + */ +@Plugin({ + pluginName: 'GoogleMaps', + plugin: 'cordova-plugin-googlemaps' +}) +export class GoogleMap extends BaseClass { + constructor(element: string | HTMLElement, options?: any) { + super(); + if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { + if (typeof element === 'string') { + element = document.getElementById(element); + } + this._objectInstance = GoogleMaps.getPlugin().Map.getMap(element, options); + } + } + + /** + * Changes the map div + * @param domNode + */ + @CordovaInstance({ sync: true }) + setDiv(domNode: HTMLElement): void { } + + /** + * Changes the map type id + * @param mapTypeId {string} + */ + @CordovaInstance({ sync: true }) + setMapTypeId(mapTypeId: string): void { } + + /** + * Moves the camera with animation + * @returns {Promise} + */ + @CordovaInstance() + animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } + + /** + * Zooming in the camera with animation + */ + @CordovaInstance() + animateCameraZoomIn(): void {} + + /** + * Zooming out the camera with animation + */ + @CordovaInstance() + animateCameraZoomOut(): void {} + + /** + * Moves the camera without animation + * @returns {Promise} + */ + @CordovaInstance() + moveCamera(cameraPosition: CameraPosition): Promise { return; } + + /** + * Zooming in the camera without animation + */ + @CordovaInstance() + moveCameraZoomIn(): void {} + + /** + * Zooming out the camera without animation + */ + @CordovaInstance() + moveCameraZoomOut(): void {} + + /** + * Get the position of the camera. + * @returns {Promise} + */ + @CordovaInstance() + getCameraPosition(): Promise { return; } + + /** + * Get the current camera target position + * @return {Promise} + */ + @CordovaInstance() + getCameraTarget(): Promise { return; } + + /** + * Get the current camera zoom level + * @return {number} + */ + @CordovaInstance({ sync: true }) + getCameraZoom(): number { return; } + + /** + * Get the current camera bearing + * @return {number} + */ + @CordovaInstance({ sync: true }) + getCameraBearing(): number { return; } + + /** + * Get the current camera tilt (view angle) + * @return {number} + */ + @CordovaInstance({ sync: true }) + getCameraTilt(): number { return; } + + /** + * Set the center position of the camera view + * @param latLng {LatLng} + */ + @CordovaInstance({ sync: true }) + setCameraTarget(latLng: LatLng): void { } + + /** + * Set zoom level of the camera + * @param zoomLevel {number} Zoom level + */ + @CordovaInstance({ sync: true }) + setCameraZoom(zoomLevel: number): void {} + + /** + * Set the camera view angle + * @param tiltLevel {number} Tilt level + */ + @CordovaInstance({ sync: true }) + setCameraTilt(tiltLevel: number): void {} + + /** + * Set camera bearing + * @param bearing {any} + */ + @CordovaInstance({ sync: true }) + setCameraBearing(bearing: any): void {} + + /** + * Change the center of the map by the given distance in pixels + * @param x {any} + * @param y {any} + */ + @CordovaInstance({ sync: true }) + panBy(x: string | number, y: string | number): void { } + + /** + * Get the current visible region (sw and ne) + * @returns {Promise} + */ + @CordovaInstance() + getVisibleRegion(): Promise { return; } + + /** + * Get the current device location + * @returns {Promise} + */ + @CordovaInstance() + getMyLocation(options?: MyLocationOptions): Promise { return; } + + /** + * Set false to ignore all clicks on the map + * @param isClickable {boolean} + */ + @CordovaInstance({ sync: true }) + setClickable(isClickable: boolean): void {} + + /** + * Destroy a map completely + */ + @CordovaInstance({ sync: true }) + remove(): void {} + + /** + * Remove all overlays, such as marker + */ + @CordovaInstance({ sync: true }) + clear(): void {} + + /** + * Convert the unit from LatLng to the pixels from the left/top of the map div + * @returns {Promise} + */ + @CordovaInstance() + fromLatLngToPoint(latLng: LatLng): Promise { return; } + + /** + * Convert the unit from the pixels from the left/top to the LatLng + * @returns {Promise} + */ + @CordovaInstance() + fromPointToLatLng(point: any): Promise { return; } + + /** + * Set true if you want to show the MyLocation button + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setMyLocationEnabled(enabled: boolean): void {} + + /** + * Get the currently focused building + * @return {Promise} + */ + @CordovaInstance() + getFocusedBuilding(): Promise { return; } + + /** + * Set true if you want to show the indoor map + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setIndoorEnabled(enabled: boolean): void {} + + /** + * Set true if you want to show the traffic layer + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setTrafficEnabled(enabled: boolean): void {} + + /** + * Set true if you want to show the compass button + * @param enabled {boolean} + */ + @CordovaInstance({ sync: true }) + setCompassEnabled(enabled: boolean): void {} + + /** + * Sets the preference for whether all gestures should be enabled or disabled + * @param enabled {boolean} */ @CordovaInstance({ sync: true }) setAllGesturesEnabled(enabled: boolean): void {} @@ -797,175 +1145,100 @@ export class GoogleMap extends BaseClass { } /** - * @name Google Maps - * @description This plugin uses the native Google Maps SDK - * @usage - * ```typescript - * import { - * GoogleMaps, - * GoogleMap, - * GoogleMapsEvent, - * LatLng, - * CameraPosition, - * MarkerOptions, - * Marker - * } from '@ionic-native/google-maps'; - * - * export class MapPage { - * constructor(private googleMaps: GoogleMaps) {} - * - * // Load map only after view is initialized - * ngAfterViewInit() { - * this.loadMap(); - * } - * - * loadMap() { - * // make sure to create following structure in your view.html file - * // and add a height (for example 100%) to it, else the map won't be visible - * // - * //
- * //
- * - * // create a new map by passing HTMLElement - * let element: HTMLElement = document.getElementById('map'); - * - * let map: GoogleMap = this.googleMaps.create(element); - * - * // listen to MAP_READY event - * // You must wait for this event to fire before adding something to the map or modifying it in anyway - * map.one(GoogleMapsEvent.MAP_READY).then( - * () => { - * console.log('Map is ready!'); - * // Now you can add elements to the map like the marker - * } - * ); - * - * // create LatLng object - * let ionic: LatLng = new LatLng(43.0741904,-89.3809802); - * - * // create CameraPosition - * let position: CameraPosition = { - * target: ionic, - * zoom: 18, - * tilt: 30 - * }; - * - * // move the map's camera to position - * map.moveCamera(position); - * - * // create new marker - * let markerOptions: MarkerOptions = { - * position: ionic, - * title: 'Ionic' - * }; - * - * const marker: Marker = map.addMarker(markerOptions) - * .then((marker: Marker) => { - * marker.showInfoWindow(); - * }); - * } - * - * } - * ``` - * @classes - * GoogleMap - * Circle - * Environment - * Marker - * LatLng - * Geocoder - * @interfaces - * AnimateCameraOptions - * MarkerOptions - * MyLocation - * MyLocationOptions - * VisibleRegion - * + * @hidden + */ +export class GroundOverlay extends BaseClass { + + constructor(_objectInstance: any) { + super(); + this._objectInstance = _objectInstance; + } + + @CordovaInstance({ sync: true }) + setBearing(bearing: number): void { } + + @CordovaInstance({ sync: true }) + getBearing(): number { return; } + + @CordovaInstance({ sync: true }) + setOpacity(opacity: number): void { } + + @CordovaInstance({ sync: true }) + getOpacity(): number { return; } + + @CordovaInstance({ sync: true }) + setVisible(visible: boolean): void { } + + @CordovaInstance({ sync: true }) + getVisible(): boolean { return; } + + @CordovaInstance({ sync: true }) + setImage(image: string): void { }; + + @CordovaInstance({ sync: true }) + remove(): void { } + +} + +// TODO add HtmlInfoWindow class here + +/** + * @hidden */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.Map', - plugin: 'cordova-plugin-googlemaps', - repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps', - install: 'ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"', - installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'], - platforms: ['Android', 'iOS'] -}) -@Injectable() -export class GoogleMaps extends IonicNativePlugin { +export class LatLng implements ILatLng { - /** - * @hidden - */ - _environment: Environment = new Environment(); + lat: number; + lng: number; - /** - * Checks if a map object has been created and is available. - * - * @returns {Promise} - */ - @Cordova() - isAvailable(): Promise { return; } + constructor(lat: number, lng: number) { + this.lat = lat; + this.lng = lng; + } - /** - * Creates a new GoogleMap instance - * @param element {string | HTMLElement} Element ID or reference to attach the map to - * @param options {any} Options - * @returns {GoogleMap} - */ - create(element: string | HTMLElement, options?: any): GoogleMap { - return new GoogleMap(element, options); + equals(other: ILatLng): boolean { + return this.lat === other.lat && this.lng === other.lng; } - /** - * Convenience method that returns an instance of Environment class - * @return {Object} - */ - environment(): Environment { - return this._environment; + toString(): string { + return this.lat + ',' + this.lng; } + toUrlValue(precision?: number): string { + precision = precision || 6; + + return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); + } } /** * @hidden */ -@Plugin({ - plugin: 'cordova-plugin-googlemaps', - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.environment', - repo: '' -}) -export class Environment extends IonicNativePlugin { +export class LatLngBounds { + private _objectInstance: any; - /** - * Get the open source software license information for Google Maps Android API v2 and Google Maps SDK for iOS. - * @returns {Promise} - */ - @Cordova() - getLicenseInfo(): Promise { return; } + @InstanceProperty northeast: LatLng; + @InstanceProperty southwest: LatLng; + @InstanceProperty type: string; - /** - * Specifies the background color of the app. - * @param color - */ - @Cordova({ sync: true }) - setBackgroundColor(color: string): void {} + constructor(southwestOrArrayOfLatLng: LatLng | LatLng[], northeast?: LatLng) { + let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng; + this._objectInstance = new (GoogleMaps.getPlugin()).LatLngBounds(args); + } - /** - * Set maps to debuggable - * @param debug {boolean} - */ - @Cordova({ sync: true }) - setDebuggable(debug: boolean): void {} + @CordovaInstance({ sync: true }) + toString(): string { return; } - /** - * Checks if plugin is available - * @return {Promise} - */ - @Cordova() - isAvailable(): Promise { return; } + @CordovaInstance({ sync: true }) + toUrlValue(precision?: number): string { return; } + + @CordovaInstance({ sync: true }) + extend(LatLng: LatLng): void { } + @CordovaInstance({ sync: true }) + contains(LatLng: LatLng): boolean { return; } + + @CordovaInstance({ sync: true }) + getCenter(): LatLng { return; } } /** @@ -1085,216 +1358,81 @@ export class Marker extends BaseClass { /** * Change snippet of the infoWindow. - * @param snippet {string} - */ - @CordovaInstance({ sync: true }) - setSnippet(snippet: string): void { } - - /** - * Return the snippet strings. - * @return {string} - */ - @CordovaInstance({ sync: true }) - getSnippet(): string { return; } - - /** - * Set the marker rotation angle. - * @param rotation {number} - */ - @CordovaInstance({ sync: true }) - setRotation(rotation: number): void { } - - /** - * Return the marker rotation angle. - * @return {number} - */ - @CordovaInstance({ sync: true }) - getRotation(): number { return; } - - /** - * Show the infoWindow of the marker. - * @return {number} - */ - @CordovaInstance({ sync: true }) - showInfoWindow(): number { return; } - - /** - * Hide the infoWindow of the marker. - * @return {number} - */ - @CordovaInstance({ sync: true }) - hideInfoWindow(): number { return; } - - /** - * Set the marker position. - * @param latLng {LatLng} - */ - @CordovaInstance({ sync: true }) - setPosition(latLng: LatLng): void { return; } - - /** - * Return the marker position. - * @return {Promise} - */ - @CordovaInstance() - getPosition(): Promise { return; } - - /** - * Return the map instance. - * @return {GoogleMap} - */ - @CordovaInstance({ sync: true }) - getMap(): GoogleMap { return; } - - /** - * Specify the animation either `DROP` or `BOUNCE` - * @param animation {string} - */ - @CordovaInstance({ sync: true }) - setAnimation(animation: string): void { } - -} - -/** - * @hidden - */ -export class Circle extends BaseClass { - - constructor(_objectInstance: any) { - super(); - this._objectInstance = _objectInstance; - } - - /** - * Change the center position. - * @param latLng {LatLng} - */ - @CordovaInstance({ sync: true }) - setCenter(latLng: LatLng): void {} - - /** - * Return the current center position - * @return {LatLng} - */ - @CordovaInstance({ sync: true }) - getCenter(): LatLng { return; } - - /** - * Return the current circle radius. - * @return {number} - */ - @CordovaInstance({ sync: true }) - getRadius(): number { return; } - - /** - * Change the circle radius. - * @param radius {number} - */ - @CordovaInstance({ sync: true }) - setRadius(radius: number): void {} - - /** - * Change the filling color (inner color). - * @param color {string} - */ - @CordovaInstance({ sync: true }) - setFillColor(color: string): void {} - - /** - * Return the current circle filling color (inner color). - * @return {string} - */ - @CordovaInstance({ sync: true }) - getFillColor(): string { return; } - - /** - * Change the stroke width. - * @param strokeWidth {number} - */ - @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void {} - - /** - * Return the current circle stroke width (unit: pixel). - * @return {number} - */ - @CordovaInstance({ sync: true }) - getStrokeWidth(): number { return; } - - /** - * Change the stroke color (outter color). - * @param strokeColor {string} + * @param snippet {string} */ @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void {} + setSnippet(snippet: string): void { } /** - * Return the current circle stroke color (outer color). + * Return the snippet strings. * @return {string} */ @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } + getSnippet(): string { return; } /** - * Change clickablity of the circle. - * @param clickable {boolean} + * Set the marker rotation angle. + * @param rotation {number} */ @CordovaInstance({ sync: true }) - setClickable(clickable: boolean): void {} + setRotation(rotation: number): void { } /** - * Return true if the circle is clickable. - * @return {boolean} + * Return the marker rotation angle. + * @return {number} */ @CordovaInstance({ sync: true }) - getClickable(): boolean { return; } + getRotation(): number { return; } /** - * Change the circle zIndex order. - * @param zIndex {number} + * Show the infoWindow of the marker. + * @return {number} */ @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void {} + showInfoWindow(): number { return; } /** - * Return the current circle zIndex. + * Hide the infoWindow of the marker. * @return {number} */ @CordovaInstance({ sync: true }) - getZIndex(): number { return; } + hideInfoWindow(): number { return; } /** - * Remove the circle. + * Set the marker position. + * @param latLng {LatLng} */ @CordovaInstance({ sync: true }) - remove(): void {} + setPosition(latLng: LatLng): void { return; } /** - * Return the latLngBounds (rectangle) that contains the circle. - * @return {LatLngBounds} + * Return the marker position. + * @return {Promise} */ - @CordovaInstance({ sync: true }) - getBounds(): LatLngBounds { return; } + @CordovaInstance() + getPosition(): Promise { return; } /** - * Set circle visibility - * @param visible {boolean} + * Return the map instance. + * @return {GoogleMap} */ @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void {} + getMap(): GoogleMap { return; } /** - * Returns a boolean that indicates whether the circle is visible - * @return {boolean} + * Specify the animation either `DROP` or `BOUNCE` + * @param animation {string} */ @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } + setAnimation(animation: string): void { } + } /** * @hidden */ -export class Polyline extends BaseClass { +export class Polygon extends BaseClass { + constructor(_objectInstance: any) { super(); this._objectInstance = _objectInstance; @@ -1304,16 +1442,22 @@ export class Polyline extends BaseClass { getPoints(): Array { return; } @CordovaInstance({ sync: true }) - getCOlor(): string { return; } + getStrokeColor(): string { return; } @CordovaInstance({ sync: true }) - getWidth(): number { return; } + getFillColor(): string { return; } + + @CordovaInstance({ sync: true }) + getStrokeWidth(): number { return; } @CordovaInstance({ sync: true }) getGeodesic(): boolean { return; } @CordovaInstance({ sync: true }) - getZIndex(): number { return; } + getVisible(): boolean { return; } + + @CordovaInstance({ sync: true }) + getZIndex(): boolean { return; } @CordovaInstance({ sync: true }) remove(): void { } @@ -1322,30 +1466,28 @@ export class Polyline extends BaseClass { setPoints(points: Array): void { } @CordovaInstance({ sync: true }) - setColor(color: string): void { } + setStrokeColor(strokeColor: string): void { } @CordovaInstance({ sync: true }) - setWidth(width: number): void { } + setFillColor(fillColor: string): void { } @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } + setStrokeWidth(strokeWidth: number): void { } @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { } + setVisible(visible: boolean): void { } @CordovaInstance({ sync: true }) - setGeoDesic(geoDesic: boolean): void { } + setZIndex(zIndex: number): void { } @CordovaInstance({ sync: true }) - getMap(): GoogleMap { return; } - + setGeodesic(geodesic: boolean): void { } } /** * @hidden */ -export class Polygon extends BaseClass { - +export class Polyline extends BaseClass { constructor(_objectInstance: any) { super(); this._objectInstance = _objectInstance; @@ -1355,22 +1497,16 @@ export class Polygon extends BaseClass { getPoints(): Array { return; } @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } - - @CordovaInstance({ sync: true }) - getFillColor(): string { return; } + getCOlor(): string { return; } @CordovaInstance({ sync: true }) - getStrokeWidth(): number { return; } + getWidth(): number { return; } @CordovaInstance({ sync: true }) getGeodesic(): boolean { return; } @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - @CordovaInstance({ sync: true }) - getZIndex(): boolean { return; } + getZIndex(): number { return; } @CordovaInstance({ sync: true }) remove(): void { } @@ -1379,13 +1515,10 @@ export class Polygon extends BaseClass { setPoints(points: Array): void { } @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void { } - - @CordovaInstance({ sync: true }) - setFillColor(fillColor: string): void { } + setColor(color: string): void { } @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void { } + setWidth(width: number): void { } @CordovaInstance({ sync: true }) setVisible(visible: boolean): void { } @@ -1394,7 +1527,11 @@ export class Polygon extends BaseClass { setZIndex(zIndex: number): void { } @CordovaInstance({ sync: true }) - setGeodesic(geodesic: boolean): void { } + setGeoDesic(geoDesic: boolean): void { } + + @CordovaInstance({ sync: true }) + getMap(): GoogleMap { return; } + } /** @@ -1439,41 +1576,7 @@ export class TileOverlay extends BaseClass { } -/** - * @hidden - */ -export class GroundOverlay extends BaseClass { - - constructor(_objectInstance: any) { - super(); - this._objectInstance = _objectInstance; - } - - @CordovaInstance({ sync: true }) - setBearing(bearing: number): void { } - - @CordovaInstance({ sync: true }) - getBearing(): number { return; } - - @CordovaInstance({ sync: true }) - setOpacity(opacity: number): void { } - - @CordovaInstance({ sync: true }) - getOpacity(): number { return; } - - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } - - @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - @CordovaInstance({ sync: true }) - setImage(image: string): void { }; - - @CordovaInstance({ sync: true }) - remove(): void { } - -} +// TODO add spherical utility class here // /** // * @hidden @@ -1483,7 +1586,6 @@ export class GroundOverlay extends BaseClass { // preserveViewport?: boolean; // animation?: boolean; // } - // /** // * @hidden // */ @@ -1575,113 +1677,3 @@ export class GroundOverlay extends BaseClass { // @CordovaInstance({ sync: true }) // getOverlays(): Array { return; } // } - -/** - * @hidden - */ -export class LatLngBounds { - private _objectInstance: any; - - @InstanceProperty northeast: LatLng; - @InstanceProperty southwest: LatLng; - @InstanceProperty type: string; - - constructor(southwestOrArrayOfLatLng: LatLng | LatLng[], northeast?: LatLng) { - let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng; - this._objectInstance = new plugin.google.maps.LatLngBounds(args); - } - - @CordovaInstance({ sync: true }) - toString(): string { return; } - - @CordovaInstance({ sync: true }) - toUrlValue(precision?: number): string { return; } - - @CordovaInstance({ sync: true }) - extend(LatLng: LatLng): void { } - - @CordovaInstance({ sync: true }) - contains(LatLng: LatLng): boolean { return; } - - @CordovaInstance({ sync: true }) - getCenter(): LatLng { return; } -} - -/** - * @hidden - */ -export class LatLng implements ILatLng { - - lat: number; - lng: number; - - constructor(lat: number, lng: number) { - this.lat = lat; - this.lng = lng; - } - - equals(other: ILatLng): boolean { - return this.lat === other.lat && this.lng === other.lng; - } - - toString(): string { - return this.lat + ',' + this.lng; - } - - toUrlValue(precision?: number): string { - precision = precision || 6; - - return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision); - } -} - -/** - * @hidden - */ -export interface GeocoderRequest { - address?: string | string[]; - position?: ILatLng | ILatLng[]; -} - -/** - * @hidden - */ -export interface GeocoderResult { - adminArea?: string; - country?: string; - countryCode?: string; - extra?: { - featureName?: string; - lines?: Array; - permises?: string; - phone?: string; - url?: string - }; - locale?: string; - locality?: string; - position?: { lat: number; lng: number }; - postalCode?: string; - subAdminArea?: string; - subLocality?: string; - subThoroughfare?: string; - thoroughfare?: string; -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'GoogleMaps', - pluginRef: 'plugin.google.maps.Geocoder', - plugin: 'cordova-plugin-googlemaps', - repo: '' -}) -export class Geocoder { - /** - * Converts position to address and vice versa - * @param {GeocoderRequest} request Request object with either an address or a position - * @returns {Promise>} - */ - @Cordova() - geocode(request: GeocoderRequest): Promise> { return; } -} From c8e02ea796b93e8c06a8c058ee442fe7ffe73664 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:31:18 -0400 Subject: [PATCH 24/34] document GroundOverlayOptions --- src/@ionic-native/plugins/google-maps/index.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index da9e8364d2..d723865bb4 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -72,11 +72,29 @@ export interface GeocoderResult { } export interface GroundOverlayOptions { + /** + * URL of overlay + */ url?: string; + /** + * Bounds, array of LatLng + */ bounds?: Array; + /** + * Set to false to hide + */ visible?: boolean; + /** + * Opacity. From 0 to 1. + */ opacity?: number; + /** + * Bearing + */ bearing?: number; + /** + * Z-index + */ zIndex?: number; } From 861a80aa8ceac52256af44bb2e1a4a30eafae451 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:36:58 -0400 Subject: [PATCH 25/34] complete GroundOverlay class --- .../plugins/google-maps/index.ts | 76 ++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index d723865bb4..a0523308b0 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1172,29 +1172,101 @@ export class GroundOverlay extends BaseClass { this._objectInstance = _objectInstance; } + /** + * Change the bounds of the GroundOverlay + * @param bounds {ILatLng[]} + */ + @CordovaInstance({ sync: true }) + setBounds(bounds: ILatLng[]): void {} + + /** + * Return the current center position + * @return {ILatLng[]} + */ + @CordovaInstance({ sync: true }) + getBounds(): ILatLng[] { return; } + + /** + * Change the bearing of the ground overlay + * @param bearing {number} + */ @CordovaInstance({ sync: true }) setBearing(bearing: number): void { } + /** + * Return the current bearing value + */ @CordovaInstance({ sync: true }) getBearing(): number { return; } + /** + * Change the image of the ground overlay + * @param image {string} URL of image + */ + @CordovaInstance({ sync: true }) + setImage(image: string): void {}; + + /** + * Change the opacity of the ground overlay + * @param opacity {number} + */ @CordovaInstance({ sync: true }) setOpacity(opacity: number): void { } + /** + * Return the current opacity + * @return {number} + */ @CordovaInstance({ sync: true }) getOpacity(): number { return; } + /** + * Change clickablity of the ground overlay + * @param clickable {boolean} + */ + @CordovaInstance({ sync: true }) + setClickable(clickable: boolean): void {} + + /** + * Return true if the ground overlay is clickable + * @return {boolean} + */ + @CordovaInstance({ sync: true }) + getClickable(): boolean { return; } + + /** + * Change visibility of the ground overlay + * @param visible {boolean} + */ @CordovaInstance({ sync: true }) setVisible(visible: boolean): void { } + /** + * Return true if the ground overlay is visible + * @return {boolean} + */ @CordovaInstance({ sync: true }) getVisible(): boolean { return; } + /** + * Change the ground overlay zIndex order + * @param index {number} + */ @CordovaInstance({ sync: true }) - setImage(image: string): void { }; + setZIndex(index: number): void {} + /** + * Return the current ground overlay zIndex + * @return {number} + */ @CordovaInstance({ sync: true }) - remove(): void { } + getZIndex(): number { return; } + + /** + * Remove the ground overlay + */ + @CordovaInstance({ sync: true }) + remove(): void {} } From d5e8e72c33d9dcabda00e28e198b8d42ab4f6144 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:44:09 -0400 Subject: [PATCH 26/34] add and complete HtmlInfoWindow class --- .../plugins/google-maps/index.ts | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index a0523308b0..e0605ff36e 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1270,7 +1270,46 @@ export class GroundOverlay extends BaseClass { } -// TODO add HtmlInfoWindow class here +/** + * @hidden + */ +export class HtmlInfoWindow extends BaseClass { + + constructor() { + super(); + if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { + this._objectInstance = new (GoogleMaps.getPlugin()).HtmlInfoWindow(); + } + } + + /** + * Change the backgroundColor + * @param color {string} + */ + @CordovaInstance() + setBackgroundColor(color: string): void {} + + /** + * Set your HTML contents. + * @param content {any} String containing text or HTML element + */ + @CordovaInstance() + setContent(content: string | Element): void {} + + /** + * Open the htmlInfoWindow + * @param marker {Marker} + */ + @CordovaInstance() + open(marker: any): any {} + + /** + * Close the htmlInfoWindow + */ + @CordovaInstance() + close(): void {} + +} /** * @hidden @@ -1504,10 +1543,11 @@ export class Marker extends BaseClass { /** * Return the map instance. - * @return {GoogleMap} + * Note that this method returns the original Google Map object, and not the Ionic Native wrapper. + * @return {Object} */ @CordovaInstance({ sync: true }) - getMap(): GoogleMap { return; } + getMap(): any { return; } /** * Specify the animation either `DROP` or `BOUNCE` From b96545d4966a68340daaa02f00087c02180959b7 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:46:39 -0400 Subject: [PATCH 27/34] complete LatLngBounds class --- .../plugins/google-maps/index.ts | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index e0605ff36e..0bcbf86e7b 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1354,18 +1354,39 @@ export class LatLngBounds { this._objectInstance = new (GoogleMaps.getPlugin()).LatLngBounds(args); } + /** + * Converts to string + * @return {string} + */ @CordovaInstance({ sync: true }) toString(): string { return; } + /** + * Returns a string of the form "lat_lo,lng_lo,lat_hi,lng_hi" for this bounds, where "lo" corresponds to the southwest corner of the bounding box, while "hi" corresponds to the northeast corner of that box. + * @param precision {number} + * @return {string} + */ @CordovaInstance({ sync: true }) toUrlValue(precision?: number): string { return; } + /** + * Extends this bounds to contain the given point. + * @param LatLng {ILatLng} + */ @CordovaInstance({ sync: true }) - extend(LatLng: LatLng): void { } + extend(LatLng: ILatLng): void {} + /** + * Returns true if the given lat/lng is in this bounds. + * @param LatLng {ILatLng} + */ @CordovaInstance({ sync: true }) - contains(LatLng: LatLng): boolean { return; } + contains(LatLng: ILatLng): boolean { return; } + /** + * Computes the center of this LatLngBounds + * @return {ILatLng} + */ @CordovaInstance({ sync: true }) getCenter(): LatLng { return; } } From c486eb89bdb6f10488f440007c7442c6f68d8fff Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:48:11 -0400 Subject: [PATCH 28/34] update MyLocation interface --- src/@ionic-native/plugins/google-maps/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 0bcbf86e7b..74aff4f422 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -180,9 +180,14 @@ export interface MarkerOptions { export interface MyLocation { latLng?: LatLng; - speed?: number; + elapsedRealtimeNanos?: any; time?: string; + accuracy?: any; bearing?: number; + altitude?: any; + speed?: number; + provider?: any; + hashCode?: any; } export interface MyLocationOptions { From 856499e0e01256d08e2ec2c114dc578b0467d18d Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:54:53 -0400 Subject: [PATCH 29/34] complete GoogleMap class --- src/@ionic-native/plugins/google-maps/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 74aff4f422..3fca7314b3 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -808,6 +808,13 @@ export class GoogleMap extends BaseClass { @CordovaInstance({ sync: true }) setDiv(domNode: HTMLElement): void { } + /** + * Returns the map HTML element + * @return {HTMLElement} + */ + @CordovaInstance({ sync: true }) + getDiv(): HTMLElement { return; } + /** * Changes the map type id * @param mapTypeId {string} From 8530c7c1c497a4efe9d464f610e45d32184f9410 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 01:55:37 -0400 Subject: [PATCH 30/34] fix TERRAIN spelling --- src/@ionic-native/plugins/google-maps/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 3fca7314b3..79ef589982 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -267,12 +267,12 @@ export const GoogleMapsAnimation: { [animationName: string]: string; } = { * @hidden */ export const GoogleMapsMapTypeId: { [mapType: string]: string; } = { - HYBRID: 'MAP_TYPE_HYBRID', - NONE: 'MAP_TYPE_NONE', NORMAL: 'MAP_TYPE_NORMAL', ROADMAP: 'MAP_TYPE_ROADMAP', SATELLITE: 'MAP_TYPE_SATELLITE', - TERAIN: 'MAP_TYPE_TERRAIN' + HYBRID: 'MAP_TYPE_HYBRID', + TERRAIN: 'MAP_TYPE_TERRAIN', + NONE: 'MAP_TYPE_NONE' }; /** From 1d30327114c7a4eecb9d503abcaa797ffd1180fd Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 02:06:27 -0400 Subject: [PATCH 31/34] complete Marker class --- .../plugins/google-maps/index.ts | 166 ++++++++++-------- 1 file changed, 93 insertions(+), 73 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 79ef589982..56aa16e288 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1414,37 +1414,94 @@ export class Marker extends BaseClass { } /** - * Return true if the marker is visible + * Set the marker position. + * @param latLng {LatLng} */ @CordovaInstance({ sync: true }) - isVisible(): boolean { return; } + setPosition(latLng: LatLng): void { return; } + + /** + * Return the marker position. + * @return {Promise} + */ + @CordovaInstance() + getPosition(): Promise { return; } + + /** + * Show the infoWindow of the marker. + * @return {number} + */ + @CordovaInstance({ sync: true }) + showInfoWindow(): number { return; } + + /** + * Hide the infoWindow of the marker. + * @return {number} + */ + @CordovaInstance({ sync: true }) + hideInfoWindow(): number { return; } + + /** + * Specify the animation either `DROP` or `BOUNCE` + * @param animation {string} + */ + @CordovaInstance({ sync: true }) + setAnimation(animation: string): void {} + + /** + * Set true if you **do not want** to move the map when you click on the marker. + * @param disableAutoPan {boolean} + */ + @CordovaInstance({ sync: true }) + setDisableAutoPan(disableAutoPan: boolean): void {} /** * Set false if you want to hide the marker. * @param visible */ @CordovaInstance() - setVisible(visible: boolean): void { } + setVisible(visible: boolean): void {} /** - * Return the marker hash code. - * @return {string} Marker hash code + * Return true if the marker is visible */ @CordovaInstance({ sync: true }) - getHashCode(): string { return; } + isVisible(): boolean { return; } /** - * Remove the marker completely. + * Change title of the infoWindow. + * @param title {string} */ @CordovaInstance({ sync: true }) - remove(): void { } + setTitle(title: string): void {} + + /** + * Return the title strings. + * @return {string} + */ + @CordovaInstance({ sync: true }) + getTitle(): string { return; } + + /** + * Change snippet of the infoWindow. + * @param snippet {string} + */ + @CordovaInstance({ sync: true }) + setSnippet(snippet: string): void {} + + /** + * Return the snippet strings. + * @return {string} + */ + @CordovaInstance({ sync: true }) + getSnippet(): string { return; } /** * Change the marker opacity. * @param alpha {number} Opacity */ @CordovaInstance({ sync: true }) - setOpacity(alpha: number): void { } + setOpacity(alpha: number): void {} /** * Return the marker opacity. @@ -1454,11 +1511,10 @@ export class Marker extends BaseClass { getOpacity(): number { return; } /** - * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect) - * @return {number} + * Remove the marker completely. */ @CordovaInstance({ sync: true }) - setZIndex(): number { return; } + remove(): void {} /** * Change the info window anchor. This defaults to 50% from the left of the image and at the bottom of the image. @@ -1466,7 +1522,7 @@ export class Marker extends BaseClass { * @param y {number} */ @CordovaInstance({ sync: true }) - setIconAnchor(x: number, y: number): void { } + setIconAnchor(x: number, y: number): void {} /** * Change the info window anchor. This defaults to 50% from the left of the image and at the top of the image. @@ -1474,63 +1530,62 @@ export class Marker extends BaseClass { * @param y {number} */ @CordovaInstance({ sync: true }) - setInfoWindowAnchor(x: number, y: number): void { } + setInfoWindowAnchor(x: number, y: number): void {} /** - * Set true if you allows all users to drag the marker. - * @param draggable {boolean} + * Retrurn true if the infoWindow is shown on the marker + * @return {boolean} */ @CordovaInstance({ sync: true }) - setDraggable(draggable: boolean): void { } + isInfoWindowShown(): boolean { return; } /** - * Return true if the marker drag is enabled. - * @return {boolean} + * Return the marker hash code. + * @return {string} Marker hash code */ @CordovaInstance({ sync: true }) - isDraggable(): boolean { return; } + getHashCode(): string { return; } /** - * Set true if you want to be flat marker. - * @param flat {boolean} + * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect) */ @CordovaInstance({ sync: true }) - setFlat(flat: boolean): void { return; } + setZIndex(): void {} /** - * Change icon url and/or size - * @param icon + * Get z-index + * @return {number} */ @CordovaInstance({ sync: true }) - setIcon(icon: MarkerIcon): void { return; } + getZIndex(): number { return; } /** - * Change title of the infoWindow. - * @param title {string} + * Set true if you allows all users to drag the marker. + * @param draggable {boolean} */ @CordovaInstance({ sync: true }) - setTitle(title: string): void { } + setDraggable(draggable: boolean): void { } /** - * Return the title strings. - * @return {string} + * Return true if the marker drag is enabled. + * @return {boolean} */ @CordovaInstance({ sync: true }) - getTitle(): string { return; } + isDraggable(): boolean { return; } /** - * Change snippet of the infoWindow. - * @param snippet {string} + * Set true if you want to be flat marker. + * @param flat {boolean} */ @CordovaInstance({ sync: true }) - setSnippet(snippet: string): void { } + setFlat(flat: boolean): void { return; } /** - * Return the snippet strings. - * @return {string} + * Change icon url and/or size + * @param icon */ @CordovaInstance({ sync: true }) - getSnippet(): string { return; } + setIcon(icon: MarkerIcon): void { return; } /** * Set the marker rotation angle. @@ -1546,34 +1601,6 @@ export class Marker extends BaseClass { @CordovaInstance({ sync: true }) getRotation(): number { return; } - /** - * Show the infoWindow of the marker. - * @return {number} - */ - @CordovaInstance({ sync: true }) - showInfoWindow(): number { return; } - - /** - * Hide the infoWindow of the marker. - * @return {number} - */ - @CordovaInstance({ sync: true }) - hideInfoWindow(): number { return; } - - /** - * Set the marker position. - * @param latLng {LatLng} - */ - @CordovaInstance({ sync: true }) - setPosition(latLng: LatLng): void { return; } - - /** - * Return the marker position. - * @return {Promise} - */ - @CordovaInstance() - getPosition(): Promise { return; } - /** * Return the map instance. * Note that this method returns the original Google Map object, and not the Ionic Native wrapper. @@ -1582,13 +1609,6 @@ export class Marker extends BaseClass { @CordovaInstance({ sync: true }) getMap(): any { return; } - /** - * Specify the animation either `DROP` or `BOUNCE` - * @param animation {string} - */ - @CordovaInstance({ sync: true }) - setAnimation(animation: string): void { } - } /** From 815b87022a014d3201df84bbec138e35e4c8c825 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 02:17:56 -0400 Subject: [PATCH 32/34] complete Polygon class --- .../plugins/google-maps/index.ts | 97 ++++++++++++++++--- 1 file changed, 83 insertions(+), 14 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 56aa16e288..49238554d2 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1621,50 +1621,119 @@ export class Polygon extends BaseClass { this._objectInstance = _objectInstance; } + /** + * Change the polygon points. + * @param points {ILatLng[]} + */ @CordovaInstance({ sync: true }) - getPoints(): Array { return; } + setPoints(points: ILatLng[]): void {} + /** + * Return an instance of the BaseArrayClass. + * You can modify the points. + * @return {BaseArrayClass} + */ @CordovaInstance({ sync: true }) - getStrokeColor(): string { return; } + getPoints(): BaseArrayClass { return; } + /** + * Change the polygon holes. + * @param holes {ILatLng[][]} + */ + @CordovaInstance({ sync: true }) + setHoles(holes: ILatLng[][]): void {} + + /** + * Return an instance of the BaseArrayClass. + * You can modify the holes. + * @return {BaseArrayClass} + */ + @CordovaInstance({ sync: true }) + getHoles(): BaseArrayClass { return; } + + /** + * Change the filling color (inner color) + * @param fillColor {string} + */ + @CordovaInstance({ sync: true }) + setFillColor(fillColor: string): void {} + + /** + * Return the current polygon filling color (inner color). + * @return {string} + */ @CordovaInstance({ sync: true }) getFillColor(): string { return; } + /** + * Change the stroke color (outter color) + * @param strokeColor {string} + */ @CordovaInstance({ sync: true }) - getStrokeWidth(): number { return; } + setStrokeColor(strokeColor: string): void {} + /** + * Return the current polygon stroke color (outer color) + * @return {string} + */ @CordovaInstance({ sync: true }) - getGeodesic(): boolean { return; } + getStrokeColor(): string { return; } + /** + * Change clickablity of the polygon + * @param clickable {boolean} + */ @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } + setClickable(clickable: boolean): void {} + /** + * Return true if the polygon is clickable + */ @CordovaInstance({ sync: true }) - getZIndex(): boolean { return; } + getClickable(): boolean { return; } + /** + * Change visibility of the polygon + * @param visible {boolean} + */ @CordovaInstance({ sync: true }) - remove(): void { } + setVisible(visible: boolean): void {} + /** + * Return true if the polygon is visible + * @return {boolean} + */ @CordovaInstance({ sync: true }) - setPoints(points: Array): void { } + getVisible(): boolean { return; } + /** + * Change the polygon zIndex order. + * @param zIndex {number} + */ + @CordovaInstance({ sync: true }) + setZIndex(zIndex: number): void {} + + /** + * Return the current polygon zIndex + * @return {number} + */ @CordovaInstance({ sync: true }) - setStrokeColor(strokeColor: string): void { } + getZIndex(): number { return; } @CordovaInstance({ sync: true }) - setFillColor(fillColor: string): void { } + remove(): void {} @CordovaInstance({ sync: true }) - setStrokeWidth(strokeWidth: number): void { } + setStrokeWidth(strokeWidth: number): void {} @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } + getStrokeWidth(): number { return; } @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { } + setGeodesic(geodesic: boolean): void {} @CordovaInstance({ sync: true }) - setGeodesic(geodesic: boolean): void { } + getGeodesic(): boolean { return; } } /** From 647e08b3914e7fe1e401b5d6475a60a52bf5b4f9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 02:32:28 -0400 Subject: [PATCH 33/34] complete TileOverlay class --- .../plugins/google-maps/index.ts | 158 +++++++++++++++--- 1 file changed, 135 insertions(+), 23 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 49238554d2..d8c71ed468 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -1729,9 +1729,17 @@ export class Polygon extends BaseClass { @CordovaInstance({ sync: true }) getStrokeWidth(): number { return; } + /** + * When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. + * @param geodesic {boolean} + */ @CordovaInstance({ sync: true }) setGeodesic(geodesic: boolean): void {} + /** + * Return true if the polylgon is geodesic. + * @return {boolean} + */ @CordovaInstance({ sync: true }) getGeodesic(): boolean { return; } } @@ -1740,49 +1748,117 @@ export class Polygon extends BaseClass { * @hidden */ export class Polyline extends BaseClass { + constructor(_objectInstance: any) { super(); this._objectInstance = _objectInstance; } + /** + * Change the polyline points. + * @param points {ILatLng[]} + */ @CordovaInstance({ sync: true }) - getPoints(): Array { return; } + setPoints(points: ILatLng[]): void {} + /** + * Return an instance of the BaseArrayClass + * You can modify the points. + */ @CordovaInstance({ sync: true }) - getCOlor(): string { return; } + getPoints(): BaseArrayClass { return; } + /** + * When true, edges of the polyline are interpreted as geodesic and will follow the curvature of the Earth. + * @param geoDesic {boolean} + */ @CordovaInstance({ sync: true }) - getWidth(): number { return; } + setGeoDesic(geoDesic: boolean): void {} + /** + * Return true if the polyline is geodesic + */ @CordovaInstance({ sync: true }) getGeodesic(): boolean { return; } + /** + * Change visibility of the polyline + * @param visible {boolean} + */ @CordovaInstance({ sync: true }) - getZIndex(): number { return; } + setVisible(visible: boolean): void {} + + /** + * Return true if the polyline is visible + * @return {boolean} + */ + @CordovaInstance({ sync: true }) + getVisible(): boolean { return; } + /** + * Change clickablity of the polyline + * @param clickable {boolean} + */ @CordovaInstance({ sync: true }) - remove(): void { } + setClickable(clickable: boolean): void {} + /** + * Return true if the polyline is clickable + * @return {boolean} + */ @CordovaInstance({ sync: true }) - setPoints(points: Array): void { } + getClickable(): boolean { return; } + /** + * Change the polyline color + * @param strokeColor {string} + */ @CordovaInstance({ sync: true }) - setColor(color: string): void { } + setStrokeColor(strokeColor: string): void {} + /** + * Return the current polyline color + * @return {string} + */ @CordovaInstance({ sync: true }) - setWidth(width: number): void { } + getStrokeColor(): string { return; } + /** + * Change the polyline stroke width + * @param strokeWidth {number} + */ @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } + setStrokeWidth(strokeWidth: number): void {} + + /** + * Return the current stroke width (unit: pixel). + * @return {number} + */ + @CordovaInstance({ sync: true }) + getStrokeWidth(): number { return; } + /** + * Change the polyline zIndex order. + * @param index {number} + */ @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { } + setZIndex(index: number): void {} + /** + * Return the current polyline zIndex + * @return {number} + */ @CordovaInstance({ sync: true }) - setGeoDesic(geoDesic: boolean): void { } + getZIndex(): number { return; } + /** + * Remove the polyline + */ @CordovaInstance({ sync: true }) - getMap(): GoogleMap { return; } + remove(): void {} + + @CordovaInstance({ sync: true }) + getMap(): any { return; } } @@ -1796,39 +1872,75 @@ export class TileOverlay extends BaseClass { this._objectInstance = _objectInstance; } + /** + * Set whether the tiles should fade in. + * @param fadeIn {boolean} + */ @CordovaInstance({ sync: true }) - getVisible(): boolean { return; } - - @CordovaInstance({ sync: true }) - setVisible(visible: boolean): void { } + setFadeIn(fadeIn: boolean): void {} + /** + * Get whether the tiles should fade in + * @return {boolean} + */ @CordovaInstance({ sync: true }) getFadeIn(): boolean { return; } + /** + * Set the zIndex of the tile overlay + * @param zIndex {number} + */ @CordovaInstance({ sync: true }) - setFadeIn(fadeIn: boolean): void { } + setZIndex(zIndex: number): void {} + /** + * Return the zIndex of the tile overlay + * @return {number} + */ @CordovaInstance({ sync: true }) getZIndex(): number { return; } + /** + * Set the opacity of the tile overlay + * @param opacity {number} + */ @CordovaInstance({ sync: true }) - setZIndex(zIndex: number): void { } + setOpacity(opacity: number): void {} + /** + * Return the opacity of the tile overlay + * @return {number} + */ @CordovaInstance({ sync: true }) getOpacity(): number { return; } + /** + * Set false if you want to hide + * @param visible {boolean} + */ @CordovaInstance({ sync: true }) - setOpacity(opacity: number): void { } + setVisible(visible: boolean): void {} + /** + * Return true if the tile overlay is visible + * @return {boolean} + */ @CordovaInstance({ sync: true }) - clearTileCache(): void { } + getVisible(): boolean { return; } + /** + * Get tile size + */ @CordovaInstance({ sync: true }) - remove(): void { } + getTileSize(): any { return; } -} + /** + * Remove the tile overlay + */ + @CordovaInstance({ sync: true }) + remove(): void {} -// TODO add spherical utility class here +} // /** // * @hidden From fdd1ca1ed8f8bb052ac935fc34f12922d02a38f7 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 5 Jul 2017 08:44:18 -0400 Subject: [PATCH 34/34] remove setDebuggable and isAvailable developer said they're not suited for users --- src/@ionic-native/plugins/google-maps/index.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index d8c71ed468..cd1a9dac14 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -748,20 +748,6 @@ export class Environment extends IonicNativePlugin { @Cordova({ sync: true }) setBackgroundColor(color: string): void {} - /** - * Set maps to debuggable - * @param debug {boolean} - */ - @Cordova({ sync: true }) - setDebuggable(debug: boolean): void {} - - /** - * Checks if plugin is available - * @return {Promise} - */ - @Cordova() - isAvailable(): Promise { return; } - } /**