react-native-debug-toolkit 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +5 -1
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsModule.java +17 -15
- package/lib/NativeDebugLibs.js +0 -12
- package/package.json +1 -1
- package/android/src/main/java/com/debugtoolkit/BuildTypeModule.java +0 -44
- package/android/src/main/java/com/debugtoolkit/BuildTypePackage.java +0 -24
package/android/build.gradle
CHANGED
|
@@ -25,6 +25,10 @@ repositories {
|
|
|
25
25
|
|
|
26
26
|
dependencies {
|
|
27
27
|
implementation "com.facebook.react:react-native:+"
|
|
28
|
-
implementation '
|
|
28
|
+
// implementation 'com.didichuxing.doraemonkit:dokit:3.7.1'
|
|
29
|
+
debugImplementation 'io.github.didi.dokit:dokitx:3.7.1'
|
|
30
|
+
releaseImplementation 'io.github.didi.dokit:dokitx-no-op:3.7.1'
|
|
31
|
+
// implementation 'io.github.didi.dokit:dokitx:3.7.1'
|
|
29
32
|
implementation 'com.android.volley:volley:1.2.0'
|
|
33
|
+
|
|
30
34
|
}
|
|
@@ -8,8 +8,8 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
8
8
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
9
9
|
import com.facebook.react.bridge.ReactMethod;
|
|
10
10
|
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import com.didichuxing.doraemonkit.DoKit;
|
|
12
|
+
import com.didichuxing.doraemonkit.kit.AbstractKit;
|
|
13
13
|
|
|
14
14
|
import java.util.ArrayList;
|
|
15
15
|
import java.util.List;
|
|
@@ -43,26 +43,28 @@ public class RNDebugLibsModule extends ReactContextBaseJavaModule {
|
|
|
43
43
|
// FLEX is iOS only
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
@ReactMethod
|
|
47
|
-
public void installDoraemonKit(String productId) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
46
|
+
// @ReactMethod
|
|
47
|
+
// public void installDoraemonKit(String productId) {
|
|
48
|
+
// Application app = (Application) reactContext.getApplicationContext();
|
|
49
|
+
// List<AbstractKit> kits = new ArrayList<>();
|
|
50
|
+
// // Initialize DoKit with custom kits if needed
|
|
51
|
+
// DoKit.Builder(app)
|
|
52
|
+
// .productId(productId)
|
|
53
|
+
// .customKits(kits)
|
|
54
|
+
// .build();
|
|
55
|
+
// }
|
|
56
56
|
|
|
57
57
|
@ReactMethod
|
|
58
58
|
public void showDoraemonKit() {
|
|
59
|
-
Toast.makeText(reactContext, "showDoraemonKit被调用", Toast.LENGTH_SHORT).show();
|
|
60
59
|
DoKit.showToolPanel();
|
|
60
|
+
DoKit.show();
|
|
61
|
+
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
@ReactMethod
|
|
64
65
|
public void hideDoraemonKit() {
|
|
65
|
-
Toast.makeText(reactContext, "hideDoraemonKit被调用", Toast.LENGTH_SHORT).show();
|
|
66
|
-
DoKit.hideToolPanel();
|
|
66
|
+
// Toast.makeText(reactContext, "hideDoraemonKit被调用", Toast.LENGTH_SHORT).show();
|
|
67
|
+
// DoKit.hideToolPanel();
|
|
68
|
+
DoKit.hide();
|
|
67
69
|
}
|
|
68
70
|
}
|
package/lib/NativeDebugLibs.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native'
|
|
2
2
|
|
|
3
|
-
// 添加调试日志,查看是否正确获取了RNDebugLibs模块
|
|
4
3
|
const { RNDebugLibs } = NativeModules
|
|
5
|
-
console.log('Available Native Modules:', Object.keys(NativeModules))
|
|
6
|
-
console.log('RNDebugLibs module loaded:', !!RNDebugLibs)
|
|
7
4
|
|
|
8
5
|
export default class NativeDebugLibs {
|
|
9
6
|
// FLEX methods (iOS only)
|
|
@@ -27,29 +24,20 @@ export default class NativeDebugLibs {
|
|
|
27
24
|
|
|
28
25
|
// DoraemonKit/DoKit methods
|
|
29
26
|
static installDoraemonKit(productId) {
|
|
30
|
-
console.log('Calling installDoraemonKit with:', productId)
|
|
31
27
|
if (RNDebugLibs) {
|
|
32
28
|
RNDebugLibs.installDoraemonKit(productId)
|
|
33
|
-
} else {
|
|
34
|
-
console.warn('RNDebugLibs module not available')
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
static showDoraemonKit() {
|
|
39
|
-
console.log('Calling showDoraemonKit')
|
|
40
33
|
if (RNDebugLibs) {
|
|
41
34
|
RNDebugLibs.showDoraemonKit()
|
|
42
|
-
} else {
|
|
43
|
-
console.warn('RNDebugLibs module not available')
|
|
44
35
|
}
|
|
45
36
|
}
|
|
46
37
|
|
|
47
38
|
static hideDoraemonKit() {
|
|
48
|
-
console.log('Calling hideDoraemonKit')
|
|
49
39
|
if (RNDebugLibs) {
|
|
50
40
|
RNDebugLibs.hideDoraemonKit()
|
|
51
|
-
} else {
|
|
52
|
-
console.warn('RNDebugLibs module not available')
|
|
53
41
|
}
|
|
54
42
|
}
|
|
55
43
|
}
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
package com.debugtoolkit;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
4
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
5
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
6
|
-
import com.facebook.react.bridge.Promise;
|
|
7
|
-
|
|
8
|
-
import java.util.HashMap;
|
|
9
|
-
import java.util.Map;
|
|
10
|
-
|
|
11
|
-
public class BuildTypeModule extends ReactContextBaseJavaModule {
|
|
12
|
-
private final ReactApplicationContext reactContext;
|
|
13
|
-
|
|
14
|
-
public BuildTypeModule(ReactApplicationContext reactContext) {
|
|
15
|
-
super(reactContext);
|
|
16
|
-
this.reactContext = reactContext;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Override
|
|
20
|
-
public String getName() {
|
|
21
|
-
return "BuildTypeModule";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Override
|
|
25
|
-
public Map<String, Object> getConstants() {
|
|
26
|
-
final Map<String, Object> constants = new HashMap<>();
|
|
27
|
-
constants.put("buildType", BuildConfig.DEBUG ? "debug" : "release");
|
|
28
|
-
return constants;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
32
|
-
public String getBuildTypeSync() {
|
|
33
|
-
return BuildConfig.DEBUG ? "debug" : "release";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@ReactMethod
|
|
37
|
-
public void getBuildType(Promise promise) {
|
|
38
|
-
try {
|
|
39
|
-
promise.resolve(BuildConfig.DEBUG ? "debug" : "release");
|
|
40
|
-
} catch (Exception e) {
|
|
41
|
-
promise.reject("ERR_UNEXPECTED", e.getMessage(), e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package com.debugtoolkit;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactPackage;
|
|
4
|
-
import com.facebook.react.bridge.NativeModule;
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
7
|
-
|
|
8
|
-
import java.util.ArrayList;
|
|
9
|
-
import java.util.Collections;
|
|
10
|
-
import java.util.List;
|
|
11
|
-
|
|
12
|
-
public class BuildTypePackage implements ReactPackage {
|
|
13
|
-
@Override
|
|
14
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
15
|
-
List<NativeModule> modules = new ArrayList<>();
|
|
16
|
-
modules.add(new BuildTypeModule(reactContext));
|
|
17
|
-
return modules;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Override
|
|
21
|
-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
22
|
-
return Collections.emptyList();
|
|
23
|
-
}
|
|
24
|
-
}
|