Skip to content

Commit 9e601d8

Browse files
committed
安卓更新SDK到6.0.1,iOS更新到6.0.0,插件版本为3.2.2
1 parent 26122c5 commit 9e601d8

19 files changed

Lines changed: 409 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
## [3.2.2] - 2026-01-27
4+
5+
### Added
6+
- 更新iOS JPush SDK到6.0.0版本
7+
- 更新Android JPush SDK到6.0.1版本
8+
- 新增 `getPushStatus` 方法,用于检查推送是否被停止的状态(推荐使用,替代已废弃的 `isPushStopped` 方法)
9+
- iOS: 支持获取推送状态,返回结果码和是否停止的状态
10+
- Android: 支持获取推送状态,返回结果码和是否停止的状态
11+
12+
### Changed
13+
- 插件版本从3.2.1升级到3.2.2
14+
15+
### Notes
16+
- iOS SDK 6.0.0新增了 `getPushStatus` 接口
17+
- Android SDK 6.0.0新增了 `getPushStatus` 接口,并废弃了 `isPushStopped` 接口(但仍保留以保持向后兼容)
18+
- Android SDK 6.0.1主要更新了厂商推送SDK版本和厂商通道Token回调接口
-403 KB
Binary file not shown.
8.37 KB
Binary file not shown.

android/src/main/java/cn/jiguang/plugins/push/JPushModule.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,37 @@ public void isPushStopped(Callback callback) {
8989
callback.invoke(isPushStopped);
9090
}
9191

92+
// 保存getPushStatus的callback,用于在onCommandResult中回调
93+
private static Callback pendingGetPushStatusCallback = null;
94+
95+
@ReactMethod
96+
public void getPushStatus(Callback callback) {
97+
if (callback == null) {
98+
JLogger.w(JConstants.CALLBACK_NULL);
99+
return;
100+
}
101+
// 保存callback,等待onCommandResult回调
102+
pendingGetPushStatusCallback = callback;
103+
// 调用SDK方法,结果会通过JPushMessageReceiver的onCommandResult回调
104+
JPushInterface.getPushStatus(reactContext);
105+
}
106+
107+
// 提供给JPushModuleReceiver调用的方法,用于处理getPushStatus的回调结果
108+
public static void handleGetPushStatusResult(int errorCode, String msg) {
109+
if (pendingGetPushStatusCallback != null) {
110+
WritableMap result = Arguments.createMap();
111+
// 与iOS对齐:code是结果码(0表示成功,其他表示错误),isStopped是布尔值表示是否停止
112+
// Android端:errorCode 0表示未停止,1表示已停止,其他code表示其他异常
113+
// 转换为iOS格式:code=0表示成功获取状态,isStopped表示实际是否停止
114+
int iResCode = (errorCode == 0 || errorCode == 1) ? 0 : errorCode; // 0或1都表示成功获取状态,其他表示异常
115+
boolean isStopped = (errorCode == 1); // 1表示已停止,0表示未停止
116+
result.putInt("code", iResCode);
117+
result.putBoolean("isStopped", isStopped);
118+
pendingGetPushStatusCallback.invoke(result);
119+
pendingGetPushStatusCallback = null;
120+
}
121+
}
122+
92123
@ReactMethod
93124
public void setChannel(ReadableMap readableMap) {
94125
if (readableMap == null) {

android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,15 @@ public void onConnected(Context context, boolean state) {
105105
@Override
106106
public void onCommandResult(Context context, CmdMessage message) {
107107
JLogger.d("onCommandResult:" + message.toString());
108+
109+
// 处理getPushStatus的回调结果 (cmd = 2003)
110+
if (message != null && message.cmd == 2003) {
111+
JPushModule.handleGetPushStatusResult(message.errorCode, message.msg);
112+
}
113+
108114
WritableMap writableMap = Arguments.createMap();
109115
writableMap.putInt(JConstants.COMMAND, message.cmd);
110-
writableMap.putString(JConstants.COMMAND_EXTRA, message.extra.toString());
116+
writableMap.putString(JConstants.COMMAND_EXTRA, message.extra != null ? message.extra.toString() : "");
111117
writableMap.putString(JConstants.COMMAND_MESSAGE, message.msg);
112118
writableMap.putInt(JConstants.COMMAND_RESULT, message.errorCode);
113119
JPushHelper.sendEvent(JConstants.COMMAND_EVENT, writableMap);

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"jcore-react-native": "^2.3.0",
14-
"jpush-react-native": "^3.2.1",
14+
"jpush-react-native": "^3.2.2",
1515
"react": "18.2.0",
1616
"react-native": "0.74.1"
1717
},

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,13 @@ export default class JPush {
472472
*/
473473
static isPushStopped(callback: Callback<boolean>): void;
474474

475+
/**
476+
* 检查推送是否被停止的状态(推荐使用,替代 isPushStopped)
477+
*
478+
* @param callback 回调函数,返回 {"code": number, "isStopped": boolean}
479+
*/
480+
static getPushStatus(callback: Callback<{code: number; isStopped: boolean}>): void;
481+
475482
/**
476483
* 设置允许推送时间
477484
*

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,19 @@ export default class JPush {
658658
}
659659
}
660660

661+
/*
662+
* 检查推送是否被停止的状态(推荐使用,替代 isPushStopped)
663+
*
664+
* @param {Function} callback = (result) => {"code":int,"isStopped":boolean}
665+
* */
666+
static getPushStatus(callback) {
667+
if (Platform.OS == "android") {
668+
JPushModule.getPushStatus(callback)
669+
} else {
670+
JPushModule.getPushStatus(callback)
671+
}
672+
}
673+
661674
/*
662675
* 设置允许推送时间
663676
*

ios/RCTJPushModule.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
5C103CA7236041E7000AD3DA /* RCTJPushEventQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C103CA6236041E7000AD3DA /* RCTJPushEventQueue.m */; };
1111
624386D81E096B8800F69E07 /* RCTJPushModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 624386D41E096B8800F69E07 /* RCTJPushModule.m */; };
12-
A40EE5272E2F693E00FD1C66 /* jpush-ios-5.9.0.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A40EE5262E2F693E00FD1C66 /* jpush-ios-5.9.0.xcframework */; };
12+
A40EE5272E2F693E00FD1C66 /* jpush-ios-6.0.0.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A40EE5262E2F693E00FD1C66 /* jpush-ios-6.0.0.xcframework */; };
1313
/* End PBXBuildFile section */
1414

1515
/* Begin PBXCopyFilesBuildPhase section */
@@ -30,15 +30,15 @@
3030
624386D31E096B8800F69E07 /* RCTJPushModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJPushModule.h; sourceTree = "<group>"; };
3131
624386D41E096B8800F69E07 /* RCTJPushModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJPushModule.m; sourceTree = "<group>"; };
3232
6280980A1CEDC407000D3A81 /* libRCTJPushModule.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTJPushModule.a; sourceTree = BUILT_PRODUCTS_DIR; };
33-
A40EE5262E2F693E00FD1C66 /* jpush-ios-5.9.0.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "jpush-ios-5.9.0.xcframework"; path = "RCTJPushModule/jpush-ios-5.9.0.xcframework"; sourceTree = "<group>"; };
33+
A40EE5262E2F693E00FD1C66 /* jpush-ios-6.0.0.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "jpush-ios-6.0.0.xcframework"; path = "RCTJPushModule/jpush-ios-6.0.0.xcframework"; sourceTree = "<group>"; };
3434
/* End PBXFileReference section */
3535

3636
/* Begin PBXFrameworksBuildPhase section */
3737
628098071CEDC407000D3A81 /* Frameworks */ = {
3838
isa = PBXFrameworksBuildPhase;
3939
buildActionMask = 2147483647;
4040
files = (
41-
A40EE5272E2F693E00FD1C66 /* jpush-ios-5.9.0.xcframework in Frameworks */,
41+
A40EE5272E2F693E00FD1C66 /* jpush-ios-6.0.0.xcframework in Frameworks */,
4242
);
4343
runOnlyForDeploymentPostprocessing = 0;
4444
};
@@ -48,7 +48,7 @@
4848
5CF8E647231E3A9200B12200 /* Frameworks */ = {
4949
isa = PBXGroup;
5050
children = (
51-
A40EE5262E2F693E00FD1C66 /* jpush-ios-5.9.0.xcframework */,
51+
A40EE5262E2F693E00FD1C66 /* jpush-ios-6.0.0.xcframework */,
5252
);
5353
name = Frameworks;
5454
sourceTree = "<group>";

0 commit comments

Comments
 (0)