Skip to content

Commit 912d85e

Browse files
committed
2.2.5
2 parents a8c5acd + d8f4140 commit 912d85e

File tree

3 files changed

+33
-19
lines changed

3 files changed

+33
-19
lines changed

documents/api.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [Common API](#common-api)
44
* [getRegistrationID](#getregistrationid)
55
* [stopPush](#stoppush)
6+
* [resumePush](#resumepush)
67
* [setAlias](#setalias)
78
* [addTags](#addtags)
89
* [deleteTags](#deletetags)
@@ -24,7 +25,6 @@
2425
* [网络成功登陆事件](#network-did-login-event)
2526
* [Android Only API](#android-only-api)
2627
* [initPush](#initpush)
27-
* [resumePush](#resumepush)
2828
* [crashLogOFF](#crashlogoff)
2929
* [crashLogON](#crashlogno)
3030
* [notifyJSDidLoad](#notifyjsdidload)
@@ -61,6 +61,20 @@ Android 和 iOS 通用 API。
6161
JPushModule.stopPush();
6262
```
6363

64+
* #### resumePush
65+
66+
恢复推送。建议在 `MainActivity``onResume` 中调用:
67+
68+
```
69+
// android native java
70+
JPushInterface.onResume(this);
71+
```
72+
73+
```
74+
// iOS - javascirpt
75+
JPushModule.resumePush();
76+
```
77+
6478
#### setAlias
6579

6680
* setAlias(alias, successCallback)
@@ -359,14 +373,6 @@ JPushModule.getLaunchAppNotification( notification => {
359373
JPushInterface.init(this);
360374
```
361375

362-
* #### resumePush
363-
364-
恢复推送。建议在 `MainActivity``onResume` 中调用:
365-
366-
```
367-
JPushInterface.onResume(this);
368-
```
369-
370376
* #### crashLogOFF
371377

372378
停止上报崩溃日志

documents/api_en.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [Common API](#common-api)
44
* [getRegistrationID](#getregistrationid)
55
* [stopPush](#stoppush)
6+
* [resumePush](#resumepush)
67
* [setAlias](#setalias)
78
* [addTags](#addtags)
89
* [setTags](#settags)
@@ -24,7 +25,6 @@
2425
* [Network Did Login Event](#network-did-login-event)
2526
* [Android Only API](#android-only-api)
2627
* [initPush](#initpush)
27-
* [resumePush](#resumepush)
2828
* [crashLogOFF](#crashlogoff)
2929
* [crashLogON](#crashlogon)
3030
* [notifyJSDidLoad](#notifyjsdidload)
@@ -61,6 +61,20 @@ Stop push.
6161
JPushModule.stopPush();
6262
```
6363

64+
* #### resumePush
65+
66+
Resume push. Suggest invokes in `MainActivity` 's `onResume` method:
67+
68+
```
69+
// android native java
70+
JPushInterface.onResume(this);
71+
```
72+
73+
```
74+
// iOS - javascirpt
75+
JPushModule.resumePush();
76+
```
77+
6478
#### setAlias
6579

6680
set device's application alias, you can push notificaiton with alias, every device can only have one alias.
@@ -330,14 +344,6 @@ JPushModule.getLaunchAppNotification( notification => {
330344
JPushInterface.init(this);
331345
```
332346

333-
* #### resumePush
334-
335-
Resume push. Suggest invokes in `MainActivity` 's `onResume` method:
336-
337-
```
338-
JPushInterface.onResume(this);
339-
```
340-
341347
* #### crashLogOFF
342348

343349
Stop upload crash log.

ios/RCTJPushModule/RCTJPushModule.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,12 @@ - (void)didRegistRemoteNotification:(NSString *)token {
745745
* - 通过本 API 把当前客户端(当前这个用户的) 的实际 badge 设置到服务器端保存起来;
746746
* - 调用服务器端 API 发 APNs 时(通常这个调用是批量针对大量用户),
747747
* 使用 "+1" 的语义, 来表达需要基于目标用户实际的 badge 值(保存的) +1 来下发通知时带上新的 badge 值;
748+
*
749+
* setBadge(-1): 支持清空icon的badge而不清空通知栏消息
748750
*/
749751
RCT_EXPORT_METHOD(setBadge:(NSInteger)value callback:(RCTResponseSenderBlock)callback) {// ->Bool
750752
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:value];
751-
NSNumber *badgeNumber = [NSNumber numberWithBool:[JPUSHService setBadge: value]];
753+
NSNumber *badgeNumber = [NSNumber numberWithBool:[JPUSHService setBadge: value > 0 ? value : 0]];
752754
callback(@[badgeNumber]);
753755
}
754756

0 commit comments

Comments
 (0)