react-native-inapp-inspector 1.1.24 → 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/AnalyticsEventCard.js +94 -88
- package/dist/commonjs/components/ConsoleLogCard.js +49 -25
- package/dist/commonjs/components/ErrorBoundary.d.ts +1 -1
- package/dist/commonjs/components/ErrorBoundary.js +9 -145
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.d.ts +7 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +1002 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +637 -10
- package/dist/commonjs/components/Inspector/BundleTab.d.ts +1 -1
- package/dist/commonjs/components/Inspector/BundleTab.js +826 -406
- 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/InspectorContext.js +6 -1
- package/dist/commonjs/components/Inspector/InspectorHeader.js +65 -28
- package/dist/commonjs/components/Inspector/LogDetail.js +227 -114
- package/dist/commonjs/components/Inspector/MainScreen.js +13 -4
- package/dist/commonjs/components/Inspector/NetworkDetail.js +131 -81
- package/dist/commonjs/components/Inspector/PerformanceTab.js +20 -10
- 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 +25 -0
- package/dist/commonjs/components/NetworkIcons.js +188 -1
- package/dist/commonjs/components/SegmentedTabs.js +33 -23
- package/dist/commonjs/components/TreeNode.js +13 -12
- 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/bundleAnalyzer.d.ts +5 -1
- package/dist/commonjs/customHooks/bundleAnalyzer.js +497 -126
- package/dist/commonjs/customHooks/consoleLogger.d.ts +1 -0
- package/dist/commonjs/customHooks/consoleLogger.js +153 -51
- package/dist/commonjs/customHooks/crashHandler.d.ts +64 -0
- package/dist/commonjs/customHooks/crashHandler.js +681 -0
- package/dist/commonjs/customHooks/networkLogger.js +74 -49
- package/dist/commonjs/customHooks/performanceTracker.d.ts +8 -0
- package/dist/commonjs/customHooks/performanceTracker.js +44 -3
- package/dist/commonjs/decorators/index.d.ts +49 -0
- package/dist/commonjs/decorators/index.js +142 -0
- package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +18 -0
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +174 -0
- package/dist/commonjs/helpers/index.d.ts +7 -4
- package/dist/commonjs/helpers/index.js +102 -64
- package/dist/commonjs/i18n/locales/en.json +182 -4
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.js +310 -8
- package/dist/commonjs/styles/index.d.ts +4 -1
- package/dist/commonjs/styles/index.js +22 -19
- package/dist/commonjs/types/enums.d.ts +156 -9
- package/dist/commonjs/types/enums.js +139 -2
- package/dist/commonjs/types/interfaces.d.ts +70 -1
- package/dist/esm/components/AnalyticsEventCard.js +95 -89
- package/dist/esm/components/ConsoleLogCard.js +49 -25
- package/dist/esm/components/ErrorBoundary.d.ts +1 -1
- package/dist/esm/components/ErrorBoundary.js +10 -113
- package/dist/esm/components/Inspector/AnalyticsFilterModal.d.ts +7 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +964 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +639 -12
- package/dist/esm/components/Inspector/BundleTab.d.ts +1 -1
- package/dist/esm/components/Inspector/BundleTab.js +827 -407
- 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/InspectorContext.js +1 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +66 -29
- package/dist/esm/components/Inspector/LogDetail.js +227 -114
- package/dist/esm/components/Inspector/MainScreen.js +14 -5
- package/dist/esm/components/Inspector/NetworkDetail.js +132 -49
- package/dist/esm/components/Inspector/PerformanceTab.js +20 -10
- 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 +25 -0
- package/dist/esm/components/NetworkIcons.js +161 -0
- package/dist/esm/components/SegmentedTabs.js +33 -23
- package/dist/esm/components/TreeNode.js +13 -12
- 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/bundleAnalyzer.d.ts +5 -1
- package/dist/esm/customHooks/bundleAnalyzer.js +493 -125
- package/dist/esm/customHooks/consoleLogger.d.ts +1 -0
- package/dist/esm/customHooks/consoleLogger.js +151 -50
- package/dist/esm/customHooks/crashHandler.d.ts +64 -0
- package/dist/esm/customHooks/crashHandler.js +659 -0
- package/dist/esm/customHooks/networkLogger.js +74 -49
- package/dist/esm/customHooks/performanceTracker.d.ts +8 -0
- package/dist/esm/customHooks/performanceTracker.js +38 -1
- package/dist/esm/decorators/index.d.ts +49 -0
- package/dist/esm/decorators/index.js +137 -0
- package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +18 -0
- package/dist/esm/helpers/gaAnalyticsRegistry.js +169 -0
- package/dist/esm/helpers/index.d.ts +7 -4
- package/dist/esm/helpers/index.js +100 -63
- package/dist/esm/i18n/locales/en.json +182 -4
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +262 -8
- package/dist/esm/styles/index.d.ts +4 -1
- package/dist/esm/styles/index.js +22 -19
- package/dist/esm/types/enums.d.ts +156 -9
- package/dist/esm/types/enums.js +138 -3
- package/dist/esm/types/interfaces.d.ts +70 -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
package/dist/esm/types/enums.js
CHANGED
|
@@ -1,3 +1,138 @@
|
|
|
1
|
-
// ───
|
|
2
|
-
//
|
|
3
|
-
|
|
1
|
+
// ─── Enums & Constants ─────────────────────────────────────────────────────────
|
|
2
|
+
// Universal TypeScript Enum Objects and Type Aliases.
|
|
3
|
+
// Allows both enum-style access (e.g. ActiveTab.Apis) and string literals ('apis').
|
|
4
|
+
export const ActiveTab = {
|
|
5
|
+
Apis: 'apis',
|
|
6
|
+
Analytics: 'analytics',
|
|
7
|
+
Logs: 'logs',
|
|
8
|
+
Redux: 'redux',
|
|
9
|
+
Bundle: 'bundle',
|
|
10
|
+
Performance: 'performance',
|
|
11
|
+
Crash: 'crash',
|
|
12
|
+
};
|
|
13
|
+
export const Method = {
|
|
14
|
+
All: 'ALL',
|
|
15
|
+
Get: 'GET',
|
|
16
|
+
Post: 'POST',
|
|
17
|
+
Put: 'PUT',
|
|
18
|
+
Patch: 'PATCH',
|
|
19
|
+
Delete: 'DELETE',
|
|
20
|
+
};
|
|
21
|
+
export const StatusFilter = {
|
|
22
|
+
All: 'ALL',
|
|
23
|
+
TwoXx: '2xx',
|
|
24
|
+
ThreeXx: '3xx',
|
|
25
|
+
FourXx: '4xx',
|
|
26
|
+
FiveXx: '5xx',
|
|
27
|
+
Failed: 'Failed',
|
|
28
|
+
};
|
|
29
|
+
export const SortOrder = {
|
|
30
|
+
Newest: 'newest',
|
|
31
|
+
Oldest: 'oldest',
|
|
32
|
+
};
|
|
33
|
+
export const LocalFilter = {
|
|
34
|
+
Success: 'success',
|
|
35
|
+
Failed: 'failed',
|
|
36
|
+
Loading: 'loading',
|
|
37
|
+
};
|
|
38
|
+
export const ModalAnimationType = {
|
|
39
|
+
Slide: 'slide',
|
|
40
|
+
Fade: 'fade',
|
|
41
|
+
None: 'none',
|
|
42
|
+
};
|
|
43
|
+
export const SettingsPage = {
|
|
44
|
+
Main: 'main',
|
|
45
|
+
Apis: 'apis',
|
|
46
|
+
Logs: 'logs',
|
|
47
|
+
Analytics: 'analytics',
|
|
48
|
+
Redux: 'redux',
|
|
49
|
+
Bundle: 'bundle',
|
|
50
|
+
Performance: 'performance',
|
|
51
|
+
Crash: 'crash',
|
|
52
|
+
};
|
|
53
|
+
export const SettingsSubTab = {
|
|
54
|
+
Module: 'module',
|
|
55
|
+
Ui: 'ui',
|
|
56
|
+
};
|
|
57
|
+
export const LogFilter = {
|
|
58
|
+
All: 'all',
|
|
59
|
+
Info: 'info',
|
|
60
|
+
Warn: 'warn',
|
|
61
|
+
Error: 'error',
|
|
62
|
+
UserLog: 'user-log',
|
|
63
|
+
Analytics: 'analytics',
|
|
64
|
+
};
|
|
65
|
+
export const ConsoleLogType = {
|
|
66
|
+
Info: 'info',
|
|
67
|
+
Warn: 'warn',
|
|
68
|
+
Error: 'error',
|
|
69
|
+
};
|
|
70
|
+
export const AnalyticsEventSource = {
|
|
71
|
+
Firebase: 'firebase',
|
|
72
|
+
Manual: 'manual',
|
|
73
|
+
};
|
|
74
|
+
export const GAEventCategory = {
|
|
75
|
+
PageView: 'page_view',
|
|
76
|
+
Ecommerce: 'ecommerce',
|
|
77
|
+
System: 'system',
|
|
78
|
+
Custom: 'custom',
|
|
79
|
+
};
|
|
80
|
+
export const StackFrameType = {
|
|
81
|
+
App: 'app',
|
|
82
|
+
Dependency: 'dependency',
|
|
83
|
+
Runtime: 'runtime',
|
|
84
|
+
Native: 'native',
|
|
85
|
+
};
|
|
86
|
+
export const DiffResultType = {
|
|
87
|
+
Added: 'added',
|
|
88
|
+
Removed: 'removed',
|
|
89
|
+
Changed: 'changed',
|
|
90
|
+
};
|
|
91
|
+
export const BundleSubTab = {
|
|
92
|
+
Overview: 'overview',
|
|
93
|
+
Production: 'production',
|
|
94
|
+
Files: 'files',
|
|
95
|
+
Packages: 'packages',
|
|
96
|
+
Media: 'media',
|
|
97
|
+
Optimizer: 'optimizer',
|
|
98
|
+
};
|
|
99
|
+
export const PerformanceSubTab = {
|
|
100
|
+
Overview: 'overview',
|
|
101
|
+
Renders: 'renders',
|
|
102
|
+
Interactions: 'interactions',
|
|
103
|
+
Memory: 'memory',
|
|
104
|
+
};
|
|
105
|
+
export const CrashType = {
|
|
106
|
+
Native: 'native',
|
|
107
|
+
Js: 'js',
|
|
108
|
+
Promise: 'promise',
|
|
109
|
+
Render: 'render',
|
|
110
|
+
Custom: 'custom',
|
|
111
|
+
};
|
|
112
|
+
export const CrashExportFormat = {
|
|
113
|
+
Text: 'text',
|
|
114
|
+
Markdown: 'markdown',
|
|
115
|
+
Json: 'json',
|
|
116
|
+
};
|
|
117
|
+
export const CrashDetailSubTab = {
|
|
118
|
+
Stack: 'stack',
|
|
119
|
+
Diagnostics: 'diagnostics',
|
|
120
|
+
Breadcrumbs: 'breadcrumbs',
|
|
121
|
+
Raw: 'raw',
|
|
122
|
+
};
|
|
123
|
+
export const CrashFilterType = {
|
|
124
|
+
All: 'all',
|
|
125
|
+
Fatal: 'fatal',
|
|
126
|
+
Js: 'js',
|
|
127
|
+
Promise: 'promise',
|
|
128
|
+
Render: 'render',
|
|
129
|
+
Native: 'native',
|
|
130
|
+
};
|
|
131
|
+
export const BreadcrumbType = {
|
|
132
|
+
Navigation: 'navigation',
|
|
133
|
+
Network: 'network',
|
|
134
|
+
Redux: 'redux',
|
|
135
|
+
Console: 'console',
|
|
136
|
+
User: 'user',
|
|
137
|
+
System: 'system',
|
|
138
|
+
};
|
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewStyle } from 'react-native';
|
|
3
3
|
import { Animated, PanResponderInstance } from 'react-native';
|
|
4
|
-
import type { ActiveTab, GroupedListItem, LocalFilter, LogFilter, Method, SettingsPage, SettingsSubTab, SortOrder, StatusFilter } from './index';
|
|
4
|
+
import type { ActiveTab, BreadcrumbType, CrashType, GroupedListItem, LocalFilter, LogFilter, Method, SettingsPage, SettingsSubTab, SortOrder, StatusFilter } from './index';
|
|
5
|
+
export interface ParsedStackFrame {
|
|
6
|
+
method: string;
|
|
7
|
+
file: string;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
column: number;
|
|
10
|
+
raw?: string;
|
|
11
|
+
isAppCode?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface CrashBreadcrumb {
|
|
14
|
+
type: BreadcrumbType;
|
|
15
|
+
message: string;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
data?: any;
|
|
18
|
+
}
|
|
19
|
+
export interface CrashRecord {
|
|
20
|
+
id: string;
|
|
21
|
+
error?: Error | any;
|
|
22
|
+
isFatal: boolean;
|
|
23
|
+
type: CrashType;
|
|
24
|
+
message: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
stack?: string;
|
|
27
|
+
parsedStack?: ParsedStackFrame[];
|
|
28
|
+
componentStack?: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
dateStr: string;
|
|
31
|
+
timeStr: string;
|
|
32
|
+
deviceInfo?: {
|
|
33
|
+
platform: string;
|
|
34
|
+
osVersion?: string;
|
|
35
|
+
rnVersion?: string;
|
|
36
|
+
isHermes?: boolean;
|
|
37
|
+
isFabric?: boolean;
|
|
38
|
+
appState?: string;
|
|
39
|
+
};
|
|
40
|
+
memoryInfo?: {
|
|
41
|
+
usedJSHeapSize?: number;
|
|
42
|
+
totalJSHeapSize?: number;
|
|
43
|
+
};
|
|
44
|
+
breadcrumbs?: CrashBreadcrumb[];
|
|
45
|
+
logId?: number;
|
|
46
|
+
}
|
|
5
47
|
export interface ConsoleLog {
|
|
6
48
|
id: number;
|
|
7
49
|
type: 'info' | 'warn' | 'error';
|
|
@@ -32,6 +74,21 @@ export interface AnalyticsEvent {
|
|
|
32
74
|
pageTitle?: string;
|
|
33
75
|
pageLocation?: string;
|
|
34
76
|
}
|
|
77
|
+
export interface AnalyticsFilters {
|
|
78
|
+
categories: Set<string>;
|
|
79
|
+
screens: Set<string>;
|
|
80
|
+
sources: Set<string>;
|
|
81
|
+
userTypes: Set<string>;
|
|
82
|
+
timeWindow: 'all' | '1m' | '5m' | '15m' | '1h';
|
|
83
|
+
payloadComplexity: 'all' | 'none' | 'simple' | 'heavy';
|
|
84
|
+
hasRevenue: boolean;
|
|
85
|
+
hasItems: boolean;
|
|
86
|
+
hasUserProps: boolean;
|
|
87
|
+
hasParams: boolean;
|
|
88
|
+
onlyDuplicates: boolean;
|
|
89
|
+
onlyConversions: boolean;
|
|
90
|
+
sortBy: 'time_desc' | 'time_asc' | 'revenue_desc' | 'count_desc';
|
|
91
|
+
}
|
|
35
92
|
export interface NetworkLog {
|
|
36
93
|
id: number;
|
|
37
94
|
url: string;
|
|
@@ -192,6 +249,10 @@ export interface InspectorContextValue {
|
|
|
192
249
|
})[];
|
|
193
250
|
analyticsSearch: string;
|
|
194
251
|
setAnalyticsSearch: React.Dispatch<React.SetStateAction<string>>;
|
|
252
|
+
analyticsFilters: AnalyticsFilters;
|
|
253
|
+
setAnalyticsFilters: React.Dispatch<React.SetStateAction<AnalyticsFilters>>;
|
|
254
|
+
isAnalyticsFilterApplied: boolean;
|
|
255
|
+
resetAnalyticsFilters: () => void;
|
|
195
256
|
newEventIds: Set<number>;
|
|
196
257
|
isAnalyticsLayoutReady: boolean;
|
|
197
258
|
setIsAnalyticsLayoutReady: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -210,6 +271,14 @@ export interface InspectorContextValue {
|
|
|
210
271
|
setSelectedReduxAction: React.Dispatch<React.SetStateAction<any | null>>;
|
|
211
272
|
reduxActiveSubTab: 'state' | 'timeline';
|
|
212
273
|
setReduxActiveSubTab: React.Dispatch<React.SetStateAction<'state' | 'timeline'>>;
|
|
274
|
+
crashRecords: CrashRecord[];
|
|
275
|
+
setCrashRecords: React.Dispatch<React.SetStateAction<CrashRecord[]>>;
|
|
276
|
+
selectedCrash: CrashRecord | null;
|
|
277
|
+
setSelectedCrash: React.Dispatch<React.SetStateAction<CrashRecord | null>>;
|
|
278
|
+
lastReadCrashesCount: number;
|
|
279
|
+
maxCrashLogs: number;
|
|
280
|
+
setMaxCrashLogs: React.Dispatch<React.SetStateAction<number>>;
|
|
281
|
+
clearAllCrashes: () => void;
|
|
213
282
|
settingsActiveSubTab: SettingsSubTab;
|
|
214
283
|
setSettingsActiveSubTab: React.Dispatch<React.SetStateAction<SettingsSubTab>>;
|
|
215
284
|
defaultTab: ActiveTab;
|
|
@@ -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
|