Skip to content

Commit

Permalink
Fix to make the plugin to work on browser platform with Cordova 9
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaa committed Dec 31, 2019
1 parent f02d3f7 commit 96c3a2a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions hooks/browser/after_prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ var getPreferenceValue = function(config, name) {
return null
}
};
var getPreferenceValueFromPackageJson = function (config, name) {
var value = config.match(new RegExp('"' + name + '":\\s"(.*?)"', "i"));
if (value && value[1]) {
return value[1]
} else {
return null
}
};

var WEB_APPLICATION_CLIENT_ID = '';

Expand All @@ -19,6 +27,10 @@ if(process.argv.join("|").indexOf("WEB_APPLICATION_CLIENT_ID=") > -1) {
} else {
var config = fs.readFileSync("config.xml").toString();
WEB_APPLICATION_CLIENT_ID = getPreferenceValue(config, "WEB_APPLICATION_CLIENT_ID");
if (!WEB_APPLICATION_CLIENT_ID) {
var packageJson = fs.readFileSync("package.json").toString();
WEB_APPLICATION_CLIENT_ID = getPreferenceValueFromPackageJson(packageJson, "WEB_APPLICATION_CLIENT_ID");
}
}

var files = [
Expand Down

0 comments on commit 96c3a2a

Please sign in to comment.