update hook scripts
MODIFY
README.md
README.md
@@ -114,7 +114,7 @@ $> cordova plugin add cordova-plugin-googlemaps \
- **v2.2.9**
- Add: support languages (`Denmark`)
- - Internal code refactoring
+ - Refactoring internal code
- Fix: Cannot find module '../node_modules/xml2js' error.
- Fix: getMyLocation() does not work on Genymotion.
- Add: hook scripts to prevent `unknown property GOOGLE_PLAY_SERVICES_VERSION` problem with older version Cordova.

MODIFY
package.json
package.json
]
},
"dependencies": {
- "xml2js": "~0.4.19"
+ "xml2js": "~0.4.19",
+ "minimist": "~1.2.0"
},
"repository": {
"type": "git",

MODIFY
plugin.xml
plugin.xml
@@ -242,10 +242,11 @@ The native map view is faster, use less network usage, display 3D views, and eve
<resource-file src="src/android/res/drawable/dummy_mylocation_button_shadow.xml" target="res/drawable/dummy_mylocation_button_shadow.xml"/>
<!--
- Minimum required version of Google Play Services SDK for this plugin.
+ Minimum required version of Google Play Services SDK for this plugin is 11.8.0.
+ You need to specify this version number for all other plugins that use google play services sdk.
https://developers.google.com/android/guides/releases
-->
- <preference name="PLAY_SERVICES_VERSION" default="11.8.0" />
+ <preference name="PLAY_SERVICES_VERSION" default="12.0.0" />
<framework src="com.google.android.gms:play-services-maps:$PLAY_SERVICES_VERSION" />
<framework src="com.google.android.gms:play-services-location:$PLAY_SERVICES_VERSION" />

MODIFY
src/before_plugin_install.js
src/before_plugin_install.js
@@ -64,6 +64,7 @@ module.exports = function(ctx) {
//------------------------------------------------------------------------------
return Q.Promise(function(resolve, reject, notify) {
var hasPluginGoogleMaps = false;
+ configXmlData.widget.plugin = configXmlData.widget.plugin || [];
configXmlData.widget.plugin = configXmlData.widget.plugin.map(function(plugin) {
if (plugin.$.name !== "cordova-plugin-googlemaps") {
return plugin;
@@ -159,6 +160,7 @@ module.exports = function(ctx) {
variables[variable.$.name] = variable.$.value;
});
+
//------------------------------
// Read default preferences
//------------------------------
@@ -202,6 +204,19 @@ module.exports = function(ctx) {
var pluginDefaults = findPreference(params.pluginXmlData);
variables = Object.assign(pluginDefaults, variables);
+ //----------------------------------
+ // Parse the command line variables
+ //----------------------------------
+ if (ctx.cmdLine.includes("cordova plugin add")) {
+ var phrses = require(path.join(NODE_MODULES_DIR, 'minimist'))(ctx.cmdLine.split(' '));
+ if (Array.isArray(phrses.variable)) {
+ phrses.variable.forEach(function(line) {
+ var tmp = line.split("=");
+ variables[tmp[0]] = tmp[1];
+ });
+ }
+ }
+
//--------------------------------
// Override the plugin.xml itself
//--------------------------------

MODIFY
src/before_plugin_rm.js
src/before_plugin_rm.js
@@ -51,6 +51,7 @@ module.exports = function(ctx) {
//------------------------------------------------------------------------------
return Q.Promise(function(resolve, reject, notify) {
var hasPluginGoogleMaps = false;
+ data.widget.plugin = data.widget.plugin || [];
data.widget.plugin = data.widget.plugin.map(function(plugin) {
if (plugin.$.name !== "cordova-plugin-googlemaps") {
return plugin;

update hook scripts