Skip to content

Commit

Permalink
Cordova 9 support #2581
Browse files Browse the repository at this point in the history
  • Loading branch information
wf9a5m75 committed Mar 20, 2019
1 parent df72a9d commit 4be3c19
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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",
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.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" />
Expand Down
7 changes: 3 additions & 4 deletions src/after_plugin_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
17 changes: 8 additions & 9 deletions src/before_plugin_install.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
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');
Expand All @@ -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 [email protected] [email protected] --save 2>&1', function(err, stdout) {
if (err) {
Expand All @@ -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')
Expand All @@ -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
//---------------------------
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
//---------------------------
Expand Down Expand Up @@ -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
//------------------------------
Expand Down
13 changes: 6 additions & 7 deletions src/before_plugin_rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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
//---------------------------
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4be3c19

Please sign in to comment.