This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Issue #1188: Strings.xml google_app_id conflict with google-service…
…s.json
- Loading branch information
Showing
6 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = function(ctx) { | ||
var fs = ctx.requireCordovaModule('fs'), | ||
path = ctx.requireCordovaModule('path'), | ||
os = require("os"), | ||
readline = require("readline"), | ||
deferral = ctx.requireCordovaModule('q').defer(); | ||
|
||
var settingsFile = path.join(ctx.opts.projectRoot, 'google-services.json'); | ||
|
||
fs.stat(settingsFile, function(err,stats) { | ||
if (err) { | ||
deferral.reject("To use this plugin on android you'll need to add a google-services.json file with the FCM project_info and place that into your www folder"); | ||
} else { | ||
|
||
fs.createReadStream(settingsFile).pipe(fs.createWriteStream('platforms/android/google-services.json')); | ||
|
||
var lineReader = readline.createInterface({ | ||
terminal: false, | ||
input : fs.createReadStream('platforms/android/build.gradle') | ||
}); | ||
lineReader.on("line", function(line) { | ||
fs.appendFileSync('./build.gradle', line.toString() + os.EOL); | ||
if (/.*\ dependencies \{.*/.test(line)) { | ||
fs.appendFileSync('./build.gradle', '\t\tclasspath "com.google.gms:google-services:3.0.0"' + os.EOL); | ||
} | ||
}).on("close", function () { | ||
fs.rename('./build.gradle', 'platforms/android/build.gradle', deferral.resolve); | ||
}); | ||
|
||
} | ||
}); | ||
|
||
return deferral.promise; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters