Skip to content

Commit 246e415

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into dev
2 parents 701b95a + c864b82 commit 246e415

File tree

10 files changed

+79
-34
lines changed

10 files changed

+79
-34
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ private static void sendEvent() {
163163
WritableMap map = Arguments.createMap();
164164
map.putInt("id", mCachedBundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID));
165165
map.putString("message", mCachedBundle.getString(JPushInterface.EXTRA_MESSAGE));
166+
map.putString("content", mCachedBundle.getString(JPushInterface.EXTRA_MESSAGE));
167+
map.putString("content_type", mCachedBundle.getString(JPushInterface.EXTRA_CONTENT_TYPE));
168+
map.putString("title", mCachedBundle.getString(JPushInterface.EXTRA_TITLE));
166169
map.putString("extras", mCachedBundle.getString(JPushInterface.EXTRA_EXTRA));
167170
mRAC.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
168171
.emit(mEvent, map);
@@ -177,7 +180,7 @@ private static void sendEvent() {
177180
.emit(mEvent, map);
178181
break;
179182
}
180-
183+
181184
mEvent = null;
182185
mCachedBundle = null;
183186
}

documents/api.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[English document](api_en.md)
22

33
* [Common API](#common-api)
4+
* [initPush](#initpush)
45
* [getRegistrationID](#getregistrationid)
56
* [stopPush](#stoppush)
67
* [resumePush](#resumepush)
@@ -24,7 +25,6 @@
2425
* [点击推送启动应用事件](#open-notification-launch-app-event)
2526
* [网络成功登陆事件](#network-did-login-event)
2627
* [Android Only API](#android-only-api)
27-
* [initPush](#initpush)
2828
* [crashLogOFF](#crashlogoff)
2929
* [crashLogON](#crashlogno)
3030
* [notifyJSDidLoad](#notifyjsdidload)
@@ -37,12 +37,26 @@
3737
* [addGetRegistrationIdListener](#addgetregistrationIdlistener)
3838
* [removeGetRegistrationIdListener](#removegetregistrationidlistener)
3939

40-
注意: 在 Android 需要先调用 `initPush` 方法, iOS 端不需要
40+
注意: 需要调用先调用 `initPush` 方法才能正常使用
4141

4242
### Common API
4343

4444
Android 和 iOS 通用 API。
4545

46+
#### initPush
47+
48+
初始化 JPush,这个方法初始化推送功能 iOS 会弹出获取推送权限的提示框(注意这个系统提示框只会触发一次,如果用户首次不同意,之后需要用户到设置中修改推送权限)。
49+
50+
```
51+
JPushModule.initPush()
52+
```
53+
54+
Android 建议在原生 `MainActivity``onCreate` 中调用:
55+
56+
```
57+
// java 原生代码
58+
JPushInterface.init(this);
59+
```
4660
#### getRegistrationID
4761

4862
* getRegistrationID(function)
@@ -61,20 +75,19 @@ Android 和 iOS 通用 API。
6175
JPushModule.stopPush();
6276
```
6377

64-
* #### resumePush
78+
#### resumePush
6579

66-
恢复推送。建议在 `MainActivity``onResume` 中调用:
80+
恢复推送。建议在 `MainActivity``onResume` 中调用:
6781

68-
```
69-
// android native java
70-
JPushInterface.onResume(this);
71-
```
82+
```
83+
// android native java
84+
JPushInterface.onResume(this);
85+
```
7286

73-
```
74-
// iOS - javascirpt
75-
JPushModule.resumePush();
76-
```
77-
87+
```
88+
// iOS - javascirpt
89+
JPushModule.resumePush();
90+
```
7891
#### setAlias
7992

8093
* setAlias(alias, successCallback)
@@ -199,7 +212,7 @@ JPushModule.clearNotificationById(id);
199212

200213
#### 点击推送事件
201214

202-
**NOTE**: iOS 需要安装到 [email protected]+ 。
215+
**NOTE**: iOS 需要安装到 [email protected]+ 。参数 function 不能复用,不能用于其他 add****Listener 的方法。
203216

204217
* addReceiveOpenNotificationListener(function)
205218

@@ -216,7 +229,7 @@ JPushModule.clearNotificationById(id);
216229

217230
#### 接收推送事件
218231

219-
**NOTE**: iOS 需要安装到 [email protected]+ 。
232+
**NOTE**: iOS 需要安装到 [email protected]+ 。参数 function 不能复用,不能用于其他 add****Listener 的方法。
220233

221234
* addReceiveNotificationListener(function)
222235

@@ -235,7 +248,7 @@ JPushModule.clearNotificationById(id);
235248

236249
#### 接收自定义消息事件
237250

238-
**NOTE**: iOS 需要安装到 [email protected]+ 。
251+
**NOTE**: iOS 需要安装到 [email protected]+ 。参数 function 不能复用,不能用于其他 add****Listener 的方法。
239252

240253
* addReceiveCustomMsgListener(function)
241254

@@ -365,13 +378,6 @@ JPushModule.getLaunchAppNotification( notification => {
365378

366379
### Android Only API
367380

368-
* #### initPush
369-
370-
初始化 JPush。建议在 `MainActivity``onCreate` 中调用:
371-
372-
```
373-
JPushInterface.init(this);
374-
```
375381

376382
* #### crashLogOFF
377383

example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default class App extends Component {
228228

229229
JPushModule.addReceiveCustomMsgListener(map => {
230230
this.setState({
231-
pushMsg: map.message
231+
pushMsg: map.content
232232
})
233233
console.log('extras: ' + map.extras)
234234
})

example/ios/PushDemo/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"idiom" : "iphone",
515
"size" : "29x29",
@@ -29,6 +39,11 @@
2939
"idiom" : "iphone",
3040
"size" : "60x60",
3141
"scale" : "3x"
42+
},
43+
{
44+
"idiom" : "ios-marketing",
45+
"size" : "1024x1024",
46+
"scale" : "1x"
3247
}
3348
],
3449
"info" : {

ios/RCTJPushModule.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
624386D71E096B8800F69E07 /* RCTJPushActionQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 624386D21E096B8800F69E07 /* RCTJPushActionQueue.m */; };
1111
624386D81E096B8800F69E07 /* RCTJPushModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 624386D41E096B8800F69E07 /* RCTJPushModule.m */; };
12-
626A78821FA336AA0074D518 /* libjpush-ios-3.0.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 626A78811FA336AA0074D518 /* libjpush-ios-3.0.7.a */; };
12+
62854FE720F76769001F09E3 /* libjpush-ios-3.0.9.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 62854FE620F76769001F09E3 /* libjpush-ios-3.0.9.a */; };
1313
/* End PBXBuildFile section */
1414

1515
/* Begin PBXCopyFilesBuildPhase section */
@@ -25,21 +25,21 @@
2525
/* End PBXCopyFilesBuildPhase section */
2626

2727
/* Begin PBXFileReference section */
28-
623D05801EA4D29100F31FBE /* JPUSHService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JPUSHService.h; sourceTree = "<group>"; };
2928
624386D11E096B8800F69E07 /* RCTJPushActionQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJPushActionQueue.h; sourceTree = "<group>"; };
3029
624386D21E096B8800F69E07 /* RCTJPushActionQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJPushActionQueue.m; sourceTree = "<group>"; };
3130
624386D31E096B8800F69E07 /* RCTJPushModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJPushModule.h; sourceTree = "<group>"; };
3231
624386D41E096B8800F69E07 /* RCTJPushModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJPushModule.m; sourceTree = "<group>"; };
33-
626A78811FA336AA0074D518 /* libjpush-ios-3.0.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libjpush-ios-3.0.7.a"; sourceTree = "<group>"; };
3432
6280980A1CEDC407000D3A81 /* libRCTJPushModule.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTJPushModule.a; sourceTree = BUILT_PRODUCTS_DIR; };
33+
62854FE520F76769001F09E3 /* JPUSHService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JPUSHService.h; sourceTree = "<group>"; };
34+
62854FE620F76769001F09E3 /* libjpush-ios-3.0.9.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libjpush-ios-3.0.9.a"; sourceTree = "<group>"; };
3535
/* End PBXFileReference section */
3636

3737
/* Begin PBXFrameworksBuildPhase section */
3838
628098071CEDC407000D3A81 /* Frameworks */ = {
3939
isa = PBXFrameworksBuildPhase;
4040
buildActionMask = 2147483647;
4141
files = (
42-
626A78821FA336AA0074D518 /* libjpush-ios-3.0.7.a in Frameworks */,
42+
62854FE720F76769001F09E3 /* libjpush-ios-3.0.9.a in Frameworks */,
4343
);
4444
runOnlyForDeploymentPostprocessing = 0;
4545
};
@@ -65,8 +65,8 @@
6565
6280980C1CEDC407000D3A81 /* RCTJPushModule */ = {
6666
isa = PBXGroup;
6767
children = (
68-
626A78811FA336AA0074D518 /* libjpush-ios-3.0.7.a */,
69-
623D05801EA4D29100F31FBE /* JPUSHService.h */,
68+
62854FE520F76769001F09E3 /* JPUSHService.h */,
69+
62854FE620F76769001F09E3 /* libjpush-ios-3.0.9.a */,
7070
624386D11E096B8800F69E07 /* RCTJPushActionQueue.h */,
7171
624386D21E096B8800F69E07 /* RCTJPushActionQueue.m */,
7272
624386D31E096B8800F69E07 /* RCTJPushModule.h */,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

ios/RCTJPushModule/JPUSHService.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
1010
*/
1111

12-
#define JPUSH_VERSION_NUMBER 3.0.7
12+
#define JPUSH_VERSION_NUMBER 3.0.9
1313

1414
#import <Foundation/Foundation.h>
1515

@@ -493,6 +493,20 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
493493
*/
494494
+ (void)resetBadge;
495495

496+
///----------------------------------------------------
497+
/// @name Other Feature 其他功能
498+
///----------------------------------------------------
499+
500+
/*!
501+
* @abstract 设置手机号码(到服务器)
502+
*
503+
* @param mobileNumber 手机号码. 会与用户信息一一对应。可为空,为空则清除号码
504+
* @param completion 响应回调。成功则error为空,失败则error带有错误码及错误信息
505+
*
506+
* @discussion 设置手机号码后,可实现“推送不到短信到”的通知方式,提高推送达到率。结果信息通过completion异步返回,也可将completion设置为nil不处理结果信息。
507+
*
508+
*/
509+
+ (void)setMobileNumber:(NSString *)mobileNumber completion:(void (^)(NSError *error))completion;
496510

497511
///----------------------------------------------------
498512
/// @name Logs and others 日志与其他
@@ -536,7 +550,6 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
536550
*/
537551
+ (void)setLogOFF;
538552

539-
540553
///----------------------------------------------------
541554
///********************下列方法已过期********************
542555
///**************请使用新版tag/alias操作接口**************
-2.55 MB
Binary file not shown.
2.92 MB
Binary file not shown.

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.2.5",
3+
"version": "2.2.6",
44
"description": "a jpush plugin for react native application",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)