react-native-debug-toolkit 0.4.0 → 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 +34 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsModule.java +16 -11
- package/package.json +1 -1
- package/react-native.config.js +3 -0
- package/android/src/main/java/com/debugtoolkit/BuildTypeModule.java +0 -44
- package/android/src/main/java/com/debugtoolkit/BuildTypePackage.java +0 -24
|
@@ -0,0 +1,34 @@
|
|
|
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 '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'
|
|
32
|
+
implementation 'com.android.volley:volley:1.2.0'
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -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,6 +1,7 @@
|
|
|
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;
|
|
@@ -42,24 +43,28 @@ public class RNDebugLibsModule extends ReactContextBaseJavaModule {
|
|
|
42
43
|
// FLEX is iOS only
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
@ReactMethod
|
|
46
|
-
public void installDoraemonKit(String productId) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
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
|
+
// }
|
|
55
56
|
|
|
56
57
|
@ReactMethod
|
|
57
58
|
public void showDoraemonKit() {
|
|
58
59
|
DoKit.showToolPanel();
|
|
60
|
+
DoKit.show();
|
|
61
|
+
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
@ReactMethod
|
|
62
65
|
public void hideDoraemonKit() {
|
|
63
|
-
|
|
66
|
+
// Toast.makeText(reactContext, "hideDoraemonKit被调用", Toast.LENGTH_SHORT).show();
|
|
67
|
+
// DoKit.hideToolPanel();
|
|
68
|
+
DoKit.hide();
|
|
64
69
|
}
|
|
65
70
|
}
|
package/package.json
CHANGED
package/react-native.config.js
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
|
-
}
|