-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #702 from shankari/script_fixes
Fix issues in the hook scripts
- Loading branch information
Showing
4 changed files
with
30 additions
and
8 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
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,22 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict' | ||
|
||
var fs = require('fs-extra'); | ||
|
||
const LOG_NAME = "Setting iOS push: FCM = false, APNS = true"; | ||
const CONF_FILE = "GoogleServicesInfo.plist"; | ||
|
||
module.exports = function (context) { | ||
const FCM_TOKEN_SETTING = new RegEx("<key>IS_GCM_ENABLED</key>(\n\\s*)<true></true>", "g"); | ||
if (!ctx.opts.platforms.includes('ios')) return; | ||
if (fs.existsSync(confFile)) { | ||
console.log(LOG_NAME + confFile + " found, modifying it"); | ||
var regEx = new RegExp(currentName, 'g'); | ||
|
||
var data = fs.readFileSync(confFile, 'utf8'); | ||
var replacedData = data.replace(regEx, "<key>IS_GCM_ENABLED</key>$1<false></false>"); | ||
fs.writeFileSync(CONF_FILE, replacedData, 'utf8'); | ||
console.log(LOG_NAME + confFile + " modified file written"); | ||
} | ||
} |