Skip to content

Commit

Permalink
v2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wf9a5m75 committed Aug 26, 2018
1 parent 59fe9ef commit e48f203
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 7 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cordova GoogleMaps plugin for Android, iOS and Browser (version 2.4.0)
# Cordova GoogleMaps plugin for Android, iOS and Browser (version 2.4.1)

This plugin displays Google Maps in your application.
This plugin uses these libraries for each platforms:
Expand Down Expand Up @@ -51,7 +51,7 @@
```xml
<widget ...>
<plugin name="cordova-plugin-googlemaps" spec="2.4.0">
<plugin name="cordova-plugin-googlemaps" spec="2.4.1">
<variable name="API_KEY_FOR_ANDROID" value="(api key)" />
<variable name="API_KEY_FOR_IOS" value="(api key)" />
</plugin>
Expand Down Expand Up @@ -154,7 +154,7 @@
### Which browser supported?

Modern browsers should work without any problem.
![](https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/master/images/modern_browser.png)
![](https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/master/images/modern_browsers.png)

Internet Explorer 11 might work. We don't confirm all features, but basic features work.

Expand Down Expand Up @@ -192,6 +192,10 @@
---------------------------------------------------------------------------------------------------------

## Release Notes
- **v2.4.1**
- Fix: `map.getMap()` does not work when page changing on ionic v4.
- Fix: `LocationService.hasPermission()` is not implement for browser platform.

- **v2.4.0**
- Add: `Browser` platform!
- Add: `plugin.google.maps.environment.setEnv()` method.
Expand All @@ -207,7 +211,6 @@

![](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/raw/master/v1.4.0/top/demo.gif)

[Demo (Browser)](https://mapsplugin.github.io/HelloGoogleMap/)

---------------------------------------------------------------------------------------------------------

Expand Down
Binary file modified images/modern_browsers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cordova-plugin-googlemaps",
"version": "2.4.0",
"description": "Google Maps native SDK for Android and iOS",
"version": "2.4.1",
"description": "Google Maps native SDK for Android and iOS, and Google Maps JavaScript API v3 for browser.",
"cordova": {
"id": "cordova-plugin-googlemaps",
"platforms": [
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-googlemaps" version="2.4.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.4.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="Promise" src="www/Promise.js">
<runs/>
Expand Down
1 change: 1 addition & 0 deletions src/browser/CordovaGoogleMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ var CordovaGoogleMaps = {
pluginMap = null;
MAPS[mapId] = undefined;
delete MAPS[mapId];
onSuccess();
},

getPanorama: function(onSuccess, onError, args) {
Expand Down
11 changes: 11 additions & 0 deletions src/browser/PluginLocationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ var LOCATION_ERROR = {
};

module.exports = {
'hasPermission': function(onSuccess, onError, args) {
if (navigator.permissions) {
navigator.permissions.query({'name': 'geolocation'})
.then(function(permission) {
onSuccess(permission.state === 'granted' ? 1 : 0);
})
.catch(onError);
} else {
onError('Browser does not support this feature.');
}
},
'getMyLocation': function(onSuccess, onError, args) {

if (navigator.geolocation) {
Expand Down
40 changes: 40 additions & 0 deletions www/js_CordovaGoogleMaps-for-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,46 @@ function CordovaGoogleMaps(execCmd) {
self.MAPS = {};
self.MAP_CNT = 0;

var removeMapDiv = function(node) {
if (node.hasAttribute('__pluginmapid') && !node.parentNode) {
var mapId = node.getAttribute('__pluginmapid');
var map = self.MAPS[mapId];
if (map) {
map.remove();
delete self.MAPS[mapId];
}
} else {
var childNodes = Array.prototype.slice.call(node.childNodes);
childNodes.forEach(function(child) {
if (child.outerHTML && child.outerHTML.indexOf('__pluginmapid') > -1) {
removeMapDiv(child);
}
});
}
};

//------------------------------------------------------------------------------
// Using MutationObserver, observe only added/removed or style changed elements
//------------------------------------------------------------------------------
var observer = new MutationObserver(function(mutations) {
common.nextTick(function() {
var mutationRecords = Array.prototype.slice.call(mutations, 0);
mutationRecords.forEach(function(record) {
if (record.removedNodes.length > 0) {
record.removeNodes = Array.prototype.slice.call(record.removedNodes, 0);
record.removeNodes.forEach(function(node) {
if (node.outerHTML && node.outerHTML.indexOf('__pluginmapid') > -1) {
removeMapDiv(node);
}
});
}
});
});
});
observer.observe(document.body.parentElement, {
childList: true,
subtree: true
});
}

CordovaGoogleMaps.prototype.getMap = function(div, mapOptions) {
Expand Down

0 comments on commit e48f203

Please sign in to comment.