Skip to content

Commit b576674

Browse files
authored
Merge pull request #456 from jpush/dev
Dev
2 parents 1d60118 + 3574bf4 commit b576674

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

JPushConfiguration.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const questions = [
2020

2121
inquirer.prompt(questions).then(answers => {
2222
const { appKey, moduleName } = answers
23+
if (moduleName == undefined) {
24+
moduleName = "app"
25+
}
2326

2427
// 深度遍历所有文件,
2528
getAllFiles('./ios', function(f, s) {
@@ -43,7 +46,7 @@ inquirer.prompt(questions).then(answers => {
4346
var isSettingGradle = f.match(/settings\.gradle/)
4447
if (isSettingGradle != null) {
4548
console.log('find settings.gradle in android project ' + f)
46-
configureSetting(f)
49+
configureSetting(f, moduleName)
4750
}
4851

4952
// 找到project下的build.gradle
@@ -305,12 +308,12 @@ function configureAppKey(file, appKey) {
305308
var rf = fs.readFileSync(file, 'utf-8')
306309
var isAlreadyWrite = rf.match(/.*JPUSH_APPKEY.*/)
307310
if (isAlreadyWrite == null) {
308-
var insertKey = rf.match(/\n.*ndk \{\n.*\}\n/)
311+
var insertKey = rf.match(/.*versionName.*\n/)
309312
if (insertKey != null) {
310313
rf = rf.replace(
311314
insertKey[0],
312315
insertKey[0] +
313-
'manifestPlaceholders = [\n JPUSH_APPKEY: "' +
316+
' manifestPlaceholders = [\n JPUSH_APPKEY: "' +
314317
appKey +
315318
'",\n APP_CHANNEL: "developer-default"\n ]\n'
316319
)
@@ -321,7 +324,7 @@ function configureAppKey(file, appKey) {
321324
}
322325
}
323326

324-
function configureSetting(file) {
327+
function configureSetting(file, moduleName) {
325328
if (!isFile(file)) {
326329
console.log('configuration JPush error!!')
327330
return
@@ -333,11 +336,7 @@ function configureSetting(file) {
333336
var re = new RegExp("\n.*include.*':" + moduleName + "'", 'gi')
334337
var searchKey = rf.match(re)
335338
if (searchKey != null) {
336-
rf = rf.replace(
337-
searchKey[0],
338-
searchKey[0] +
339-
", ':jpush-react-native', ':jcore-react-native'\nproject(':jpush-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jpush-react-native/android')\nproject(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')\n"
340-
)
339+
rf = rf.replace("\n", "\ninclude ':jpush-react-native' \nproject(':jpush-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jpush-react-native/android')\ninclude ':jcore-react-native' \nproject(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')\n")
341340
fs.writeFileSync(file, rf, 'utf-8')
342341
} else {
343342
console.log('Did not find include in settings.gradle: ' + file)

JPushRN.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
1212

1313
s.ios.deployment_target = '7.0'
1414

15-
s.source = { :git => "https://github.com/jpush/jpush-react-native", :tag => "#{s.version}" }
15+
s.source = { :git => "https://github.com/jpush/jpush-react-native.git", :tag => "#{s.version}" }
1616
s.source_files = 'ios/RCTJPushModule/*.{h,m}'
1717
s.preserve_paths = "*.js"
1818
s.frameworks = 'UIKit','CFNetwork','CoreFoundation','CoreTelephony','SystemConfiguration','CoreGraphics','Foundation','Security'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@ dependencies {
109109
* [bang88](https://github.com/bang88)
110110
* [pampang](https://github.com/pampang)
111111
* [huhuanming](https://github.com/huhuanming)
112+
* [arniu](https://github.com/arniu)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jpush-react-native",
3-
"version": "2.1.8",
3+
"version": "2.1.11",
44
"description": "a jpush plugin for react native application",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)