(JS) Bug fix: map view remains after it is removed
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.0-beta-20171031-1849" 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.1.0-beta-20171101-1047" 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
www/Circle.js
www/Circle.js
@@ -157,7 +157,7 @@ Circle.prototype.remove = function(callback) {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()]);
+ }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {remove: true});
};
Circle.prototype.getBounds = function() {

MODIFY
www/GroundOverlay.js
www/GroundOverlay.js
@@ -160,7 +160,7 @@ GroundOverlay.prototype.remove = function(callback) {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()]);
+ }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {remove: true});
};

MODIFY
www/Map.js
www/Map.js
@@ -577,7 +577,7 @@ Map.prototype.remove = function(callback) {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, 'CordovaGoogleMaps', 'removeMap', [self.id], {sync: true});
+ }, self.errorHandler, 'CordovaGoogleMaps', 'removeMap', [self.id], {sync: true, remove: true});
};

MODIFY
www/Marker.js
www/Marker.js
@@ -121,7 +121,7 @@ Marker.prototype.remove = function(callback) {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()]);
+ }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {remove: true});
};

MODIFY
www/MarkerCluster.js
www/MarkerCluster.js
@@ -327,7 +327,7 @@ MarkerCluster.prototype.remove = function() {
cluster.remove();
});
}
- exec.call(self, null, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {sync: true});
+ exec.call(self, null, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {sync: true, remove: true});
keys = Object.keys(self._markerMap);
keys.forEach(function(markerId) {

MODIFY
www/Polygon.js
www/Polygon.js
@@ -141,7 +141,7 @@ Polygon.prototype.remove = function(callback) {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()]);
+ }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {remove: true});
};
Polygon.prototype.getPluginName = function() {
return this.map.getId() + "-polygon";

MODIFY
www/Polyline.js
www/Polyline.js
@@ -179,7 +179,7 @@ Polyline.prototype.remove = function() {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()]);
+ }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {remove: true});
self.trigger(self.id + "_remove");
var points = self.get("points");
if (points) {

MODIFY
www/TileOverlay.js
www/TileOverlay.js
@@ -121,7 +121,7 @@ TileOverlay.prototype.remove = function(callback) {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()]);
+ }, self.errorHandler, self.getPluginName(), 'remove', [self.getId()], {remove: true});
};
module.exports = TileOverlay;

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -719,11 +719,11 @@ var _isResizeMapExecuting = false;
var _stopRequested = false;
function execCmd(success, error, pluginName, methodName, args, execOptions) {
- if (this._isRemoved && methodName !== "remove" || !this._isReady) {
+ execOptions = execOptions || {};
+ if (this._isRemoved && !execOptions.remove || !this._isReady) {
// Ignore if the instance is already removed, or the instance is not ready.
return true;
}
- execOptions = execOptions || {};
var self = this;
commandQueue.push({
"execOptions": execOptions,

(JS) Bug fix: map view remains after it is removed