react-native-inapp-inspector 2.3.18 → 2.3.20
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 +57 -0
- package/dist/commonjs/analytics.js +1 -24
- package/dist/commonjs/bundle.js +1 -16
- package/dist/commonjs/capture.d.ts +2 -0
- package/dist/commonjs/capture.js +1 -32
- package/dist/commonjs/components/AnalyticsDetail.js +92 -623
- package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
- package/dist/commonjs/components/AnalyticsGraph.js +70 -370
- package/dist/commonjs/components/AnimatedEntrance.js +1 -11
- package/dist/commonjs/components/AppHeaderLogo.js +7 -134
- package/dist/commonjs/components/BrandCircleIcon.js +73 -118
- package/dist/commonjs/components/BrandSquareIcon.js +63 -108
- package/dist/commonjs/components/CodeSnippet.js +48 -623
- package/dist/commonjs/components/ConsoleLogCard.js +63 -537
- package/dist/commonjs/components/CopyButton.js +3 -89
- package/dist/commonjs/components/DiffViewer.js +19 -83
- package/dist/commonjs/components/DomainHeader.js +27 -127
- package/dist/commonjs/components/EmptyState.d.ts +1 -0
- package/dist/commonjs/components/EmptyState.js +10 -87
- package/dist/commonjs/components/EndOfListFooter.js +7 -81
- package/dist/commonjs/components/ErrorBoundary.js +72 -566
- package/dist/commonjs/components/HeadersSection.js +31 -110
- package/dist/commonjs/components/HighlightText.js +17 -58
- package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/commonjs/components/Inspector/AboutModal.js +351 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
- package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
- package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
- package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
- package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
- package/dist/commonjs/components/Inspector/DebuggingTab.js +64 -871
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
- package/dist/commonjs/components/Inspector/FabLauncher.js +85 -54
- package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +9 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.js +167 -521
- package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
- package/dist/commonjs/components/Inspector/InspectorHeader.js +219 -1093
- package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
- package/dist/commonjs/components/Inspector/MainScreen.js +60 -332
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +136 -278
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +134 -361
- package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
- package/dist/commonjs/components/Inspector/NetworkDetail.js +96 -432
- package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
- package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +17 -433
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
- package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
- package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
- package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
- package/dist/commonjs/components/Inspector/SettingsPanel.js +431 -3431
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
- package/dist/commonjs/components/Inspector/TabBar.js +47 -183
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +34 -408
- package/dist/commonjs/components/JsonViewer.js +168 -380
- package/dist/commonjs/components/LogCard.js +57 -567
- package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
- package/dist/commonjs/components/MetaAccordion.js +69 -238
- package/dist/commonjs/components/MiniBarChart.js +3 -56
- package/dist/commonjs/components/MiniLineChart.js +3 -58
- package/dist/commonjs/components/NetworkIcons.d.ts +7 -0
- package/dist/commonjs/components/NetworkIcons.js +479 -997
- package/dist/commonjs/components/QRCodeView.js +5 -79
- package/dist/commonjs/components/SectionHeader.js +15 -37
- package/dist/commonjs/components/SegmentedTabs.js +7 -61
- package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Slider.js +15 -243
- package/dist/commonjs/components/SourcePageCard.js +30 -89
- package/dist/commonjs/components/Toast.js +5 -147
- package/dist/commonjs/components/TouchableScale.js +3 -24
- package/dist/commonjs/components/TreeNode.js +55 -130
- package/dist/commonjs/console.js +1 -16
- package/dist/commonjs/constants/index.js +1 -32
- package/dist/commonjs/constants/telemetryConfig.js +1 -6
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -4
- package/dist/commonjs/crash.js +1 -23
- package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
- package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
- package/dist/commonjs/customHooks/consoleLogger.js +6 -445
- package/dist/commonjs/customHooks/crashHandler.js +7 -656
- package/dist/commonjs/customHooks/logFilters.js +1 -23
- package/dist/commonjs/customHooks/networkLogger.js +2 -536
- package/dist/commonjs/customHooks/performanceTracker.js +63 -750
- package/dist/commonjs/customHooks/reduxLogger.js +2 -313
- package/dist/commonjs/customHooks/storageInspector.js +1 -435
- package/dist/commonjs/customHooks/useAccordion.js +1 -18
- package/dist/commonjs/decorators/index.js +1 -100
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
- package/dist/commonjs/helpers/index.js +8 -921
- package/dist/commonjs/helpers/memoryManager.js +1 -99
- package/dist/commonjs/helpers/qrGenerator.js +1 -367
- package/dist/commonjs/helpers/remoteConfig.js +1 -165
- package/dist/commonjs/helpers/searchQueryParser.js +1 -62
- package/dist/commonjs/helpers/settingsStore.js +1 -144
- package/dist/commonjs/helpers/telemetry.js +1 -501
- package/dist/commonjs/helpers/toast.js +1 -20
- package/dist/commonjs/i18n/index.js +1 -90
- package/dist/commonjs/i18n/locales/en.json +1 -1122
- package/dist/commonjs/index.js +5 -2153
- package/dist/commonjs/metro.js +6 -468
- package/dist/commonjs/native/NativeInspector.d.ts +3 -0
- package/dist/commonjs/native/NativeInspector.js +1 -402
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +1 -0
- package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
- package/dist/commonjs/network.js +1 -13
- package/dist/commonjs/performance.js +1 -29
- package/dist/commonjs/redux.js +1 -20
- package/dist/commonjs/storage.js +1 -14
- package/dist/commonjs/styles/AppColors.js +1 -423
- package/dist/commonjs/styles/AppFonts.js +1 -17
- package/dist/commonjs/styles/common.js +1 -190
- package/dist/commonjs/styles/index.d.ts +6 -0
- package/dist/commonjs/styles/index.js +1 -1589
- package/dist/commonjs/types/enums.d.ts +2 -1
- package/dist/commonjs/types/enums.js +1 -150
- package/dist/commonjs/types/index.js +1 -18
- package/dist/commonjs/types/interfaces.d.ts +7 -0
- package/dist/commonjs/types/interfaces.js +1 -2
- package/dist/esm/analytics.js +1 -2
- package/dist/esm/bundle.js +1 -2
- package/dist/esm/capture.d.ts +2 -0
- package/dist/esm/capture.js +1 -29
- package/dist/esm/components/AnalyticsDetail.js +171 -664
- package/dist/esm/components/AnalyticsEventCard.js +77 -335
- package/dist/esm/components/AnalyticsGraph.js +95 -357
- package/dist/esm/components/AnimatedEntrance.js +1 -6
- package/dist/esm/components/AppHeaderLogo.js +7 -94
- package/dist/esm/components/BrandCircleIcon.js +114 -119
- package/dist/esm/components/BrandSquareIcon.js +73 -78
- package/dist/esm/components/CodeSnippet.js +58 -595
- package/dist/esm/components/ConsoleLogCard.js +91 -526
- package/dist/esm/components/CopyButton.js +3 -51
- package/dist/esm/components/DiffViewer.js +22 -48
- package/dist/esm/components/DomainHeader.js +43 -138
- package/dist/esm/components/EmptyState.d.ts +1 -0
- package/dist/esm/components/EmptyState.js +17 -56
- package/dist/esm/components/EndOfListFooter.js +15 -83
- package/dist/esm/components/ErrorBoundary.js +125 -582
- package/dist/esm/components/HeadersSection.js +52 -93
- package/dist/esm/components/HighlightText.js +17 -53
- package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/esm/components/Inspector/AboutModal.js +351 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
- package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
- package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
- package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
- package/dist/esm/components/Inspector/CrashDetail.js +236 -747
- package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
- package/dist/esm/components/Inspector/CrashTab.js +177 -711
- package/dist/esm/components/Inspector/DebuggingTab.js +156 -923
- package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
- package/dist/esm/components/Inspector/FabLauncher.js +85 -49
- package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +9 -0
- package/dist/esm/components/Inspector/FeedbackModal.js +182 -499
- package/dist/esm/components/Inspector/InspectorContext.js +1 -12
- package/dist/esm/components/Inspector/InspectorHeader.js +309 -1145
- package/dist/esm/components/Inspector/LogDetail.js +235 -1023
- package/dist/esm/components/Inspector/MainScreen.js +86 -320
- package/dist/esm/components/Inspector/MediaGalleryTab.js +157 -259
- package/dist/esm/components/Inspector/MediaPreviewModal.js +153 -340
- package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +141 -472
- package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
- package/dist/esm/components/Inspector/NetworkTab.js +125 -517
- package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
- package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
- package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
- package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
- package/dist/esm/components/Inspector/ReduxTab.js +144 -722
- package/dist/esm/components/Inspector/SettingsPanel.js +647 -3609
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Inspector/StorageTab.js +172 -866
- package/dist/esm/components/Inspector/TabBar.js +52 -183
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +79 -416
- package/dist/esm/components/JsonViewer.js +179 -353
- package/dist/esm/components/LogCard.js +93 -565
- package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
- package/dist/esm/components/MetaAccordion.js +136 -267
- package/dist/esm/components/MiniBarChart.js +3 -18
- package/dist/esm/components/MiniLineChart.js +3 -20
- package/dist/esm/components/NetworkIcons.d.ts +7 -0
- package/dist/esm/components/NetworkIcons.js +481 -817
- package/dist/esm/components/QRCodeView.js +8 -45
- package/dist/esm/components/SectionHeader.js +22 -39
- package/dist/esm/components/SegmentedTabs.js +8 -57
- package/dist/esm/components/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Slider.js +24 -213
- package/dist/esm/components/SourcePageCard.js +65 -86
- package/dist/esm/components/Toast.js +10 -117
- package/dist/esm/components/TouchableScale.js +3 -19
- package/dist/esm/components/TreeNode.js +58 -95
- package/dist/esm/console.js +1 -2
- package/dist/esm/constants/index.js +1 -28
- package/dist/esm/constants/telemetryConfig.js +1 -3
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/crash.js +1 -2
- package/dist/esm/customHooks/analyticsLogger.js +1 -230
- package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
- package/dist/esm/customHooks/consoleLogger.js +6 -432
- package/dist/esm/customHooks/crashHandler.js +7 -630
- package/dist/esm/customHooks/logFilters.js +1 -20
- package/dist/esm/customHooks/networkLogger.js +2 -519
- package/dist/esm/customHooks/performanceTracker.js +63 -723
- package/dist/esm/customHooks/reduxLogger.js +2 -293
- package/dist/esm/customHooks/storageInspector.js +1 -418
- package/dist/esm/customHooks/useAccordion.js +1 -16
- package/dist/esm/decorators/index.js +1 -95
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
- package/dist/esm/helpers/index.js +8 -861
- package/dist/esm/helpers/memoryManager.js +1 -91
- package/dist/esm/helpers/qrGenerator.js +1 -364
- package/dist/esm/helpers/remoteConfig.js +1 -160
- package/dist/esm/helpers/searchQueryParser.js +1 -59
- package/dist/esm/helpers/settingsStore.js +1 -134
- package/dist/esm/helpers/telemetry.js +1 -489
- package/dist/esm/helpers/toast.js +1 -15
- package/dist/esm/i18n/index.js +1 -78
- package/dist/esm/i18n/locales/en.json +1 -1122
- package/dist/esm/index.js +7 -1967
- package/dist/esm/metro.js +6 -459
- package/dist/esm/native/NativeInspector.d.ts +3 -0
- package/dist/esm/native/NativeInspector.js +1 -370
- package/dist/esm/native/NativeNetworkInspector.d.ts +1 -0
- package/dist/esm/native/NativeNetworkInspector.js +1 -2
- package/dist/esm/network.js +1 -1
- package/dist/esm/performance.js +1 -2
- package/dist/esm/redux.js +1 -1
- package/dist/esm/storage.js +1 -1
- package/dist/esm/styles/AppColors.js +1 -417
- package/dist/esm/styles/AppFonts.js +1 -13
- package/dist/esm/styles/common.js +1 -186
- package/dist/esm/styles/index.d.ts +6 -0
- package/dist/esm/styles/index.js +1 -1551
- package/dist/esm/types/enums.d.ts +2 -1
- package/dist/esm/types/enums.js +1 -147
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/interfaces.d.ts +7 -0
- package/dist/esm/types/interfaces.js +1 -1
- package/ios/NetworkInspectorModule.mm +253 -136
- package/package.json +5 -3
- package/react-native-inapp-inspector.podspec +1 -1
- package/src/native/NativeInspector.ts +17 -0
- package/src/native/NativeNetworkInspector.ts +1 -0
- package/src/analytics.ts +0 -35
- package/src/bundle.ts +0 -25
- package/src/capture.ts +0 -101
- package/src/components/AnalyticsDetail.tsx +0 -870
- package/src/components/AnalyticsEventCard.tsx +0 -444
- package/src/components/AnalyticsGraph.tsx +0 -583
- package/src/components/AnimatedEntrance.tsx +0 -20
- package/src/components/AppHeaderLogo.tsx +0 -143
- package/src/components/BrandCircleIcon.tsx +0 -144
- package/src/components/BrandSquareIcon.tsx +0 -184
- package/src/components/CodeSnippet.tsx +0 -725
- package/src/components/ConsoleLogCard.tsx +0 -679
- package/src/components/CopyButton.tsx +0 -87
- package/src/components/DiffViewer.tsx +0 -82
- package/src/components/DomainHeader.tsx +0 -224
- package/src/components/EmptyState.tsx +0 -95
- package/src/components/EndOfListFooter.tsx +0 -100
- package/src/components/ErrorBoundary.tsx +0 -688
- package/src/components/HeadersSection.tsx +0 -172
- package/src/components/HighlightText.tsx +0 -100
- package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
- package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
- package/src/components/Inspector/BundleTab.tsx +0 -4768
- package/src/components/Inspector/ConsoleTab.tsx +0 -726
- package/src/components/Inspector/CrashDetail.tsx +0 -997
- package/src/components/Inspector/CrashFilterModal.tsx +0 -721
- package/src/components/Inspector/CrashTab.tsx +0 -933
- package/src/components/Inspector/DebuggingTab.tsx +0 -1103
- package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
- package/src/components/Inspector/FabLauncher.tsx +0 -80
- package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
- package/src/components/Inspector/FeedbackModal.tsx +0 -626
- package/src/components/Inspector/InspectorContext.tsx +0 -28
- package/src/components/Inspector/InspectorHeader.tsx +0 -1545
- package/src/components/Inspector/LogDetail.tsx +0 -1431
- package/src/components/Inspector/MainScreen.tsx +0 -459
- package/src/components/Inspector/MediaGalleryTab.tsx +0 -355
- package/src/components/Inspector/MediaPreviewModal.tsx +0 -435
- package/src/components/Inspector/NavigationTracker.tsx +0 -13
- package/src/components/Inspector/NetworkDetail.tsx +0 -795
- package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
- package/src/components/Inspector/NetworkTab.tsx +0 -820
- package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
- package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
- package/src/components/Inspector/PerformanceTab.tsx +0 -1967
- package/src/components/Inspector/ReduxDetail.tsx +0 -1651
- package/src/components/Inspector/ReduxTab.tsx +0 -987
- package/src/components/Inspector/SettingsPanel.tsx +0 -4580
- package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Inspector/StorageTab.tsx +0 -1159
- package/src/components/Inspector/TabBar.tsx +0 -263
- package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
- package/src/components/JsonViewer.tsx +0 -547
- package/src/components/LogCard.tsx +0 -694
- package/src/components/LogSyntaxHighlighter.tsx +0 -178
- package/src/components/MetaAccordion.tsx +0 -355
- package/src/components/MiniBarChart.tsx +0 -42
- package/src/components/MiniLineChart.tsx +0 -33
- package/src/components/NetworkIcons.tsx +0 -2599
- package/src/components/QRCodeView.tsx +0 -75
- package/src/components/SectionHeader.tsx +0 -101
- package/src/components/SegmentedTabs.tsx +0 -83
- package/src/components/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Slider.tsx +0 -300
- package/src/components/SourcePageCard.tsx +0 -150
- package/src/components/Toast.tsx +0 -131
- package/src/components/TouchableScale.tsx +0 -61
- package/src/components/TreeNode.tsx +0 -171
- package/src/console.ts +0 -24
- package/src/constants/index.ts +0 -41
- package/src/constants/telemetryConfig.ts +0 -4
- package/src/constants/version.ts +0 -3
- package/src/crash.ts +0 -32
- package/src/customHooks/analyticsLogger.ts +0 -336
- package/src/customHooks/bundleAnalyzer.ts +0 -1256
- package/src/customHooks/consoleLogger.ts +0 -530
- package/src/customHooks/crashHandler.ts +0 -944
- package/src/customHooks/logFilters.ts +0 -32
- package/src/customHooks/networkLogger.ts +0 -624
- package/src/customHooks/performanceTracker.ts +0 -1014
- package/src/customHooks/reduxLogger.ts +0 -406
- package/src/customHooks/storageInspector.ts +0 -513
- package/src/customHooks/useAccordion.tsx +0 -27
- package/src/decorators/index.ts +0 -184
- package/src/helpers/gaAnalyticsRegistry.ts +0 -204
- package/src/helpers/index.ts +0 -1092
- package/src/helpers/memoryManager.ts +0 -138
- package/src/helpers/qrGenerator.ts +0 -430
- package/src/helpers/remoteConfig.ts +0 -212
- package/src/helpers/searchQueryParser.ts +0 -84
- package/src/helpers/settingsStore.ts +0 -171
- package/src/helpers/telemetry.ts +0 -568
- package/src/helpers/toast.ts +0 -17
- package/src/i18n/index.ts +0 -104
- package/src/i18n/locales/en.json +0 -1125
- package/src/index.tsx +0 -2635
- package/src/metro.ts +0 -598
- package/src/network.ts +0 -22
- package/src/performance.ts +0 -38
- package/src/redux.ts +0 -23
- package/src/storage.ts +0 -18
- package/src/styles/AppColors.ts +0 -455
- package/src/styles/AppFonts.ts +0 -26
- package/src/styles/common.ts +0 -209
- package/src/styles/index.ts +0 -1606
- package/src/types/enums.ts +0 -208
- package/src/types/index.ts +0 -34
- package/src/types/interfaces.ts +0 -530
|
@@ -1,134 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getNativeStorageItem, setNativeStorageItem, isNativeModuleAvailable, } from '../native/NativeInspector';
|
|
3
|
-
const memory = new Map();
|
|
4
|
-
let customStorage = null;
|
|
5
|
-
export function setCustomStorage(storage) {
|
|
6
|
-
customStorage = storage;
|
|
7
|
-
}
|
|
8
|
-
const SETTINGS_KEY = 'rn-inapp-inspector.settings.v1';
|
|
9
|
-
export async function loadSettings() {
|
|
10
|
-
try {
|
|
11
|
-
if (customStorage) {
|
|
12
|
-
const raw = await customStorage.getItem(SETTINGS_KEY);
|
|
13
|
-
if (!raw)
|
|
14
|
-
return {};
|
|
15
|
-
const parsed = JSON.parse(raw);
|
|
16
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
17
|
-
}
|
|
18
|
-
if (isNativeModuleAvailable()) {
|
|
19
|
-
const raw = await getNativeStorageItem(SETTINGS_KEY);
|
|
20
|
-
if (raw) {
|
|
21
|
-
const parsed = JSON.parse(raw);
|
|
22
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (Platform.OS === 'ios') {
|
|
26
|
-
const raw = Settings.get(SETTINGS_KEY);
|
|
27
|
-
if (!raw)
|
|
28
|
-
return {};
|
|
29
|
-
if (typeof raw === 'string') {
|
|
30
|
-
const parsed = JSON.parse(raw);
|
|
31
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
32
|
-
}
|
|
33
|
-
return raw && typeof raw === 'object' ? raw : {};
|
|
34
|
-
}
|
|
35
|
-
const raw = memory.get(SETTINGS_KEY);
|
|
36
|
-
if (!raw)
|
|
37
|
-
return {};
|
|
38
|
-
const parsed = JSON.parse(raw);
|
|
39
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function saveSettings(settings) {
|
|
46
|
-
try {
|
|
47
|
-
const raw = JSON.stringify(settings);
|
|
48
|
-
if (customStorage) {
|
|
49
|
-
customStorage.setItem(SETTINGS_KEY, raw);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (isNativeModuleAvailable()) {
|
|
53
|
-
setNativeStorageItem(SETTINGS_KEY, raw);
|
|
54
|
-
}
|
|
55
|
-
if (Platform.OS === 'ios') {
|
|
56
|
-
Settings.set({ [SETTINGS_KEY]: raw });
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
memory.set(SETTINGS_KEY, raw);
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export async function clearPersistedSettings() {
|
|
65
|
-
try {
|
|
66
|
-
if (customStorage) {
|
|
67
|
-
if (typeof customStorage.removeItem === 'function') {
|
|
68
|
-
await customStorage.removeItem(SETTINGS_KEY);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
await customStorage.setItem(SETTINGS_KEY, '');
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (isNativeModuleAvailable()) {
|
|
76
|
-
await setNativeStorageItem(SETTINGS_KEY, null);
|
|
77
|
-
}
|
|
78
|
-
if (Platform.OS === 'ios') {
|
|
79
|
-
Settings.set({ [SETTINGS_KEY]: null });
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
memory.delete(SETTINGS_KEY);
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export const isPersistentStorageAvailable = () => {
|
|
88
|
-
return customStorage !== null || isNativeModuleAvailable() || Platform.OS === 'ios';
|
|
89
|
-
};
|
|
90
|
-
export function getCustomStorage() {
|
|
91
|
-
return customStorage;
|
|
92
|
-
}
|
|
93
|
-
export function calculateRamBasedLimits(freeRamMb) {
|
|
94
|
-
if (freeRamMb >= 3000) {
|
|
95
|
-
return {
|
|
96
|
-
maxNetworkLogs: 100,
|
|
97
|
-
maxConsoleLogs: 100,
|
|
98
|
-
maxAnalyticsEvents: 75,
|
|
99
|
-
maxCrashRecords: 50,
|
|
100
|
-
profileName: 'High-End',
|
|
101
|
-
freeRamMb,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
else if (freeRamMb >= 1500) {
|
|
105
|
-
return {
|
|
106
|
-
maxNetworkLogs: 100,
|
|
107
|
-
maxConsoleLogs: 100,
|
|
108
|
-
maxAnalyticsEvents: 75,
|
|
109
|
-
maxCrashRecords: 50,
|
|
110
|
-
profileName: 'Standard',
|
|
111
|
-
freeRamMb,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
else if (freeRamMb >= 600) {
|
|
115
|
-
return {
|
|
116
|
-
maxNetworkLogs: 100,
|
|
117
|
-
maxConsoleLogs: 100,
|
|
118
|
-
maxAnalyticsEvents: 50,
|
|
119
|
-
maxCrashRecords: 25,
|
|
120
|
-
profileName: 'Compact',
|
|
121
|
-
freeRamMb,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return {
|
|
126
|
-
maxNetworkLogs: 50,
|
|
127
|
-
maxConsoleLogs: 50,
|
|
128
|
-
maxAnalyticsEvents: 25,
|
|
129
|
-
maxCrashRecords: 15,
|
|
130
|
-
profileName: 'Ultra-Light',
|
|
131
|
-
freeRamMb,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1
|
+
import{Platform as n,Settings as c}from"react-native";import{getNativeStorageItem as u,setNativeStorageItem as m,isNativeModuleAvailable as i}from"../native/NativeInspector";const l=new Map;let s=null;export function setCustomStorage(t){s=t}const e="rn-inapp-inspector.settings.v1";export async function loadSettings(){try{if(s){const r=await s.getItem(e);if(!r)return{};const o=JSON.parse(r);return o&&typeof o=="object"?o:{}}if(i()){const r=await u(e);if(r){const o=JSON.parse(r);return o&&typeof o=="object"?o:{}}}if(n.OS==="ios"){const r=c.get(e);if(!r)return{};if(typeof r=="string"){const o=JSON.parse(r);return o&&typeof o=="object"?o:{}}return r&&typeof r=="object"?r:{}}const t=l.get(e);if(!t)return{};const a=JSON.parse(t);return a&&typeof a=="object"?a:{}}catch{return{}}}export function saveSettings(t){try{const a=JSON.stringify(t);if(s){s.setItem(e,a);return}if(i()&&m(e,a),n.OS==="ios"){c.set({[e]:a});return}l.set(e,a)}catch{}}export async function clearPersistedSettings(){try{if(s){typeof s.removeItem=="function"?await s.removeItem(e):await s.setItem(e,"");return}if(i()&&await m(e,null),n.OS==="ios"){c.set({[e]:null});return}l.delete(e)}catch{}}export const isPersistentStorageAvailable=()=>s!==null||i()||n.OS==="ios";export function getCustomStorage(){return s}export function calculateRamBasedLimits(t){return t>=3e3?{maxNetworkLogs:100,maxConsoleLogs:100,maxAnalyticsEvents:75,maxCrashRecords:50,profileName:"High-End",freeRamMb:t}:t>=1500?{maxNetworkLogs:100,maxConsoleLogs:100,maxAnalyticsEvents:75,maxCrashRecords:50,profileName:"Standard",freeRamMb:t}:t>=600?{maxNetworkLogs:100,maxConsoleLogs:100,maxAnalyticsEvents:50,maxCrashRecords:25,profileName:"Compact",freeRamMb:t}:{maxNetworkLogs:50,maxConsoleLogs:50,maxAnalyticsEvents:25,maxCrashRecords:15,profileName:"Ultra-Light",freeRamMb:t}}
|
|
@@ -1,489 +1 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Appearance, Dimensions, PixelRatio, Platform, NativeModules } from 'react-native';
|
|
3
|
-
import { LIB_VERSION } from '../constants/version';
|
|
4
|
-
import { loadSettings, saveSettings } from './settingsStore';
|
|
5
|
-
import { isReduxConnected } from '../customHooks/reduxLogger';
|
|
6
|
-
import { isFirebaseAnalyticsPatched } from '../customHooks/analyticsLogger';
|
|
7
|
-
import { getCrashRecords } from '../customHooks/crashHandler';
|
|
8
|
-
import { getNetworkLogs } from '../customHooks/networkLogger';
|
|
9
|
-
import { isNativeModuleAvailable } from '../native/NativeInspector';
|
|
10
|
-
import { getAppName, getBundleIdentifier, getAppVersionAndBuild, isLocalDebugEnvironment, } from './index';
|
|
11
|
-
import { ENC_MID, ENC_SEC, TELEMETRY_SALT, } from '../constants/telemetryConfig';
|
|
12
|
-
const PKG_NAME = 'react-native-inapp-inspector';
|
|
13
|
-
const KEY_MATERIAL = `${PKG_NAME}::${TELEMETRY_SALT}`;
|
|
14
|
-
function getKeystream(material, length) {
|
|
15
|
-
const stream = [];
|
|
16
|
-
let acc = 0x5a827999;
|
|
17
|
-
for (let i = 0; i < length; i++) {
|
|
18
|
-
const charCode = material.charCodeAt(i % material.length);
|
|
19
|
-
acc = ((acc * 31 + charCode * 17 + i * 13) ^ (acc >>> 7)) & 0xffffffff;
|
|
20
|
-
stream.push((acc >>> (i % 24)) & 0xff);
|
|
21
|
-
}
|
|
22
|
-
return stream;
|
|
23
|
-
}
|
|
24
|
-
function deobfuscate(hexStr) {
|
|
25
|
-
if (!hexStr)
|
|
26
|
-
return '';
|
|
27
|
-
const bytes = [];
|
|
28
|
-
for (let i = 0; i < hexStr.length; i += 2) {
|
|
29
|
-
bytes.push(parseInt(hexStr.substring(i, i + 2), 16));
|
|
30
|
-
}
|
|
31
|
-
const keystream = getKeystream(KEY_MATERIAL, bytes.length);
|
|
32
|
-
const out = [];
|
|
33
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
34
|
-
const k = keystream[i];
|
|
35
|
-
const s = TELEMETRY_SALT.charCodeAt(i % TELEMETRY_SALT.length);
|
|
36
|
-
const dec = (bytes[i] ^ k ^ s) & 0xff;
|
|
37
|
-
out.push(String.fromCharCode(dec));
|
|
38
|
-
}
|
|
39
|
-
return out.join('');
|
|
40
|
-
}
|
|
41
|
-
let _cachedMid = null;
|
|
42
|
-
let _cachedSec = null;
|
|
43
|
-
function getCredentials() {
|
|
44
|
-
if (_cachedMid !== null && _cachedSec !== null) {
|
|
45
|
-
return { measurementId: _cachedMid, apiSecret: _cachedSec };
|
|
46
|
-
}
|
|
47
|
-
if (!ENC_MID || !ENC_SEC || !TELEMETRY_SALT) {
|
|
48
|
-
_cachedMid = '';
|
|
49
|
-
_cachedSec = '';
|
|
50
|
-
return { measurementId: '', apiSecret: '' };
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
_cachedMid = deobfuscate(ENC_MID);
|
|
54
|
-
_cachedSec = deobfuscate(ENC_SEC);
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
_cachedMid = '';
|
|
58
|
-
_cachedSec = '';
|
|
59
|
-
}
|
|
60
|
-
return { measurementId: _cachedMid, apiSecret: _cachedSec };
|
|
61
|
-
}
|
|
62
|
-
function getCollectUrl() {
|
|
63
|
-
const { measurementId, apiSecret } = getCredentials();
|
|
64
|
-
if (!measurementId || !apiSecret)
|
|
65
|
-
return '';
|
|
66
|
-
return `https://www.google-analytics.com/mp/collect?measurement_id=${measurementId}&api_secret=${apiSecret}`;
|
|
67
|
-
}
|
|
68
|
-
const PING_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
69
|
-
let isTelemetryEnabled = true;
|
|
70
|
-
let _hasSearchFilterBeenUsed = false;
|
|
71
|
-
export function setTelemetryEnabled(enabled) {
|
|
72
|
-
isTelemetryEnabled = enabled;
|
|
73
|
-
}
|
|
74
|
-
export function markSearchFilterUsed() {
|
|
75
|
-
_hasSearchFilterBeenUsed = true;
|
|
76
|
-
}
|
|
77
|
-
async function getOrCreateClientId() {
|
|
78
|
-
try {
|
|
79
|
-
const settings = await loadSettings();
|
|
80
|
-
if (settings.telemetryClientId || settings.telemetryDeviceId) {
|
|
81
|
-
const id = settings.telemetryClientId || settings.telemetryDeviceId || '';
|
|
82
|
-
if (!settings.telemetryDeviceId) {
|
|
83
|
-
await saveSettings({ ...settings, telemetryDeviceId: id });
|
|
84
|
-
}
|
|
85
|
-
return id;
|
|
86
|
-
}
|
|
87
|
-
const part1 = Math.floor(100000000 + Math.random() * 900000000);
|
|
88
|
-
const part2 = Math.floor(1000000000 + Math.random() * 9000000000);
|
|
89
|
-
const newId = `${part1}.${part2}`;
|
|
90
|
-
const now = Date.now();
|
|
91
|
-
await saveSettings({
|
|
92
|
-
...settings,
|
|
93
|
-
telemetryClientId: newId,
|
|
94
|
-
telemetryDeviceId: newId,
|
|
95
|
-
deviceFirstSeen: settings.deviceFirstSeen || now,
|
|
96
|
-
});
|
|
97
|
-
return newId;
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
return `${Math.floor(100000000 + Math.random() * 900000000)}.${Math.floor(1000000000 + Math.random() * 9000000000)}`;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function isDeviceEmulator() {
|
|
104
|
-
try {
|
|
105
|
-
if (Platform.OS === 'android') {
|
|
106
|
-
const c = Platform.constants || {};
|
|
107
|
-
const model = String(c.Model || '').toLowerCase();
|
|
108
|
-
const brand = String(c.Brand || '').toLowerCase();
|
|
109
|
-
const fingerprint = String(c.Fingerprint || '').toLowerCase();
|
|
110
|
-
const hardware = String(c.Hardware || '').toLowerCase();
|
|
111
|
-
const manufacturer = String(c.Manufacturer || '').toLowerCase();
|
|
112
|
-
return (model.includes('emulator') ||
|
|
113
|
-
model.includes('sdk') ||
|
|
114
|
-
model.includes('google_sdk') ||
|
|
115
|
-
model.includes('vbox') ||
|
|
116
|
-
brand.includes('generic') ||
|
|
117
|
-
fingerprint.startsWith('generic') ||
|
|
118
|
-
hardware.includes('goldfish') ||
|
|
119
|
-
hardware.includes('ranchu') ||
|
|
120
|
-
manufacturer.includes('genymotion'));
|
|
121
|
-
}
|
|
122
|
-
if (Platform.OS === 'ios') {
|
|
123
|
-
const c = Platform.constants || {};
|
|
124
|
-
const model = String(c.Model || '').toLowerCase();
|
|
125
|
-
return model.includes('simulator') || Boolean(c.isSimulator);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
function getDeviceLocaleInfo() {
|
|
134
|
-
try {
|
|
135
|
-
const opts = typeof Intl !== 'undefined' && Intl.DateTimeFormat ? Intl.DateTimeFormat().resolvedOptions() : {};
|
|
136
|
-
const timeZone = opts.timeZone || 'unknown';
|
|
137
|
-
const locale = opts.locale || 'unknown';
|
|
138
|
-
let countryCode = 'unknown';
|
|
139
|
-
if (locale && locale !== 'unknown') {
|
|
140
|
-
const parts = locale.split(/[-_]/);
|
|
141
|
-
if (parts.length > 1) {
|
|
142
|
-
countryCode = parts[parts.length - 1].toUpperCase();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return { countryCode, locale, timeZone };
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
return { countryCode: 'unknown', locale: 'unknown', timeZone: 'unknown' };
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function getSystemMetadata(environment, currentSettings) {
|
|
152
|
-
const rnConstants = Platform.constants;
|
|
153
|
-
const rnVersion = rnConstants?.reactNativeVersion
|
|
154
|
-
? `${rnConstants.reactNativeVersion.major}.${rnConstants.reactNativeVersion.minor}.${rnConstants.reactNativeVersion.patch}`
|
|
155
|
-
: 'unknown';
|
|
156
|
-
const isHermes = Boolean(typeof global.HermesInternal === 'object' && global.HermesInternal !== null);
|
|
157
|
-
const isFabric = Boolean(global?.nativeFabricUIManager !== undefined);
|
|
158
|
-
const isBridgeless = Boolean(global?._rn_bridgeless || global?.RN$Bridgeless);
|
|
159
|
-
const isDev = Boolean(typeof __DEV__ !== 'undefined' && __DEV__);
|
|
160
|
-
const isEmulator = isDeviceEmulator();
|
|
161
|
-
const { countryCode, locale, timeZone } = getDeviceLocaleInfo();
|
|
162
|
-
let screenRes = 'unknown';
|
|
163
|
-
let screenDensity = 1;
|
|
164
|
-
let fontScale = 1;
|
|
165
|
-
let deviceFormFactor = 'phone';
|
|
166
|
-
let screenOrientation = 'portrait';
|
|
167
|
-
try {
|
|
168
|
-
const dim = Dimensions.get('window');
|
|
169
|
-
screenRes = `${Math.round(dim.width)}x${Math.round(dim.height)}`;
|
|
170
|
-
screenDensity = PixelRatio.get();
|
|
171
|
-
fontScale = PixelRatio.getFontScale();
|
|
172
|
-
screenOrientation = dim.width > dim.height ? 'landscape' : 'portrait';
|
|
173
|
-
const isTablet = (Platform.OS === 'ios' && Boolean(Platform.isPad)) ||
|
|
174
|
-
(Math.min(dim.width, dim.height) >= 600);
|
|
175
|
-
deviceFormFactor = isTablet ? 'tablet' : 'phone';
|
|
176
|
-
}
|
|
177
|
-
catch { }
|
|
178
|
-
let appearanceMode = 'unknown';
|
|
179
|
-
try {
|
|
180
|
-
appearanceMode = Appearance?.getColorScheme?.() || 'unknown';
|
|
181
|
-
}
|
|
182
|
-
catch { }
|
|
183
|
-
const isExpo = Boolean(globalThis?.expo ||
|
|
184
|
-
globalThis?.__expo ||
|
|
185
|
-
globalThis?.__turboModuleProxy?.name === 'Expo' ||
|
|
186
|
-
Platform.constants?.ExpoVersion);
|
|
187
|
-
let hermesVersion = 'non_hermes';
|
|
188
|
-
let jsEngine = 'jsc';
|
|
189
|
-
if (isHermes) {
|
|
190
|
-
jsEngine = 'hermes';
|
|
191
|
-
try {
|
|
192
|
-
const props = global.HermesInternal?.getRuntimeProperties?.() || {};
|
|
193
|
-
hermesVersion = props['OSS Release Version'] || (props['Bytecode Version'] ? `bc_v${props['Bytecode Version']}` : 'hermes');
|
|
194
|
-
}
|
|
195
|
-
catch {
|
|
196
|
-
hermesVersion = 'hermes';
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else if (globalThis?._v8) {
|
|
200
|
-
jsEngine = 'v8';
|
|
201
|
-
}
|
|
202
|
-
let reduxAttached = false;
|
|
203
|
-
try {
|
|
204
|
-
reduxAttached = isReduxConnected();
|
|
205
|
-
}
|
|
206
|
-
catch { }
|
|
207
|
-
let analyticsAttached = false;
|
|
208
|
-
try {
|
|
209
|
-
analyticsAttached = isFirebaseAnalyticsPatched();
|
|
210
|
-
}
|
|
211
|
-
catch { }
|
|
212
|
-
const hasNativeModule = isNativeModuleAvailable();
|
|
213
|
-
const hasMmkv = Boolean(NativeModules?.RNMMKV || globalThis?.MMKV);
|
|
214
|
-
let capturedCrashesCount = 0;
|
|
215
|
-
try {
|
|
216
|
-
capturedCrashesCount = getCrashRecords().length;
|
|
217
|
-
}
|
|
218
|
-
catch { }
|
|
219
|
-
let capturedApisBracket = '0';
|
|
220
|
-
try {
|
|
221
|
-
const apiCount = getNetworkLogs().length;
|
|
222
|
-
capturedApisBracket =
|
|
223
|
-
apiCount === 0
|
|
224
|
-
? '0'
|
|
225
|
-
: apiCount <= 10
|
|
226
|
-
? '1-10'
|
|
227
|
-
: apiCount <= 50
|
|
228
|
-
? '11-50'
|
|
229
|
-
: apiCount <= 100
|
|
230
|
-
? '51-100'
|
|
231
|
-
: '100+';
|
|
232
|
-
}
|
|
233
|
-
catch { }
|
|
234
|
-
let isMetroConnected = false;
|
|
235
|
-
try {
|
|
236
|
-
isMetroConnected = isLocalDebugEnvironment();
|
|
237
|
-
}
|
|
238
|
-
catch { }
|
|
239
|
-
const defaultLandingTab = currentSettings?.defaultTab || 'apis';
|
|
240
|
-
const fabMode = hasNativeModule && currentSettings?.useNativeFab !== false
|
|
241
|
-
? 'native_ui_thread'
|
|
242
|
-
: 'js_floating_button';
|
|
243
|
-
const deviceBrand = String(rnConstants?.Brand ||
|
|
244
|
-
(Platform.OS === 'ios' ? 'Apple' : 'unknown'));
|
|
245
|
-
const deviceModel = String(rnConstants?.Model ||
|
|
246
|
-
rnConstants?.systemName ||
|
|
247
|
-
(Platform.OS === 'ios' ? 'iPhone/iPad' : 'unknown'));
|
|
248
|
-
const deviceManufacturer = String(rnConstants?.Manufacturer ||
|
|
249
|
-
(Platform.OS === 'ios' ? 'Apple' : 'unknown'));
|
|
250
|
-
let appName = 'App';
|
|
251
|
-
let bundleId = 'unknown';
|
|
252
|
-
let appVersion = 'unknown';
|
|
253
|
-
let appBuild = 'unknown';
|
|
254
|
-
try {
|
|
255
|
-
appName = getAppName() || 'App';
|
|
256
|
-
bundleId = getBundleIdentifier() || 'unknown';
|
|
257
|
-
const verInfo = getAppVersionAndBuild();
|
|
258
|
-
appVersion = verInfo.version || 'unknown';
|
|
259
|
-
appBuild = verInfo.build || 'unknown';
|
|
260
|
-
}
|
|
261
|
-
catch { }
|
|
262
|
-
const reactVer = typeof React !== 'undefined' && React.version ? React.version : 'unknown';
|
|
263
|
-
return {
|
|
264
|
-
pkg_name: PKG_NAME,
|
|
265
|
-
pkg_version: LIB_VERSION,
|
|
266
|
-
lib_version: LIB_VERSION,
|
|
267
|
-
install_type: isDev ? 'local_dev' : 'bundled_production',
|
|
268
|
-
app_name: appName,
|
|
269
|
-
bundle_id: bundleId,
|
|
270
|
-
app_version: appVersion,
|
|
271
|
-
app_build: appBuild,
|
|
272
|
-
react_version: reactVer,
|
|
273
|
-
platform: Platform.OS,
|
|
274
|
-
os_version: String(Platform.Version || 'unknown'),
|
|
275
|
-
rn_version: rnVersion,
|
|
276
|
-
country_code: countryCode,
|
|
277
|
-
device_locale: locale,
|
|
278
|
-
time_zone: timeZone,
|
|
279
|
-
device_brand: deviceBrand,
|
|
280
|
-
device_model: deviceModel,
|
|
281
|
-
device_manufacturer: deviceManufacturer,
|
|
282
|
-
device_form_factor: deviceFormFactor,
|
|
283
|
-
screen_resolution: screenRes,
|
|
284
|
-
screen_density: screenDensity,
|
|
285
|
-
screen_orientation: screenOrientation,
|
|
286
|
-
font_scale: fontScale,
|
|
287
|
-
appearance_mode: appearanceMode,
|
|
288
|
-
is_expo: isExpo,
|
|
289
|
-
js_engine: jsEngine,
|
|
290
|
-
hermes_version: hermesVersion,
|
|
291
|
-
is_hermes: isHermes,
|
|
292
|
-
is_fabric: isFabric,
|
|
293
|
-
is_bridgeless: isBridgeless,
|
|
294
|
-
has_native_module: hasNativeModule,
|
|
295
|
-
has_mmkv: hasMmkv,
|
|
296
|
-
fab_mode: fabMode,
|
|
297
|
-
default_landing_tab: defaultLandingTab,
|
|
298
|
-
captured_crashes_count: capturedCrashesCount,
|
|
299
|
-
captured_apis_bracket: capturedApisBracket,
|
|
300
|
-
search_filter_used: _hasSearchFilterBeenUsed,
|
|
301
|
-
is_metro_connected: isMetroConnected,
|
|
302
|
-
is_dev: isDev,
|
|
303
|
-
is_emulator: isEmulator,
|
|
304
|
-
device_type: isEmulator ? 'emulator' : 'real_device',
|
|
305
|
-
app_mode: isDev ? 'local_mode' : 'bundled_application',
|
|
306
|
-
redux_attached: reduxAttached,
|
|
307
|
-
analytics_attached: analyticsAttached,
|
|
308
|
-
environment: environment || (isDev ? 'DEV' : 'PROD'),
|
|
309
|
-
engagement_time_msec: 1000,
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
export async function trackActiveTelemetryHeartbeat(telemetryEnabled = true, environment) {
|
|
313
|
-
if (telemetryEnabled === false) {
|
|
314
|
-
isTelemetryEnabled = false;
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
isTelemetryEnabled = true;
|
|
318
|
-
const url = getCollectUrl();
|
|
319
|
-
if (!url)
|
|
320
|
-
return;
|
|
321
|
-
try {
|
|
322
|
-
const settings = await loadSettings();
|
|
323
|
-
const lastPing = settings.telemetryLastPing || 0;
|
|
324
|
-
const now = Date.now();
|
|
325
|
-
const isNewDevice = !settings.deviceRegistered;
|
|
326
|
-
if (!isNewDevice && now - lastPing < PING_INTERVAL_MS)
|
|
327
|
-
return;
|
|
328
|
-
const clientId = await getOrCreateClientId();
|
|
329
|
-
const params = getSystemMetadata(environment, settings);
|
|
330
|
-
const deviceParams = {
|
|
331
|
-
...params,
|
|
332
|
-
device_id: clientId,
|
|
333
|
-
is_new_device: isNewDevice,
|
|
334
|
-
device_first_seen: settings.deviceFirstSeen || now,
|
|
335
|
-
};
|
|
336
|
-
const eventsToDispatch = isNewDevice
|
|
337
|
-
? [
|
|
338
|
-
{ name: 'active_device', params: deviceParams },
|
|
339
|
-
{ name: 'first_device_install', params: deviceParams },
|
|
340
|
-
{ name: 'inspector_active_heartbeat', params: deviceParams },
|
|
341
|
-
]
|
|
342
|
-
: [
|
|
343
|
-
{ name: 'active_device', params: deviceParams },
|
|
344
|
-
{ name: 'inspector_active_heartbeat', params: deviceParams },
|
|
345
|
-
];
|
|
346
|
-
await fetch(url, {
|
|
347
|
-
method: 'POST',
|
|
348
|
-
headers: { 'Content-Type': 'application/json' },
|
|
349
|
-
body: JSON.stringify({
|
|
350
|
-
client_id: clientId,
|
|
351
|
-
user_id: clientId,
|
|
352
|
-
non_personalized_ads: true,
|
|
353
|
-
user_properties: {
|
|
354
|
-
device_id: { value: clientId },
|
|
355
|
-
pkg_name: { value: params.pkg_name },
|
|
356
|
-
pkg_version: { value: params.pkg_version },
|
|
357
|
-
install_type: { value: params.install_type },
|
|
358
|
-
app_name: { value: params.app_name },
|
|
359
|
-
bundle_id: { value: params.bundle_id },
|
|
360
|
-
app_version: { value: params.app_version },
|
|
361
|
-
react_version: { value: params.react_version },
|
|
362
|
-
country: { value: params.country_code },
|
|
363
|
-
country_code: { value: params.country_code },
|
|
364
|
-
locale: { value: params.device_locale },
|
|
365
|
-
time_zone: { value: params.time_zone },
|
|
366
|
-
device_brand: { value: params.device_brand },
|
|
367
|
-
device_model: { value: params.device_model },
|
|
368
|
-
device_form_factor: { value: params.device_form_factor },
|
|
369
|
-
screen_resolution: { value: params.screen_resolution },
|
|
370
|
-
appearance_mode: { value: params.appearance_mode },
|
|
371
|
-
is_expo: { value: String(params.is_expo) },
|
|
372
|
-
js_engine: { value: params.js_engine },
|
|
373
|
-
is_fabric: { value: String(params.is_fabric) },
|
|
374
|
-
is_bridgeless: { value: String(params.is_bridgeless) },
|
|
375
|
-
has_native_module: { value: String(params.has_native_module) },
|
|
376
|
-
has_mmkv: { value: String(params.has_mmkv) },
|
|
377
|
-
fab_mode: { value: params.fab_mode },
|
|
378
|
-
default_landing_tab: { value: params.default_landing_tab },
|
|
379
|
-
captured_crashes_count: { value: String(params.captured_crashes_count) },
|
|
380
|
-
captured_apis_bracket: { value: params.captured_apis_bracket },
|
|
381
|
-
search_filter_used: { value: String(params.search_filter_used) },
|
|
382
|
-
is_metro_connected: { value: String(params.is_metro_connected) },
|
|
383
|
-
redux_attached: { value: String(params.redux_attached) },
|
|
384
|
-
analytics_attached: { value: String(params.analytics_attached) },
|
|
385
|
-
platform: { value: params.platform },
|
|
386
|
-
rn_version: { value: params.rn_version },
|
|
387
|
-
lib_version: { value: params.lib_version },
|
|
388
|
-
},
|
|
389
|
-
events: eventsToDispatch,
|
|
390
|
-
}),
|
|
391
|
-
});
|
|
392
|
-
await saveSettings({
|
|
393
|
-
...settings,
|
|
394
|
-
telemetryClientId: clientId,
|
|
395
|
-
telemetryDeviceId: clientId,
|
|
396
|
-
deviceRegistered: true,
|
|
397
|
-
deviceFirstSeen: settings.deviceFirstSeen || now,
|
|
398
|
-
telemetryLastPing: now,
|
|
399
|
-
telemetryLastActive: now,
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
catch {
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
export async function trackTelemetryEvent(eventName, eventParams) {
|
|
406
|
-
if (!isTelemetryEnabled)
|
|
407
|
-
return;
|
|
408
|
-
const url = getCollectUrl();
|
|
409
|
-
if (!url)
|
|
410
|
-
return;
|
|
411
|
-
try {
|
|
412
|
-
const clientId = await getOrCreateClientId();
|
|
413
|
-
const settings = await loadSettings().catch(() => ({}));
|
|
414
|
-
const metadata = getSystemMetadata(undefined, settings);
|
|
415
|
-
const params = {
|
|
416
|
-
...metadata,
|
|
417
|
-
device_id: clientId,
|
|
418
|
-
...eventParams,
|
|
419
|
-
engagement_time_msec: 100,
|
|
420
|
-
};
|
|
421
|
-
await fetch(url, {
|
|
422
|
-
method: 'POST',
|
|
423
|
-
headers: { 'Content-Type': 'application/json' },
|
|
424
|
-
body: JSON.stringify({
|
|
425
|
-
client_id: clientId,
|
|
426
|
-
user_id: clientId,
|
|
427
|
-
non_personalized_ads: true,
|
|
428
|
-
user_properties: {
|
|
429
|
-
device_id: { value: clientId },
|
|
430
|
-
pkg_name: { value: metadata.pkg_name },
|
|
431
|
-
pkg_version: { value: metadata.pkg_version },
|
|
432
|
-
install_type: { value: metadata.install_type },
|
|
433
|
-
app_name: { value: metadata.app_name },
|
|
434
|
-
bundle_id: { value: metadata.bundle_id },
|
|
435
|
-
app_version: { value: metadata.app_version },
|
|
436
|
-
react_version: { value: metadata.react_version },
|
|
437
|
-
country: { value: metadata.country_code },
|
|
438
|
-
country_code: { value: metadata.country_code },
|
|
439
|
-
locale: { value: metadata.device_locale },
|
|
440
|
-
time_zone: { value: metadata.time_zone },
|
|
441
|
-
device_brand: { value: metadata.device_brand },
|
|
442
|
-
device_model: { value: metadata.device_model },
|
|
443
|
-
device_form_factor: { value: metadata.device_form_factor },
|
|
444
|
-
screen_resolution: { value: metadata.screen_resolution },
|
|
445
|
-
appearance_mode: { value: metadata.appearance_mode },
|
|
446
|
-
is_expo: { value: String(metadata.is_expo) },
|
|
447
|
-
js_engine: { value: metadata.js_engine },
|
|
448
|
-
is_fabric: { value: String(metadata.is_fabric) },
|
|
449
|
-
is_bridgeless: { value: String(metadata.is_bridgeless) },
|
|
450
|
-
has_native_module: { value: String(metadata.has_native_module) },
|
|
451
|
-
has_mmkv: { value: String(metadata.has_mmkv) },
|
|
452
|
-
fab_mode: { value: metadata.fab_mode },
|
|
453
|
-
default_landing_tab: { value: metadata.default_landing_tab },
|
|
454
|
-
captured_crashes_count: { value: String(metadata.captured_crashes_count) },
|
|
455
|
-
captured_apis_bracket: { value: metadata.captured_apis_bracket },
|
|
456
|
-
search_filter_used: { value: String(metadata.search_filter_used) },
|
|
457
|
-
is_metro_connected: { value: String(metadata.is_metro_connected) },
|
|
458
|
-
redux_attached: { value: String(metadata.redux_attached) },
|
|
459
|
-
analytics_attached: { value: String(metadata.analytics_attached) },
|
|
460
|
-
platform: { value: metadata.platform },
|
|
461
|
-
rn_version: { value: metadata.rn_version },
|
|
462
|
-
lib_version: { value: metadata.lib_version },
|
|
463
|
-
},
|
|
464
|
-
events: [{ name: eventName, params }],
|
|
465
|
-
}),
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
catch {
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
export function trackInspectorTabView(tabName) {
|
|
472
|
-
trackTelemetryEvent('inspector_tab_view', {
|
|
473
|
-
tab_name: tabName,
|
|
474
|
-
screen_name: `tab_${tabName}`,
|
|
475
|
-
screen_class: 'NetworkInspector',
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
export function trackInspectorScreenView(screenName) {
|
|
479
|
-
trackTelemetryEvent('screen_view', {
|
|
480
|
-
screen_name: screenName,
|
|
481
|
-
screen_class: 'NetworkInspector',
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
export function trackInspectorScreenRecord(action, recordingType = 'screen') {
|
|
485
|
-
trackTelemetryEvent('inspector_screen_record', {
|
|
486
|
-
action,
|
|
487
|
-
recording_type: recordingType,
|
|
488
|
-
});
|
|
489
|
-
}
|
|
1
|
+
import b from"react";import{Appearance as ae,Dimensions as re,PixelRatio as P,Platform as l,NativeModules as oe}from"react-native";import{LIB_VERSION as R}from"../constants/version";import{loadSettings as y,saveSettings as S}from"./settingsStore";import{isReduxConnected as ie}from"../customHooks/reduxLogger";import{isFirebaseAnalyticsPatched as se}from"../customHooks/analyticsLogger";import{getCrashRecords as ce}from"../customHooks/crashHandler";import{getNetworkLogs as le}from"../customHooks/networkLogger";import{isNativeModuleAvailable as de}from"../native/NativeInspector";import{getAppName as _e,getBundleIdentifier as ue,getAppVersionAndBuild as me,isLocalDebugEnvironment as ve}from"./index";import{ENC_MID as $,ENC_SEC as j,TELEMETRY_SALT as v}from"../constants/telemetryConfig";const z="react-native-inapp-inspector",pe=`${z}::${v}`;function fe(t,o){const i=[];let r=1518500249;for(let a=0;a<o;a++){const e=t.charCodeAt(a%t.length);r=(r*31+e*17+a*13^r>>>7)&4294967295,i.push(r>>>a%24&255)}return i}function H(t){if(!t)return"";const o=[];for(let a=0;a<t.length;a+=2)o.push(parseInt(t.substring(a,a+2),16));const i=fe(pe,o.length),r=[];for(let a=0;a<o.length;a++){const e=i[a],d=v.charCodeAt(a%v.length),c=(o[a]^e^d)&255;r.push(String.fromCharCode(c))}return r.join("")}let u=null,m=null;function ge(){if(u!==null&&m!==null)return{measurementId:u,apiSecret:m};if(!$||!j||!v)return u="",m="",{measurementId:"",apiSecret:""};try{u=H($),m=H(j)}catch{u="",m=""}return{measurementId:u,apiSecret:m}}function K(){const{measurementId:t,apiSecret:o}=ge();return!t||!o?"":`https://www.google-analytics.com/mp/collect?measurement_id=${t}&api_secret=${o}`}const he=1440*60*1e3;let p=!0,U=!1;export function setTelemetryEnabled(t){p=t}export function markSearchFilterUsed(){U=!0}async function Z(){try{const t=await y();if(t.telemetryClientId||t.telemetryDeviceId){const e=t.telemetryClientId||t.telemetryDeviceId||"";return t.telemetryDeviceId||await S({...t,telemetryDeviceId:e}),e}const o=Math.floor(1e8+Math.random()*9e8),i=Math.floor(1e9+Math.random()*9e9),r=`${o}.${i}`,a=Date.now();return await S({...t,telemetryClientId:r,telemetryDeviceId:r,deviceFirstSeen:t.deviceFirstSeen||a}),r}catch{return`${Math.floor(1e8+Math.random()*9e8)}.${Math.floor(1e9+Math.random()*9e9)}`}}function be(){try{if(l.OS==="android"){const t=l.constants||{},o=String(t.Model||"").toLowerCase(),i=String(t.Brand||"").toLowerCase(),r=String(t.Fingerprint||"").toLowerCase(),a=String(t.Hardware||"").toLowerCase(),e=String(t.Manufacturer||"").toLowerCase();return o.includes("emulator")||o.includes("sdk")||o.includes("google_sdk")||o.includes("vbox")||i.includes("generic")||r.startsWith("generic")||a.includes("goldfish")||a.includes("ranchu")||e.includes("genymotion")}if(l.OS==="ios"){const t=l.constants||{};return String(t.Model||"").toLowerCase().includes("simulator")||!!t.isSimulator}}catch{return!1}return!1}function ye(){try{const t=typeof Intl<"u"&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions():{},o=t.timeZone||"unknown",i=t.locale||"unknown";let r="unknown";if(i&&i!=="unknown"){const a=i.split(/[-_]/);a.length>1&&(r=a[a.length-1].toUpperCase())}return{countryCode:r,locale:i,timeZone:o}}catch{return{countryCode:"unknown",locale:"unknown",timeZone:"unknown"}}}function G(t,o){const i=l.constants,r=i?.reactNativeVersion?`${i.reactNativeVersion.major}.${i.reactNativeVersion.minor}.${i.reactNativeVersion.patch}`:"unknown",a=typeof global.HermesInternal=="object"&&global.HermesInternal!==null,e=global?.nativeFabricUIManager!==void 0,d=!!(global?._rn_bridgeless||global?.RN$Bridgeless),c=!!(typeof __DEV__<"u"&&__DEV__),n=be(),{countryCode:_,locale:f,timeZone:J}=ye();let w="unknown",k=1,I=1,M="phone",C="portrait";try{const s=re.get("window");w=`${Math.round(s.width)}x${Math.round(s.height)}`,k=P.get(),I=P.getFontScale(),C=s.width>s.height?"landscape":"portrait",M=l.OS==="ios"&&!!l.isPad||Math.min(s.width,s.height)>=600?"tablet":"phone"}catch{}let x="unknown";try{x=ae?.getColorScheme?.()||"unknown"}catch{}const Y=!!(globalThis?.expo||globalThis?.__expo||globalThis?.__turboModuleProxy?.name==="Expo"||l.constants?.ExpoVersion);let g="non_hermes",h="jsc";if(a){h="hermes";try{const s=global.HermesInternal?.getRuntimeProperties?.()||{};g=s["OSS Release Version"]||(s["Bytecode Version"]?`bc_v${s["Bytecode Version"]}`:"hermes")}catch{g="hermes"}}else globalThis?._v8&&(h="v8");let T=!1;try{T=ie()}catch{}let E=!1;try{E=se()}catch{}const N=de(),W=!!(oe?.RNMMKV||globalThis?.MMKV);let D=0;try{D=ce().length}catch{}let V="0";try{const s=le().length;V=s===0?"0":s<=10?"1-10":s<=50?"11-50":s<=100?"51-100":"100+"}catch{}let A=!1;try{A=ve()}catch{}const q=o?.defaultTab||"apis",Q=N&&o?.useNativeFab!==!1?"native_ui_thread":"js_floating_button",X=String(i?.Brand||(l.OS==="ios"?"Apple":"unknown")),ee=String(i?.Model||i?.systemName||(l.OS==="ios"?"iPhone/iPad":"unknown")),te=String(i?.Manufacturer||(l.OS==="ios"?"Apple":"unknown"));let B="App",L="unknown",F="unknown",O="unknown";try{B=_e()||"App",L=ue()||"unknown";const s=me();F=s.version||"unknown",O=s.build||"unknown"}catch{}const ne=typeof b<"u"&&b.version?b.version:"unknown";return{pkg_name:z,pkg_version:R,lib_version:R,install_type:c?"local_dev":"bundled_production",app_name:B,bundle_id:L,app_version:F,app_build:O,react_version:ne,platform:l.OS,os_version:String(l.Version||"unknown"),rn_version:r,country_code:_,device_locale:f,time_zone:J,device_brand:X,device_model:ee,device_manufacturer:te,device_form_factor:M,screen_resolution:w,screen_density:k,screen_orientation:C,font_scale:I,appearance_mode:x,is_expo:Y,js_engine:h,hermes_version:g,is_hermes:a,is_fabric:e,is_bridgeless:d,has_native_module:N,has_mmkv:W,fab_mode:Q,default_landing_tab:q,captured_crashes_count:D,captured_apis_bracket:V,search_filter_used:U,is_metro_connected:A,is_dev:c,is_emulator:n,device_type:n?"emulator":"real_device",app_mode:c?"local_mode":"bundled_application",redux_attached:T,analytics_attached:E,environment:t||(c?"DEV":"PROD"),engagement_time_msec:1e3}}export async function trackActiveTelemetryHeartbeat(t=!0,o){if(t===!1){p=!1;return}p=!0;const i=K();if(i)try{const r=await y(),a=r.telemetryLastPing||0,e=Date.now(),d=!r.deviceRegistered;if(!d&&e-a<he)return;const c=await Z(),n=G(o,r),_={...n,device_id:c,is_new_device:d,device_first_seen:r.deviceFirstSeen||e},f=d?[{name:"active_device",params:_},{name:"first_device_install",params:_},{name:"inspector_active_heartbeat",params:_}]:[{name:"active_device",params:_},{name:"inspector_active_heartbeat",params:_}];await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:c,user_id:c,non_personalized_ads:!0,user_properties:{device_id:{value:c},pkg_name:{value:n.pkg_name},pkg_version:{value:n.pkg_version},install_type:{value:n.install_type},app_name:{value:n.app_name},bundle_id:{value:n.bundle_id},app_version:{value:n.app_version},react_version:{value:n.react_version},country:{value:n.country_code},country_code:{value:n.country_code},locale:{value:n.device_locale},time_zone:{value:n.time_zone},device_brand:{value:n.device_brand},device_model:{value:n.device_model},device_form_factor:{value:n.device_form_factor},screen_resolution:{value:n.screen_resolution},appearance_mode:{value:n.appearance_mode},is_expo:{value:String(n.is_expo)},js_engine:{value:n.js_engine},is_fabric:{value:String(n.is_fabric)},is_bridgeless:{value:String(n.is_bridgeless)},has_native_module:{value:String(n.has_native_module)},has_mmkv:{value:String(n.has_mmkv)},fab_mode:{value:n.fab_mode},default_landing_tab:{value:n.default_landing_tab},captured_crashes_count:{value:String(n.captured_crashes_count)},captured_apis_bracket:{value:n.captured_apis_bracket},search_filter_used:{value:String(n.search_filter_used)},is_metro_connected:{value:String(n.is_metro_connected)},redux_attached:{value:String(n.redux_attached)},analytics_attached:{value:String(n.analytics_attached)},platform:{value:n.platform},rn_version:{value:n.rn_version},lib_version:{value:n.lib_version}},events:f})}),await S({...r,telemetryClientId:c,telemetryDeviceId:c,deviceRegistered:!0,deviceFirstSeen:r.deviceFirstSeen||e,telemetryLastPing:e,telemetryLastActive:e})}catch{}}export async function trackTelemetryEvent(t,o){if(!p)return;const i=K();if(i)try{const r=await Z(),a=await y().catch(()=>({})),e=G(void 0,a),d={...e,device_id:r,...o,engagement_time_msec:100};await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:r,user_id:r,non_personalized_ads:!0,user_properties:{device_id:{value:r},pkg_name:{value:e.pkg_name},pkg_version:{value:e.pkg_version},install_type:{value:e.install_type},app_name:{value:e.app_name},bundle_id:{value:e.bundle_id},app_version:{value:e.app_version},react_version:{value:e.react_version},country:{value:e.country_code},country_code:{value:e.country_code},locale:{value:e.device_locale},time_zone:{value:e.time_zone},device_brand:{value:e.device_brand},device_model:{value:e.device_model},device_form_factor:{value:e.device_form_factor},screen_resolution:{value:e.screen_resolution},appearance_mode:{value:e.appearance_mode},is_expo:{value:String(e.is_expo)},js_engine:{value:e.js_engine},is_fabric:{value:String(e.is_fabric)},is_bridgeless:{value:String(e.is_bridgeless)},has_native_module:{value:String(e.has_native_module)},has_mmkv:{value:String(e.has_mmkv)},fab_mode:{value:e.fab_mode},default_landing_tab:{value:e.default_landing_tab},captured_crashes_count:{value:String(e.captured_crashes_count)},captured_apis_bracket:{value:e.captured_apis_bracket},search_filter_used:{value:String(e.search_filter_used)},is_metro_connected:{value:String(e.is_metro_connected)},redux_attached:{value:String(e.redux_attached)},analytics_attached:{value:String(e.analytics_attached)},platform:{value:e.platform},rn_version:{value:e.rn_version},lib_version:{value:e.lib_version}},events:[{name:t,params:d}]})})}catch{}}export function trackInspectorTabView(t){trackTelemetryEvent("inspector_tab_view",{tab_name:t,screen_name:`tab_${t}`,screen_class:"NetworkInspector"})}export function trackInspectorScreenView(t){trackTelemetryEvent("screen_view",{screen_name:t,screen_class:"NetworkInspector"})}export function trackInspectorScreenRecord(t,o="screen"){trackTelemetryEvent("inspector_screen_record",{action:t,recording_type:o})}
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
export const showToast = (message) => {
|
|
3
|
-
listeners.forEach(fn => {
|
|
4
|
-
try {
|
|
5
|
-
fn(message);
|
|
6
|
-
}
|
|
7
|
-
catch { }
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const subscribeToast = (listener) => {
|
|
11
|
-
listeners.add(listener);
|
|
12
|
-
return () => {
|
|
13
|
-
listeners.delete(listener);
|
|
14
|
-
};
|
|
15
|
-
};
|
|
1
|
+
const e=new Set;export const showToast=t=>{e.forEach(o=>{try{o(t)}catch{}})},subscribeToast=t=>(e.add(t),()=>{e.delete(t)});
|