react-native-inapp-inspector 1.1.28 → 1.1.31

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.
Files changed (77) hide show
  1. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +29 -80
  2. package/dist/commonjs/components/AnalyticsDetail.js +668 -108
  3. package/dist/commonjs/components/AppHeaderLogo.js +15 -15
  4. package/dist/commonjs/components/ConsoleLogCard.js +112 -66
  5. package/dist/commonjs/components/CopyButton.js +15 -1
  6. package/dist/commonjs/components/DomainHeader.js +64 -32
  7. package/dist/commonjs/components/HighlightText.js +7 -1
  8. package/dist/commonjs/components/Inspector/AnalyticsTab.js +332 -221
  9. package/dist/commonjs/components/Inspector/ConsoleTab.js +162 -56
  10. package/dist/commonjs/components/Inspector/InspectorHeader.js +70 -119
  11. package/dist/commonjs/components/Inspector/LogDetail.js +53 -17
  12. package/dist/commonjs/components/Inspector/MainScreen.js +4 -0
  13. package/dist/commonjs/components/Inspector/NetworkDetail.js +24 -24
  14. package/dist/commonjs/components/Inspector/NetworkTab.js +4 -1
  15. package/dist/commonjs/components/Inspector/ReduxDetail.js +237 -42
  16. package/dist/commonjs/components/Inspector/ReduxTab.js +456 -35
  17. package/dist/commonjs/components/JsonViewer.js +26 -4
  18. package/dist/commonjs/components/LogCard.js +103 -11
  19. package/dist/commonjs/components/NetworkIcons.js +19 -10
  20. package/dist/commonjs/components/Toast.d.ts +3 -0
  21. package/dist/commonjs/components/Toast.js +152 -0
  22. package/dist/commonjs/components/TouchableScale.d.ts +1 -0
  23. package/dist/commonjs/components/TouchableScale.js +3 -3
  24. package/dist/commonjs/components/TreeNode.js +12 -2
  25. package/dist/commonjs/constants/index.js +6 -6
  26. package/dist/commonjs/constants/version.d.ts +1 -1
  27. package/dist/commonjs/constants/version.js +1 -1
  28. package/dist/commonjs/customHooks/reduxLogger.js +128 -5
  29. package/dist/commonjs/helpers/index.d.ts +4 -0
  30. package/dist/commonjs/helpers/index.js +107 -92
  31. package/dist/commonjs/helpers/toast.d.ts +4 -0
  32. package/dist/commonjs/helpers/toast.js +20 -0
  33. package/dist/commonjs/i18n/locales/en.json +49 -3
  34. package/dist/commonjs/styles/AppColors.d.ts +6 -0
  35. package/dist/commonjs/styles/AppColors.js +6 -0
  36. package/dist/commonjs/styles/index.d.ts +82 -15
  37. package/dist/commonjs/styles/index.js +92 -26
  38. package/dist/commonjs/types/interfaces.d.ts +7 -0
  39. package/dist/esm/components/AnalyticsDetail.js +670 -110
  40. package/dist/esm/components/AppHeaderLogo.js +15 -15
  41. package/dist/esm/components/ConsoleLogCard.js +114 -68
  42. package/dist/esm/components/CopyButton.js +15 -1
  43. package/dist/esm/components/DomainHeader.js +64 -32
  44. package/dist/esm/components/HighlightText.js +7 -1
  45. package/dist/esm/components/Inspector/AnalyticsTab.js +334 -223
  46. package/dist/esm/components/Inspector/ConsoleTab.js +163 -57
  47. package/dist/esm/components/Inspector/InspectorHeader.js +71 -120
  48. package/dist/esm/components/Inspector/LogDetail.js +55 -19
  49. package/dist/esm/components/Inspector/MainScreen.js +4 -0
  50. package/dist/esm/components/Inspector/NetworkDetail.js +25 -25
  51. package/dist/esm/components/Inspector/NetworkTab.js +4 -1
  52. package/dist/esm/components/Inspector/ReduxDetail.js +239 -44
  53. package/dist/esm/components/Inspector/ReduxTab.js +458 -37
  54. package/dist/esm/components/JsonViewer.js +26 -4
  55. package/dist/esm/components/LogCard.js +105 -13
  56. package/dist/esm/components/NetworkIcons.js +19 -10
  57. package/dist/esm/components/Toast.d.ts +3 -0
  58. package/dist/esm/components/Toast.js +117 -0
  59. package/dist/esm/components/TouchableScale.d.ts +1 -0
  60. package/dist/esm/components/TouchableScale.js +3 -3
  61. package/dist/esm/components/TreeNode.js +12 -2
  62. package/dist/esm/constants/index.js +6 -6
  63. package/dist/esm/constants/version.d.ts +1 -1
  64. package/dist/esm/constants/version.js +1 -1
  65. package/dist/esm/customHooks/reduxLogger.js +128 -5
  66. package/dist/esm/helpers/index.d.ts +4 -0
  67. package/dist/esm/helpers/index.js +102 -92
  68. package/dist/esm/helpers/toast.d.ts +4 -0
  69. package/dist/esm/helpers/toast.js +15 -0
  70. package/dist/esm/i18n/locales/en.json +49 -3
  71. package/dist/esm/styles/AppColors.d.ts +6 -0
  72. package/dist/esm/styles/AppColors.js +6 -0
  73. package/dist/esm/styles/index.d.ts +82 -15
  74. package/dist/esm/styles/index.js +92 -26
  75. package/dist/esm/types/interfaces.d.ts +7 -0
  76. package/ios/NetworkInspectorModule.m +0 -10
  77. package/package.json +13 -10
@@ -1,8 +1,5 @@
1
1
  package com.inappinspector;
2
2
 
3
- import android.content.ClipData;
4
- import android.content.ClipboardManager;
5
- import android.content.Context;
6
3
  import android.os.Handler;
7
4
  import android.os.Looper;
8
5
  import android.util.Log;
@@ -31,7 +28,6 @@ public class NetworkInspectorModule extends ReactContextBaseJavaModule {
31
28
  public NetworkInspectorModule(ReactApplicationContext reactContext) {
32
29
  super(reactContext);
33
30
  this.reactContext = reactContext;
34
- setupNativeCrashProtection();
35
31
  }
36
32
 
37
33
  @NonNull
@@ -41,55 +37,39 @@ public class NetworkInspectorModule extends ReactContextBaseJavaModule {
41
37
  }
42
38
 
43
39
  private void setupNativeCrashProtection() {
44
- if (isProtectionEnabled) return;
45
- isProtectionEnabled = true;
46
-
47
- try {
48
- defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
49
- Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
50
- @Override
51
- public void uncaughtException(@NonNull Thread thread, @NonNull Throwable throwable) {
52
- try {
53
- StringWriter sw = new StringWriter();
54
- PrintWriter pw = new PrintWriter(sw);
55
- throwable.printStackTrace(pw);
56
- String stackTrace = sw.toString();
57
- String message = throwable.getMessage() != null ? throwable.getMessage() : throwable.toString();
58
-
59
- Log.e(TAG, "Intercepted Android Native Crash: " + message, throwable);
60
-
61
- sendCrashEventToJS(message, stackTrace, thread.getName());
62
- } catch (Exception e) {
63
- Log.e(TAG, "Failed to dispatch native crash event", e);
64
- }
65
-
66
- // Keep main looper processing to prevent instant process exit
67
- if (Looper.myLooper() != null) {
68
- while (true) {
69
- try {
70
- Looper.loop();
71
- } catch (Throwable inner) {
72
- Log.e(TAG, "Caught inner loop exception", inner);
73
- }
74
- }
75
- }
76
- }
77
- });
78
- } catch (Exception e) {
79
- Log.e(TAG, "Error installing uncaught exception handler", e);
40
+ if (isProtectionEnabled) {
41
+ return;
80
42
  }
43
+ defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
44
+ Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
45
+ try {
46
+ handleNativeCrash(thread, throwable);
47
+ } catch (Exception e) {
48
+ Log.e(TAG, "Error in native crash handler", e);
49
+ } finally {
50
+ if (defaultHandler != null) {
51
+ defaultHandler.uncaughtException(thread, throwable);
52
+ }
53
+ }
54
+ });
55
+ isProtectionEnabled = true;
56
+ Log.i(TAG, "Native crash protection enabled");
81
57
  }
82
58
 
83
- private void sendCrashEventToJS(String message, String stackTrace, String threadName) {
59
+ private void handleNativeCrash(Thread thread, Throwable throwable) {
84
60
  try {
85
- if (reactContext != null && reactContext.hasActiveReactInstance()) {
86
- WritableMap params = Arguments.createMap();
87
- params.putString("platform", "android");
88
- params.putString("message", message);
89
- params.putString("stack", stackTrace);
90
- params.putString("thread", threadName);
91
- params.putDouble("timestamp", System.currentTimeMillis());
92
-
61
+ StringWriter sw = new StringWriter();
62
+ PrintWriter pw = new PrintWriter(sw);
63
+ throwable.printStackTrace(pw);
64
+ String stackTrace = sw.toString();
65
+
66
+ WritableMap params = Arguments.createMap();
67
+ params.putString("error", throwable.getMessage() != null ? throwable.getMessage() : "Unknown native crash");
68
+ params.putString("name", throwable.getClass().getName());
69
+ params.putString("stack", stackTrace);
70
+ params.putDouble("timestamp", System.currentTimeMillis());
71
+
72
+ if (reactContext.hasActiveReactInstance()) {
93
73
  reactContext
94
74
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
95
75
  .emit("onNativeCrash", params);
@@ -105,37 +85,6 @@ public class NetworkInspectorModule extends ReactContextBaseJavaModule {
105
85
  promise.resolve(true);
106
86
  }
107
87
 
108
- @ReactMethod
109
- public void copyToClipboard(String text, Promise promise) {
110
- try {
111
- Handler mainHandler = new Handler(Looper.getMainLooper());
112
- mainHandler.post(() -> {
113
- try {
114
- ClipboardManager clipboard = (ClipboardManager) reactContext.getSystemService(Context.CLIPBOARD_SERVICE);
115
- if (clipboard != null) {
116
- ClipData clip = ClipData.newPlainText("NetworkInspector", text != null ? text : "");
117
- clipboard.setPrimaryClip(clip);
118
- if (promise != null) {
119
- promise.resolve(true);
120
- }
121
- return;
122
- }
123
- if (promise != null) {
124
- promise.resolve(false);
125
- }
126
- } catch (Exception e) {
127
- if (promise != null) {
128
- promise.reject("CLIPBOARD_ERROR", e.getMessage(), e);
129
- }
130
- }
131
- });
132
- } catch (Exception e) {
133
- if (promise != null) {
134
- promise.reject("CLIPBOARD_ERROR", e.getMessage(), e);
135
- }
136
- }
137
- }
138
-
139
88
  @ReactMethod
140
89
  public void addListener(String eventName) {
141
90
  // Required for RN built-in Event Emitter