react-native-debug-toolkit 0.4.0 → 0.4.1
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.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
|
|
3
|
+
android {
|
|
4
|
+
compileSdkVersion rootProject.ext.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
|
|
5
|
+
buildToolsVersion rootProject.ext.hasProperty('buildToolsVersion') ? rootProject.ext.buildToolsVersion : "30.0.3"
|
|
6
|
+
|
|
7
|
+
defaultConfig {
|
|
8
|
+
minSdkVersion rootProject.ext.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
|
|
9
|
+
targetSdkVersion rootProject.ext.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
|
|
10
|
+
versionCode 1
|
|
11
|
+
versionName "1.0"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
compileOptions {
|
|
15
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
16
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
repositories {
|
|
21
|
+
mavenCentral()
|
|
22
|
+
maven { url "https://jitpack.io" }
|
|
23
|
+
google()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
dependencies {
|
|
27
|
+
implementation "com.facebook.react:react-native:+"
|
|
28
|
+
implementation 'io.github.didi.dokit:dokitx:3.7.1'
|
|
29
|
+
implementation 'com.android.volley:volley:1.2.0'
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
package="com.reactnative.debuglibs">
|
|
4
|
+
|
|
5
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
6
|
+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
|
7
|
+
|
|
8
|
+
</manifest>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
package com.reactnative.debuglibs;
|
|
2
2
|
|
|
3
3
|
import android.app.Application;
|
|
4
|
+
import android.widget.Toast;
|
|
4
5
|
import androidx.annotation.NonNull;
|
|
5
6
|
|
|
6
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
8
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
9
|
import com.facebook.react.bridge.ReactMethod;
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
import
|
|
11
|
+
import io.github.didi.dokit.DoKit;
|
|
12
|
+
import io.github.didi.dokit.kit.AbstractKit;
|
|
12
13
|
|
|
13
14
|
import java.util.ArrayList;
|
|
14
15
|
import java.util.List;
|
|
@@ -55,11 +56,13 @@ public class RNDebugLibsModule extends ReactContextBaseJavaModule {
|
|
|
55
56
|
|
|
56
57
|
@ReactMethod
|
|
57
58
|
public void showDoraemonKit() {
|
|
59
|
+
Toast.makeText(reactContext, "showDoraemonKit被调用", Toast.LENGTH_SHORT).show();
|
|
58
60
|
DoKit.showToolPanel();
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
@ReactMethod
|
|
62
64
|
public void hideDoraemonKit() {
|
|
65
|
+
Toast.makeText(reactContext, "hideDoraemonKit被调用", Toast.LENGTH_SHORT).show();
|
|
63
66
|
DoKit.hideToolPanel();
|
|
64
67
|
}
|
|
65
68
|
}
|
package/lib/NativeDebugLibs.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native'
|
|
2
2
|
|
|
3
|
+
// 添加调试日志,查看是否正确获取了RNDebugLibs模块
|
|
3
4
|
const { RNDebugLibs } = NativeModules
|
|
5
|
+
console.log('Available Native Modules:', Object.keys(NativeModules))
|
|
6
|
+
console.log('RNDebugLibs module loaded:', !!RNDebugLibs)
|
|
4
7
|
|
|
5
8
|
export default class NativeDebugLibs {
|
|
6
9
|
// FLEX methods (iOS only)
|
|
@@ -24,20 +27,29 @@ export default class NativeDebugLibs {
|
|
|
24
27
|
|
|
25
28
|
// DoraemonKit/DoKit methods
|
|
26
29
|
static installDoraemonKit(productId) {
|
|
30
|
+
console.log('Calling installDoraemonKit with:', productId)
|
|
27
31
|
if (RNDebugLibs) {
|
|
28
32
|
RNDebugLibs.installDoraemonKit(productId)
|
|
33
|
+
} else {
|
|
34
|
+
console.warn('RNDebugLibs module not available')
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
static showDoraemonKit() {
|
|
39
|
+
console.log('Calling showDoraemonKit')
|
|
33
40
|
if (RNDebugLibs) {
|
|
34
41
|
RNDebugLibs.showDoraemonKit()
|
|
42
|
+
} else {
|
|
43
|
+
console.warn('RNDebugLibs module not available')
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
static hideDoraemonKit() {
|
|
48
|
+
console.log('Calling hideDoraemonKit')
|
|
39
49
|
if (RNDebugLibs) {
|
|
40
50
|
RNDebugLibs.hideDoraemonKit()
|
|
51
|
+
} else {
|
|
52
|
+
console.warn('RNDebugLibs module not available')
|
|
41
53
|
}
|
|
42
54
|
}
|
|
43
55
|
}
|
package/package.json
CHANGED