Skip to content

Commit 2584a65

Browse files
committed
升级安卓jcore5.0.3,新增enableSDKLocalLog和readNewLogs方法。修改插件版本号为2.3.0
1 parent b5a04cf commit 2584a65

File tree

6 files changed

+54
-1
lines changed

6 files changed

+54
-1
lines changed
-845 KB
Binary file not shown.
855 KB
Binary file not shown.

android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,32 @@ public void setCountryCode(ReadableMap readableMap){
5858
}
5959
}
6060

61+
@ReactMethod
62+
public void enableSDKLocalLog(ReadableMap readableMap){
63+
if (readableMap == null) {
64+
return;
65+
}
66+
boolean enable = false;
67+
if (readableMap.hasKey("enable")) {
68+
enable = readableMap.getBoolean("enable");
69+
}
70+
boolean uploadJgToServer = false;
71+
if (readableMap.hasKey("uploadJgToServer")) {
72+
uploadJgToServer = readableMap.getBoolean("uploadJgToServer");
73+
}
74+
JCoreInterface.enableSDKLocalLog(reactContext,enable,uploadJgToServer);
75+
}
76+
77+
@ReactMethod
78+
public void readNewLogs(Callback callback) {
79+
if (callback == null) {
80+
return;
81+
}
82+
String logs = JCoreInterface.readNewLogs(reactContext);
83+
WritableMap writableMap = Arguments.createMap();
84+
writableMap.putString("logs", logs);
85+
callback.invoke(writableMap);
86+
}
87+
6188

6289
}

index.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,18 @@ export default class JCore {
1717
* @param enable 是否启用自动唤醒
1818
*/
1919
static enableAutoWakeup(enable: boolean): void;
20+
21+
/**
22+
* 启用SDK本地日志,启动用SDK日志缓存本设备
23+
* @param enable 是否启用日志(true表示启用,false表示禁用)
24+
* @param uploadJgToServer 是否将日志上传到极光服务器(true表示上传,false表示不上传)
25+
*/
26+
static enableSDKLocalLog(params: {enable: boolean, uploadJgToServer: boolean}): void;
27+
28+
/**
29+
* 获取所有进程的新增SDK日志
30+
*
31+
* @param {Function} callback = (result) => {"logs":String}
32+
*/
33+
static readNewLogs(callback: Callback<{ logs: string }>): void;
2034
}

index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,16 @@ export default class JCore {
2323
}
2424
}
2525

26+
static enableSDKLocalLog(params) {
27+
if (Platform.OS == "android") {
28+
JCoreModule.enableSDKLocalLog(params)
29+
}
30+
}
31+
32+
static readNewLogs(callback) {
33+
if (Platform.OS == "android") {
34+
JCoreModule.readNewLogs(callback)
35+
}
36+
}
37+
2638
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author" : "wicked.tc130",
66
"license" : "ISC",
77
"main" : "index.js",
8-
"version" : "2.2.9",
8+
"version" : "2.3.0",
99
"repository" : {
1010
"type": "git",
1111
"url": "https://github.com/jpush/jcore-react-native"

0 commit comments

Comments
 (0)