react-native-inapp-inspector 2.0.5 → 2.0.6
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/src/main/java/com/inappinspector/NetworkInspectorModule.kt +11 -0
- package/dist/commonjs/components/Inspector/AuditTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/AuditTab.js +741 -0
- package/dist/commonjs/components/Inspector/DeviceTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/DeviceTab.js +717 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +28 -25
- package/dist/commonjs/components/Inspector/MainScreen.js +15 -2
- package/dist/commonjs/components/Inspector/NetworkDetail.js +15 -0
- package/dist/commonjs/components/Inspector/PerformanceHud.d.ts +7 -0
- package/dist/commonjs/components/Inspector/PerformanceHud.js +210 -0
- package/dist/commonjs/components/Inspector/PerformanceTab.js +30 -18
- package/dist/commonjs/components/Inspector/RequestReplayModal.d.ts +9 -0
- package/dist/commonjs/components/Inspector/RequestReplayModal.js +792 -0
- package/dist/commonjs/components/Inspector/RequestReplayView.d.ts +8 -0
- package/dist/commonjs/components/Inspector/RequestReplayView.js +871 -0
- package/dist/commonjs/components/Inspector/SettingsPanel.js +326 -15
- package/dist/commonjs/components/Inspector/StorageTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/StorageTab.js +610 -0
- package/dist/commonjs/components/Inspector/TabBar.js +23 -2
- package/dist/commonjs/components/NetworkIcons.d.ts +12 -0
- package/dist/commonjs/components/NetworkIcons.js +72 -3
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/storageInspector.d.ts +13 -0
- package/dist/commonjs/customHooks/storageInspector.js +179 -0
- package/dist/commonjs/helpers/deviceInfo.d.ts +4 -0
- package/dist/commonjs/helpers/deviceInfo.js +94 -0
- package/dist/commonjs/helpers/index.d.ts +2 -0
- package/dist/commonjs/helpers/index.js +12 -1
- package/dist/commonjs/helpers/packageAuditor.d.ts +5 -0
- package/dist/commonjs/helpers/packageAuditor.js +182 -0
- package/dist/commonjs/i18n/locales/en.json +3 -2
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.js +113 -9
- package/dist/commonjs/native/NativeInspector.d.ts +1 -0
- package/dist/commonjs/types/enums.d.ts +7 -0
- package/dist/commonjs/types/enums.js +7 -0
- package/dist/commonjs/types/interfaces.d.ts +73 -0
- package/dist/esm/components/Inspector/AuditTab.d.ts +3 -0
- package/dist/esm/components/Inspector/AuditTab.js +702 -0
- package/dist/esm/components/Inspector/DeviceTab.d.ts +3 -0
- package/dist/esm/components/Inspector/DeviceTab.js +678 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +28 -25
- package/dist/esm/components/Inspector/MainScreen.js +15 -2
- package/dist/esm/components/Inspector/NetworkDetail.js +16 -1
- package/dist/esm/components/Inspector/PerformanceHud.d.ts +7 -0
- package/dist/esm/components/Inspector/PerformanceHud.js +170 -0
- package/dist/esm/components/Inspector/PerformanceTab.js +31 -19
- package/dist/esm/components/Inspector/RequestReplayModal.d.ts +9 -0
- package/dist/esm/components/Inspector/RequestReplayModal.js +752 -0
- package/dist/esm/components/Inspector/RequestReplayView.d.ts +8 -0
- package/dist/esm/components/Inspector/RequestReplayView.js +831 -0
- package/dist/esm/components/Inspector/SettingsPanel.js +327 -16
- package/dist/esm/components/Inspector/StorageTab.d.ts +3 -0
- package/dist/esm/components/Inspector/StorageTab.js +571 -0
- package/dist/esm/components/Inspector/TabBar.js +24 -3
- package/dist/esm/components/NetworkIcons.d.ts +12 -0
- package/dist/esm/components/NetworkIcons.js +57 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/storageInspector.d.ts +13 -0
- package/dist/esm/customHooks/storageInspector.js +170 -0
- package/dist/esm/helpers/deviceInfo.d.ts +4 -0
- package/dist/esm/helpers/deviceInfo.js +89 -0
- package/dist/esm/helpers/index.d.ts +2 -0
- package/dist/esm/helpers/index.js +10 -0
- package/dist/esm/helpers/packageAuditor.d.ts +5 -0
- package/dist/esm/helpers/packageAuditor.js +173 -0
- package/dist/esm/i18n/locales/en.json +3 -2
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +109 -8
- package/dist/esm/native/NativeInspector.d.ts +1 -0
- package/dist/esm/types/enums.d.ts +7 -0
- package/dist/esm/types/enums.js +7 -0
- package/dist/esm/types/interfaces.d.ts +73 -0
- package/ios/NetworkInspectorModule.mm +12 -5
- package/package.json +4 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
2
|
-
import { Alert, Animated, PanResponder, Platform, UIManager, LogBox, InteractionManager, } from 'react-native';
|
|
2
|
+
import { Alert, Animated, PanResponder, Platform, UIManager, LogBox, InteractionManager, View, StyleSheet, } from 'react-native';
|
|
3
3
|
import { NavigationContext } from '@react-navigation/native';
|
|
4
4
|
// i18n
|
|
5
5
|
import { I18nextProvider, i18n } from './i18n';
|
|
@@ -23,14 +23,22 @@ import { subscribeAnalyticsEvents, clearAnalyticsEvents, autoSetupAnalyticsLogge
|
|
|
23
23
|
import { getReduxState, subscribeReduxState, setReduxAutoRefresh, getLastActionForReducer, clearActionHistory, isReduxConnected, setReduxModuleEnabled, } from './customHooks/reduxLogger';
|
|
24
24
|
import { setPerformanceModuleEnabled } from './customHooks/performanceTracker';
|
|
25
25
|
import { setBundleModuleEnabled } from './customHooks/bundleAnalyzer';
|
|
26
|
+
import { fetchAllStorageEntries, setStorageItem, removeStorageItem, clearAllStorage, subscribeStorageChanges, } from './customHooks/storageInspector';
|
|
27
|
+
import { getSystemDiagnostics } from './helpers/deviceInfo';
|
|
28
|
+
import { runLivePackageAudit, subscribeAuditChanges, logCodeQualityIssue, } from './helpers/packageAuditor';
|
|
26
29
|
import { showNativeFloatingButton, hideNativeFloatingButton, setNativeFloatingButtonBadge, subscribeNativeFloatingButtonPress, subscribeNativeDeviceShake, isNativeModuleAvailable, } from './native/NativeInspector';
|
|
27
30
|
import { LIB_VERSION } from './constants';
|
|
28
31
|
// Stylesheet
|
|
29
32
|
import { toggleGlobalTheme } from './styles';
|
|
30
|
-
const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigationRef, appIcon, environment, initialVisible, visible: controlledVisible, }) => {
|
|
33
|
+
const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigationRef, appIcon, environment, initialVisible, visible: controlledVisible, initialTab, enablePerformanceHud = false, }) => {
|
|
34
|
+
// Zero-overhead production stub: if disabled, return null immediately
|
|
35
|
+
if (!enabled || !isEnabled) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
31
38
|
// Set custom storage synchronously during render phase
|
|
32
39
|
setCustomStorage(storage || null);
|
|
33
40
|
const [isDark, setIsDark] = useState(false);
|
|
41
|
+
const [isPerformanceHudEnabled, setIsPerformanceHudEnabled] = useState(enablePerformanceHud);
|
|
34
42
|
const [reduxState, setReduxState] = useState(null);
|
|
35
43
|
// Per-reducer last action is kept in component state so the
|
|
36
44
|
// Redux tab re-renders live on every dispatch, independent of the state tree ref.
|
|
@@ -45,6 +53,11 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
45
53
|
setVisible(controlledVisible);
|
|
46
54
|
}
|
|
47
55
|
}, [controlledVisible]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (enablePerformanceHud !== undefined) {
|
|
58
|
+
setIsPerformanceHudEnabled(enablePerformanceHud);
|
|
59
|
+
}
|
|
60
|
+
}, [enablePerformanceHud]);
|
|
48
61
|
const [isReady, setIsReady] = useState(false);
|
|
49
62
|
const [selected, setSelected] = useState(null);
|
|
50
63
|
const [selectedLogs, setSelectedLogs] = useState(new Set());
|
|
@@ -84,7 +97,7 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
84
97
|
const [showReqDiff, setShowReqDiff] = useState(false);
|
|
85
98
|
const [showResDiff, setShowResDiff] = useState(false);
|
|
86
99
|
// ─── Analytics state ───────────────────────────────────────────────────────
|
|
87
|
-
const [activeTab, setActiveTab] = useState('apis');
|
|
100
|
+
const [activeTab, setActiveTab] = useState(initialTab || 'apis');
|
|
88
101
|
const [analyticsEvents, setAnalyticsEvents] = useState([]);
|
|
89
102
|
// ─── Logs state ────────────────────────────────────────────────────────────
|
|
90
103
|
const [consoleLogs, setConsoleLogs] = useState([]);
|
|
@@ -140,6 +153,47 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
140
153
|
setLastReadCrashesCount(crashRecords.length);
|
|
141
154
|
}
|
|
142
155
|
}, [activeTab, crashRecords.length]);
|
|
156
|
+
// ─── Storage state ─────────────────────────────────────────────────────────
|
|
157
|
+
const [storageEntries, setStorageEntries] = useState([]);
|
|
158
|
+
const [selectedStorageKey, setSelectedStorageKey] = useState(null);
|
|
159
|
+
const refreshStorageEntries = useCallback(async () => {
|
|
160
|
+
try {
|
|
161
|
+
const entries = await fetchAllStorageEntries();
|
|
162
|
+
setStorageEntries(entries);
|
|
163
|
+
}
|
|
164
|
+
catch { }
|
|
165
|
+
}, []);
|
|
166
|
+
const updateStorageEntry = useCallback(async (key, value) => {
|
|
167
|
+
await setStorageItem(key, value);
|
|
168
|
+
await refreshStorageEntries();
|
|
169
|
+
}, [refreshStorageEntries]);
|
|
170
|
+
const deleteStorageEntry = useCallback(async (key) => {
|
|
171
|
+
await removeStorageItem(key);
|
|
172
|
+
await refreshStorageEntries();
|
|
173
|
+
}, [refreshStorageEntries]);
|
|
174
|
+
const clearAllStorageEntries = useCallback(async () => {
|
|
175
|
+
await clearAllStorage();
|
|
176
|
+
await refreshStorageEntries();
|
|
177
|
+
}, [refreshStorageEntries]);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
refreshStorageEntries();
|
|
180
|
+
const unsub = subscribeStorageChanges(refreshStorageEntries);
|
|
181
|
+
return () => unsub();
|
|
182
|
+
}, [refreshStorageEntries]);
|
|
183
|
+
// ─── Device info state ──────────────────────────────────────────────────────
|
|
184
|
+
const [deviceInfo] = useState(() => getSystemDiagnostics());
|
|
185
|
+
// ─── Code Quality & Package Audit state ─────────────────────────────────────
|
|
186
|
+
const [auditReport, setAuditReport] = useState(() => runLivePackageAudit());
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
const unsub = subscribeAuditChanges(setAuditReport);
|
|
189
|
+
return () => unsub();
|
|
190
|
+
}, []);
|
|
191
|
+
const refreshAuditReport = useCallback(() => {
|
|
192
|
+
setAuditReport(runLivePackageAudit());
|
|
193
|
+
}, []);
|
|
194
|
+
const logCustomAuditIssue = useCallback((issue) => {
|
|
195
|
+
logCodeQualityIssue(issue);
|
|
196
|
+
}, []);
|
|
143
197
|
const [maxConsoleLogs, setMaxConsoleLogs] = useState(100);
|
|
144
198
|
const [showConsoleLevels, setShowConsoleLevels] = useState({
|
|
145
199
|
info: true,
|
|
@@ -180,6 +234,9 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
180
234
|
logs: true,
|
|
181
235
|
analytics: false,
|
|
182
236
|
redux: false,
|
|
237
|
+
storage: false,
|
|
238
|
+
device: false,
|
|
239
|
+
audit: false,
|
|
183
240
|
bundle: false,
|
|
184
241
|
performance: false,
|
|
185
242
|
crash: false,
|
|
@@ -234,6 +291,9 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
234
291
|
logs: true,
|
|
235
292
|
analytics: false,
|
|
236
293
|
redux: false,
|
|
294
|
+
storage: false,
|
|
295
|
+
device: false,
|
|
296
|
+
audit: false,
|
|
237
297
|
bundle: false,
|
|
238
298
|
performance: false,
|
|
239
299
|
crash: false,
|
|
@@ -271,14 +331,24 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
271
331
|
setModalHeightPercent(saved.modalHeightPercent);
|
|
272
332
|
if (saved.modalAnimationType)
|
|
273
333
|
setModalAnimationType(saved.modalAnimationType);
|
|
274
|
-
if (saved.tabVisibility)
|
|
334
|
+
if (saved.tabVisibility) {
|
|
335
|
+
const savedVis = saved.tabVisibility;
|
|
275
336
|
setTabVisibility(prev => ({
|
|
276
337
|
...prev,
|
|
277
|
-
...
|
|
338
|
+
...savedVis,
|
|
339
|
+
storage: savedVis.storage ?? false,
|
|
340
|
+
device: savedVis.device ?? false,
|
|
341
|
+
audit: savedVis.audit ?? false,
|
|
278
342
|
apis: true, // APIs is always required
|
|
279
343
|
}));
|
|
280
|
-
|
|
344
|
+
}
|
|
345
|
+
if (initialTab) {
|
|
346
|
+
setActiveTab(initialTab);
|
|
347
|
+
}
|
|
348
|
+
else if (saved.defaultTab) {
|
|
281
349
|
setDefaultTab(saved.defaultTab);
|
|
350
|
+
setActiveTab(saved.defaultTab);
|
|
351
|
+
}
|
|
282
352
|
if (saved.isAutoRamLimitEnabled != null)
|
|
283
353
|
setIsAutoRamLimitEnabled(saved.isAutoRamLimitEnabled);
|
|
284
354
|
if (saved.maxNetworkLogs != null)
|
|
@@ -299,7 +369,10 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
299
369
|
setShowDuplicateLogs(saved.showDuplicateLogs);
|
|
300
370
|
if (saved.showUpdateToast != null)
|
|
301
371
|
setShowUpdateToast(saved.showUpdateToast);
|
|
302
|
-
if (
|
|
372
|
+
if (initialTab) {
|
|
373
|
+
setActiveTab(initialTab);
|
|
374
|
+
}
|
|
375
|
+
else if (saved.defaultTab) {
|
|
303
376
|
const dt = saved.defaultTab;
|
|
304
377
|
const vis = {
|
|
305
378
|
...{
|
|
@@ -307,6 +380,9 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
307
380
|
logs: true,
|
|
308
381
|
analytics: false,
|
|
309
382
|
redux: false,
|
|
383
|
+
storage: false,
|
|
384
|
+
device: false,
|
|
385
|
+
audit: false,
|
|
310
386
|
bundle: false,
|
|
311
387
|
performance: false,
|
|
312
388
|
crash: false,
|
|
@@ -775,6 +851,12 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
775
851
|
? defaultTab
|
|
776
852
|
: 'apis';
|
|
777
853
|
setActiveTab(target);
|
|
854
|
+
setSelected(null);
|
|
855
|
+
setSelectedEvent(null);
|
|
856
|
+
setSelectedLog(null);
|
|
857
|
+
setSelectedReduxSlice(null);
|
|
858
|
+
setSelectedReduxAction(null);
|
|
859
|
+
setSelectedCrash(null);
|
|
778
860
|
// Track inspector opened event in GA4
|
|
779
861
|
trackInspectorOpen({ activeTab: target });
|
|
780
862
|
// Instant synchronization of data collected while modal was closed
|
|
@@ -1754,6 +1836,20 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
1754
1836
|
setCrashRecords([]);
|
|
1755
1837
|
setSelectedCrash(null);
|
|
1756
1838
|
},
|
|
1839
|
+
// ─── Storage ─────────────────────────────────────────────────────────
|
|
1840
|
+
storageEntries,
|
|
1841
|
+
refreshStorageEntries,
|
|
1842
|
+
updateStorageEntry,
|
|
1843
|
+
deleteStorageEntry,
|
|
1844
|
+
clearAllStorageEntries,
|
|
1845
|
+
selectedStorageKey,
|
|
1846
|
+
setSelectedStorageKey,
|
|
1847
|
+
// ─── Device ──────────────────────────────────────────────────────────
|
|
1848
|
+
deviceInfo,
|
|
1849
|
+
// ─── Audit / Code Quality ─────────────────────────────────────────────
|
|
1850
|
+
auditReport,
|
|
1851
|
+
refreshAuditReport,
|
|
1852
|
+
logCustomAuditIssue,
|
|
1757
1853
|
// ─── Settings ───────────────────────────────────────────────────────
|
|
1758
1854
|
settingsActiveSubTab,
|
|
1759
1855
|
setSettingsActiveSubTab,
|
|
@@ -1778,13 +1874,17 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
1778
1874
|
isAutoRamLimitEnabled,
|
|
1779
1875
|
setIsAutoRamLimitEnabled,
|
|
1780
1876
|
deviceFreeRamMb,
|
|
1877
|
+
isPerformanceHudEnabled,
|
|
1878
|
+
setIsPerformanceHudEnabled,
|
|
1781
1879
|
reduxAutoRefresh,
|
|
1782
1880
|
setReduxAutoRefreshState,
|
|
1783
1881
|
reduxExpandDepth,
|
|
1784
1882
|
setReduxExpandDepth,
|
|
1785
1883
|
};
|
|
1786
1884
|
return (<InspectorContext.Provider value={contextValue}>
|
|
1787
|
-
<
|
|
1885
|
+
<View style={StyleSheet.absoluteFill} pointerEvents="box-none">
|
|
1886
|
+
<MainScreen />
|
|
1887
|
+
</View>
|
|
1788
1888
|
</InspectorContext.Provider>);
|
|
1789
1889
|
};
|
|
1790
1890
|
const NetworkInspectorWrapper = (props) => {
|
|
@@ -1813,5 +1913,6 @@ export { usePerformanceTracker, useComponentProfiler, useNavigationProfiler, tra
|
|
|
1813
1913
|
export { InspectLog, InspectTrackTime, InspectCatch, } from './decorators';
|
|
1814
1914
|
export { getNativeDeviceMetrics, enableNativeCrashProtection, subscribeNativeCrashes, showNativeFloatingButton, hideNativeFloatingButton, setNativeFloatingButtonBadge, subscribeNativeFloatingButtonPress, subscribeNativeDeviceShake, startNativeFpsMonitoring, stopNativeFpsMonitoring, getNativeFpsMetrics, getNativeStorageItem, setNativeStorageItem, isNativeModuleAvailable, } from './native/NativeInspector';
|
|
1815
1915
|
export { sendSessionTelemetryPing, trackTelemetryEvent, trackInspectorOpen, trackTabSwitch, trackLogExport, GA4_MEASUREMENT_ID, GA4_API_SECRET, } from './helpers';
|
|
1916
|
+
export { runLivePackageAudit, logCodeQualityIssue, clearCustomAuditIssues, } from './helpers/packageAuditor';
|
|
1816
1917
|
export { BrandSquareIcon, BrandCircleIcon, } from './components/NetworkIcons';
|
|
1817
1918
|
export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';
|
|
@@ -3,6 +3,9 @@ export declare const ActiveTab: {
|
|
|
3
3
|
readonly Analytics: "analytics";
|
|
4
4
|
readonly Logs: "logs";
|
|
5
5
|
readonly Redux: "redux";
|
|
6
|
+
readonly Storage: "storage";
|
|
7
|
+
readonly Device: "device";
|
|
8
|
+
readonly Audit: "audit";
|
|
6
9
|
readonly Bundle: "bundle";
|
|
7
10
|
readonly Performance: "performance";
|
|
8
11
|
readonly Crash: "crash";
|
|
@@ -49,6 +52,9 @@ export declare const SettingsPage: {
|
|
|
49
52
|
readonly Logs: "logs";
|
|
50
53
|
readonly Analytics: "analytics";
|
|
51
54
|
readonly Redux: "redux";
|
|
55
|
+
readonly Storage: "storage";
|
|
56
|
+
readonly Device: "device";
|
|
57
|
+
readonly Audit: "audit";
|
|
52
58
|
readonly Bundle: "bundle";
|
|
53
59
|
readonly Performance: "performance";
|
|
54
60
|
readonly Crash: "crash";
|
|
@@ -56,6 +62,7 @@ export declare const SettingsPage: {
|
|
|
56
62
|
export type SettingsPage = (typeof SettingsPage)[keyof typeof SettingsPage] | null;
|
|
57
63
|
export declare const SettingsSubTab: {
|
|
58
64
|
readonly Module: "module";
|
|
65
|
+
readonly Limits: "limits";
|
|
59
66
|
readonly Ui: "ui";
|
|
60
67
|
};
|
|
61
68
|
export type SettingsSubTab = (typeof SettingsSubTab)[keyof typeof SettingsSubTab];
|
package/dist/esm/types/enums.js
CHANGED
|
@@ -6,6 +6,9 @@ export const ActiveTab = {
|
|
|
6
6
|
Analytics: 'analytics',
|
|
7
7
|
Logs: 'logs',
|
|
8
8
|
Redux: 'redux',
|
|
9
|
+
Storage: 'storage',
|
|
10
|
+
Device: 'device',
|
|
11
|
+
Audit: 'audit',
|
|
9
12
|
Bundle: 'bundle',
|
|
10
13
|
Performance: 'performance',
|
|
11
14
|
Crash: 'crash',
|
|
@@ -46,12 +49,16 @@ export const SettingsPage = {
|
|
|
46
49
|
Logs: 'logs',
|
|
47
50
|
Analytics: 'analytics',
|
|
48
51
|
Redux: 'redux',
|
|
52
|
+
Storage: 'storage',
|
|
53
|
+
Device: 'device',
|
|
54
|
+
Audit: 'audit',
|
|
49
55
|
Bundle: 'bundle',
|
|
50
56
|
Performance: 'performance',
|
|
51
57
|
Crash: 'crash',
|
|
52
58
|
};
|
|
53
59
|
export const SettingsSubTab = {
|
|
54
60
|
Module: 'module',
|
|
61
|
+
Limits: 'limits',
|
|
55
62
|
Ui: 'ui',
|
|
56
63
|
};
|
|
57
64
|
export const LogFilter = {
|
|
@@ -3,6 +3,64 @@ import { ViewStyle } from 'react-native';
|
|
|
3
3
|
import { Animated, PanResponderInstance } from 'react-native';
|
|
4
4
|
import type { ActiveTab, BreadcrumbType, CrashType, GroupedListItem, LocalFilter, LogFilter, Method, SettingsPage, SettingsSubTab, SortOrder, StatusFilter } from './index';
|
|
5
5
|
export type SearchScope = 'all' | 'url' | 'reqBody' | 'resBody' | 'headers';
|
|
6
|
+
export interface StorageEntry {
|
|
7
|
+
key: string;
|
|
8
|
+
value: string;
|
|
9
|
+
sizeBytes: number;
|
|
10
|
+
isJson: boolean;
|
|
11
|
+
parsedJson?: any;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export interface DeviceInfoData {
|
|
15
|
+
appName: string;
|
|
16
|
+
bundleId: string;
|
|
17
|
+
appVersion: string;
|
|
18
|
+
buildNumber: string;
|
|
19
|
+
reactNativeVersion: string;
|
|
20
|
+
jsEngine: string;
|
|
21
|
+
isHermes: boolean;
|
|
22
|
+
isFabric: boolean;
|
|
23
|
+
isTurboModule: boolean;
|
|
24
|
+
platform: 'ios' | 'android' | 'windows' | 'macos' | 'web';
|
|
25
|
+
osVersion: string;
|
|
26
|
+
deviceModel: string;
|
|
27
|
+
deviceId?: string;
|
|
28
|
+
isDevice: boolean;
|
|
29
|
+
screenWidth: number;
|
|
30
|
+
screenHeight: number;
|
|
31
|
+
screenScale: number;
|
|
32
|
+
screenFontScale: number;
|
|
33
|
+
statusBarHeight: number;
|
|
34
|
+
memoryMb?: number;
|
|
35
|
+
arch?: string;
|
|
36
|
+
locale?: string;
|
|
37
|
+
timeZone?: string;
|
|
38
|
+
}
|
|
39
|
+
export type AuditSeverity = 'critical' | 'warning' | 'info' | 'optimal';
|
|
40
|
+
export type AuditCategory = 'dependency' | 'typescript' | 'peer' | 'performance' | 'security';
|
|
41
|
+
export interface AuditIssue {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
message: string;
|
|
45
|
+
severity: AuditSeverity;
|
|
46
|
+
category: AuditCategory;
|
|
47
|
+
packageName?: string;
|
|
48
|
+
currentVersion?: string;
|
|
49
|
+
requiredVersion?: string;
|
|
50
|
+
fixCommand?: string;
|
|
51
|
+
fixSnippet?: string;
|
|
52
|
+
timestamp: number;
|
|
53
|
+
}
|
|
54
|
+
export interface PackageHealthReport {
|
|
55
|
+
score: number;
|
|
56
|
+
grade: 'A+' | 'A' | 'B' | 'C' | 'D';
|
|
57
|
+
totalIssues: number;
|
|
58
|
+
criticalCount: number;
|
|
59
|
+
warningCount: number;
|
|
60
|
+
infoCount: number;
|
|
61
|
+
issues: AuditIssue[];
|
|
62
|
+
scannedAt: number;
|
|
63
|
+
}
|
|
6
64
|
export interface ParsedStackFrame {
|
|
7
65
|
method: string;
|
|
8
66
|
file: string;
|
|
@@ -164,6 +222,8 @@ export interface NetworkInspectorProps {
|
|
|
164
222
|
environment?: 'DEV' | 'UAT' | 'PrePROD' | 'PROD' | 'QA' | 'Staging' | string;
|
|
165
223
|
initialVisible?: boolean;
|
|
166
224
|
visible?: boolean;
|
|
225
|
+
initialTab?: ActiveTab;
|
|
226
|
+
enablePerformanceHud?: boolean;
|
|
167
227
|
}
|
|
168
228
|
export interface NavigationTrackerProps {
|
|
169
229
|
onStateChange: (state: any) => void;
|
|
@@ -176,6 +236,8 @@ export interface InspectorContextValue {
|
|
|
176
236
|
isEnabled: boolean;
|
|
177
237
|
appIcon?: any;
|
|
178
238
|
environment?: string;
|
|
239
|
+
isPerformanceHudEnabled: boolean;
|
|
240
|
+
setIsPerformanceHudEnabled: React.Dispatch<React.SetStateAction<boolean>>;
|
|
179
241
|
modalHeightPercent: number;
|
|
180
242
|
setModalHeightPercent: React.Dispatch<React.SetStateAction<number>>;
|
|
181
243
|
modalAnimationType: 'slide' | 'fade' | 'none';
|
|
@@ -305,6 +367,17 @@ export interface InspectorContextValue {
|
|
|
305
367
|
maxCrashLogs: number;
|
|
306
368
|
setMaxCrashLogs: React.Dispatch<React.SetStateAction<number>>;
|
|
307
369
|
clearAllCrashes: () => void;
|
|
370
|
+
storageEntries: StorageEntry[];
|
|
371
|
+
refreshStorageEntries: () => Promise<void>;
|
|
372
|
+
updateStorageEntry: (key: string, value: string) => Promise<void>;
|
|
373
|
+
deleteStorageEntry: (key: string) => Promise<void>;
|
|
374
|
+
clearAllStorageEntries: () => Promise<void>;
|
|
375
|
+
selectedStorageKey: string | null;
|
|
376
|
+
setSelectedStorageKey: React.Dispatch<React.SetStateAction<string | null>>;
|
|
377
|
+
deviceInfo: DeviceInfoData;
|
|
378
|
+
auditReport: PackageHealthReport;
|
|
379
|
+
refreshAuditReport: () => void;
|
|
380
|
+
logCustomAuditIssue: (issue: Omit<AuditIssue, 'id' | 'timestamp'>) => void;
|
|
308
381
|
settingsActiveSubTab: SettingsSubTab;
|
|
309
382
|
setSettingsActiveSubTab: React.Dispatch<React.SetStateAction<SettingsSubTab>>;
|
|
310
383
|
defaultTab: ActiveTab;
|
|
@@ -515,6 +515,10 @@ RCT_EXPORT_METHOD(getDeviceMetrics:(RCTPromiseResolveBlock)resolve
|
|
|
515
515
|
[metrics setObject:[UIDevice currentDevice].systemName forKey:@"deviceBrand"];
|
|
516
516
|
[metrics setObject:[UIDevice currentDevice].systemVersion forKey:@"osVersion"];
|
|
517
517
|
[metrics setObject:@"arm64" forKey:@"cpuAbi"];
|
|
518
|
+
NSString *deviceId = [[UIDevice currentDevice].identifierForVendor UUIDString];
|
|
519
|
+
if (deviceId) {
|
|
520
|
+
[metrics setObject:deviceId forKey:@"deviceId"];
|
|
521
|
+
}
|
|
518
522
|
|
|
519
523
|
// 5. Application Identifiers (Legal & Non-PII)
|
|
520
524
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
|
@@ -557,10 +561,13 @@ static UIWindow *GetAppActiveWindow(void) {
|
|
|
557
561
|
return [UIApplication sharedApplication].windows.firstObject;
|
|
558
562
|
}
|
|
559
563
|
|
|
564
|
+
static BOOL isFloatingButtonRequestedVisible = NO;
|
|
565
|
+
|
|
560
566
|
RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
|
|
561
567
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
562
568
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
563
569
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
570
|
+
isFloatingButtonRequestedVisible = YES;
|
|
564
571
|
UIWindow *targetWindow = GetAppActiveWindow();
|
|
565
572
|
CGRect screenBounds = targetWindow ? targetWindow.bounds : [UIScreen mainScreen].bounds;
|
|
566
573
|
|
|
@@ -599,6 +606,7 @@ RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
|
|
|
599
606
|
}
|
|
600
607
|
|
|
601
608
|
void (^attachToWindow)(void) = ^{
|
|
609
|
+
if (!isFloatingButtonRequestedVisible) return;
|
|
602
610
|
UIWindow *activeWin = GetAppActiveWindow();
|
|
603
611
|
if (!activeWin || !floatingButtonView) return;
|
|
604
612
|
|
|
@@ -635,12 +643,11 @@ RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
|
|
|
635
643
|
RCT_EXPORT_METHOD(hideFloatingButton:(RCTPromiseResolveBlock)resolve
|
|
636
644
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
637
645
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
646
|
+
isFloatingButtonRequestedVisible = NO;
|
|
638
647
|
if (floatingButtonView != nil) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
floatingButtonView.hidden = YES;
|
|
643
|
-
}];
|
|
648
|
+
floatingButtonView.alpha = 0.0;
|
|
649
|
+
floatingButtonView.hidden = YES;
|
|
650
|
+
[floatingButtonView removeFromSuperview];
|
|
644
651
|
}
|
|
645
652
|
resolve(@(YES));
|
|
646
653
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-inapp-inspector",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
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",
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
"clean": "rm -rf dist",
|
|
45
45
|
"prebuild": "node scripts/gen-version.js",
|
|
46
46
|
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && node scripts/inject-telemetry.js",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
49
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
47
50
|
"watch": "tsc -w",
|
|
48
51
|
"prepack": "npm run build",
|
|
49
52
|
"publish": "node release.cjs",
|