react-native-inapp-inspector 1.1.13 → 1.1.15
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/README.md +9 -34
- package/dist/commonjs/assets/svgAssets.d.ts +3 -0
- package/dist/commonjs/assets/svgAssets.js +17 -0
- package/dist/commonjs/components/AnalyticsEventCard.d.ts +1 -14
- package/dist/commonjs/components/AnalyticsEventCard.js +120 -50
- package/dist/commonjs/components/AnalyticsGraph.d.ts +2 -6
- package/dist/commonjs/components/AnalyticsGraph.js +8 -8
- package/dist/commonjs/components/AnalyticsTabView.d.ts +15 -0
- package/dist/commonjs/components/AnalyticsTabView.js +157 -0
- package/dist/commonjs/components/AnimatedEntrance.d.ts +1 -1
- package/dist/commonjs/components/AnimatedEntrance.js +2 -2
- package/dist/commonjs/components/ApiDetailView.d.ts +22 -0
- package/dist/commonjs/components/ApiDetailView.js +304 -0
- package/dist/commonjs/components/ApisTabView.d.ts +33 -0
- package/dist/commonjs/components/ApisTabView.js +235 -0
- package/dist/commonjs/components/CodeSnippet.d.ts +1 -5
- package/dist/commonjs/components/CodeSnippet.js +34 -34
- package/dist/commonjs/components/ConsoleLogCard.d.ts +1 -8
- package/dist/commonjs/components/ConsoleLogCard.js +262 -442
- package/dist/commonjs/components/ConsoleLogDetailView.d.ts +9 -0
- package/dist/commonjs/components/ConsoleLogDetailView.js +278 -0
- package/dist/commonjs/components/ConsoleLogsTabView.d.ts +24 -0
- package/dist/commonjs/components/ConsoleLogsTabView.js +354 -0
- package/dist/commonjs/components/DiffViewer.js +4 -2
- package/dist/commonjs/components/DomainHeader.js +66 -41
- package/dist/commonjs/components/EmptyState.d.ts +2 -2
- package/dist/commonjs/components/EmptyState.js +2 -2
- package/dist/commonjs/components/EndOfListFooter.d.ts +8 -0
- package/dist/commonjs/components/EndOfListFooter.js +90 -0
- package/dist/commonjs/components/ErrorBoundary.d.ts +5 -14
- package/dist/commonjs/components/ErrorBoundary.js +28 -28
- package/dist/commonjs/components/FloatingBubble.d.ts +14 -0
- package/dist/commonjs/components/FloatingBubble.js +75 -0
- package/dist/commonjs/components/HeadersSection.js +5 -3
- package/dist/commonjs/components/HighlightText.d.ts +1 -1
- package/dist/commonjs/components/HighlightText.js +5 -7
- package/dist/commonjs/components/Inspector/AnalyticsTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +232 -0
- package/dist/commonjs/components/Inspector/ConsoleTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/ConsoleTab.js +410 -0
- package/dist/commonjs/components/Inspector/FabLauncher.d.ts +3 -0
- package/dist/commonjs/components/Inspector/FabLauncher.js +54 -0
- package/dist/commonjs/components/Inspector/InsightsDashboard.d.ts +3 -0
- package/dist/commonjs/components/Inspector/InsightsDashboard.js +619 -0
- package/dist/commonjs/components/Inspector/InspectorContext.d.ts +5 -0
- package/dist/commonjs/components/Inspector/InspectorContext.js +18 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.d.ts +3 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +452 -0
- package/dist/commonjs/components/Inspector/LogDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/LogDetail.js +963 -0
- package/dist/commonjs/components/Inspector/MainScreen.d.ts +3 -0
- package/dist/commonjs/components/Inspector/MainScreen.js +68 -0
- package/dist/commonjs/components/Inspector/NavigationTracker.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NavigationTracker.js +12 -0
- package/dist/commonjs/components/Inspector/NetworkDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NetworkDetail.js +405 -0
- package/dist/commonjs/components/Inspector/NetworkTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NetworkTab.js +281 -0
- package/dist/commonjs/components/Inspector/ReduxTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/ReduxTab.js +75 -0
- package/dist/commonjs/components/Inspector/SettingsPanel.d.ts +3 -0
- package/dist/commonjs/components/Inspector/SettingsPanel.js +1476 -0
- package/dist/commonjs/components/Inspector/TabBar.d.ts +3 -0
- package/dist/commonjs/components/Inspector/TabBar.js +95 -0
- package/dist/commonjs/components/Inspector/WebViewTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/WebViewTab.js +757 -0
- package/dist/commonjs/components/InspectorHeader.d.ts +19 -0
- package/dist/commonjs/components/InspectorHeader.js +329 -0
- package/dist/commonjs/components/InspectorTabBar.d.ts +16 -0
- package/dist/commonjs/components/InspectorTabBar.js +90 -0
- package/dist/commonjs/components/JsonViewer.d.ts +4 -1
- package/dist/commonjs/components/JsonViewer.js +110 -171
- package/dist/commonjs/components/LogCard.js +109 -86
- package/dist/commonjs/components/MetaAccordion.d.ts +1 -10
- package/dist/commonjs/components/MetaAccordion.js +23 -21
- package/dist/commonjs/components/NavigationTracker.d.ts +7 -0
- package/dist/commonjs/components/NavigationTracker.js +76 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +6 -0
- package/dist/commonjs/components/NetworkIcons.js +54 -8
- package/dist/commonjs/components/ReduxTabView.d.ts +9 -0
- package/dist/commonjs/components/ReduxTabView.js +56 -0
- package/dist/commonjs/components/ReduxTreeView.js +241 -200
- package/dist/commonjs/components/SegmentedTabs.d.ts +15 -0
- package/dist/commonjs/components/SegmentedTabs.js +52 -0
- package/dist/commonjs/components/SettingsView.d.ts +13 -0
- package/dist/commonjs/components/SettingsView.js +328 -0
- package/dist/commonjs/components/TouchableScale.d.ts +2 -2
- package/dist/commonjs/components/TouchableScale.js +2 -2
- package/dist/commonjs/components/TreeNode.js +2 -2
- package/dist/commonjs/constants/index.js +1 -12
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +8 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +42 -1
- package/dist/commonjs/customHooks/consoleLogger.js +137 -13
- package/dist/commonjs/customHooks/networkLogger.d.ts +0 -1
- package/dist/commonjs/customHooks/networkLogger.js +0 -1
- package/dist/commonjs/customHooks/reduxLogger.d.ts +2 -9
- package/dist/commonjs/enums/index.d.ts +39 -0
- package/dist/commonjs/enums/index.js +50 -0
- package/dist/commonjs/helpers/index.d.ts +27 -1
- package/dist/commonjs/helpers/index.js +187 -12
- package/dist/commonjs/helpers/settingsStore.d.ts +2 -24
- package/dist/commonjs/i18n/en.json +144 -0
- package/dist/commonjs/i18n/index.d.ts +2 -0
- package/dist/commonjs/i18n/index.js +27 -0
- package/dist/commonjs/i18n/locales/en.json +314 -0
- package/dist/commonjs/index.d.ts +2 -3
- package/dist/commonjs/index.js +207 -4927
- package/dist/commonjs/styles/AppColors.d.ts +148 -0
- package/dist/commonjs/styles/AppColors.js +176 -0
- package/dist/commonjs/styles/common.d.ts +3 -0
- package/dist/commonjs/styles/common.js +201 -0
- package/dist/commonjs/styles/index.d.ts +219 -435
- package/dist/commonjs/styles/index.js +312 -488
- package/dist/commonjs/types/enums.d.ts +9 -0
- package/dist/commonjs/types/enums.js +4 -0
- package/dist/commonjs/types/index.d.ts +4 -111
- package/dist/commonjs/types/index.js +16 -0
- package/dist/commonjs/types/interfaces.d.ts +337 -0
- package/dist/commonjs/types/interfaces.js +2 -0
- package/dist/esm/assets/svgAssets.d.ts +3 -0
- package/dist/esm/assets/svgAssets.js +14 -0
- package/dist/esm/components/AnalyticsEventCard.d.ts +1 -14
- package/dist/esm/components/AnalyticsEventCard.js +118 -48
- package/dist/esm/components/AnalyticsGraph.d.ts +2 -6
- package/dist/esm/components/AnalyticsGraph.js +8 -8
- package/dist/esm/components/AnalyticsTabView.d.ts +15 -0
- package/dist/esm/components/AnalyticsTabView.js +151 -0
- package/dist/esm/components/AnimatedEntrance.d.ts +1 -1
- package/dist/esm/components/AnimatedEntrance.js +2 -2
- package/dist/esm/components/ApiDetailView.d.ts +22 -0
- package/dist/esm/components/ApiDetailView.js +264 -0
- package/dist/esm/components/ApisTabView.d.ts +33 -0
- package/dist/esm/components/ApisTabView.js +196 -0
- package/dist/esm/components/CodeSnippet.d.ts +1 -5
- package/dist/esm/components/CodeSnippet.js +34 -34
- package/dist/esm/components/ConsoleLogCard.d.ts +1 -8
- package/dist/esm/components/ConsoleLogCard.js +262 -409
- package/dist/esm/components/ConsoleLogDetailView.d.ts +9 -0
- package/dist/esm/components/ConsoleLogDetailView.js +271 -0
- package/dist/esm/components/ConsoleLogsTabView.d.ts +24 -0
- package/dist/esm/components/ConsoleLogsTabView.js +348 -0
- package/dist/esm/components/DiffViewer.js +4 -2
- package/dist/esm/components/DomainHeader.js +66 -41
- package/dist/esm/components/EmptyState.d.ts +2 -2
- package/dist/esm/components/EmptyState.js +2 -2
- package/dist/esm/components/EndOfListFooter.d.ts +8 -0
- package/dist/esm/components/EndOfListFooter.js +83 -0
- package/dist/esm/components/ErrorBoundary.d.ts +5 -14
- package/dist/esm/components/ErrorBoundary.js +29 -29
- package/dist/esm/components/FloatingBubble.d.ts +14 -0
- package/dist/esm/components/FloatingBubble.js +68 -0
- package/dist/esm/components/HeadersSection.js +5 -3
- package/dist/esm/components/HighlightText.d.ts +1 -1
- package/dist/esm/components/HighlightText.js +5 -7
- package/dist/esm/components/Inspector/AnalyticsTab.d.ts +3 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +194 -0
- package/dist/esm/components/Inspector/ConsoleTab.d.ts +3 -0
- package/dist/esm/components/Inspector/ConsoleTab.js +372 -0
- package/dist/esm/components/Inspector/FabLauncher.d.ts +3 -0
- package/dist/esm/components/Inspector/FabLauncher.js +49 -0
- package/dist/esm/components/Inspector/InsightsDashboard.d.ts +3 -0
- package/dist/esm/components/Inspector/InsightsDashboard.js +614 -0
- package/dist/esm/components/Inspector/InspectorContext.d.ts +5 -0
- package/dist/esm/components/Inspector/InspectorContext.js +13 -0
- package/dist/esm/components/Inspector/InspectorHeader.d.ts +3 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +447 -0
- package/dist/esm/components/Inspector/LogDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/LogDetail.js +925 -0
- package/dist/esm/components/Inspector/MainScreen.d.ts +3 -0
- package/dist/esm/components/Inspector/MainScreen.js +63 -0
- package/dist/esm/components/Inspector/NavigationTracker.d.ts +3 -0
- package/dist/esm/components/Inspector/NavigationTracker.js +10 -0
- package/dist/esm/components/Inspector/NetworkDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/NetworkDetail.js +367 -0
- package/dist/esm/components/Inspector/NetworkTab.d.ts +3 -0
- package/dist/esm/components/Inspector/NetworkTab.js +243 -0
- package/dist/esm/components/Inspector/ReduxTab.d.ts +3 -0
- package/dist/esm/components/Inspector/ReduxTab.js +70 -0
- package/dist/esm/components/Inspector/SettingsPanel.d.ts +3 -0
- package/dist/esm/components/Inspector/SettingsPanel.js +1438 -0
- package/dist/esm/components/Inspector/TabBar.d.ts +3 -0
- package/dist/esm/components/Inspector/TabBar.js +90 -0
- package/dist/esm/components/Inspector/WebViewTab.d.ts +3 -0
- package/dist/esm/components/Inspector/WebViewTab.js +752 -0
- package/dist/esm/components/InspectorHeader.d.ts +19 -0
- package/dist/esm/components/InspectorHeader.js +323 -0
- package/dist/esm/components/InspectorTabBar.d.ts +16 -0
- package/dist/esm/components/InspectorTabBar.js +84 -0
- package/dist/esm/components/JsonViewer.d.ts +4 -1
- package/dist/esm/components/JsonViewer.js +111 -172
- package/dist/esm/components/LogCard.js +111 -88
- package/dist/esm/components/MetaAccordion.d.ts +1 -10
- package/dist/esm/components/MetaAccordion.js +23 -21
- package/dist/esm/components/NavigationTracker.d.ts +7 -0
- package/dist/esm/components/NavigationTracker.js +39 -0
- package/dist/esm/components/NetworkIcons.d.ts +6 -0
- package/dist/esm/components/NetworkIcons.js +46 -6
- package/dist/esm/components/ReduxTabView.d.ts +9 -0
- package/dist/esm/components/ReduxTabView.js +50 -0
- package/dist/esm/components/ReduxTreeView.js +243 -202
- package/dist/esm/components/SegmentedTabs.d.ts +15 -0
- package/dist/esm/components/SegmentedTabs.js +47 -0
- package/dist/esm/components/SettingsView.d.ts +13 -0
- package/dist/esm/components/SettingsView.js +321 -0
- package/dist/esm/components/TouchableScale.d.ts +2 -2
- package/dist/esm/components/TouchableScale.js +2 -2
- package/dist/esm/components/TreeNode.js +2 -2
- package/dist/esm/constants/index.js +1 -12
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.d.ts +8 -0
- package/dist/esm/customHooks/analyticsLogger.js +37 -0
- package/dist/esm/customHooks/consoleLogger.js +137 -13
- package/dist/esm/customHooks/networkLogger.d.ts +0 -1
- package/dist/esm/customHooks/networkLogger.js +0 -1
- package/dist/esm/customHooks/reduxLogger.d.ts +2 -9
- package/dist/esm/enums/index.d.ts +39 -0
- package/dist/esm/enums/index.js +47 -0
- package/dist/esm/helpers/index.d.ts +27 -1
- package/dist/esm/helpers/index.js +180 -11
- package/dist/esm/helpers/settingsStore.d.ts +2 -24
- package/dist/esm/i18n/en.json +144 -0
- package/dist/esm/i18n/index.d.ts +2 -0
- package/dist/esm/i18n/index.js +22 -0
- package/dist/esm/i18n/locales/en.json +314 -0
- package/dist/esm/index.d.ts +2 -3
- package/dist/esm/index.js +207 -4923
- package/dist/esm/styles/AppColors.d.ts +148 -0
- package/dist/esm/styles/AppColors.js +176 -0
- package/dist/esm/styles/common.d.ts +3 -0
- package/dist/esm/styles/common.js +197 -0
- package/dist/esm/styles/index.d.ts +219 -435
- package/dist/esm/styles/index.js +312 -488
- package/dist/esm/types/enums.d.ts +9 -0
- package/dist/esm/types/enums.js +3 -0
- package/dist/esm/types/index.d.ts +4 -111
- package/dist/esm/types/index.js +2 -1
- package/dist/esm/types/interfaces.d.ts +337 -0
- package/dist/esm/types/interfaces.js +1 -0
- package/example/App.tsx +88 -1
- package/example/android/app/build.gradle +29 -1
- package/example/android/app/src/main/java/com/example/MainApplication.kt +25 -0
- package/example/android/build.gradle +31 -4
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/android/gradle.properties +1 -0
- package/example/android/settings.gradle +20 -1
- package/example/package-lock.json +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert, Pressable, ScrollView, Switch, Text, View, } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import TouchableScale from './TouchableScale';
|
|
6
|
+
import { WhiteBackNavigation, SunIcon, MoonIcon, SignalIcon, TerminalIcon, AnalyticsIcon, GlobeIcon, TrashIcon, } from './NetworkIcons';
|
|
7
|
+
import { AppColors } from '../styles/AppColors';
|
|
8
|
+
import { AppFonts } from '../styles/AppFonts';
|
|
9
|
+
import { toggleGlobalTheme } from '../styles';
|
|
10
|
+
import { saveSettings, isPersistentStorageAvailable, clearPersistedSettings, } from '../helpers/settingsStore';
|
|
11
|
+
export const SettingsView = ({ headerTopPadding, defaultTab, tabVisibility, onCloseSettings, onUpdateTabVisibility, onSetDefaultTab, }) => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const [themeMode, setThemeMode] = React.useState(AppColors.primaryLight === AppColors.white ? 'light' : 'dark');
|
|
14
|
+
const handleToggleTheme = () => {
|
|
15
|
+
const nextIsDark = themeMode !== 'dark';
|
|
16
|
+
toggleGlobalTheme(nextIsDark);
|
|
17
|
+
const newTheme = nextIsDark ? 'dark' : 'light';
|
|
18
|
+
setThemeMode(newTheme);
|
|
19
|
+
saveSettings({ isDark: nextIsDark, theme: newTheme });
|
|
20
|
+
};
|
|
21
|
+
const renderSettingRow = (opts) => {
|
|
22
|
+
return (<Pressable onPress={opts.onPress} disabled={!opts.onPress} style={{
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
paddingVertical: 12,
|
|
27
|
+
paddingHorizontal: 16,
|
|
28
|
+
borderBottomWidth: 1,
|
|
29
|
+
borderBottomColor: AppColors.dividerColor,
|
|
30
|
+
}}>
|
|
31
|
+
<View style={{
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: 12,
|
|
35
|
+
flex: 1,
|
|
36
|
+
marginRight: 8,
|
|
37
|
+
}}>
|
|
38
|
+
<View style={{
|
|
39
|
+
width: 32,
|
|
40
|
+
height: 32,
|
|
41
|
+
borderRadius: 8,
|
|
42
|
+
backgroundColor: AppColors.grayBackground,
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
}}>
|
|
46
|
+
{opts.icon}
|
|
47
|
+
</View>
|
|
48
|
+
<View style={{ flex: 1 }}>
|
|
49
|
+
<Text style={{
|
|
50
|
+
fontFamily: AppFonts.interBold,
|
|
51
|
+
fontSize: 13,
|
|
52
|
+
color: AppColors.primaryBlack,
|
|
53
|
+
}}>
|
|
54
|
+
{opts.title}
|
|
55
|
+
</Text>
|
|
56
|
+
{opts.description ? (<Text style={{
|
|
57
|
+
fontFamily: AppFonts.interRegular,
|
|
58
|
+
fontSize: 11,
|
|
59
|
+
color: AppColors.grayTextWeak,
|
|
60
|
+
marginTop: 2,
|
|
61
|
+
}}>
|
|
62
|
+
{opts.description}
|
|
63
|
+
</Text>) : null}
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
{opts.rightComponent}
|
|
67
|
+
</Pressable>);
|
|
68
|
+
};
|
|
69
|
+
return (<View style={{ flex: 1, backgroundColor: AppColors.grayBackground }}>
|
|
70
|
+
<LinearGradient colors={[AppColors.purple, '#6B4EFF']} style={{ paddingTop: headerTopPadding, paddingBottom: 16 }}>
|
|
71
|
+
<View style={{
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
paddingHorizontal: 16,
|
|
75
|
+
gap: 12,
|
|
76
|
+
}}>
|
|
77
|
+
<TouchableScale onPress={onCloseSettings} hitSlop={15} style={{
|
|
78
|
+
width: 36,
|
|
79
|
+
height: 36,
|
|
80
|
+
borderRadius: 18,
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
backgroundColor: 'rgba(255,255,255,0.18)',
|
|
84
|
+
}}>
|
|
85
|
+
<WhiteBackNavigation />
|
|
86
|
+
</TouchableScale>
|
|
87
|
+
<Text style={{
|
|
88
|
+
fontFamily: AppFonts.interBold,
|
|
89
|
+
fontSize: 18,
|
|
90
|
+
color: AppColors.white,
|
|
91
|
+
}}>
|
|
92
|
+
{t('settings.title')}
|
|
93
|
+
</Text>
|
|
94
|
+
</View>
|
|
95
|
+
</LinearGradient>
|
|
96
|
+
|
|
97
|
+
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 32, gap: 16, paddingTop: 16 }}>
|
|
98
|
+
{/* Theme Settings */}
|
|
99
|
+
<View style={{
|
|
100
|
+
backgroundColor: AppColors.primaryLight,
|
|
101
|
+
marginHorizontal: 16,
|
|
102
|
+
borderRadius: 12,
|
|
103
|
+
borderWidth: 1,
|
|
104
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
105
|
+
overflow: 'hidden',
|
|
106
|
+
}}>
|
|
107
|
+
<View style={{
|
|
108
|
+
paddingHorizontal: 16,
|
|
109
|
+
paddingVertical: 10,
|
|
110
|
+
backgroundColor: AppColors.grayBackground,
|
|
111
|
+
borderBottomWidth: 1,
|
|
112
|
+
borderBottomColor: AppColors.dividerColor,
|
|
113
|
+
}}>
|
|
114
|
+
<Text style={{
|
|
115
|
+
fontFamily: AppFonts.interBold,
|
|
116
|
+
fontSize: 11,
|
|
117
|
+
color: AppColors.grayTextWeak,
|
|
118
|
+
letterSpacing: 0.5,
|
|
119
|
+
}}>
|
|
120
|
+
{t('settings.appearance')}
|
|
121
|
+
</Text>
|
|
122
|
+
</View>
|
|
123
|
+
{renderSettingRow({
|
|
124
|
+
icon: themeMode === 'dark' ? (<MoonIcon color={AppColors.purple} size={16}/>) : (<SunIcon color={AppColors.lightOrange} size={16}/>),
|
|
125
|
+
title: t('settings.dark_mode'),
|
|
126
|
+
description: t('settings.dark_mode_desc'),
|
|
127
|
+
rightComponent: (<Switch value={themeMode === 'dark'} onValueChange={handleToggleTheme} trackColor={{
|
|
128
|
+
false: AppColors.grayBorderSecondary,
|
|
129
|
+
true: AppColors.purple,
|
|
130
|
+
}}/>),
|
|
131
|
+
})}
|
|
132
|
+
</View>
|
|
133
|
+
|
|
134
|
+
{/* Module Visibility Settings */}
|
|
135
|
+
<View style={{
|
|
136
|
+
backgroundColor: AppColors.primaryLight,
|
|
137
|
+
marginHorizontal: 16,
|
|
138
|
+
borderRadius: 12,
|
|
139
|
+
borderWidth: 1,
|
|
140
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
141
|
+
overflow: 'hidden',
|
|
142
|
+
}}>
|
|
143
|
+
<View style={{
|
|
144
|
+
paddingHorizontal: 16,
|
|
145
|
+
paddingVertical: 10,
|
|
146
|
+
backgroundColor: AppColors.grayBackground,
|
|
147
|
+
borderBottomWidth: 1,
|
|
148
|
+
borderBottomColor: AppColors.dividerColor,
|
|
149
|
+
}}>
|
|
150
|
+
<Text style={{
|
|
151
|
+
fontFamily: AppFonts.interBold,
|
|
152
|
+
fontSize: 11,
|
|
153
|
+
color: AppColors.grayTextWeak,
|
|
154
|
+
letterSpacing: 0.5,
|
|
155
|
+
}}>
|
|
156
|
+
{t('settings.module_visibility')}
|
|
157
|
+
</Text>
|
|
158
|
+
</View>
|
|
159
|
+
|
|
160
|
+
{renderSettingRow({
|
|
161
|
+
icon: <SignalIcon color={AppColors.purple} size={16}/>,
|
|
162
|
+
title: t('settings.apis_tab'),
|
|
163
|
+
description: t('settings.apis_tab_desc'),
|
|
164
|
+
rightComponent: (<Switch value={tabVisibility.apis !== false} onValueChange={val => onUpdateTabVisibility('apis', val)} trackColor={{
|
|
165
|
+
false: AppColors.grayBorderSecondary,
|
|
166
|
+
true: AppColors.purple,
|
|
167
|
+
}}/>),
|
|
168
|
+
})}
|
|
169
|
+
|
|
170
|
+
{renderSettingRow({
|
|
171
|
+
icon: <TerminalIcon color={AppColors.purple} size={16}/>,
|
|
172
|
+
title: t('settings.logs_tab'),
|
|
173
|
+
description: t('settings.logs_tab_desc'),
|
|
174
|
+
rightComponent: (<Switch value={tabVisibility.logs !== false} onValueChange={val => onUpdateTabVisibility('logs', val)} trackColor={{
|
|
175
|
+
false: AppColors.grayBorderSecondary,
|
|
176
|
+
true: AppColors.purple,
|
|
177
|
+
}}/>),
|
|
178
|
+
})}
|
|
179
|
+
|
|
180
|
+
{renderSettingRow({
|
|
181
|
+
icon: <AnalyticsIcon color={AppColors.purple} size={16}/>,
|
|
182
|
+
title: t('settings.analytics_tab'),
|
|
183
|
+
description: t('settings.analytics_tab_desc'),
|
|
184
|
+
rightComponent: (<Switch value={tabVisibility.analytics !== false} onValueChange={val => onUpdateTabVisibility('analytics', val)} trackColor={{
|
|
185
|
+
false: AppColors.grayBorderSecondary,
|
|
186
|
+
true: AppColors.purple,
|
|
187
|
+
}}/>),
|
|
188
|
+
})}
|
|
189
|
+
|
|
190
|
+
{renderSettingRow({
|
|
191
|
+
icon: <TerminalIcon color={AppColors.purple} size={16}/>,
|
|
192
|
+
title: t('settings.redux_tab'),
|
|
193
|
+
description: t('settings.redux_tab_desc'),
|
|
194
|
+
rightComponent: (<Switch value={tabVisibility.redux !== false} onValueChange={val => onUpdateTabVisibility('redux', val)} trackColor={{
|
|
195
|
+
false: AppColors.grayBorderSecondary,
|
|
196
|
+
true: AppColors.purple,
|
|
197
|
+
}}/>),
|
|
198
|
+
})}
|
|
199
|
+
</View>
|
|
200
|
+
|
|
201
|
+
{/* Landing Tab Preference */}
|
|
202
|
+
<View style={{
|
|
203
|
+
backgroundColor: AppColors.primaryLight,
|
|
204
|
+
marginHorizontal: 16,
|
|
205
|
+
borderRadius: 12,
|
|
206
|
+
borderWidth: 1,
|
|
207
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
208
|
+
overflow: 'hidden',
|
|
209
|
+
}}>
|
|
210
|
+
<View style={{
|
|
211
|
+
paddingHorizontal: 16,
|
|
212
|
+
paddingVertical: 10,
|
|
213
|
+
backgroundColor: AppColors.grayBackground,
|
|
214
|
+
borderBottomWidth: 1,
|
|
215
|
+
borderBottomColor: AppColors.dividerColor,
|
|
216
|
+
}}>
|
|
217
|
+
<Text style={{
|
|
218
|
+
fontFamily: AppFonts.interBold,
|
|
219
|
+
fontSize: 11,
|
|
220
|
+
color: AppColors.grayTextWeak,
|
|
221
|
+
letterSpacing: 0.5,
|
|
222
|
+
}}>
|
|
223
|
+
{t('settings.default_landing_tab')}
|
|
224
|
+
</Text>
|
|
225
|
+
</View>
|
|
226
|
+
{['apis', 'logs', 'analytics', 'redux'].map(tabKey => {
|
|
227
|
+
if (!tabVisibility[tabKey])
|
|
228
|
+
return null;
|
|
229
|
+
const isSelected = defaultTab === tabKey;
|
|
230
|
+
return (<TouchableScale key={tabKey} onPress={() => onSetDefaultTab(tabKey)} style={{
|
|
231
|
+
flexDirection: 'row',
|
|
232
|
+
alignItems: 'center',
|
|
233
|
+
justifyContent: 'space-between',
|
|
234
|
+
paddingVertical: 12,
|
|
235
|
+
paddingHorizontal: 16,
|
|
236
|
+
borderBottomWidth: 1,
|
|
237
|
+
borderBottomColor: AppColors.dividerColor,
|
|
238
|
+
backgroundColor: isSelected
|
|
239
|
+
? 'rgba(107, 78, 255, 0.05)'
|
|
240
|
+
: AppColors.primaryLight,
|
|
241
|
+
}}>
|
|
242
|
+
<Text style={{
|
|
243
|
+
fontFamily: isSelected
|
|
244
|
+
? AppFonts.interBold
|
|
245
|
+
: AppFonts.interMedium,
|
|
246
|
+
fontSize: 13,
|
|
247
|
+
color: isSelected
|
|
248
|
+
? AppColors.purple
|
|
249
|
+
: AppColors.primaryBlack,
|
|
250
|
+
}}>
|
|
251
|
+
{tabKey.toUpperCase()} Tab
|
|
252
|
+
</Text>
|
|
253
|
+
<View style={{
|
|
254
|
+
width: 18,
|
|
255
|
+
height: 18,
|
|
256
|
+
borderRadius: 9,
|
|
257
|
+
borderWidth: isSelected ? 5 : 2,
|
|
258
|
+
borderColor: isSelected
|
|
259
|
+
? AppColors.purple
|
|
260
|
+
: AppColors.grayBorderSecondary,
|
|
261
|
+
}}/>
|
|
262
|
+
</TouchableScale>);
|
|
263
|
+
})}
|
|
264
|
+
</View>
|
|
265
|
+
|
|
266
|
+
{/* Storage & Persistence Settings */}
|
|
267
|
+
<View style={{
|
|
268
|
+
backgroundColor: AppColors.primaryLight,
|
|
269
|
+
marginHorizontal: 16,
|
|
270
|
+
borderRadius: 12,
|
|
271
|
+
borderWidth: 1,
|
|
272
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
273
|
+
overflow: 'hidden',
|
|
274
|
+
}}>
|
|
275
|
+
<View style={{
|
|
276
|
+
paddingHorizontal: 16,
|
|
277
|
+
paddingVertical: 10,
|
|
278
|
+
backgroundColor: AppColors.grayBackground,
|
|
279
|
+
borderBottomWidth: 1,
|
|
280
|
+
borderBottomColor: AppColors.dividerColor,
|
|
281
|
+
}}>
|
|
282
|
+
<Text style={{
|
|
283
|
+
fontFamily: AppFonts.interBold,
|
|
284
|
+
fontSize: 11,
|
|
285
|
+
color: AppColors.grayTextWeak,
|
|
286
|
+
letterSpacing: 0.5,
|
|
287
|
+
}}>
|
|
288
|
+
{t('settings.storage_persistence')}
|
|
289
|
+
</Text>
|
|
290
|
+
</View>
|
|
291
|
+
{renderSettingRow({
|
|
292
|
+
icon: <GlobeIcon color={AppColors.purple} size={16}/>,
|
|
293
|
+
title: t('settings.custom_storage'),
|
|
294
|
+
description: isPersistentStorageAvailable()
|
|
295
|
+
? t('settings.custom_storage_active')
|
|
296
|
+
: t('settings.custom_storage_memory'),
|
|
297
|
+
})}
|
|
298
|
+
|
|
299
|
+
{renderSettingRow({
|
|
300
|
+
icon: <TrashIcon color={AppColors.errorColor} size={16}/>,
|
|
301
|
+
title: t('settings.reset_settings'),
|
|
302
|
+
description: t('settings.reset_settings_desc'),
|
|
303
|
+
onPress: () => {
|
|
304
|
+
Alert.alert(t('settings.reset_confirm_title'), t('settings.reset_confirm_msg'), [
|
|
305
|
+
{ text: t('header.cancel'), style: 'cancel' },
|
|
306
|
+
{
|
|
307
|
+
text: t('settings.reset'),
|
|
308
|
+
style: 'destructive',
|
|
309
|
+
onPress: () => {
|
|
310
|
+
clearPersistedSettings();
|
|
311
|
+
Alert.alert(t('settings.reset'), t('settings.reset_done'));
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
]);
|
|
315
|
+
},
|
|
316
|
+
})}
|
|
317
|
+
</View>
|
|
318
|
+
</ScrollView>
|
|
319
|
+
</View>);
|
|
320
|
+
};
|
|
321
|
+
export default SettingsView;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const TouchableScale:
|
|
2
|
+
declare const TouchableScale: React.NamedExoticComponent<{
|
|
3
3
|
onPress?: () => void;
|
|
4
4
|
style?: any;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
hitSlop?: any;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
}
|
|
8
|
+
}>;
|
|
9
9
|
export default TouchableScale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { Animated, Pressable, StyleSheet, Platform } from 'react-native';
|
|
3
|
-
const TouchableScale = ({ onPress, style, children, hitSlop, disabled, })
|
|
3
|
+
const TouchableScale = React.memo(function TouchableScale({ onPress, style, children, hitSlop, disabled, }) {
|
|
4
4
|
if (Platform.OS === 'android') {
|
|
5
5
|
return (<Pressable disabled={disabled} onPress={onPress} hitSlop={hitSlop} style={({ pressed }) => [
|
|
6
6
|
style,
|
|
@@ -43,5 +43,5 @@ const TouchableScale = ({ onPress, style, children, hitSlop, disabled, }) => {
|
|
|
43
43
|
{children}
|
|
44
44
|
</Animated.View>
|
|
45
45
|
</Pressable>);
|
|
46
|
-
};
|
|
46
|
+
});
|
|
47
47
|
export default TouchableScale;
|
|
@@ -8,8 +8,8 @@ import { ChevronIcon } from './NetworkIcons';
|
|
|
8
8
|
import { AppColors } from '../styles/AppColors';
|
|
9
9
|
import styles from '../styles';
|
|
10
10
|
const TreeNode = React.memo(function TreeNode({ data, name, level = 0, search, forceOpen, defaultExpandDepth, }) {
|
|
11
|
-
const [localOpen, setLocalOpen] = useState(level < (defaultExpandDepth ?? 1));
|
|
12
|
-
const open =
|
|
11
|
+
const [localOpen, setLocalOpen] = useState(forceOpen || level < (defaultExpandDepth ?? 1));
|
|
12
|
+
const open = localOpen;
|
|
13
13
|
const isObject = typeof data === 'object' && data !== null;
|
|
14
14
|
const isArray = Array.isArray(data);
|
|
15
15
|
function renderHighlighted(text) {
|
|
@@ -16,18 +16,7 @@ export const METHOD_COLORS = {
|
|
|
16
16
|
PATCH: AppColors.offerPurple,
|
|
17
17
|
DELETE: AppColors.errorColor,
|
|
18
18
|
};
|
|
19
|
-
export const DOMAIN_COLORS =
|
|
20
|
-
'#1a5276',
|
|
21
|
-
'#8e44ad',
|
|
22
|
-
'#1e8449',
|
|
23
|
-
'#c0392b',
|
|
24
|
-
'#d35400',
|
|
25
|
-
'#d68910',
|
|
26
|
-
'#16a085',
|
|
27
|
-
'#27ae60',
|
|
28
|
-
'#2c3e50',
|
|
29
|
-
'#c2185b',
|
|
30
|
-
];
|
|
19
|
+
export const DOMAIN_COLORS = AppColors.domainColors;
|
|
31
20
|
export const DURATION_FAST_MS = 200;
|
|
32
21
|
export const DURATION_SLOW_MS = 800;
|
|
33
22
|
// Package version — auto-generated from package.json at build time.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.1.
|
|
1
|
+
export declare const LIB_VERSION = "1.1.15";
|
|
@@ -2,6 +2,14 @@ import { AnalyticsEvent } from '../types';
|
|
|
2
2
|
export declare const subscribeAnalyticsEvents: (callback: (events: AnalyticsEvent[]) => void) => () => void;
|
|
3
3
|
export declare const clearAnalyticsEvents: () => void;
|
|
4
4
|
export declare const getAnalyticsEvents: () => AnalyticsEvent[];
|
|
5
|
+
export declare const getCurrentUserProperties: () => {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const getCurrentUserId: () => string;
|
|
9
|
+
export declare const getDefaultEventParameters: () => {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
};
|
|
12
|
+
export declare const getCollectionEnabled: () => boolean;
|
|
5
13
|
/**
|
|
6
14
|
* Directly push an event into the inspector without going through Firebase.
|
|
7
15
|
* Useful for custom analytics wrappers or testing.
|
|
@@ -27,6 +27,8 @@ let counter = 0;
|
|
|
27
27
|
// Running snapshot of user properties set so far — attached to every event
|
|
28
28
|
let currentUserProperties = {};
|
|
29
29
|
let currentUserId;
|
|
30
|
+
let currentDefaultEventParameters = {};
|
|
31
|
+
let isCollectionEnabled = true;
|
|
30
32
|
// ─── Core helpers ─────────────────────────────────────────────────────────────
|
|
31
33
|
const notify = () => {
|
|
32
34
|
const snapshot = [...events];
|
|
@@ -50,6 +52,10 @@ export const clearAnalyticsEvents = () => {
|
|
|
50
52
|
notify();
|
|
51
53
|
};
|
|
52
54
|
export const getAnalyticsEvents = () => [...events];
|
|
55
|
+
export const getCurrentUserProperties = () => ({ ...currentUserProperties });
|
|
56
|
+
export const getCurrentUserId = () => currentUserId;
|
|
57
|
+
export const getDefaultEventParameters = () => ({ ...currentDefaultEventParameters });
|
|
58
|
+
export const getCollectionEnabled = () => isCollectionEnabled;
|
|
53
59
|
// ─── Manual logging (escape hatch, rarely needed) ────────────────────────────
|
|
54
60
|
/**
|
|
55
61
|
* Directly push an event into the inspector without going through Firebase.
|
|
@@ -147,8 +153,39 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
147
153
|
const originalSetUserId = analyticsInstance.setUserId.bind(analyticsInstance);
|
|
148
154
|
analyticsInstance.setUserId = async (id) => {
|
|
149
155
|
currentUserId = id ?? undefined;
|
|
156
|
+
notify();
|
|
150
157
|
return originalSetUserId(id);
|
|
151
158
|
};
|
|
159
|
+
// ── setDefaultEventParameters ──────────────────────────────────────────────
|
|
160
|
+
if (typeof analyticsInstance.setDefaultEventParameters === 'function') {
|
|
161
|
+
const originalSetDefaultEventParameters = analyticsInstance.setDefaultEventParameters.bind(analyticsInstance);
|
|
162
|
+
analyticsInstance.setDefaultEventParameters = async (params) => {
|
|
163
|
+
currentDefaultEventParameters = params ?? {};
|
|
164
|
+
notify();
|
|
165
|
+
return originalSetDefaultEventParameters(params);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// ── setAnalyticsCollectionEnabled ───────────────────────────────────────────
|
|
169
|
+
if (typeof analyticsInstance.setAnalyticsCollectionEnabled === 'function') {
|
|
170
|
+
const originalSetAnalyticsCollectionEnabled = analyticsInstance.setAnalyticsCollectionEnabled.bind(analyticsInstance);
|
|
171
|
+
analyticsInstance.setAnalyticsCollectionEnabled = async (enabled) => {
|
|
172
|
+
isCollectionEnabled = enabled;
|
|
173
|
+
notify();
|
|
174
|
+
return originalSetAnalyticsCollectionEnabled(enabled);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// ── resetAnalyticsData ──────────────────────────────────────────────────────
|
|
178
|
+
if (typeof analyticsInstance.resetAnalyticsData === 'function') {
|
|
179
|
+
const originalResetAnalyticsData = analyticsInstance.resetAnalyticsData.bind(analyticsInstance);
|
|
180
|
+
analyticsInstance.resetAnalyticsData = async () => {
|
|
181
|
+
clearAnalyticsEvents();
|
|
182
|
+
currentUserProperties = {};
|
|
183
|
+
currentUserId = undefined;
|
|
184
|
+
currentDefaultEventParameters = {};
|
|
185
|
+
notify();
|
|
186
|
+
return originalResetAnalyticsData();
|
|
187
|
+
};
|
|
188
|
+
}
|
|
152
189
|
};
|
|
153
190
|
export const autoSetupAnalyticsLogger = () => {
|
|
154
191
|
if (globalThis.__INSPECTOR_ANALYTICS_AUTOSETUP__)
|
|
@@ -24,26 +24,102 @@ const formatArgs = (args) => {
|
|
|
24
24
|
})
|
|
25
25
|
.join(' ');
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
// ─── Symbolication Helper for React Native Metro ────────────────────────────
|
|
28
|
+
const symbolicateStack = async (stackString) => {
|
|
29
|
+
if (typeof __DEV__ === 'undefined' || !__DEV__)
|
|
30
|
+
return null;
|
|
28
31
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// 1. Try React Native's built-in symbolicateStackTrace if available
|
|
33
|
+
let symModule = null;
|
|
34
|
+
try {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
symModule = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
|
|
37
|
+
}
|
|
38
|
+
catch { }
|
|
39
|
+
const symFn = symModule?.default || symModule;
|
|
40
|
+
if (typeof symFn === 'function') {
|
|
41
|
+
const res = await symFn(stackString);
|
|
42
|
+
if (res && Array.isArray(res.stack)) {
|
|
43
|
+
return res.stack;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch { }
|
|
48
|
+
try {
|
|
49
|
+
// 2. Direct HTTP symbolication to Metro packager endpoint
|
|
50
|
+
const metroUrl = 'http://localhost:8081/symbolicate';
|
|
51
|
+
const response = await fetch(metroUrl, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
headers: { 'Content-Type': 'application/json' },
|
|
54
|
+
body: JSON.stringify({ stack: stackString }),
|
|
55
|
+
});
|
|
56
|
+
if (response.ok) {
|
|
57
|
+
const json = await response.json();
|
|
58
|
+
if (json && Array.isArray(json.stack)) {
|
|
59
|
+
return json.stack;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch { }
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
const getStackDetails = (args) => {
|
|
67
|
+
try {
|
|
68
|
+
let errorStack;
|
|
69
|
+
if (args && args.length > 0) {
|
|
70
|
+
for (const arg of args) {
|
|
71
|
+
if (arg instanceof Error && arg.stack) {
|
|
72
|
+
errorStack = arg.stack;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
else if (arg &&
|
|
76
|
+
typeof arg === 'object' &&
|
|
77
|
+
typeof arg.stack === 'string') {
|
|
78
|
+
errorStack = arg.stack;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const rawStack = new Error().stack;
|
|
84
|
+
const stackToUse = errorStack || rawStack;
|
|
85
|
+
if (!stackToUse)
|
|
86
|
+
return { caller: 'Unknown', errorStack };
|
|
87
|
+
const lines = stackToUse.split('\n');
|
|
88
|
+
let userCaller;
|
|
89
|
+
let fallbackCaller;
|
|
33
90
|
for (let i = 0; i < lines.length; i++) {
|
|
34
91
|
const line = lines[i];
|
|
35
|
-
|
|
36
|
-
|
|
92
|
+
if (!line ||
|
|
93
|
+
line.includes('consoleLogger') ||
|
|
37
94
|
line.includes('setupConsoleLogger') ||
|
|
38
|
-
line.includes('
|
|
39
|
-
line.
|
|
95
|
+
line.includes('react-native-inapp-inspector') ||
|
|
96
|
+
line.trim() === 'Error') {
|
|
40
97
|
continue;
|
|
41
98
|
}
|
|
42
|
-
|
|
99
|
+
const isInternal = line.includes('react-native/Libraries') ||
|
|
100
|
+
line.includes('setUpConsole') ||
|
|
101
|
+
line.includes('ExceptionsManager') ||
|
|
102
|
+
line.includes('MessageQueue') ||
|
|
103
|
+
line.includes('metro-runtime') ||
|
|
104
|
+
line.includes('regenerator-runtime');
|
|
105
|
+
if (!fallbackCaller && !line.includes('setUpConsole')) {
|
|
106
|
+
fallbackCaller = line.trim().replace(/^at /, '');
|
|
107
|
+
}
|
|
108
|
+
if (!isInternal) {
|
|
109
|
+
userCaller = line.trim().replace(/^at /, '');
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
43
112
|
}
|
|
113
|
+
const cleanedStack = lines
|
|
114
|
+
.filter(l => !l.includes('consoleLogger') &&
|
|
115
|
+
!l.includes('setupConsoleLogger'))
|
|
116
|
+
.join('\n');
|
|
117
|
+
const caller = userCaller || fallbackCaller || 'Unknown';
|
|
118
|
+
return { caller, stack: cleanedStack || stackToUse, errorStack, stackToUse };
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
return { caller: 'Unknown' };
|
|
44
122
|
}
|
|
45
|
-
catch (e) { }
|
|
46
|
-
return 'Unknown';
|
|
47
123
|
};
|
|
48
124
|
const notify = () => {
|
|
49
125
|
const snapshot = [...logs];
|
|
@@ -68,18 +144,66 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
68
144
|
message.toLowerCase().trim().includes(prefix.toLowerCase().trim()))) {
|
|
69
145
|
return;
|
|
70
146
|
}
|
|
71
|
-
const caller =
|
|
147
|
+
const { caller, stack, errorStack, stackToUse } = getStackDetails(args);
|
|
72
148
|
const newLog = {
|
|
73
149
|
id: counter++,
|
|
74
150
|
type,
|
|
75
151
|
message,
|
|
76
152
|
timestamp: Date.now(),
|
|
77
153
|
caller,
|
|
154
|
+
stack,
|
|
155
|
+
errorStack,
|
|
156
|
+
rawArgs: args,
|
|
78
157
|
sourceMethod,
|
|
79
158
|
};
|
|
80
159
|
logs.unshift(newLog);
|
|
81
160
|
logs = logs.slice(0, MAX_LOGS);
|
|
82
161
|
notify();
|
|
162
|
+
// Asynchronously symbolicate stack trace using Metro in DEV mode
|
|
163
|
+
if (stackToUse && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
164
|
+
const currentLogId = newLog.id;
|
|
165
|
+
symbolicateStack(stackToUse)
|
|
166
|
+
.then(symFrames => {
|
|
167
|
+
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
168
|
+
const symLines = [];
|
|
169
|
+
let symUserCaller;
|
|
170
|
+
for (const frame of symFrames) {
|
|
171
|
+
const file = (frame.file || '').replace(/^webpack:\/\/\/?/, '');
|
|
172
|
+
const method = frame.methodName || '<anonymous>';
|
|
173
|
+
const line = frame.lineNumber != null ? `:${frame.lineNumber}` : '';
|
|
174
|
+
const col = frame.column != null ? `:${frame.column}` : '';
|
|
175
|
+
const lineStr = `at ${method} (${file}${line}${col})`;
|
|
176
|
+
symLines.push(lineStr);
|
|
177
|
+
const isUserFile = file &&
|
|
178
|
+
!file.includes('node_modules') &&
|
|
179
|
+
!file.includes('react-native/') &&
|
|
180
|
+
!file.includes('consoleLogger') &&
|
|
181
|
+
!file.includes('setupConsoleLogger') &&
|
|
182
|
+
(file.endsWith('.tsx') ||
|
|
183
|
+
file.endsWith('.jsx') ||
|
|
184
|
+
file.endsWith('.ts') ||
|
|
185
|
+
file.endsWith('.js'));
|
|
186
|
+
if (!symUserCaller && isUserFile) {
|
|
187
|
+
symUserCaller = `${method} (${file}${line}${col})`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const targetLog = logs.find(l => l.id === currentLogId);
|
|
191
|
+
if (targetLog) {
|
|
192
|
+
if (symUserCaller) {
|
|
193
|
+
targetLog.caller = symUserCaller;
|
|
194
|
+
}
|
|
195
|
+
else if (symLines.length > 0) {
|
|
196
|
+
targetLog.caller = symLines[0].replace(/^at /, '');
|
|
197
|
+
}
|
|
198
|
+
if (symLines.length > 0) {
|
|
199
|
+
targetLog.stack = symLines.join('\n');
|
|
200
|
+
}
|
|
201
|
+
notify();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
.catch(() => { });
|
|
206
|
+
}
|
|
83
207
|
}
|
|
84
208
|
catch (e) {
|
|
85
209
|
// Fail-safe to prevent crash during logging
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type: string;
|
|
4
|
-
payload: any;
|
|
5
|
-
timestamp: string;
|
|
6
|
-
affectedSlices: string[];
|
|
7
|
-
prevState?: any;
|
|
8
|
-
nextState?: any;
|
|
9
|
-
}
|
|
1
|
+
import { ReduxHistoryEntry } from '../types';
|
|
2
|
+
export { ReduxHistoryEntry };
|
|
10
3
|
export declare const getReduxState: () => any;
|
|
11
4
|
export declare const setReduxAutoRefresh: (val: boolean) => void;
|
|
12
5
|
export declare const getReduxAutoRefresh: () => boolean;
|