From 4e1ea247006a20d1c80df5fa8352bebfcf388966 Mon Sep 17 00:00:00 2001 From: xx Date: Sun, 28 Jul 2024 23:34:39 +0200 Subject: [PATCH 1/7] - adding support for minZoom and maxZoom - adding getRegionInfo method (bounds of the VisibleRegion, its center and current camera zoom) --- .../CapacitorGoogleMaps.java | 55 ++++++++++++++++++- .../capacitorgooglemaps/CustomMapView.java | 2 + .../capacitorgooglemaps/MapPreferences.java | 5 ++ ios/Plugin/CustomMapView.swift | 3 + ios/Plugin/MapPreferences.swift | 5 ++ ios/Plugin/Plugin.m | 1 + ios/Plugin/Plugin.swift | 40 ++++++++++++++ package-lock.json | 4 +- package.json | 2 +- src/definitions.ts | 4 ++ src/interfaces/index.ts | 1 + src/interfaces/methods/GetRegionInfo.ts | 36 ++++++++++++ .../models/GoogleMap/Preferences.ts | 12 ++-- src/web.ts | 6 ++ 14 files changed, 168 insertions(+), 8 deletions(-) create mode 100644 src/interfaces/methods/GetRegionInfo.ts diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java index 366b8cea..0f2d5769 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java @@ -4,7 +4,6 @@ import android.annotation.SuppressLint; import android.graphics.Color; import android.graphics.Rect; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -19,6 +18,7 @@ import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.Marker; +import com.google.android.gms.maps.model.VisibleRegion; import java.util.ArrayList; import java.util.HashMap; @@ -377,6 +377,59 @@ public void run() { }); } + @PluginMethod() + public void getRegionInfo(final PluginCall call) { + final String mapId = call.getString("mapId"); + + getBridge().getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + CustomMapView customMapView = customMapViews.get(mapId); + + if (customMapView != null) { + VisibleRegion region = customMapView.googleMap.getProjection().getVisibleRegion(); + + JSObject topLeft = new JSObject(); + JSObject topRight = new JSObject(); + JSObject bottomLeft = new JSObject(); + JSObject bottomRight = new JSObject(); + + topLeft.put("latitude", region.latLngBounds.northeast.latitude); + topLeft.put("longitude", region.latLngBounds.southwest.longitude); + + topRight.put("latitude", region.latLngBounds.northeast.latitude); + topRight.put("longitude", region.latLngBounds.northeast.longitude); + + bottomLeft.put("latitude", region.latLngBounds.southwest.latitude); + bottomLeft.put("longitude", region.latLngBounds.southwest.longitude); + + bottomRight.put("latitude", region.latLngBounds.southwest.latitude); + bottomRight.put("longitude", region.latLngBounds.northeast.longitude); + + JSObject bounds = new JSObject(); + bounds.put("topLeft", topLeft); + bounds.put("topRight", topRight); + bounds.put("bottomLeft", bottomLeft); + bounds.put("bottomRight", bottomRight); + + JSObject center = new JSObject(); + center.put("latitude", region.latLngBounds.getCenter().latitude); + center.put("longitude", region.latLngBounds.getCenter().longitude); + + CameraPosition camera = customMapView.googleMap.getCameraPosition(); + JSObject result = new JSObject(); + result.put("bounds", bounds); + result.put("center", center); + result.put("zoom", camera.zoom); + + call.resolve(result); + } else { + call.reject("map not found"); + } + } + }); + } + @Override public void onMapReady(String callbackId, JSObject result) { PluginCall call = bridge.getSavedCall(callbackId); diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java index 13690d96..d54c00f7 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java @@ -359,6 +359,8 @@ public void createMap(String callbackId, BoundingRect boundingRect, MapCameraPos GoogleMapOptions googleMapOptions = this.mapPreferences.generateGoogleMapOptions(); googleMapOptions.camera(this.mapCameraPosition.cameraPosition); + googleMapOptions.minZoomPreference(mapPreferences.minZoom); + googleMapOptions.maxZoomPreference(mapPreferences.maxZoom); mapView = new MapView(activity, googleMapOptions); diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/MapPreferences.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/MapPreferences.java index d02e431b..f6cc6fcc 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/MapPreferences.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/MapPreferences.java @@ -9,6 +9,8 @@ public class MapPreferences { public MapPreferencesGestures gestures; public MapPreferencesControls controls; public MapPreferencesAppearance appearance; + public Integer minZoom; + public Integer maxZoom; public MapPreferences() { this.gestures = new MapPreferencesGestures(); @@ -27,6 +29,9 @@ public void updateFromJSObject(@Nullable JSObject preferences) { // update appearance JSObject appearanceObject = preferences.getJSObject("appearance"); this.appearance.updateFromJSObject(appearanceObject); + // update zoom + this.minZoom = preferences.getInteger("minZoom", 1); + this.maxZoom = preferences.getInteger("maxZoom", 21); } } diff --git a/ios/Plugin/CustomMapView.swift b/ios/Plugin/CustomMapView.swift index 9e56ecbb..1104a74c 100644 --- a/ios/Plugin/CustomMapView.swift +++ b/ios/Plugin/CustomMapView.swift @@ -111,6 +111,9 @@ class CustomMapView: UIViewController, GMSMapViewDelegate { self.GMapView.isMyLocationEnabled = self.mapPreferences.appearance.isMyLocationDotShown; self.GMapView.isTrafficEnabled = self.mapPreferences.appearance.isTrafficShown; + // set zoom + self.GMapView.setMinZoom(self.mapPreferences.minZoom, maxZoom: self.mapPreferences.maxZoom); + return self.getResultForMap(); } diff --git a/ios/Plugin/MapPreferences.swift b/ios/Plugin/MapPreferences.swift index 81bf0420..5f8a5298 100644 --- a/ios/Plugin/MapPreferences.swift +++ b/ios/Plugin/MapPreferences.swift @@ -4,6 +4,8 @@ class MapPreferences { public var gestures: MapPreferencesGestures! public var controls: MapPreferencesControls! public var appearance: MapPreferencesAppearance! + public var minZoom: Int! + public var maxZoom: Int! public init() { self.gestures = MapPreferencesGestures(); @@ -22,6 +24,9 @@ class MapPreferences { // update appearance let appearanceObject: JSObject! = preferences["appearance"] as? JSObject ?? JSObject(); self.appearance.updateFromJSObject(object: appearanceObject); + // update zoom + self.minZoom = preferences["minZoom"] as? Float ?? 1.0; + self.maxZoom = preferences["maxZoom"] as? Float ?? 21.0; } } } diff --git a/ios/Plugin/Plugin.m b/ios/Plugin/Plugin.m index 617794f3..3f4a7072 100644 --- a/ios/Plugin/Plugin.m +++ b/ios/Plugin/Plugin.m @@ -10,6 +10,7 @@ CAP_PLUGIN_METHOD(clearMap, CAPPluginReturnNone); CAP_PLUGIN_METHOD(removeMap, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(moveCamera, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(getRegionInfo, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(addMarker, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(addMarkers, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(removeMarker, CAPPluginReturnPromise); diff --git a/ios/Plugin/Plugin.swift b/ios/Plugin/Plugin.swift index 13048304..b4dc2fc9 100644 --- a/ios/Plugin/Plugin.swift +++ b/ios/Plugin/Plugin.swift @@ -174,6 +174,46 @@ public class CapacitorGoogleMaps: CustomMapViewEvents { } } + @objc func getRegionInfo(_ call: CAPPluginCall) { + let mapId: String = call.getString("mapId", "") + + DispatchQueue.main.async { + guard let customMapView = self.customWebView?.customMapViews[mapId] else { + call.reject("map not found") + return + } + + let region = customMapView.GMapView.projection.visibleRegion(); + let centerCoords = customMapView.GMapView.projection.coordinate(for: customMapView.GMapView.center) + + call.resolve([ + "bounds": [ + "topLeft": [ + "latitude": region.farLeft.latitude as Any, + "longitude": region.farLeft.longitude as Any + ], + "topRight": [ + "latitude": region.farRight.latitude as Any, + "longitude": region.farRight.longitude as Any + ], + "bottomLeft": [ + "latitude": region.nearLeft.latitude as Any, + "longitude": region.nearLeft.longitude as Any + ], + "bottomRight": [ + "latitude": region.nearRight.latitude as Any, + "longitude": region.nearRight.longitude as Any + ] + ], + "center": [ + "latitude": centerCoords.latitude as Any, + "longitude": centerCoords.longitude as Any + ], + "zoom": customMapView.GMapView.camera.zoom + ]) + } + } + @objc func addMarker(_ call: CAPPluginCall) { let mapId: String = call.getString("mapId", "") diff --git a/package-lock.json b/package-lock.json index 0bcaf12d..d4996f69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/google-maps", - "version": "2.0.0-beta.8", + "version": "2.0.0-beta.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/google-maps", - "version": "2.0.0-beta.8", + "version": "2.0.0-beta.9", "license": "MIT", "devDependencies": { "@capacitor/android": "^6.0.0", diff --git a/package.json b/package.json index 893ced3b..708aa515 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/google-maps", - "version": "2.0.0-beta.8", + "version": "2.0.0-beta.9", "description": "Plugin using native Maps API for Android and iOS.", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/src/definitions.ts b/src/definitions.ts index 814b1bfc..d00b8f3f 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -10,6 +10,8 @@ import { RemoveMapOptions, ClearMapOptions, MoveCameraOptions, + GetRegionInfoOptions, + GetRegionInfoResult, ElementFromPointResultOptions, AddMarkerOptions, AddMarkerResult, @@ -68,6 +70,8 @@ export interface CapacitorGoogleMapsPlugin { moveCamera(options: MoveCameraOptions): Promise; + getRegionInfo(options: GetRegionInfoOptions): Promise; + addMarker(options: AddMarkerOptions): Promise; addMarkers(options: AddMarkersOptions): Promise; diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 2f1146f1..c3255473 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -5,6 +5,7 @@ export { UpdateMapOptions, UpdateMapResult } from "./methods/UpdateMap"; export { RemoveMapOptions } from "./methods/RemoveMap"; export { ClearMapOptions } from "./methods/ClearMap"; export { MoveCameraOptions } from "./methods/MoveCamera"; +export { GetRegionInfoOptions, GetRegionInfoResult } from './methods/GetRegionInfo'; export { ElementFromPointResultOptions } from "./methods/ElementFromPointResult"; export { AddMarkerOptions, AddMarkerResult } from "./methods/AddMarker"; export { diff --git a/src/interfaces/methods/GetRegionInfo.ts b/src/interfaces/methods/GetRegionInfo.ts new file mode 100644 index 00000000..b00bef85 --- /dev/null +++ b/src/interfaces/methods/GetRegionInfo.ts @@ -0,0 +1,36 @@ +import { LatLng } from "../models/LatLng"; + +export interface GetRegionInfoOptions { + /** + * @since 2.0.0 + */ + mapId: string; +} + +export interface Bounds { + /** + * @since 2.0.0 + */ + topLeft: LatLng; + /** + * @since 2.0.0 + */ + topRight: LatLng; + /** + * @since 2.0.0 + */ + bottomLeft: LatLng; + /** + * @since 2.0.0 + */ + bottomRight: LatLng; +} + +export interface GetRegionInfoResult { + /** + * @since 2.0.0 + */ + bounds: Bounds; + center: LatLng; + zoom: number; +} diff --git a/src/interfaces/models/GoogleMap/Preferences.ts b/src/interfaces/models/GoogleMap/Preferences.ts index da9a5c3d..2c5957ce 100644 --- a/src/interfaces/models/GoogleMap/Preferences.ts +++ b/src/interfaces/models/GoogleMap/Preferences.ts @@ -17,10 +17,14 @@ export interface MapPreferences { * @since 2.0.0 */ appearance?: MapAppearance; - - maxZoom?: number; // @todo: Sets a preferred upper bound for the camera zoom. - - minZoom?: number; // @todo: Sets a preferred lower bound for the camera zoom. + /** + * @since 2.0.0 + */ + minZoom?: number; + /** + * @since 2.0.0 + */ + maxZoom?: number; padding?: any; // @todo: Sets padding on the map. diff --git a/src/web.ts b/src/web.ts index 517e4f69..95b9dedd 100644 --- a/src/web.ts +++ b/src/web.ts @@ -11,6 +11,8 @@ import { RemoveMapOptions, ClearMapOptions, MoveCameraOptions, + GetRegionInfoOptions, + GetRegionInfoResult, ElementFromPointResultOptions, AddMarkerOptions, AddMarkerResult, @@ -73,6 +75,10 @@ export class CapacitorGoogleMapsWeb throw this.unimplemented("Not implemented on web."); } + async getRegionInfo(_options: GetRegionInfoOptions): Promise { + throw new Error('Method not implemented on web.'); + } + async addMarker(_options: AddMarkerOptions): Promise { throw this.unimplemented("Not implemented on web."); } From 8690bac205b001016092693c8609e9512dc80c15 Mon Sep 17 00:00:00 2001 From: xx Date: Mon, 29 Jul 2024 00:05:49 +0200 Subject: [PATCH 2/7] iOS build fix --- ios/Plugin/MapPreferences.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Plugin/MapPreferences.swift b/ios/Plugin/MapPreferences.swift index 5f8a5298..2e764eed 100644 --- a/ios/Plugin/MapPreferences.swift +++ b/ios/Plugin/MapPreferences.swift @@ -4,8 +4,8 @@ class MapPreferences { public var gestures: MapPreferencesGestures! public var controls: MapPreferencesControls! public var appearance: MapPreferencesAppearance! - public var minZoom: Int! - public var maxZoom: Int! + public var minZoom: Float! + public var maxZoom: Float! public init() { self.gestures = MapPreferencesGestures(); From 4e6fe09d203f7cbbe33205cad7837d00aa784586 Mon Sep 17 00:00:00 2001 From: xx Date: Tue, 30 Jul 2024 17:03:19 +0200 Subject: [PATCH 3/7] (feat) when clearing map you can optionally also hide map - this is useful if you have another plugin drawing directly into WebView --- .../hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java | 3 ++- .../com/hemangkumar/capacitorgooglemaps/CustomMapView.java | 4 +++- ios/Plugin/CustomMapView.swift | 3 ++- ios/Plugin/Plugin.swift | 5 +++-- src/interfaces/methods/ClearMap.ts | 5 +++++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java index 0f2d5769..b6e613ce 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java @@ -327,6 +327,7 @@ public void run() { @PluginMethod(returnType = PluginMethod.RETURN_NONE) public void clearMap(final PluginCall call) { final String mapId = call.getString("mapId"); + final boolean hide = Boolean.TRUE.equals(call.getBoolean("hide", false)); getBridge().getActivity().runOnUiThread(new Runnable() { @Override @@ -334,7 +335,7 @@ public void run() { CustomMapView customMapView = customMapViews.get(mapId); if (customMapView != null) { - customMapView.clear(); + customMapView.clear(hide); call.resolve(); } else { call.reject("map not found"); diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java index d54c00f7..5839008b 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CustomMapView.java @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; import android.content.pm.PackageManager; import android.location.Location; +import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -446,9 +447,10 @@ public void removeFromView(ViewGroup parent) { parent.removeView(mapView); } - public void clear() { + public void clear(boolean hide) { googleMap.clear(); markers.clear(); + mapView.setVisibility(hide ? View.INVISIBLE : View.VISIBLE); } public void addMarker(CustomMarker customMarker, @Nullable Consumer consumer) { diff --git a/ios/Plugin/CustomMapView.swift b/ios/Plugin/CustomMapView.swift index 1104a74c..3a2b102a 100644 --- a/ios/Plugin/CustomMapView.swift +++ b/ios/Plugin/CustomMapView.swift @@ -121,9 +121,10 @@ class CustomMapView: UIViewController, GMSMapViewDelegate { return self.getResultForMap(); } - func clearMap() { + func clearMap(hide: Bool) { if (self.GMapView != nil) { self.GMapView.clear(); + self.GMapView.isHidden = hide == true; } } diff --git a/ios/Plugin/Plugin.swift b/ios/Plugin/Plugin.swift index b4dc2fc9..8988ef9a 100644 --- a/ios/Plugin/Plugin.swift +++ b/ios/Plugin/Plugin.swift @@ -130,14 +130,15 @@ public class CapacitorGoogleMaps: CustomMapViewEvents { @objc func clearMap(_ call: CAPPluginCall) { let mapId: String = call.getString("mapId", "") + let hide: Bool = call.getBool("hide", false) DispatchQueue.main.async { guard let customMapView = self.customWebView?.customMapViews[mapId] else { call.reject("map not found") return } - - let result = customMapView.clearMap() + + let result = customMapView.clearMap(hide: hide) call.resolve() } diff --git a/src/interfaces/methods/ClearMap.ts b/src/interfaces/methods/ClearMap.ts index 454f11ec..b12964d5 100644 --- a/src/interfaces/methods/ClearMap.ts +++ b/src/interfaces/methods/ClearMap.ts @@ -3,4 +3,9 @@ export interface ClearMapOptions { * @since 2.0.0 */ mapId: string; + /** + * @since 2.0.0 + * if set to true MapView will become invisible. default false. + */ + hide?: boolean; } From 05cc9713767e5394c9775507e5915104c8338426 Mon Sep 17 00:00:00 2001 From: xx Date: Thu, 31 Oct 2024 11:57:49 +0100 Subject: [PATCH 4/7] adding debugging info for "map not found" rejection --- .../CapacitorGoogleMaps.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java index b6e613ce..a7a11abe 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java @@ -278,7 +278,7 @@ public void run() { call.resolve(result); } else { - call.reject("map not found"); + call.reject("updateMap: map not found, mapId: " + mapid); } } }); @@ -298,7 +298,7 @@ public void run() { call.resolve(result); } else { - call.reject("map not found"); + call.reject("getMap: map not found, mapId: " + mapid); } } }); @@ -318,7 +318,7 @@ public void run() { customMapViews.remove(mapId); call.resolve(); } else { - call.reject("map not found"); + call.reject("removeMap: map not found, mapId: " + mapid)); } } }); @@ -338,7 +338,7 @@ public void run() { customMapView.clear(hide); call.resolve(); } else { - call.reject("map not found"); + call.reject("clearMap: map not found, mapId: " + mapid)); } } }); @@ -372,7 +372,7 @@ public void run() { call.resolve(); } else { - call.reject("map not found"); + call.reject("moveCamera: map not found, mapId: " + mapid)); } } }); @@ -425,7 +425,7 @@ public void run() { call.resolve(result); } else { - call.reject("map not found"); + call.reject("getRegionInfo: map not found, mapId: " + mapid)); } } }); @@ -554,7 +554,7 @@ public void run() { } ); } else { - call.reject("map not found"); + call.reject("addMarker: map not found, mapId: " + mapid)); } } }); @@ -565,7 +565,7 @@ public void addMarkers(final PluginCall call) { final String mapId = call.getString("mapId"); CustomMapView customMapView = customMapViews.get(mapId); if (customMapView == null) { - call.reject("map not found"); + call.reject("addMarkers: map not found, mapId: " + mapid)); return; } try { @@ -593,7 +593,7 @@ public void run() { call.resolve(); } else { - call.reject("map not found"); + call.reject("removeMarker: map not found, mapId: " + mapid)); } } }); @@ -616,7 +616,7 @@ public void run() { call.resolve(customPolygon.getResultForPolygon(polygon, mapId)); }); } else { - call.reject("map not found"); + call.reject("addPolygon: map not found, mapId: " + mapid)); } } }); @@ -638,7 +638,7 @@ public void run() { call.resolve(); } else { - call.reject("map not found"); + call.reject("removePolygon: map not found, mapId: " + mapId); } } }); From d87e1eb24fbc8166ce99e9b88cb7c3c7b2c42b20 Mon Sep 17 00:00:00 2001 From: xx Date: Thu, 31 Oct 2024 12:42:07 +0100 Subject: [PATCH 5/7] typo --- .../CapacitorGoogleMaps.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java index a7a11abe..0f284752 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java @@ -318,7 +318,7 @@ public void run() { customMapViews.remove(mapId); call.resolve(); } else { - call.reject("removeMap: map not found, mapId: " + mapid)); + call.reject("removeMap: map not found, mapId: " + mapid); } } }); @@ -338,7 +338,7 @@ public void run() { customMapView.clear(hide); call.resolve(); } else { - call.reject("clearMap: map not found, mapId: " + mapid)); + call.reject("clearMap: map not found, mapId: " + mapid); } } }); @@ -372,7 +372,7 @@ public void run() { call.resolve(); } else { - call.reject("moveCamera: map not found, mapId: " + mapid)); + call.reject("moveCamera: map not found, mapId: " + mapid); } } }); @@ -425,7 +425,7 @@ public void run() { call.resolve(result); } else { - call.reject("getRegionInfo: map not found, mapId: " + mapid)); + call.reject("getRegionInfo: map not found, mapId: " + mapid); } } }); @@ -550,11 +550,11 @@ public void run() { customMapView.addMarker( customMarker, (Marker marker) -> { - call.resolve(CustomMarker.getResultForMarker(marker, mapId)); + call.resolve(CustomMarker.getResultForMarker(marker, mapid); } ); } else { - call.reject("addMarker: map not found, mapId: " + mapid)); + call.reject("addMarker: map not found, mapId: " + mapid); } } }); @@ -565,7 +565,7 @@ public void addMarkers(final PluginCall call) { final String mapId = call.getString("mapId"); CustomMapView customMapView = customMapViews.get(mapId); if (customMapView == null) { - call.reject("addMarkers: map not found, mapId: " + mapid)); + call.reject("addMarkers: map not found, mapId: " + mapid); return; } try { @@ -593,7 +593,7 @@ public void run() { call.resolve(); } else { - call.reject("removeMarker: map not found, mapId: " + mapid)); + call.reject("removeMarker: map not found, mapId: " + mapid); } } }); @@ -613,10 +613,10 @@ public void run() { customPolygon.updateFromJSObject(call.getData()); customMapView.addPolygon(customPolygon, (polygon) -> { - call.resolve(customPolygon.getResultForPolygon(polygon, mapId)); + call.resolve(customPolygon.getResultForPolygon(polygon, mapid); }); } else { - call.reject("addPolygon: map not found, mapId: " + mapid)); + call.reject("addPolygon: map not found, mapId: " + mapid); } } }); From 7e33d98bbff9620f10ea12b7cd482d05635c7df0 Mon Sep 17 00:00:00 2001 From: xx Date: Thu, 31 Oct 2024 13:07:21 +0100 Subject: [PATCH 6/7] typo || --- .../hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java index 0f284752..7e00beee 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java @@ -550,7 +550,7 @@ public void run() { customMapView.addMarker( customMarker, (Marker marker) -> { - call.resolve(CustomMarker.getResultForMarker(marker, mapid); + call.resolve(CustomMarker.getResultForMarker(marker, mapid)); } ); } else { @@ -613,7 +613,7 @@ public void run() { customPolygon.updateFromJSObject(call.getData()); customMapView.addPolygon(customPolygon, (polygon) -> { - call.resolve(customPolygon.getResultForPolygon(polygon, mapid); + call.resolve(customPolygon.getResultForPolygon(polygon, mapid)); }); } else { call.reject("addPolygon: map not found, mapId: " + mapid); From 4e4a80489faf62b4cc7100132f14b0b9ec87a2cf Mon Sep 17 00:00:00 2001 From: xx Date: Thu, 31 Oct 2024 13:17:38 +0100 Subject: [PATCH 7/7] typo III --- .../CapacitorGoogleMaps.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java index 7e00beee..b8d421d2 100644 --- a/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java +++ b/android/src/main/java/com/hemangkumar/capacitorgooglemaps/CapacitorGoogleMaps.java @@ -278,7 +278,7 @@ public void run() { call.resolve(result); } else { - call.reject("updateMap: map not found, mapId: " + mapid); + call.reject("updateMap: map not found, mapId: " + mapId); } } }); @@ -298,7 +298,7 @@ public void run() { call.resolve(result); } else { - call.reject("getMap: map not found, mapId: " + mapid); + call.reject("getMap: map not found, mapId: " + mapId); } } }); @@ -318,7 +318,7 @@ public void run() { customMapViews.remove(mapId); call.resolve(); } else { - call.reject("removeMap: map not found, mapId: " + mapid); + call.reject("removeMap: map not found, mapId: " + mapId); } } }); @@ -338,7 +338,7 @@ public void run() { customMapView.clear(hide); call.resolve(); } else { - call.reject("clearMap: map not found, mapId: " + mapid); + call.reject("clearMap: map not found, mapId: " + mapId); } } }); @@ -372,7 +372,7 @@ public void run() { call.resolve(); } else { - call.reject("moveCamera: map not found, mapId: " + mapid); + call.reject("moveCamera: map not found, mapId: " + mapId); } } }); @@ -425,7 +425,7 @@ public void run() { call.resolve(result); } else { - call.reject("getRegionInfo: map not found, mapId: " + mapid); + call.reject("getRegionInfo: map not found, mapId: " + mapId); } } }); @@ -550,11 +550,11 @@ public void run() { customMapView.addMarker( customMarker, (Marker marker) -> { - call.resolve(CustomMarker.getResultForMarker(marker, mapid)); + call.resolve(CustomMarker.getResultForMarker(marker, mapId)); } ); } else { - call.reject("addMarker: map not found, mapId: " + mapid); + call.reject("addMarker: map not found, mapId: " + mapId); } } }); @@ -565,7 +565,7 @@ public void addMarkers(final PluginCall call) { final String mapId = call.getString("mapId"); CustomMapView customMapView = customMapViews.get(mapId); if (customMapView == null) { - call.reject("addMarkers: map not found, mapId: " + mapid); + call.reject("addMarkers: map not found, mapId: " + mapId); return; } try { @@ -593,7 +593,7 @@ public void run() { call.resolve(); } else { - call.reject("removeMarker: map not found, mapId: " + mapid); + call.reject("removeMarker: map not found, mapId: " + mapId); } } }); @@ -613,10 +613,10 @@ public void run() { customPolygon.updateFromJSObject(call.getData()); customMapView.addPolygon(customPolygon, (polygon) -> { - call.resolve(customPolygon.getResultForPolygon(polygon, mapid)); + call.resolve(customPolygon.getResultForPolygon(polygon, mapId)); }); } else { - call.reject("addPolygon: map not found, mapId: " + mapid); + call.reject("addPolygon: map not found, mapId: " + mapId); } } });