Cordova 9 support
MODIFY
package.json
package.json
{
"name": "cordova-plugin-googlemaps",
- "version": "2.5.3-beta-20190305-1103",
+ "version": "2.5.4-beta-20190320-1419",
"description": "Google Maps native SDK for Android and iOS, and Google Maps JavaScript API v3 for browser.",
"cordova": {
"id": "cordova-plugin-googlemaps",

MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.5.3-beta-20190305-1103" 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.5.4-beta-20190320-1419" 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" />
<asset src="www/promise-7.0.4.min.js.map" target="promise-7.0.4.min.js.map" />

MODIFY
src/after_plugin_install.js
src/after_plugin_install.js
@@ -7,12 +7,11 @@ module.exports = function(ctx) {
return;
}
- var fs = ctx.requireCordovaModule('fs'),
- path = ctx.requireCordovaModule('path'),
- Q = ctx.requireCordovaModule('q');
+ var fs = require('fs'),
+ path = require('path');
var pluginXmlPath = path.join(__dirname, '..', 'plugin.xml');
- return Q.Promise(function(resolve, reject) {
+ return (new Promise(function(resolve, reject) {
// Copy the original plugin.xml to the current plugin.xml
return fs.createReadStream(pluginXmlPath + '.original')
.pipe(fs.createWriteStream(pluginXmlPath))

MODIFY
src/before_plugin_install.js
src/before_plugin_install.js
module.exports = function(ctx) {
- var fs = ctx.requireCordovaModule('fs'),
- path = ctx.requireCordovaModule('path'),
- Q = ctx.requireCordovaModule('q');
+ var fs = require('fs'),
+ path = require('path');
var projectRoot = ctx.opts.projectRoot,
configXmlPath = path.join(projectRoot, 'config.xml'),
pluginXmlPath = path.join(__dirname, '..', 'plugin.xml');
@@ -29,7 +28,7 @@ module.exports = function(ctx) {
}
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
var exec = require('child_process').exec;
exec('npm install xml2js@0.4.19 minimist@1.2.0 --save 2>&1', function(err, stdout) {
if (err) {
@@ -41,7 +40,7 @@ module.exports = function(ctx) {
});
})
.then(function() {
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
if (fs.existsSync(pluginXmlPath + '.original')) {
// Copy the original plugin.xml to the current plugin.xml
return fs.createReadStream(pluginXmlPath + '.original')
@@ -58,7 +57,7 @@ module.exports = function(ctx) {
});
})
.then(function() {
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
//---------------------------
// Read the config.xml file
//---------------------------
@@ -89,7 +88,7 @@ module.exports = function(ctx) {
// If there is no definition of this plugin in the config.xml,
// then insert some dummy data in order to prevent the API_KEY_FOR_ANDROID error.
//------------------------------------------------------------------------------
- return Q.Promise(function(resolve) {
+ return new Promise(function(resolve) {
var hasPluginGoogleMaps = false;
configXmlData.widget.plugin = configXmlData.widget.plugin || [];
configXmlData.widget.plugin = configXmlData.widget.plugin.map(function(plugin) {
@@ -147,7 +146,7 @@ module.exports = function(ctx) {
});
})
.then(function(configXmlData) {
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
//---------------------------
// Read the plugin.xml file
//---------------------------
@@ -176,7 +175,7 @@ module.exports = function(ctx) {
});
})
.then(function(params) {
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
//------------------------------
// Read the install variables
//------------------------------

MODIFY
src/before_plugin_rm.js
src/before_plugin_rm.js
@@ -7,9 +7,8 @@ module.exports = function(ctx) {
return;
}
- var fs = ctx.requireCordovaModule('fs'),
- path = ctx.requireCordovaModule('path'),
- Q = ctx.requireCordovaModule('q');
+ var fs = require('fs'),
+ path = require('path');
var projectRoot = ctx.opts.projectRoot,
configXmlPath = path.join(projectRoot, 'config.xml');
@@ -43,7 +42,7 @@ module.exports = function(ctx) {
}
};
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
//---------------------------
// Read the config.xml file
//---------------------------
@@ -59,7 +58,7 @@ module.exports = function(ctx) {
//---------------------------
// Parse the xml data
//---------------------------
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
var xmlParser = new xml2js.Parser();
xmlParser.parseString(data, function(error, data) {
if (error) {
@@ -77,7 +76,7 @@ module.exports = function(ctx) {
// If there is no definition of this plugin in the config.xml,
// then insert some dummy data in order to prevent the API_KEY_FOR_ANDROID error.
//------------------------------------------------------------------------------
- return Q.Promise(function(resolve) {
+ return new Promise(function(resolve) {
var hasPluginGoogleMaps = false;
data.widget.plugin = data.widget.plugin || [];
data.widget.plugin = data.widget.plugin.map(function(plugin) {
@@ -138,7 +137,7 @@ module.exports = function(ctx) {
//---------------------------
// Override the config.xml
//---------------------------
- return Q.Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
var builder = new xml2js.Builder();
var xml = builder.buildObject(data);
fs.writeFile(configXmlPath, xml, 'utf8', function(error) {

Cordova 9 support #2581