Skip to content

Commit 4508348

Browse files
Merge pull request #432 from jpush/dev
Dev
2 parents 9d5781a + 37e3a54 commit 4508348

File tree

79 files changed

+2726
-4197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2726
-4197
lines changed

JPushRN.podspec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require 'json'
2+
pjson = JSON.parse(File.read('package.json'))
3+
4+
Pod::Spec.new do |s|
5+
6+
s.name = "JPushRN"
7+
s.version = pjson["version"]
8+
s.homepage = "https://github.com/jpush/jpush-react-native"
9+
s.summary = pjson["description"]
10+
s.license = pjson["license"]
11+
s.author = { "huminios" => "[email protected]" }
12+
13+
s.ios.deployment_target = '7.0'
14+
15+
s.source = { :git => "https://github.com/jpush/jpush-react-native", :tag => "#{s.version}" }
16+
s.source_files = 'ios/RCTJPushModule/*.{h,m}'
17+
s.preserve_paths = "*.js"
18+
s.frameworks = 'UIKit','CFNetwork','CoreFoundation','CoreTelephony','SystemConfiguration','CoreGraphics','Foundation','Security'
19+
s.weak_frameworks = 'UserNotifications'
20+
s.libraries = 'z','resolv'
21+
s.vendored_libraries = "ios/RCTJPushModule/*.a"
22+
23+
s.dependency 'React'
24+
end

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,21 @@ npm install jpush-react-native --save
1414
npm install jcore-react-native --save ## jpush-react-native 1.4.2 版本以后需要同时安装 jcore-react-native
1515
1616
```
17+
##### (如果是原生应用集成 react-native)使用 CocoaPods 安装
18+
19+
在 Podfile 中添加如下代码:
20+
21+
```
22+
pod 'JPushRN', :path => '../node_modules/jpush-react-native'
23+
```
24+
终端执行如下指令:
25+
26+
```
27+
pod install
28+
```
29+
1730
## 配置
31+
1832
配置包括两个步骤,自动配置和手动操作。
1933
### 1.自动配置部分(以下命令均在你的 React Native Project 目录下运行,自动配置后仍需手动配置一部分)
2034

@@ -32,7 +46,7 @@ npm run configureJPush d4ee2375846bc30fa51334f5 app
3246
//执行自动配置脚本后再执行 link 操作
3347
react-native link
3448
```
35-
自动配置操作会自动插入 Native 代码,这个部分用户无需关系具体细节,如果实在想了解加入代码的细节可以查看如下链接
49+
自动配置操作会自动插入 Native 代码(iOS 中使用 Appdelegate.m 文件名,如果修改了该文件名需要手动插入[代码](https://github.com/jpush/jpush-react-native/blob/master/example/documents/iOS_Usage.md),这个部分用户无需关系具体细节,如果实在想了解加入代码的细节可以查看如下链接
3650
- [iOS 自动配置后自动添加的代码](https://github.com/jpush/jpush-react-native/blob/master/example/documents/iOS_Usage.md)
3751

3852
### 2.手动操作部分(自动配置后,部分操作需要手动修改)

android/src/main/java/cn/jpush/reactnativejpush/JPushModule.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ public void setStyleCustom() {
381381
@ReactMethod
382382
public void getRegistrationID(Callback callback) {
383383
try {
384-
mContext = getCurrentActivity();
385-
String id = JPushInterface.getRegistrationID(mContext);
384+
String id = JPushInterface.getRegistrationID(getReactApplicationContext());
386385
if (id != null) {
387386
callback.invoke(id);
388387
} else {

example/.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["react-native"]
3-
}
2+
"presets": ["react-native"]
3+
}

example/.flowconfig

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,45 @@
1212
; For RN Apps installed via npm, "Libraries" folder is inside
1313
; "node_modules/react-native" but in the source repo it is in the root
1414
.*/Libraries/react-native/React.js
15-
.*/Libraries/react-native/ReactNative.js
15+
16+
; Ignore polyfills
17+
.*/Libraries/polyfills/.*
18+
19+
; Ignore metro
20+
.*/node_modules/metro/.*
1621

1722
[include]
1823

1924
[libs]
2025
node_modules/react-native/Libraries/react-native/react-native-interface.js
21-
node_modules/react-native/flow
22-
flow/
26+
node_modules/react-native/flow/
27+
node_modules/react-native/flow-github/
2328

2429
[options]
25-
module.system=haste
30+
emoji=true
2631

27-
experimental.strict_type_args=true
32+
module.system=haste
2833

2934
munge_underscores=true
3035

3136
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
3237

38+
module.file_ext=.js
39+
module.file_ext=.jsx
40+
module.file_ext=.json
41+
module.file_ext=.native.js
42+
3343
suppress_type=$FlowIssue
3444
suppress_type=$FlowFixMe
35-
suppress_type=$FixMe
36-
37-
<<<<<<< ours
38-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-7]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
39-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-7]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
40-
=======
41-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
42-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
43-
>>>>>>> theirs
45+
suppress_type=$FlowFixMeProps
46+
suppress_type=$FlowFixMeState
47+
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
4450
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
51+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4552

4653
unsafe.enable_getters_and_setters=true
4754

4855
[version]
49-
<<<<<<< ours
50-
^0.37.0
51-
=======
52-
^0.56.0
53-
>>>>>>> theirs
56+
^0.61.0

example/.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/.qshell/account.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)