react-native-inapp-inspector 1.1.25 → 1.1.26
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 +36 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +114 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.java +28 -0
- package/dist/commonjs/components/ErrorBoundary.d.ts +1 -1
- package/dist/commonjs/components/ErrorBoundary.js +9 -145
- package/dist/commonjs/components/Inspector/CrashDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/CrashDetail.js +796 -0
- package/dist/commonjs/components/Inspector/CrashFilterModal.d.ts +20 -0
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +597 -0
- package/dist/commonjs/components/Inspector/CrashTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/CrashTab.js +727 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +52 -23
- package/dist/commonjs/components/Inspector/LogDetail.js +4 -3
- package/dist/commonjs/components/Inspector/MainScreen.js +12 -3
- package/dist/commonjs/components/Inspector/SettingsPanel.js +90 -1
- package/dist/commonjs/components/Inspector/TabBar.js +15 -3
- package/dist/commonjs/components/NetworkIcons.d.ts +11 -0
- package/dist/commonjs/components/NetworkIcons.js +96 -1
- package/dist/commonjs/components/SegmentedTabs.js +2 -1
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.js +70 -44
- package/dist/commonjs/customHooks/consoleLogger.d.ts +1 -0
- package/dist/commonjs/customHooks/consoleLogger.js +70 -6
- package/dist/commonjs/customHooks/crashHandler.d.ts +64 -0
- package/dist/commonjs/customHooks/crashHandler.js +681 -0
- package/dist/commonjs/customHooks/networkLogger.js +64 -48
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -1
- package/dist/commonjs/i18n/locales/en.json +131 -0
- package/dist/commonjs/index.d.ts +3 -1
- package/dist/commonjs/index.js +95 -1
- package/dist/commonjs/types/enums.d.ts +41 -0
- package/dist/commonjs/types/enums.js +37 -1
- package/dist/commonjs/types/interfaces.d.ts +51 -1
- package/dist/esm/components/ErrorBoundary.d.ts +1 -1
- package/dist/esm/components/ErrorBoundary.js +10 -113
- package/dist/esm/components/Inspector/CrashDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/CrashDetail.js +758 -0
- package/dist/esm/components/Inspector/CrashFilterModal.d.ts +20 -0
- package/dist/esm/components/Inspector/CrashFilterModal.js +557 -0
- package/dist/esm/components/Inspector/CrashTab.d.ts +3 -0
- package/dist/esm/components/Inspector/CrashTab.js +689 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +52 -23
- package/dist/esm/components/Inspector/LogDetail.js +4 -3
- package/dist/esm/components/Inspector/MainScreen.js +12 -3
- package/dist/esm/components/Inspector/SettingsPanel.js +91 -2
- package/dist/esm/components/Inspector/TabBar.js +16 -4
- package/dist/esm/components/NetworkIcons.d.ts +11 -0
- package/dist/esm/components/NetworkIcons.js +83 -0
- package/dist/esm/components/SegmentedTabs.js +2 -1
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.js +70 -44
- package/dist/esm/customHooks/consoleLogger.d.ts +1 -0
- package/dist/esm/customHooks/consoleLogger.js +68 -5
- package/dist/esm/customHooks/crashHandler.d.ts +64 -0
- package/dist/esm/customHooks/crashHandler.js +659 -0
- package/dist/esm/customHooks/networkLogger.js +64 -48
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -1
- package/dist/esm/i18n/locales/en.json +131 -0
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +73 -1
- package/dist/esm/types/enums.d.ts +41 -0
- package/dist/esm/types/enums.js +36 -0
- package/dist/esm/types/interfaces.d.ts +51 -1
- package/ios/NetworkInspectorModule.h +6 -0
- package/ios/NetworkInspectorModule.m +125 -0
- package/package.json +5 -2
- package/react-native-inapp-inspector.podspec +18 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#import "NetworkInspectorModule.h"
|
|
2
|
+
#import <execinfo.h>
|
|
3
|
+
#import <signal.h>
|
|
4
|
+
#import <unistd.h>
|
|
5
|
+
|
|
6
|
+
static NetworkInspectorModule *sharedInstance = nil;
|
|
7
|
+
static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
|
|
8
|
+
|
|
9
|
+
static void NativeSignalHandler(int signalNumber) {
|
|
10
|
+
void* callstack[128];
|
|
11
|
+
int frames = backtrace(callstack, 128);
|
|
12
|
+
char **strs = backtrace_symbols(callstack, frames);
|
|
13
|
+
|
|
14
|
+
NSMutableArray *backtraceArray = [NSMutableArray arrayWithCapacity:frames];
|
|
15
|
+
for (int i = 0; i < frames; i++) {
|
|
16
|
+
if (strs[i]) {
|
|
17
|
+
[backtraceArray addObject:[NSString stringWithUTF8String:strs[i]]];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
free(strs);
|
|
21
|
+
|
|
22
|
+
NSString *stackTrace = [backtraceArray componentsJoinedByString:@"\n"];
|
|
23
|
+
NSString *signalName = @"UNKNOWN";
|
|
24
|
+
switch (signalNumber) {
|
|
25
|
+
case SIGABRT: signalName = @"SIGABRT (Abort)"; break;
|
|
26
|
+
case SIGSEGV: signalName = @"SIGSEGV (Segmentation Fault)"; break;
|
|
27
|
+
case SIGBUS: signalName = @"SIGBUS (Bus Error)"; break;
|
|
28
|
+
case SIGILL: signalName = @"SIGILL (Illegal Instruction)"; break;
|
|
29
|
+
case SIGFPE: signalName = @"SIGFPE (Floating Point Exception)"; break;
|
|
30
|
+
case SIGPIPE: signalName = @"SIGPIPE (Broken Pipe)"; break;
|
|
31
|
+
case SIGTRAP: signalName = @"SIGTRAP (Trace Trap)"; break;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
NSString *message = [NSString stringWithFormat:@"Native Signal Crash: %@", signalName];
|
|
35
|
+
if (sharedInstance != nil) {
|
|
36
|
+
[sharedInstance emitCrashEventWithMessage:message stackTrace:stackTrace];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static void NativeExceptionHandler(NSException *exception) {
|
|
41
|
+
NSArray *callStack = [exception callStackSymbols];
|
|
42
|
+
NSString *stackTrace = [callStack componentsJoinedByString:@"\n"];
|
|
43
|
+
NSString *message = [NSString stringWithFormat:@"%@: %@", [exception name], [exception reason]];
|
|
44
|
+
|
|
45
|
+
if (sharedInstance != nil) {
|
|
46
|
+
[sharedInstance emitCrashEventWithMessage:message stackTrace:stackTrace];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Keep the runloop cycling so the UI thread doesn't terminate immediately
|
|
50
|
+
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
|
51
|
+
CFArrayRef allModes = CFRunLoopCopyAllModes(runLoop);
|
|
52
|
+
while (true) {
|
|
53
|
+
for (NSString *mode in (__bridge NSArray *)allModes) {
|
|
54
|
+
CFRunLoopRunInMode((CFStringRef)mode, 0.001, false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@implementation NetworkInspectorModule {
|
|
60
|
+
bool hasListeners;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
RCT_EXPORT_MODULE(NetworkInspectorModule);
|
|
64
|
+
|
|
65
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
66
|
+
return YES;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (instancetype)init {
|
|
70
|
+
if (self = [super init]) {
|
|
71
|
+
sharedInstance = self;
|
|
72
|
+
[self installHandlers];
|
|
73
|
+
}
|
|
74
|
+
return self;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (void)startObserving {
|
|
78
|
+
hasListeners = YES;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (void)stopObserving {
|
|
82
|
+
hasListeners = NO;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
86
|
+
return @[@"onNativeCrash"];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (void)installHandlers {
|
|
90
|
+
previousUncaughtExceptionHandler = NSGetUncaughtExceptionHandler();
|
|
91
|
+
NSSetUncaughtExceptionHandler(&NativeExceptionHandler);
|
|
92
|
+
|
|
93
|
+
struct sigaction sa;
|
|
94
|
+
sa.sa_handler = NativeSignalHandler;
|
|
95
|
+
sigemptyset(&sa.sa_mask);
|
|
96
|
+
sa.sa_flags = SA_NODEFER;
|
|
97
|
+
|
|
98
|
+
sigaction(SIGABRT, &sa, NULL);
|
|
99
|
+
sigaction(SIGSEGV, &sa, NULL);
|
|
100
|
+
sigaction(SIGBUS, &sa, NULL);
|
|
101
|
+
sigaction(SIGILL, &sa, NULL);
|
|
102
|
+
sigaction(SIGFPE, &sa, NULL);
|
|
103
|
+
sigaction(SIGPIPE, &sa, NULL);
|
|
104
|
+
sigaction(SIGTRAP, &sa, NULL);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (void)emitCrashEventWithMessage:(NSString *)message stackTrace:(NSString *)stackTrace {
|
|
108
|
+
if (hasListeners) {
|
|
109
|
+
[self sendEventWithName:@"onNativeCrash"
|
|
110
|
+
body:@{
|
|
111
|
+
@"platform": @"ios",
|
|
112
|
+
@"message": message ?: @"Unknown iOS Native Exception",
|
|
113
|
+
@"stack": stackTrace ?: @"",
|
|
114
|
+
@"timestamp": @([[NSDate date] timeIntervalSince1970] * 1000)
|
|
115
|
+
}];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
RCT_EXPORT_METHOD(enableNativeCrashProtection:(RCTPromiseResolveBlock)resolve
|
|
120
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
121
|
+
[self installHandlers];
|
|
122
|
+
resolve(@(YES));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-inapp-inspector",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
4
4
|
"description": "The zero-config, all-in-one in-app debugger for React Native & Expo. Inspect Network (fetch/axios), Console logs, Stack Traces, Redux State, Firebase Analytics, and JS Bundle size directly on device.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist",
|
|
27
|
-
"README.md"
|
|
27
|
+
"README.md",
|
|
28
|
+
"android",
|
|
29
|
+
"ios",
|
|
30
|
+
"react-native-inapp-inspector.podspec"
|
|
28
31
|
],
|
|
29
32
|
"scripts": {
|
|
30
33
|
"prebuild": "node scripts/gen-version.js",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-inapp-inspector"
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.authors = package['author']
|
|
11
|
+
s.homepage = package['homepage']
|
|
12
|
+
s.platform = :ios, "11.0"
|
|
13
|
+
s.source = { :git => "https://github.com/vengatmacuser/react-native-inapp-inspector.git", :tag => "v#{s.version}" }
|
|
14
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
15
|
+
s.requires_arc = true
|
|
16
|
+
|
|
17
|
+
s.dependency "React-Core"
|
|
18
|
+
end
|