Bump up to v2.3.1
MODIFY
README.md
README.md
-# Cordova GoogleMaps plugin for iOS and Android (version 2.3.0)
+# Cordova GoogleMaps plugin for iOS and Android (version 2.3.1)
This plugin is a thin wrapper for [Google Maps Android API](https://developers.google.com/maps/documentation/android/) and [Google Maps SDK for iOS](https://developers.google.com/maps/documentation/ios/).
@@ -10,7 +10,7 @@ Both [PhoneGap](http://phonegap.com/) and [Apache Cordova](http://cordova.apache
*Stable version(npm)*
```
-$> cordova plugin add cordova-plugin-googlemaps@2.3.0 \
+$> cordova plugin add cordova-plugin-googlemaps@2.3.1 \
--variable API_KEY_FOR_ANDROID="..." \
--variable API_KEY_FOR_IOS="..."
@@ -40,7 +40,7 @@ $> cordova plugin add cordova-plugin-googlemaps@2.3.0 \
```xml
<widget ...>
- <plugin name="cordova-plugin-googlemaps" spec="^2.3.0">
+ <plugin name="cordova-plugin-googlemaps" spec="^2.3.1">
<variable name="API_KEY_FOR_ANDROID" value="(api key)" />
<variable name="API_KEY_FOR_IOS" value="(api key)" />
@@ -63,7 +63,10 @@ $> cordova plugin add cordova-plugin-googlemaps@2.3.0 \
## Release Notes
- - [v2.3.0 is released](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.3.0/ReleaseNotes/v2.3.0/README.md)
+ - **v2.3.1**
+ - Fix: incompatible with `@ionic-native/google-maps`
+
+ - [v2.3.0](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.3.0/ReleaseNotes/v2.3.0/README.md)
- New feature: `StreetView`
- A callback is no longer required for the most part.
- `Promise` is supported instead of `callback`

MODIFY
package.json
package.json
{
"name": "cordova-plugin-googlemaps",
- "version": "2.3.0",
+ "version": "2.3.1",
"description": "Google Maps native SDK for Android and iOS",
"cordova": {
"id": "cordova-plugin-googlemaps",

MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.3.0" 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.3.1" 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/Common.js
www/Common.js
var BaseArrayClass = require('./BaseArrayClass');
var utils = require("cordova/utils");
-var nextTick = Promise.then;
+var resolvedPromise = typeof Promise == 'undefined' ? null : Promise.resolve();
+var nextTick = resolvedPromise ? function(fn) { resolvedPromise.then(fn); } : function(fn) { setTimeout(fn); };
//---------------------------
// Convert HTML color to RGB

MODIFY
www/CordovaGoogleMaps.js
www/CordovaGoogleMaps.js
@@ -243,7 +243,11 @@ CordovaGoogleMaps.prototype.putHtmlElements = function() {
if (isTouchable) {
var elemId = common.getPluginDomId(map.getDiv());
var domInfo = self.domPositions[elemId];
+ if (domInfo && domInfo.size) {
isTouchable = domInfo.size.width * domInfo.size.height > 0;
+ } else {
+ isTouchable = false;
+ }
}
map.set("__isAttached", isTouchable);
}

MODIFY
www/Geocoder.js
www/Geocoder.js
@@ -102,15 +102,17 @@ var Geocoder = function(exec) {
geocoderRequest.idx = -1;
var resolver1 = function(resolve, reject) {
- exec.call({_isReady: true}, resolve, reject, "Geocoder", 'geocode', [geocoderRequest]);
+ exec.call({_isReady: true}, function(_results) {
+ resolve(_results.results);
+ }, reject, "Geocoder", 'geocode', [geocoderRequest]);
};
if (typeof callback === "function") {
- resolver(callback, function(error) {
+ resolver1(callback, function(error) {
callback([], error);
});
} else {
- return new Promise(resolver);
+ return new Promise(resolver1);
}
}

MODIFY
www/Map.js
www/Map.js
@@ -542,7 +542,7 @@ Map.prototype.setMyLocationButtonEnabled = function(enabled) {
var self = this;
enabled = common.parseBoolean(enabled);
this.set("myLocationButton", enabled);
- self.exec.call(this, null, this.errorHandler, this.id, 'setMyLocationEnabled', [{
+ self.exec.call(self, null, this.errorHandler, this.id, 'setMyLocationEnabled', [{
myLocationButton: enabled,
myLocation: self.get("myLocation") === true
}], {
@@ -555,7 +555,7 @@ Map.prototype.setMyLocationEnabled = function(enabled) {
var self = this;
enabled = common.parseBoolean(enabled);
this.set("myLocation", enabled);
- self.exec.call(this, null, this.errorHandler, this.id, 'setMyLocationEnabled', [{
+ self.exec.call(self, null, this.errorHandler, this.id, 'setMyLocationEnabled', [{
myLocationButton: self.get("myLocationButton") === true,
myLocation: enabled
}], {
@@ -577,7 +577,7 @@ Map.prototype.setTrafficEnabled = function(enabled) {
Map.prototype.setCompassEnabled = function(enabled) {
var self = this;
enabled = common.parseBoolean(enabled);
- self.exec.call(this, null, self.errorHandler, this.id, 'setCompassEnabled', [enabled]);
+ self.exec.call(self, null, self.errorHandler, this.id, 'setCompassEnabled', [enabled]);
return this;
};
Map.prototype.getFocusedBuilding = function(callback) {
@@ -603,7 +603,7 @@ Map.prototype.setVisible = function(isVisible) {
var self = this;
isVisible = common.parseBoolean(isVisible);
self.set("visible", isVisible);
- self.exec.call(this, null, self.errorHandler, this.id, 'setVisible', [isVisible]);
+ self.exec.call(self, null, self.errorHandler, this.id, 'setVisible', [isVisible]);
return this;
};
@@ -612,7 +612,7 @@ Map.prototype.setClickable = function(isClickable) {
var self = this;
isClickable = common.parseBoolean(isClickable);
self.set("clickable", isClickable);
- self.exec.call(this, null, self.errorHandler, this.id, 'setClickable', [isClickable]);
+ self.exec.call(self, null, self.errorHandler, this.id, 'setClickable', [isClickable]);
return this;
};
Map.prototype.getClickable = function() {
@@ -626,7 +626,7 @@ Map.prototype.getClickable = function() {
Map.prototype.setAllGesturesEnabled = function(enabled) {
var self = this;
enabled = common.parseBoolean(enabled);
- self.exec.call(this, null, self.errorHandler, this.id, 'setAllGesturesEnabled', [enabled]);
+ self.exec.call(self, null, self.errorHandler, this.id, 'setAllGesturesEnabled', [enabled]);
return this;
};
@@ -698,7 +698,7 @@ Map.prototype.remove = function(callback) {
var resolver = function(resolve, reject) {
- self.exec.call(this,
+ self.exec.call(self,
resolve.bind(self),
reject.bind(self),
'CordovaGoogleMaps', 'removeMap', [self.id],
@@ -729,7 +729,7 @@ Map.prototype.toDataURL = function(params, callback) {
var self = this;
var resolver = function(resolve, reject) {
- self.exec.call(this,
+ self.exec.call(self,
resolve.bind(self),
reject.bind(self),
self.id, 'toDataURL', [params]);
@@ -809,7 +809,7 @@ Map.prototype.setDiv = function(div) {
div = div.parentNode;
}
}
- self.exec.call(this, function() {
+ self.exec.call(self, function() {
cordova.fireDocumentEvent('plugin_touch', {
force: true,
action: "setDiv"
@@ -856,7 +856,7 @@ Map.prototype.fromLatLngToPoint = function(latLng, callback) {
if ("lat" in latLng && "lng" in latLng) {
var resolver = function(resolve, reject) {
- self.exec.call(this,
+ self.exec.call(self,
resolve.bind(self),
reject.bind(self),
self.id, 'fromLatLngToPoint', [latLng.lat, latLng.lng]);
@@ -891,7 +891,7 @@ Map.prototype.fromPointToLatLng = function(pixel, callback) {
if (pixel.length == 2 && utils.isArray(pixel)) {
var resolver = function(resolve, reject) {
- self.exec.call(this,
+ self.exec.call(self,
function(result) {
var latLng = new LatLng(result[0] || 0, result[1] || 0);
resolve.call(self, latLng);
@@ -1033,7 +1033,7 @@ Map.prototype.addGroundOverlay = function(groundOverlayOptions, callback) {
groundOverlay = undefined;
});
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
groundOverlay._privateInitialize();
delete groundOverlay._privateInitialize;
if (typeof callback === "function") {
@@ -1100,7 +1100,7 @@ Map.prototype.addTileOverlay = function(tilelayerOptions, callback) {
};
document.addEventListener(self.id + "-" + hashCode + "-tileoverlay", onNativeCallback);
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
tileOverlay._privateInitialize();
delete tileOverlay._privateInitialize;
@@ -1158,7 +1158,7 @@ Map.prototype.addPolygon = function(polygonOptions, callback) {
polygon = undefined;
});
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
polygon._privateInitialize();
delete polygon._privateInitialize;
@@ -1197,7 +1197,7 @@ Map.prototype.addPolyline = function(polylineOptions, callback) {
polyline = undefined;
});
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
polyline._privateInitialize();
delete polyline._privateInitialize;
@@ -1233,7 +1233,7 @@ Map.prototype.addCircle = function(circleOptions, callback) {
circle = undefined;
});
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
circle._privateInitialize();
delete circle._privateInitialize;
@@ -1275,7 +1275,7 @@ Map.prototype.addMarker = function(markerOptions, callback) {
marker = undefined;
});
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
markerOptions.icon.size = markerOptions.icon.size || {};
markerOptions.icon.size.width = markerOptions.icon.size.width || result.width;
@@ -1322,7 +1322,7 @@ Map.prototype.addMarkerCluster = function(markerClusterOptions, callback) {
var markerClusterId = markerCluster.getId();
self.OVERLAYS[markerClusterId] = markerCluster;
- self.exec.call(this, function(result) {
+ self.exec.call(self, function(result) {
var markerMap = {};
result.geocellList.forEach(function(geocell, idx) {

MODIFY
www/Marker.js
www/Marker.js
@@ -172,10 +172,7 @@ Marker.prototype.setAnimation = function(animation, callback) {
var resolver = function(resolve, reject) {
self.exec.call(self,
- function() {
- self.destroy();
- resolve.call(self);
- },
+ resolve.bind(self),
reject.bind(self),
self.getPluginName(), 'setAnimation', [self.getId(), animation]);
};

MODIFY
www/Polygon.js
www/Polygon.js
@@ -162,7 +162,7 @@ Polygon.prototype.setPoints = function (points) {
for (i = 0; i < points.length; i++) {
mvcArray.push(common.getLatLng(points[i]), true);
}
- self.exec.call(this, null, self.errorHandler, self.getPluginName(), 'setPoints', [self.id, mvcArray.getArray()]);
+ self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setPoints', [self.id, mvcArray.getArray()]);
return self;
};
Polygon.prototype.getPoints = function () {
@@ -189,7 +189,7 @@ Polygon.prototype.setHoles = function (holes) {
mvcArray.push(newHole, true);
}
});
- self.exec.call(this, null, self.errorHandler, self.getPluginName(), 'setHoles', [self.id, mvcArray.getArray()]);
+ self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setHoles', [self.id, mvcArray.getArray()]);
return this;
};
Polygon.prototype.getHoles = function () {

MODIFY
www/StreetViewPanorama.js
www/StreetViewPanorama.js
@@ -263,14 +263,33 @@ StreetViewPanorama.prototype.setPov = function(pov, callback) {
StreetViewPanorama.prototype.remove = function(callback) {
var self = this;
- self.exec.call(this, function() {
- if (typeof callback === "function") {
- callback.call(self);
- }
- }, self.errorHandler, 'CordovaGoogleMaps', 'removeMap', [self.id], {
+
+ var resolver = function(resolve, reject) {
+ self.exec.call(self,
+ function() {
+ self.destroy();
+ resolve.call(self);
+ },
+ reject.bind(self),
+ 'CordovaGoogleMaps', 'removeMap', [self.id], {
sync: true,
remove: true
});
+ };
+
+ if (typeof callback === "function") {
+ resolver(callback, self.errorHandler);
+ } else {
+ return new Promise(resolver);
+ }
+
+
+
+
+
+
+
+
self.trigger("remove");
};
StreetViewPanorama.prototype._onPanoramaCameraChange = function(eventName, cameraPosition) {

Bump up to v2.3.1