Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple maps #2812

Open
wants to merge 7 commits into
base: multiple_maps
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<!-- GPS -->
<uses-feature android:name="android.hardware.location"/>
<uses-feature android:name="android.hardware.location.gps"/>
<!-- ATW 05/11/2021 removed this entry as it clashes with cordova-plugin-location
<uses-feature android:name="android.hardware.location.gps"/> -->
</config-file>

<resource-file src="src/android/res/layout/dummy_infowindow.xml" target="res/layout/dummy_infowindow.xml"/>
Expand Down
27 changes: 19 additions & 8 deletions src/android/plugin/google/maps/CordovaGoogleMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,18 @@ public void getMap(final JSONArray args, final CallbackContext callbackContext)
JSONObject meta = args.getJSONObject(0);
String mapId = meta.getString("__pgmId");
PluginMap pluginMap = new PluginMap();
pluginMap.privateInitialize(mapId, cordova, webView, null);
pluginMap.initialize(cordova, webView);
pluginMap.mapCtrl = CordovaGoogleMaps.this;
pluginMap.self = pluginMap;

//ATW removed these 2 lines to make app work with cordova 10 as per issue 2872
//pluginMap.privateInitialize(mapId, cordova, webView, null);
//pluginMap.initialize(cordova, webView);
//pluginMap.mapCtrl = CordovaGoogleMaps.this;
//pluginMap.self = pluginMap;

PluginEntry pluginEntry = new PluginEntry(mapId, pluginMap);
pluginManager.addService(pluginEntry);

pluginMap.mapCtrl = CordovaGoogleMaps.this;
pluginMap.self = pluginMap;
pluginMap.getMap(args, callbackContext);
}

Expand All @@ -470,14 +474,21 @@ public void getPanorama(final JSONArray args, final CallbackContext callbackCont
String mapId = meta.getString("__pgmId");
Log.d(TAG, "---> mapId = " + mapId);
PluginStreetViewPanorama pluginStreetView = new PluginStreetViewPanorama();
pluginStreetView.privateInitialize(mapId, cordova, webView, null);
pluginStreetView.initialize(cordova, webView);
pluginStreetView.mapCtrl = CordovaGoogleMaps.this;
pluginStreetView.self = pluginStreetView;

//ATW removed these 2 lines to make app work with cordova 10 as per issue 2872
//pluginStreetView.privateInitialize(mapId, cordova, webView, null);
//pluginStreetView.initialize(cordova, webView);


PluginEntry pluginEntry = new PluginEntry(mapId, pluginStreetView);
pluginManager.addService(pluginEntry);

//ATW moved these 2 lines from above the two above to make app work with cordova 10 as per issue 2872
pluginStreetView.mapCtrl = CordovaGoogleMaps.this;
pluginStreetView.self = pluginStreetView;



pluginStreetView.getPanorama(args, callbackContext);
}

Expand Down
15 changes: 10 additions & 5 deletions src/android/plugin/google/maps/PluginMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,11 @@ public synchronized void loadPlugin(final JSONArray args, final CallbackContext
plugins.put(pluginName, pluginEntry);
mapCtrl.pluginManager.addService(pluginEntry);

plugin.privateInitialize(pluginName, cordova, webView, null);

plugin.initialize(cordova, webView);
//ATW removed these 2 lines to make app work with cordova 10 as per issue 2872
//plugin.privateInitialize(pluginName, cordova, webView, null);
//plugin.initialize(cordova, webView);


((MyPluginInterface)plugin).setPluginMap(PluginMap.this);
MyPlugin myPlugin = (MyPlugin) plugin;
myPlugin.self = (MyPlugin)plugin;
Expand Down Expand Up @@ -684,8 +686,11 @@ public void create(final JSONArray args, final CallbackContext callbackContext)
pluginMap = PluginMap.this;
pluginMap.mapCtrl.pluginManager.addService(pluginEntry);

plugin.privateInitialize(className, cordova, webView, null);
plugin.initialize(cordova, webView);
//ATW removed these 2 lines to make app work with cordova 10 as per issue 2872
//plugin.privateInitialize(className, cordova, webView, null);
//plugin.initialize(cordova, webView);


((MyPluginInterface)plugin).setPluginMap(PluginMap.this);
pluginEntry.plugin.execute("create", args, callbackContext);

Expand Down
2 changes: 1 addition & 1 deletion src/browser/PluginMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ PluginMarker.prototype.__create = function(markerId, pluginOptions, onSuccess, o
});
};
img.onerror = function(error) {
console.warn(error.getMessage());
console.warn(`Error loading marker`);
onSuccess(marker, {
'__pgmId': markerId,
'width': 20,
Expand Down
2 changes: 1 addition & 1 deletion src/browser/PluginMarkerCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ PluginMarkerCluster.prototype.redrawClusters = function(onSuccess, onError, args
}
self.pluginMarkers[clusterId_markerId] = STATUS.DELETED;

console.warn(error.getMessage());
console.warn(`Error loading marker`);
self.deleteMarkers.push(clusterId_markerId);
resolve();
});
Expand Down