fix: conflict internal plugin name with others.
fix: the visible = false does not work when add a overlay (such as marker)
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.2.0-beta-20180117-2125" 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.2.0-beta-20180117-2320" 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 />
<js-module name="poly" src="www/poly.js">
<runs />
</js-module>
- <js-module name="Geocoder" src="www/Geocoder.js">
+ <js-module name="pgmGeocoder" src="www/Geocoder.js">
<runs />
</js-module>
- <js-module name="Geolocation" src="www/Geolocation.js">
+ <js-module name="pgmGeolocation" src="www/Geolocation.js">
<runs />
</js-module>
<js-module name="Map" src="www/Map.js">
@@ -156,10 +156,10 @@ The native map view is faster, use less network usage, display 3D views, and eve
<feature name="KmlOverlay">
<param name="android-package" value="plugin.google.maps.PluginKmlOverlay" />
</feature>
- <feature name="Geocoder">
+ <feature name="pgmGeocoder">
<param name="android-package" value="plugin.google.maps.PluginGeocoder" />
</feature>
- <feature name="Geolocation">
+ <feature name="pgmGeolocation">
<param name="android-package" value="plugin.google.maps.PluginGeolocation" />
</feature>
<feature name="Environment">
@@ -256,10 +256,10 @@ The native map view is faster, use less network usage, display 3D views, and eve
<feature name="Environment">
<param name="ios-package" value="Environment" />
</feature>
- <feature name="Geocoder">
+ <feature name="pgmGeocoder">
<param name="ios-package" value="PluginGeocoder" />
</feature>
- <feature name="Geolocation">
+ <feature name="pgmGeolocation">
<param name="ios-package" value="PluginGeolocation" />
</feature>
<feature name="Map">

MODIFY
src/ios/GoogleMaps/PluginCircle.m
src/ios/GoogleMaps/PluginCircle.m
circle.zIndex = [[json valueForKey:@"zIndex"] floatValue];
}
- BOOL isVisible = NO;
- if (json[@"visible"]) {
+ BOOL isVisible = YES;
+
+ // Visible property
+ NSString *visibleValue = [NSString stringWithFormat:@"%@", json[@"visible"]];
+ if ([@"0" isEqualToString:visibleValue]) {
+ // false
+ isVisible = NO;
+ circle.map = nil;
+ } else {
+ // true or default
circle.map = self.mapCtrl.map;
- isVisible = YES;
}
BOOL isClickable = NO;
if ([[json valueForKey:@"clickable"] boolValue]) {

MODIFY
src/ios/GoogleMaps/PluginGroundOverlay.m
src/ios/GoogleMaps/PluginGroundOverlay.m
groundOverlay.bearing = [[json valueForKey:@"bearing"] floatValue];
}
- BOOL isVisible = NO;
- if (json[@"visible"]) {
+ BOOL isVisible = YES;
+
+ // Visible property
+ NSString *visibleValue = [NSString stringWithFormat:@"%@", json[@"visible"]];
+ if ([@"0" isEqualToString:visibleValue]) {
+ // false
+ isVisible = NO;
+ groundOverlay.map = nil;
+ } else {
+ // true or default
groundOverlay.map = self.mapCtrl.map;
- isVisible = YES;
}
BOOL isClickable = NO;
if ([[json valueForKey:@"clickable"] boolValue]) {

MODIFY
src/ios/GoogleMaps/PluginMarker.m
src/ios/GoogleMaps/PluginMarker.m
}
// Visible property
- if (json[@"visible"]) {
- [iconProperty setObject:json[@"visible"] forKey:@"visible"];
+ NSString *visibleValue = [NSString stringWithFormat:@"%@", json[@"visible"]];
+ BOOL visible = YES;
+ if ([@"0" isEqualToString:visibleValue]) {
+ // false
+ visible = NO;
+ [iconProperty setObject:[NSNumber numberWithBool:false] forKey:@"visible"];
} else {
+ // default or true
[iconProperty setObject:[NSNumber numberWithBool:true] forKey:@"visible"];
}
// Load icon in asynchronise
[self setIcon_:marker iconProperty:iconProperty callbackBlock:callbackBlock];
} else {
- if (json[@"visible"]) {
+ if (visible) {
marker.map = self.mapCtrl.map;
+ } else {
+ marker.map = nil;
}
marker.icon = [GMSMarker markerImageWithColor:iconColor];
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}
if (animation) {
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}
if (animation) {
if (!succeeded) {
NSLog(@"[fail] url = %@", url);
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}
if ([[UIImageCache sharedInstance].iconCacheKeys objectForKey:iconCacheKey]) {
[[UIImageCache sharedInstance].iconCacheKeys removeObjectForKey:iconCacheKey];
}
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}
if (animation) {
if (!succeeded) {
NSLog(@"[fail] url = %@", url);
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}
if ([[UIImageCache sharedInstance].iconCacheKeys objectForKey:iconCacheKey]) {
[[UIImageCache sharedInstance].iconCacheKeys removeObjectForKey:iconCacheKey];
}
// The `visible` property
- if (iconProperty[@"visible"]) {
+ if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
marker.map = self.mapCtrl.map;
+ } else if (iconProperty[@"visible"] == [NSNumber numberWithBool:false]) {
+ marker.map = nil;
}

MODIFY
src/ios/GoogleMaps/PluginPolygon.m
src/ios/GoogleMaps/PluginPolygon.m
polygon.holes = holePaths;
}
- BOOL isVisible = NO;
- if (json[@"visible"]) {
+ BOOL isVisible = YES;
+
+ // Visible property
+ NSString *visibleValue = [NSString stringWithFormat:@"%@", json[@"visible"]];
+ if ([@"0" isEqualToString:visibleValue]) {
+ // false
+ isVisible = NO;
+ polygon.map = nil;
+ } else {
+ // true or default
polygon.map = self.mapCtrl.map;
- isVisible = YES;
}
+
BOOL isClickable = NO;
if ([[json valueForKey:@"clickable"] boolValue]) {
isClickable = YES;

MODIFY
src/ios/GoogleMaps/PluginPolyline.m
src/ios/GoogleMaps/PluginPolyline.m
// Create the Polyline, and assign it to the map.
GMSPolyline *polyline = [GMSPolyline polylineWithPath:mutablePath];
- BOOL isVisible = NO;
- if (json[@"visible"]) {
+
+ BOOL isVisible = YES;
+ // Visible property
+ NSString *visibleValue = [NSString stringWithFormat:@"%@", json[@"visible"]];
+ if ([@"0" isEqualToString:visibleValue]) {
+ // false
+ isVisible = NO;
+ polyline.map = nil;
+ } else {
+ // true or default
polyline.map = self.mapCtrl.map;
- isVisible = YES;
}
BOOL isClickable = NO;
if ([[json valueForKey:@"clickable"] boolValue]) {

MODIFY
src/ios/GoogleMaps/PluginTileOverlay.m
src/ios/GoogleMaps/PluginTileOverlay.m
-
- if (json[@"visible"]) {
+ // Visible property
+ NSString *visibleValue = [NSString stringWithFormat:@"%@", json[@"visible"]];
+ if ([@"0" isEqualToString:visibleValue]) {
+ // false
+ layer.map = nil;
+ } else {
+ // true or default
layer.map = self.mapCtrl.map;
}
if ([json valueForKey:@"zIndex"]) {

MODIFY
www/Geocoder.js
www/Geocoder.js
@@ -41,7 +41,7 @@ Geocoder.geocode = function(geocoderRequest, callback) {
} else {
mvcResults.trigger("error", error);
}
- }, "Geocoder", 'geocode', [request]);
+ }, "pgmGeocoder", 'geocode', [request]);
});
geocoderRequest = geocoderRequest || {};

MODIFY
www/Geolocation.js
www/Geolocation.js
@@ -38,7 +38,7 @@ Geolocation.prototype.getMyLocation = function(params, success_callback, error_c
};
exec.call({
_isReady: true
- }, successHandler, errorHandler, 'Geolocation', 'getMyLocation', [params], {sync: true});
+ }, successHandler, errorHandler, 'pgmGeolocation', 'getMyLocation', [params], {sync: true});
};
/**

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -70,8 +70,8 @@ if (!cordova) {
var encoding = require('./encoding');
var spherical = require('./spherical');
var poly = require('./poly');
- var Geocoder = require('./Geocoder');
- var Geolocation = require('./Geolocation');
+ var Geocoder = require('./pgmGeocoder');
+ var Geolocation = require('./pgmGeolocation');
var Environment = require('./Environment');
var MapTypeId = require('./MapTypeId');

- fix: conflict internal plugin name with others.
- fix: the visible = false does not work when add a overlay (such as marker)