Bug fix: useHtmlInfoWnd does not work correctly
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170720-1821" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170720-1916" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
src/android/plugin/google/maps/PluginMap.java
src/android/plugin/google/maps/PluginMap.java
@@ -930,7 +930,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
if (pluginMarker.objects.containsKey(propertyId)) {
properties = (JSONObject) pluginMarker.objects.get(propertyId);
try {
- if (properties.has("useHtmlInfoWnd") && properties.getBoolean("useHtmlInfoWnd")) {
+ if (marker.getTitle() == null && marker.getSnippet() == null) {
syncInfoWndPosition();
this.onMarkerEvent("info_open", marker);

MODIFY
src/android/plugin/google/maps/PluginMarker.java
src/android/plugin/google/maps/PluginMarker.java
@@ -226,11 +226,6 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
} else {
properties.put("noCache", false);
}
- if (opts.has("useHtmlInfoWnd")) {
- properties.put("useHtmlInfoWnd", opts.getBoolean("useHtmlInfoWnd"));
- } else {
- properties.put("useHtmlInfoWnd", false);
- }
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
@@ -706,20 +701,6 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
Marker marker = getMarker(id);
if (marker != null) {
marker.setTitle(title);
-
- try {
- String propertyId = "marker_property_" + id;
- JSONObject properties = null;
- if (self.objects.containsKey(propertyId)) {
- properties = (JSONObject) self.objects.get(propertyId);
- } else {
- properties = new JSONObject();
- }
- properties.put("useHtmlInfoWnd", title == null && marker.getSnippet() == null);
- self.objects.put(propertyId, properties);
- } catch (JSONException e) {
- e.printStackTrace();
- }
}
sendNoResult(callbackContext);
}

MODIFY
src/ios/GoogleMaps/GoogleMapsViewController.m
src/ios/GoogleMaps/GoogleMapsViewController.m
NSString *markerPropertyId = [NSString stringWithFormat:@"marker_property_%lu", (unsigned long)marker.hash];
NSDictionary *properties = [plugin.objects objectForKey:markerPropertyId];
- if (![[properties objectForKey:@"useHtmlInfoWnd"] boolValue]) {
+
+ BOOL useHtmlInfoWnd = marker.title == nil &&
+ marker.snippet == nil;
+
+ if (useHtmlInfoWnd) {
[self triggerMarkerEvent:@"info_close" marker:marker];
}

MODIFY
src/ios/GoogleMaps/PluginMarker.m
src/ios/GoogleMaps/PluginMarker.m
}
[properties setObject:[NSNumber numberWithBool:disableAutoPan] forKey:@"disableAutoPan"];
- BOOL useHtmlInfoWnd = NO;
- if ([json valueForKey:@"useHtmlInfoWnd"] != nil) {
- useHtmlInfoWnd = [[json valueForKey:@"useHtmlInfoWnd"] boolValue];
- }
- [properties setObject:[NSNumber numberWithBool:useHtmlInfoWnd] forKey:@"useHtmlInfoWnd"];
[self.objects setObject:properties forKey: propertyId];
// Create icon
GMSMarker *marker = [self.objects objectForKey:markerId];
marker.title = [command.arguments objectAtIndex:1];
- BOOL useHtmlInfoWnd = marker.title == nil &&
- marker.snippet == nil;
-
- NSString *propertyId = [NSString stringWithFormat:@"marker_property_%lu", (unsigned long)marker.hash];
- NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithDictionary:
- [self.objects objectForKey:propertyId]];
- [properties setObject:[NSNumber numberWithBool:useHtmlInfoWnd] forKey:@"useHtmlInfoWnd"];
[self.objects setObject:properties forKey:propertyId];

MODIFY
www/Map.js
www/Map.js
@@ -926,7 +926,6 @@ Map.prototype.addMarker = function(markerOptions, callback) {
markerOptions.rotation = markerOptions.rotation || 0;
markerOptions.opacity = parseFloat("" + markerOptions.opacity, 10) || 1;
markerOptions.disableAutoPan = markerOptions.disableAutoPan === true;
- markerOptions.useHtmlInfoWnd = !markerOptions.title && !markerOptions.snippet;
markerOptions.noCache = markerOptions.noCache === true; //experimental
if ("styles" in markerOptions) {

Bug fix: useHtmlInfoWnd does not work correctly