react-native-debug-toolkit 0.6.3 → 2.0.0
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/LICENSE +21 -0
- package/README.md +150 -212
- package/lib/commonjs/components/ClipboardTab.js +92 -0
- package/lib/commonjs/components/ClipboardTab.js.map +1 -0
- package/lib/commonjs/components/ConsoleLogTab.js +295 -0
- package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/components/EnvironmentTab.js +288 -0
- package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/components/FloatPanelView.js +797 -0
- package/lib/commonjs/components/FloatPanelView.js.map +1 -0
- package/lib/commonjs/components/NavigationLogTab.js +131 -0
- package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/components/NetworkLogTab.js +575 -0
- package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/components/TrackLogTab.js +372 -0
- package/lib/commonjs/components/TrackLogTab.js.map +1 -0
- package/lib/commonjs/components/ZustandLogTab.js +451 -0
- package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/components/shared/CopyButton.js +64 -0
- package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/components/shared/JsonView.js +157 -0
- package/lib/commonjs/components/shared/JsonView.js.map +1 -0
- package/lib/commonjs/core/DebugToolkit.js +142 -0
- package/lib/commonjs/core/DebugToolkit.js.map +1 -0
- package/lib/commonjs/core/DebugToolkitProvider.js +64 -0
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
- package/lib/commonjs/features/ClipboardFeature.js +17 -0
- package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
- package/lib/commonjs/features/ConsoleLogFeature.js +98 -0
- package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
- package/lib/commonjs/features/EnvironmentFeature.js +168 -0
- package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
- package/lib/commonjs/features/NavigationLogFeature.js +60 -0
- package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
- package/lib/commonjs/features/NetworkFeature.js +328 -0
- package/lib/commonjs/features/NetworkFeature.js.map +1 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/commonjs/features/TrackFeature.js +55 -0
- package/lib/commonjs/features/TrackFeature.js.map +1 -0
- package/lib/commonjs/features/ZustandLogFeature.js +76 -0
- package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
- package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
- package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/index.js +165 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +161 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/native/NativeDebugLibs.js +58 -0
- package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/constants.js +135 -0
- package/lib/commonjs/utils/constants.js.map +1 -0
- package/lib/commonjs/utils/copyToComputer.js +97 -0
- package/lib/commonjs/utils/copyToComputer.js.map +1 -0
- package/lib/commonjs/utils/createEventChannel.js +21 -0
- package/lib/commonjs/utils/createEventChannel.js.map +1 -0
- package/lib/commonjs/utils/createObservableStore.js +38 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -0
- package/lib/commonjs/utils/safeStringify.js +27 -0
- package/lib/commonjs/utils/safeStringify.js.map +1 -0
- package/lib/module/components/ClipboardTab.js +86 -0
- package/lib/module/components/ClipboardTab.js.map +1 -0
- package/lib/module/components/ConsoleLogTab.js +290 -0
- package/lib/module/components/ConsoleLogTab.js.map +1 -0
- package/lib/module/components/EnvironmentTab.js +282 -0
- package/lib/module/components/EnvironmentTab.js.map +1 -0
- package/lib/module/components/FloatPanelView.js +791 -0
- package/lib/module/components/FloatPanelView.js.map +1 -0
- package/lib/module/components/NavigationLogTab.js +126 -0
- package/lib/module/components/NavigationLogTab.js.map +1 -0
- package/lib/module/components/NetworkLogTab.js +570 -0
- package/lib/module/components/NetworkLogTab.js.map +1 -0
- package/lib/module/components/ThirdPartyLibsTab.js +91 -0
- package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/components/TrackLogTab.js +367 -0
- package/lib/module/components/TrackLogTab.js.map +1 -0
- package/lib/module/components/ZustandLogTab.js +446 -0
- package/lib/module/components/ZustandLogTab.js.map +1 -0
- package/lib/module/components/shared/CollapsibleSection.js +78 -0
- package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/components/shared/CopyButton.js +58 -0
- package/lib/module/components/shared/CopyButton.js.map +1 -0
- package/lib/module/components/shared/JsonView.js +152 -0
- package/lib/module/components/shared/JsonView.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +137 -0
- package/lib/module/core/DebugToolkit.js.map +1 -0
- package/lib/module/core/DebugToolkitProvider.js +58 -0
- package/lib/module/core/DebugToolkitProvider.js.map +1 -0
- package/lib/module/features/ClipboardFeature.js +12 -0
- package/lib/module/features/ClipboardFeature.js.map +1 -0
- package/lib/module/features/ConsoleLogFeature.js +93 -0
- package/lib/module/features/ConsoleLogFeature.js.map +1 -0
- package/lib/module/features/EnvironmentFeature.js +164 -0
- package/lib/module/features/EnvironmentFeature.js.map +1 -0
- package/lib/module/features/NavigationLogFeature.js +54 -0
- package/lib/module/features/NavigationLogFeature.js.map +1 -0
- package/lib/module/features/NetworkFeature.js +322 -0
- package/lib/module/features/NetworkFeature.js.map +1 -0
- package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
- package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/module/features/TrackFeature.js +49 -0
- package/lib/module/features/TrackFeature.js.map +1 -0
- package/lib/module/features/ZustandLogFeature.js +69 -0
- package/lib/module/features/ZustandLogFeature.js.map +1 -0
- package/lib/module/hooks/useNavigationLogger.js +74 -0
- package/lib/module/hooks/useNavigationLogger.js.map +1 -0
- package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
- package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +156 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/native/NativeDebugLibs.js +54 -0
- package/lib/module/native/NativeDebugLibs.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/constants.js +130 -0
- package/lib/module/utils/constants.js.map +1 -0
- package/lib/module/utils/copyToComputer.js +91 -0
- package/lib/module/utils/copyToComputer.js.map +1 -0
- package/lib/module/utils/createEventChannel.js +17 -0
- package/lib/module/utils/createEventChannel.js.map +1 -0
- package/lib/module/utils/createObservableStore.js +34 -0
- package/lib/module/utils/createObservableStore.js.map +1 -0
- package/lib/module/utils/safeStringify.js +23 -0
- package/lib/module/utils/safeStringify.js.map +1 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts +64 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +27 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +18 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts +3 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +7 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts +8 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts +28 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/TrackFeature.d.ts +12 -0
- package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts +29 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts +20 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +26 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/initialize.d.ts +51 -0
- package/lib/typescript/src/initialize.d.ts.map +1 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +112 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/constants.d.ts +96 -0
- package/lib/typescript/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
- package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
- package/package.json +63 -24
- package/src/components/ClipboardTab.tsx +81 -0
- package/src/components/ConsoleLogTab.tsx +209 -0
- package/src/components/EnvironmentTab.tsx +276 -0
- package/src/components/FloatPanelView.tsx +714 -0
- package/src/components/NavigationLogTab.tsx +66 -0
- package/src/components/NetworkLogTab.tsx +411 -0
- package/src/components/ThirdPartyLibsTab.tsx +63 -0
- package/src/components/TrackLogTab.tsx +245 -0
- package/src/components/ZustandLogTab.tsx +305 -0
- package/src/components/shared/CollapsibleSection.tsx +78 -0
- package/src/components/shared/CopyButton.tsx +68 -0
- package/src/components/shared/JsonView.tsx +125 -0
- package/src/core/DebugToolkit.tsx +174 -0
- package/src/core/DebugToolkitProvider.tsx +89 -0
- package/src/features/ClipboardFeature.ts +11 -0
- package/src/features/ConsoleLogFeature.ts +118 -0
- package/src/features/EnvironmentFeature.ts +194 -0
- package/src/features/NavigationLogFeature.ts +74 -0
- package/src/features/NetworkFeature.ts +488 -0
- package/src/features/ThirdPartyLibsFeature.ts +42 -0
- package/src/features/TrackFeature.ts +69 -0
- package/src/features/ZustandLogFeature.ts +127 -0
- package/src/hooks/useNavigationLogger.ts +107 -0
- package/src/hooks/useSlideDetailAnimation.ts +45 -0
- package/src/index.ts +52 -0
- package/src/initialize.ts +214 -0
- package/src/native/NativeDebugLibs.ts +74 -0
- package/src/types/index.ts +138 -0
- package/src/utils/constants.ts +91 -0
- package/src/utils/copyToComputer.ts +104 -0
- package/src/utils/createEventChannel.ts +22 -0
- package/src/utils/createObservableStore.ts +42 -0
- package/src/utils/safeStringify.ts +25 -0
- package/.cursor/rules/react-native.mdc +0 -41
- package/README.zh-CN.md +0 -230
- package/android/build.gradle +0 -34
- package/android/src/main/AndroidManifest.xml +0 -8
- package/android/src/main/java/com/reactnative/debuglibs/BuildTypeModule.java +0 -44
- package/android/src/main/java/com/reactnative/debuglibs/BuildTypePackage.java +0 -25
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsModule.java +0 -75
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsPackage.java +0 -28
- package/index.js +0 -41
- package/ios/BuildTypeModule.h +0 -9
- package/ios/BuildTypeModule.m +0 -42
- package/ios/RNDebugLibs.h +0 -10
- package/ios/RNDebugLibs.m +0 -79
- package/lib/DebugToolKit.js +0 -126
- package/lib/EnvironmentManager.ts +0 -80
- package/lib/NativeDebugLibs.js +0 -67
- package/lib/features/ConsoleLogFeature.js +0 -70
- package/lib/features/NavigationLogFeature.js +0 -45
- package/lib/features/NetworkFeature.js +0 -389
- package/lib/features/PerformanceFeature.js +0 -390
- package/lib/features/ThirdPartyLibsFeature.js +0 -63
- package/lib/features/TrackFeature.js +0 -94
- package/lib/features/ZustandLogFeature.js +0 -44
- package/lib/hooks/useNavigationLogger.js +0 -92
- package/lib/index.js +0 -114
- package/lib/navigation/NavigationLogger.js +0 -1
- package/lib/types/TrackTypes.ts +0 -92
- package/lib/utils/DebugConst.js +0 -67
- package/lib/utils/StorageUtils.js +0 -80
- package/lib/views/ConsoleLogDetails.js +0 -314
- package/lib/views/FloatPanelView.js +0 -697
- package/lib/views/HttpLogDetails.js +0 -648
- package/lib/views/NavigationLogDetails.js +0 -302
- package/lib/views/RestartModal.js +0 -75
- package/lib/views/SubViewConsoleLogs.js +0 -209
- package/lib/views/SubViewEnvironment.js +0 -73
- package/lib/views/SubViewHTTPLogs.js +0 -235
- package/lib/views/SubViewNavigationLogs.js +0 -199
- package/lib/views/SubViewPerformance.js +0 -515
- package/lib/views/SubViewThirdPartyLibs.js +0 -239
- package/lib/views/SubViewTrackLogs.js +0 -318
- package/lib/views/SubViewZustandLogs.js +0 -279
- package/lib/views/TabView.js +0 -66
- package/lib/views/TrackLogDetails.js +0 -481
- package/lib/views/ZustandLogDetails.js +0 -355
- package/react-native-debug-toolkit.podspec +0 -25
- package/react-native.config.js +0 -18
package/android/build.gradle
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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,44 +0,0 @@
|
|
|
1
|
-
package com.reactnative.debuglibs;
|
|
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,25 +0,0 @@
|
|
|
1
|
-
package com.reactnative.debuglibs;
|
|
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
|
-
modules.add(new RNDebugLibsModule(reactContext));
|
|
18
|
-
return modules;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Override
|
|
22
|
-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
23
|
-
return Collections.emptyList();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
package com.reactnative.debuglibs;
|
|
2
|
-
|
|
3
|
-
import android.app.Application;
|
|
4
|
-
import androidx.annotation.NonNull;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
9
|
-
|
|
10
|
-
import com.didichuxing.doraemonkit.DoKit;
|
|
11
|
-
import com.didichuxing.doraemonkit.kit.AbstractKit;
|
|
12
|
-
|
|
13
|
-
import java.util.ArrayList;
|
|
14
|
-
import java.util.List;
|
|
15
|
-
|
|
16
|
-
public class RNDebugLibsModule extends ReactContextBaseJavaModule {
|
|
17
|
-
private final ReactApplicationContext reactContext;
|
|
18
|
-
|
|
19
|
-
public RNDebugLibsModule(ReactApplicationContext reactContext) {
|
|
20
|
-
super(reactContext);
|
|
21
|
-
this.reactContext = reactContext;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@NonNull
|
|
25
|
-
@Override
|
|
26
|
-
public String getName() {
|
|
27
|
-
return "RNDebugLibs";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@ReactMethod
|
|
31
|
-
public void showExplorer() {
|
|
32
|
-
// FLEX is iOS only
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@ReactMethod
|
|
36
|
-
public void hideExplorer() {
|
|
37
|
-
// FLEX is iOS only
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@ReactMethod
|
|
41
|
-
public void toggleExplorer() {
|
|
42
|
-
// FLEX is iOS only
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// @ReactMethod
|
|
46
|
-
// public void installDoraemonKit(String productId) {
|
|
47
|
-
// Application app = (Application) reactContext.getApplicationContext();
|
|
48
|
-
// List<AbstractKit> kits = new ArrayList<>();
|
|
49
|
-
// // Initialize DoKit with custom kits if needed
|
|
50
|
-
// DoKit.Builder(app)
|
|
51
|
-
// .productId(productId)
|
|
52
|
-
// .customKits(kits)
|
|
53
|
-
// .build();
|
|
54
|
-
// }
|
|
55
|
-
|
|
56
|
-
@ReactMethod
|
|
57
|
-
public void showDoraemonKit() {
|
|
58
|
-
reactContext.runOnUiQueueThread(new Runnable() {
|
|
59
|
-
@Override
|
|
60
|
-
public void run() {
|
|
61
|
-
DoKit.show();
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@ReactMethod
|
|
67
|
-
public void hideDoraemonKit() {
|
|
68
|
-
reactContext.runOnUiQueueThread(new Runnable() {
|
|
69
|
-
@Override
|
|
70
|
-
public void run() {
|
|
71
|
-
DoKit.hide();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package com.reactnative.debuglibs;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.ReactPackage;
|
|
6
|
-
import com.facebook.react.bridge.NativeModule;
|
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
-
|
|
10
|
-
import java.util.ArrayList;
|
|
11
|
-
import java.util.Collections;
|
|
12
|
-
import java.util.List;
|
|
13
|
-
|
|
14
|
-
public class RNDebugLibsPackage implements ReactPackage {
|
|
15
|
-
@NonNull
|
|
16
|
-
@Override
|
|
17
|
-
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
18
|
-
List<NativeModule> modules = new ArrayList<>();
|
|
19
|
-
modules.add(new RNDebugLibsModule(reactContext));
|
|
20
|
-
return modules;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@NonNull
|
|
24
|
-
@Override
|
|
25
|
-
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
26
|
-
return Collections.emptyList();
|
|
27
|
-
}
|
|
28
|
-
}
|
package/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Native Debug Toolkit
|
|
3
|
-
* A comprehensive debugging toolkit for React Native
|
|
4
|
-
*/
|
|
5
|
-
import DebugToolKit from './lib/DebugToolKit'
|
|
6
|
-
import { initializeDebugToolkit, isDebugMode } from './lib'
|
|
7
|
-
|
|
8
|
-
import { createNetworkFeature } from './lib/features/NetworkFeature'
|
|
9
|
-
import { createPerformanceFeature } from './lib/features/PerformanceFeature'
|
|
10
|
-
import { createConsoleLogFeature } from './lib/features/ConsoleLogFeature'
|
|
11
|
-
import { createZustandLogFeature, addZustandLog } from './lib/features/ZustandLogFeature'
|
|
12
|
-
import { createNavigationLogFeature, addNavigationLog } from './lib/features/NavigationLogFeature'
|
|
13
|
-
import { useNavigationLogger } from './lib/hooks/useNavigationLogger'
|
|
14
|
-
import { createTrackFeature, addTrackLog } from './lib/features/TrackFeature'
|
|
15
|
-
|
|
16
|
-
// Function to clear all logs and close the panel
|
|
17
|
-
const clearAll = () => {
|
|
18
|
-
const instance = DebugToolKit.instance;
|
|
19
|
-
if (instance && typeof instance.clearAll === 'function') {
|
|
20
|
-
instance.clearAll();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
DebugToolKit,
|
|
26
|
-
initializeDebugToolkit,
|
|
27
|
-
createNetworkFeature,
|
|
28
|
-
createPerformanceFeature,
|
|
29
|
-
createConsoleLogFeature,
|
|
30
|
-
createZustandLogFeature,
|
|
31
|
-
addZustandLog,
|
|
32
|
-
createNavigationLogFeature,
|
|
33
|
-
addNavigationLog,
|
|
34
|
-
addTrackLog,
|
|
35
|
-
useNavigationLogger,
|
|
36
|
-
isDebugMode,
|
|
37
|
-
clearAll,
|
|
38
|
-
createTrackFeature
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default DebugToolKit
|
package/ios/BuildTypeModule.h
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* BuildTypeModule
|
|
5
|
-
* Native module that provides information about the current build type (debug or release)
|
|
6
|
-
* Used to conditionally enable debugging tools only in debug builds
|
|
7
|
-
*/
|
|
8
|
-
@interface BuildTypeModule : NSObject <RCTBridgeModule>
|
|
9
|
-
@end
|
package/ios/BuildTypeModule.m
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#import "BuildTypeModule.h"
|
|
2
|
-
|
|
3
|
-
@implementation BuildTypeModule
|
|
4
|
-
|
|
5
|
-
RCT_EXPORT_MODULE();
|
|
6
|
-
|
|
7
|
-
+ (BOOL)requiresMainQueueSetup
|
|
8
|
-
{
|
|
9
|
-
return NO;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
- (NSDictionary *)constantsToExport
|
|
13
|
-
{
|
|
14
|
-
#ifdef DEBUG
|
|
15
|
-
NSString *buildType = @"debug";
|
|
16
|
-
#else
|
|
17
|
-
NSString *buildType = @"release";
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
return @{ @"buildType": buildType };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getBuildTypeSync)
|
|
24
|
-
{
|
|
25
|
-
#ifdef DEBUG
|
|
26
|
-
return @"debug";
|
|
27
|
-
#else
|
|
28
|
-
return @"release";
|
|
29
|
-
#endif
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
RCT_EXPORT_METHOD(getBuildType:(RCTPromiseResolveBlock)resolve
|
|
33
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
34
|
-
{
|
|
35
|
-
#ifdef DEBUG
|
|
36
|
-
resolve(@"debug");
|
|
37
|
-
#else
|
|
38
|
-
resolve(@"release");
|
|
39
|
-
#endif
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@end
|
package/ios/RNDebugLibs.h
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* RNDebugLibs
|
|
5
|
-
* Native module that provides access to FLEX and DoraemonKit debugging tools
|
|
6
|
-
* Note: These debugging tools are only available in DEBUG builds
|
|
7
|
-
*/
|
|
8
|
-
@interface RNDebugLibs : NSObject <RCTBridgeModule>
|
|
9
|
-
|
|
10
|
-
@end
|
package/ios/RNDebugLibs.m
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#import "RNDebugLibs.h"
|
|
2
|
-
|
|
3
|
-
#ifdef DEBUG
|
|
4
|
-
#import "FLEXManager.h"
|
|
5
|
-
#import <DoraemonKit/DoraemonManager.h>
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
@implementation RNDebugLibs
|
|
9
|
-
|
|
10
|
-
// Export the module
|
|
11
|
-
RCT_EXPORT_MODULE();
|
|
12
|
-
|
|
13
|
-
RCT_EXPORT_METHOD(showExplorer)
|
|
14
|
-
{
|
|
15
|
-
#ifdef DEBUG
|
|
16
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
17
|
-
[[FLEXManager sharedManager] showExplorer];
|
|
18
|
-
});
|
|
19
|
-
#else
|
|
20
|
-
NSLog(@"[RNDebugLibs] showExplorer is only available in DEBUG builds");
|
|
21
|
-
#endif
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
RCT_EXPORT_METHOD(hideExplorer)
|
|
25
|
-
{
|
|
26
|
-
#ifdef DEBUG
|
|
27
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
28
|
-
[[FLEXManager sharedManager] hideExplorer];
|
|
29
|
-
});
|
|
30
|
-
#else
|
|
31
|
-
NSLog(@"[RNDebugLibs] hideExplorer is only available in DEBUG builds");
|
|
32
|
-
#endif
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
RCT_EXPORT_METHOD(toggleExplorer)
|
|
36
|
-
{
|
|
37
|
-
#ifdef DEBUG
|
|
38
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
39
|
-
[[FLEXManager sharedManager] toggleExplorer];
|
|
40
|
-
});
|
|
41
|
-
#else
|
|
42
|
-
NSLog(@"[RNDebugLibs] toggleExplorer is only available in DEBUG builds");
|
|
43
|
-
#endif
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
RCT_EXPORT_METHOD(installDoraemonKit:(NSString *)productId)
|
|
47
|
-
{
|
|
48
|
-
#ifdef DEBUG
|
|
49
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
50
|
-
[[DoraemonManager shareInstance] installWithPid:productId];
|
|
51
|
-
});
|
|
52
|
-
#else
|
|
53
|
-
NSLog(@"[RNDebugLibs] installDoraemonKit is only available in DEBUG builds");
|
|
54
|
-
#endif
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
RCT_EXPORT_METHOD(showDoraemonKit)
|
|
58
|
-
{
|
|
59
|
-
#ifdef DEBUG
|
|
60
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
61
|
-
[[DoraemonManager shareInstance] showDoraemon];
|
|
62
|
-
});
|
|
63
|
-
#else
|
|
64
|
-
NSLog(@"[RNDebugLibs] showDoraemonKit is only available in DEBUG builds");
|
|
65
|
-
#endif
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
RCT_EXPORT_METHOD(hideDoraemonKit)
|
|
69
|
-
{
|
|
70
|
-
#ifdef DEBUG
|
|
71
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
72
|
-
[[DoraemonManager shareInstance] hiddenDoraemon];
|
|
73
|
-
});
|
|
74
|
-
#else
|
|
75
|
-
NSLog(@"[RNDebugLibs] hideDoraemonKit is only available in DEBUG builds");
|
|
76
|
-
#endif
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@end
|
package/lib/DebugToolKit.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { BackHandler, Pressable, Text } from 'react-native'
|
|
3
|
-
import RootSiblings from 'react-native-root-siblings'
|
|
4
|
-
import FloatPanelView from './views/FloatPanelView'
|
|
5
|
-
import NativeDebugLibs from './NativeDebugLibs'
|
|
6
|
-
|
|
7
|
-
export default class DebugToolKit {
|
|
8
|
-
static instance = null
|
|
9
|
-
|
|
10
|
-
constructor(config = {}) {
|
|
11
|
-
if (DebugToolKit.instance) {
|
|
12
|
-
return DebugToolKit.instance
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Set the debug mode flag directly from NativeDebugLibs
|
|
16
|
-
// this.isDebugMode = NativeDebugLibs.isDebugBuild()
|
|
17
|
-
this.isDebugMode = true
|
|
18
|
-
|
|
19
|
-
this.floatPanel = null
|
|
20
|
-
this.features = []
|
|
21
|
-
this.isPanelVisible = false
|
|
22
|
-
|
|
23
|
-
const featuresToLoad = config.features || []
|
|
24
|
-
|
|
25
|
-
// Only load features in debug mode
|
|
26
|
-
if (this.isDebugMode) {
|
|
27
|
-
featuresToLoad.forEach(featureOrCreator => {
|
|
28
|
-
const feature = typeof featureOrCreator === 'function'
|
|
29
|
-
? featureOrCreator()
|
|
30
|
-
: featureOrCreator
|
|
31
|
-
this.addFeature(feature)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
if (config.autoShow) {
|
|
35
|
-
this.showDebugPanel()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
BackHandler.addEventListener('hardwareBackPress', () => true)
|
|
39
|
-
} else {
|
|
40
|
-
console.log('[DebugToolKit] Not initializing features - not in debug mode')
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
DebugToolKit.instance = this
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
addFeature(feature) {
|
|
47
|
-
if (!this.isDebugMode) return this;
|
|
48
|
-
|
|
49
|
-
if (feature && typeof feature.name === 'string') {
|
|
50
|
-
this.features.push(feature)
|
|
51
|
-
feature.setup?.()
|
|
52
|
-
} else {
|
|
53
|
-
console.warn('[DebugToolKit] Invalid feature added:', feature)
|
|
54
|
-
}
|
|
55
|
-
return this
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
clearAll = () => {
|
|
60
|
-
// Clear all logs from all features
|
|
61
|
-
this.features.forEach((feature) => {
|
|
62
|
-
if (typeof feature.cleanup === 'function') {
|
|
63
|
-
feature.cleanup();
|
|
64
|
-
}
|
|
65
|
-
// Re-setup the feature to initialize it again
|
|
66
|
-
if (typeof feature.setup === 'function') {
|
|
67
|
-
feature.setup();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
showDebugPanel = () => {
|
|
74
|
-
if (!this.isDebugMode) {
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!this.floatPanel) {
|
|
79
|
-
this.floatPanel = new RootSiblings(
|
|
80
|
-
<FloatPanelView
|
|
81
|
-
features={this.features}
|
|
82
|
-
close={this.hideDebugPanel}
|
|
83
|
-
clearAll={this.clearAll}
|
|
84
|
-
/>,
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
this.isPanelVisible = true
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
hideDebugPanel = () => {
|
|
91
|
-
if (this.floatPanel) {
|
|
92
|
-
this.floatPanel.destroy()
|
|
93
|
-
this.floatPanel = null
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
updateDebugPanel() {
|
|
98
|
-
if (this.floatPanel) {
|
|
99
|
-
this.floatPanel.update(
|
|
100
|
-
<FloatPanelView
|
|
101
|
-
features={this.features}
|
|
102
|
-
close={this.hideDebugPanel}
|
|
103
|
-
clearAll={this.clearAll}
|
|
104
|
-
/>,
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
destroy() {
|
|
110
|
-
this.hideDebugPanel()
|
|
111
|
-
|
|
112
|
-
if (this.restartModal) {
|
|
113
|
-
this.restartModal.destroy()
|
|
114
|
-
this.restartModal = null
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
this.features.forEach((feature) => {
|
|
118
|
-
if (typeof feature.cleanup === 'function') {
|
|
119
|
-
feature.cleanup()
|
|
120
|
-
}
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
this.features = []
|
|
124
|
-
BackHandler.removeEventListener('hardwareBackPress')
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
|
|
3
|
-
export type BaseEnvironmentConfig = {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export class EnvironmentManager<T extends BaseEnvironmentConfig> {
|
|
8
|
-
private static instance: EnvironmentManager<any>;
|
|
9
|
-
private currentEnv: string;
|
|
10
|
-
private environments: Record<string, T>;
|
|
11
|
-
private listeners: ((env: T) => void)[] = [];
|
|
12
|
-
static ENV_STORAGE_KEY = '@debug_toolkit_env';
|
|
13
|
-
|
|
14
|
-
protected constructor() {
|
|
15
|
-
this.environments = {};
|
|
16
|
-
this.currentEnv = '';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static getInstance<T extends BaseEnvironmentConfig>(): EnvironmentManager<T> {
|
|
20
|
-
if (!EnvironmentManager.instance) {
|
|
21
|
-
EnvironmentManager.instance = new EnvironmentManager<T>();
|
|
22
|
-
}
|
|
23
|
-
return EnvironmentManager.instance;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public async initialize(environments: Record<string, T>, defaultEnv: string): Promise<string> {
|
|
27
|
-
if (!__DEV__) return defaultEnv;
|
|
28
|
-
|
|
29
|
-
this.environments = environments;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const savedEnv = await AsyncStorage.getItem(EnvironmentManager.ENV_STORAGE_KEY);
|
|
33
|
-
this.currentEnv = savedEnv || defaultEnv;
|
|
34
|
-
await AsyncStorage.setItem(EnvironmentManager.ENV_STORAGE_KEY, this.currentEnv);
|
|
35
|
-
return this.currentEnv;
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.error('EnvironmentManager initialization error:', error);
|
|
38
|
-
this.currentEnv = defaultEnv;
|
|
39
|
-
return defaultEnv;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public async changeEnvironment(newValue: string): Promise<void> {
|
|
44
|
-
if (newValue === this.currentEnv) return;
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
await AsyncStorage.setItem(EnvironmentManager.ENV_STORAGE_KEY, newValue);
|
|
48
|
-
this.currentEnv = newValue;
|
|
49
|
-
|
|
50
|
-
const envConfig = this.environments[newValue];
|
|
51
|
-
this.listeners.forEach(listener => listener(envConfig));
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error('Failed to change environment:', error);
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public getCurrentEnvironment(): string {
|
|
59
|
-
return this.currentEnv;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public getEnvironmentConfig(): T {
|
|
63
|
-
return this.environments[this.currentEnv];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public getEnvironments(): Record<string, T> {
|
|
67
|
-
return this.environments;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public onEnvironmentChange(listener: (env: T) => void): () => void {
|
|
71
|
-
this.listeners.push(listener);
|
|
72
|
-
return () => {
|
|
73
|
-
this.listeners = this.listeners.filter(l => l !== listener);
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public destroy(): void {
|
|
78
|
-
this.listeners = [];
|
|
79
|
-
}
|
|
80
|
-
}
|
package/lib/NativeDebugLibs.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { NativeModules, Platform } from 'react-native'
|
|
2
|
-
|
|
3
|
-
const { RNDebugLibs, BuildTypeModule } = NativeModules
|
|
4
|
-
|
|
5
|
-
export default class NativeDebugLibs {
|
|
6
|
-
// Build type methods
|
|
7
|
-
static getBuildType() {
|
|
8
|
-
if (BuildTypeModule) {
|
|
9
|
-
return BuildTypeModule.getBuildType();
|
|
10
|
-
}
|
|
11
|
-
return Promise.resolve(null);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static getBuildTypeSync() {
|
|
15
|
-
console.log('BuildTypeModule', BuildTypeModule);
|
|
16
|
-
if (BuildTypeModule) {
|
|
17
|
-
console.log('BuildTypeModule.getBuildTypeSync()', BuildTypeModule.getBuildTypeSync());
|
|
18
|
-
return BuildTypeModule.getBuildTypeSync();
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static isDebugBuild() {
|
|
24
|
-
if (BuildTypeModule) {
|
|
25
|
-
return BuildTypeModule.getBuildTypeSync() === 'debug';
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// FLEX methods (iOS only)
|
|
31
|
-
static showExplorer() {
|
|
32
|
-
if (Platform.OS === 'ios' && RNDebugLibs) {
|
|
33
|
-
RNDebugLibs.showExplorer()
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static hideExplorer() {
|
|
38
|
-
if (Platform.OS === 'ios' && RNDebugLibs) {
|
|
39
|
-
RNDebugLibs.hideExplorer()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
static toggleExplorer() {
|
|
44
|
-
if (Platform.OS === 'ios' && RNDebugLibs) {
|
|
45
|
-
RNDebugLibs.toggleExplorer()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// DoraemonKit/DoKit methods
|
|
50
|
-
static installDoraemonKit(productId) {
|
|
51
|
-
// if (RNDebugLibs) {
|
|
52
|
-
// RNDebugLibs.installDoraemonKit(productId)
|
|
53
|
-
// }
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
static showDoraemonKit() {
|
|
57
|
-
// if (RNDebugLibs) {
|
|
58
|
-
// RNDebugLibs.showDoraemonKit()
|
|
59
|
-
// }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static hideDoraemonKit() {
|
|
63
|
-
// if (RNDebugLibs) {
|
|
64
|
-
// RNDebugLibs.hideDoraemonKit()
|
|
65
|
-
// }
|
|
66
|
-
}
|
|
67
|
-
}
|