react-native-inapp-inspector 2.2.3 → 2.2.4

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.
Files changed (86) hide show
  1. package/dist/commonjs/components/AnalyticsDetail.js +5 -1
  2. package/dist/commonjs/components/AnalyticsEventCard.js +2 -1
  3. package/dist/commonjs/components/DiffViewer.js +1 -1
  4. package/dist/commonjs/components/Inspector/BundleTab.js +22 -0
  5. package/dist/commonjs/components/Inspector/DeviceInfoTab.d.ts +3 -0
  6. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +835 -0
  7. package/dist/commonjs/components/Inspector/InspectorHeader.js +12 -14
  8. package/dist/commonjs/components/Inspector/LogDetail.js +6 -3
  9. package/dist/commonjs/components/Inspector/MainScreen.js +7 -3
  10. package/dist/commonjs/components/Inspector/NetworkTab.js +92 -15
  11. package/dist/commonjs/components/Inspector/PerformanceTab.js +38 -12
  12. package/dist/commonjs/components/Inspector/SettingsPanel.js +440 -229
  13. package/dist/commonjs/components/Inspector/StorageTab.d.ts +3 -0
  14. package/dist/commonjs/components/Inspector/StorageTab.js +892 -0
  15. package/dist/commonjs/components/Inspector/TabBar.js +14 -0
  16. package/dist/commonjs/components/Inspector/TelemetryConsentModal.js +11 -2
  17. package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +4 -1
  18. package/dist/commonjs/components/NetworkIcons.d.ts +6 -0
  19. package/dist/commonjs/components/NetworkIcons.js +30 -1
  20. package/dist/commonjs/constants/version.d.ts +1 -1
  21. package/dist/commonjs/constants/version.js +1 -1
  22. package/dist/commonjs/customHooks/bundleAnalyzer.js +44 -22
  23. package/dist/commonjs/customHooks/storageInspector.d.ts +67 -0
  24. package/dist/commonjs/customHooks/storageInspector.js +486 -0
  25. package/dist/commonjs/i18n/locales/en.json +8 -2
  26. package/dist/commonjs/index.d.ts +1 -0
  27. package/dist/commonjs/index.js +16 -1
  28. package/dist/commonjs/storage.d.ts +5 -0
  29. package/dist/commonjs/storage.js +18 -0
  30. package/dist/commonjs/types/enums.d.ts +5 -0
  31. package/dist/commonjs/types/enums.js +5 -0
  32. package/dist/esm/components/AnalyticsDetail.js +6 -2
  33. package/dist/esm/components/AnalyticsEventCard.js +2 -1
  34. package/dist/esm/components/DiffViewer.js +1 -1
  35. package/dist/esm/components/Inspector/BundleTab.js +22 -0
  36. package/dist/esm/components/Inspector/DeviceInfoTab.d.ts +3 -0
  37. package/dist/esm/components/Inspector/DeviceInfoTab.js +796 -0
  38. package/dist/esm/components/Inspector/InspectorHeader.js +13 -15
  39. package/dist/esm/components/Inspector/LogDetail.js +7 -4
  40. package/dist/esm/components/Inspector/MainScreen.js +7 -3
  41. package/dist/esm/components/Inspector/NetworkTab.js +93 -16
  42. package/dist/esm/components/Inspector/PerformanceTab.js +39 -13
  43. package/dist/esm/components/Inspector/SettingsPanel.js +441 -230
  44. package/dist/esm/components/Inspector/StorageTab.d.ts +3 -0
  45. package/dist/esm/components/Inspector/StorageTab.js +853 -0
  46. package/dist/esm/components/Inspector/TabBar.js +15 -1
  47. package/dist/esm/components/Inspector/TelemetryConsentModal.js +11 -2
  48. package/dist/esm/components/Inspector/UpdateAvailableModal.js +4 -1
  49. package/dist/esm/components/NetworkIcons.d.ts +6 -0
  50. package/dist/esm/components/NetworkIcons.js +23 -0
  51. package/dist/esm/constants/version.d.ts +1 -1
  52. package/dist/esm/constants/version.js +1 -1
  53. package/dist/esm/customHooks/bundleAnalyzer.js +44 -22
  54. package/dist/esm/customHooks/storageInspector.d.ts +67 -0
  55. package/dist/esm/customHooks/storageInspector.js +469 -0
  56. package/dist/esm/i18n/locales/en.json +8 -2
  57. package/dist/esm/index.d.ts +1 -0
  58. package/dist/esm/index.js +5 -0
  59. package/dist/esm/storage.d.ts +5 -0
  60. package/dist/esm/storage.js +5 -0
  61. package/dist/esm/types/enums.d.ts +5 -0
  62. package/dist/esm/types/enums.js +5 -0
  63. package/package.json +8 -1
  64. package/src/components/AnalyticsDetail.tsx +6 -1
  65. package/src/components/AnalyticsEventCard.tsx +2 -1
  66. package/src/components/DiffViewer.tsx +1 -1
  67. package/src/components/Inspector/BundleTab.tsx +29 -0
  68. package/src/components/Inspector/DeviceInfoTab.tsx +1204 -0
  69. package/src/components/Inspector/InspectorHeader.tsx +13 -14
  70. package/src/components/Inspector/LogDetail.tsx +15 -11
  71. package/src/components/Inspector/MainScreen.tsx +7 -3
  72. package/src/components/Inspector/NetworkTab.tsx +104 -16
  73. package/src/components/Inspector/PerformanceTab.tsx +46 -12
  74. package/src/components/Inspector/SettingsPanel.tsx +570 -304
  75. package/src/components/Inspector/StorageTab.tsx +1048 -0
  76. package/src/components/Inspector/TabBar.tsx +20 -0
  77. package/src/components/Inspector/TelemetryConsentModal.tsx +26 -2
  78. package/src/components/Inspector/UpdateAvailableModal.tsx +13 -1
  79. package/src/components/NetworkIcons.tsx +103 -0
  80. package/src/constants/version.ts +1 -1
  81. package/src/customHooks/bundleAnalyzer.ts +47 -22
  82. package/src/customHooks/storageInspector.ts +509 -0
  83. package/src/i18n/locales/en.json +8 -2
  84. package/src/index.tsx +21 -1
  85. package/src/storage.ts +18 -0
  86. package/src/types/enums.ts +5 -0
@@ -57,10 +57,15 @@ import {
57
57
  ForwardChevronIcon,
58
58
  ChevronDownIcon,
59
59
  NpmIcon,
60
+ BoltIcon,
61
+ BrainIcon,
62
+ SmartphoneIcon,
63
+ DatabaseIcon,
60
64
  } from '../NetworkIcons';
61
65
  import {LIB_VERSION} from '../../constants';
62
66
  import {copyToClipboard} from '../../helpers';
63
67
  import {showToast} from '../../helpers/toast';
68
+ import {pruneAllLogs} from '../../helpers/memoryManager';
64
69
 
65
70
  const SettingsPanel = () => {
66
71
  const {t} = useTranslation();
@@ -196,6 +201,20 @@ const SettingsPanel = () => {
196
201
  icon: 'redux',
197
202
  desc: 'Store state diffing, action history & reducer timeline',
198
203
  },
204
+ {
205
+ key: 'device',
206
+ label: 'Device Info',
207
+ category: 'diagnostic',
208
+ icon: 'device',
209
+ desc: 'Hardware specs, IP address, screen metrics, UDID & runtime stats',
210
+ },
211
+ {
212
+ key: 'storage',
213
+ label: 'Storage Inspector',
214
+ category: 'telemetry',
215
+ icon: 'storage',
216
+ desc: 'AsyncStorage & MMKV key-value store viewer with full CRUD support',
217
+ },
199
218
  ] as const;
200
219
 
201
220
  // Staged selection state for checkboxes before clicking "Save Changes"
@@ -209,6 +228,8 @@ const SettingsPanel = () => {
209
228
  bundle: Boolean(tabVisibility?.bundle),
210
229
  performance: Boolean(tabVisibility?.performance),
211
230
  crash: Boolean(tabVisibility?.crash),
231
+ device: Boolean(tabVisibility?.device ?? true),
232
+ storage: Boolean(tabVisibility?.storage ?? true),
212
233
  }));
213
234
 
214
235
  // Synchronize staged state with tabVisibility when tabVisibility updates
@@ -221,6 +242,8 @@ const SettingsPanel = () => {
221
242
  bundle: Boolean(tabVisibility?.bundle),
222
243
  performance: Boolean(tabVisibility?.performance),
223
244
  crash: Boolean(tabVisibility?.crash),
245
+ device: Boolean(tabVisibility?.device ?? true),
246
+ storage: Boolean(tabVisibility?.storage ?? true),
224
247
  });
225
248
  }, [tabVisibility]);
226
249
 
@@ -527,7 +550,7 @@ const SettingsPanel = () => {
527
550
  flexDirection: 'row',
528
551
  alignItems: 'center',
529
552
  justifyContent: 'center',
530
- gap: 6,
553
+ gap: 5,
531
554
  borderRadius: 9,
532
555
  backgroundColor:
533
556
  settingsActiveSubTab === 'ui'
@@ -543,9 +566,10 @@ const SettingsPanel = () => {
543
566
  size={13}
544
567
  />
545
568
  <Text
569
+ numberOfLines={1}
546
570
  style={{
547
571
  fontFamily: AppFonts.interBold,
548
- fontSize: 12.5,
572
+ fontSize: 12,
549
573
  lineHeight: 16,
550
574
  color:
551
575
  settingsActiveSubTab === 'ui'
@@ -555,9 +579,54 @@ const SettingsPanel = () => {
555
579
  {t('settings.uiPreferences')}
556
580
  </Text>
557
581
  </TouchableScale>
582
+
583
+ <TouchableScale
584
+ accessible={true}
585
+ accessibilityRole="tab"
586
+ accessibilityLabel={t('settings.ramLimits')}
587
+ accessibilityState={{selected: settingsActiveSubTab === 'limits'}}
588
+ onPress={() => {
589
+ animateNextLayout();
590
+ setSettingsActiveSubTab('limits');
591
+ }}
592
+ style={{
593
+ flex: 1,
594
+ paddingVertical: 9,
595
+ flexDirection: 'row',
596
+ alignItems: 'center',
597
+ justifyContent: 'center',
598
+ gap: 5,
599
+ borderRadius: 9,
600
+ backgroundColor:
601
+ settingsActiveSubTab === 'limits'
602
+ ? AppColors.purple
603
+ : 'transparent',
604
+ }}>
605
+ <BrainIcon
606
+ color={
607
+ settingsActiveSubTab === 'limits'
608
+ ? AppColors.white
609
+ : AppColors.grayText
610
+ }
611
+ size={13}
612
+ />
613
+ <Text
614
+ numberOfLines={1}
615
+ style={{
616
+ fontFamily: AppFonts.interBold,
617
+ fontSize: 12,
618
+ lineHeight: 16,
619
+ color:
620
+ settingsActiveSubTab === 'limits'
621
+ ? AppColors.white
622
+ : AppColors.grayText,
623
+ }}>
624
+ {t('settings.ramLimits')}
625
+ </Text>
626
+ </TouchableScale>
558
627
  </View>
559
628
 
560
- {settingsActiveSubTab === 'module' ? (
629
+ {settingsActiveSubTab === 'module' && (
561
630
  <View style={{gap: 12}}>
562
631
  {/* Individual Module Cards with Left Checkboxes */}
563
632
  <View style={{gap: 10}}>
@@ -794,6 +863,26 @@ const SettingsPanel = () => {
794
863
  size={16}
795
864
  />
796
865
  )}
866
+ {moduleItem.icon === 'device' && (
867
+ <SmartphoneIcon
868
+ color={
869
+ isChecked
870
+ ? AppColors.purple
871
+ : AppColors.grayTextWeak
872
+ }
873
+ size={16}
874
+ />
875
+ )}
876
+ {moduleItem.icon === 'storage' && (
877
+ <DatabaseIcon
878
+ color={
879
+ isChecked
880
+ ? AppColors.purple
881
+ : AppColors.grayTextWeak
882
+ }
883
+ size={16}
884
+ />
885
+ )}
797
886
  </View>
798
887
 
799
888
  {/* Titles & Status Pill */}
@@ -1038,8 +1127,12 @@ const SettingsPanel = () => {
1038
1127
  );
1039
1128
  })}
1040
1129
  </View>
1130
+ </View>
1131
+ )}
1041
1132
 
1042
- {/* Section 3.5: RAM-Based Auto Limits */}
1133
+ {settingsActiveSubTab === 'ui' && (
1134
+ <View style={{gap: 14}}>
1135
+ {/* Section 1: Appearance */}
1043
1136
  <View
1044
1137
  style={{
1045
1138
  backgroundColor: AppColors.primaryLight,
@@ -1058,10 +1151,9 @@ const SettingsPanel = () => {
1058
1151
  color: AppColors.grayTextWeak,
1059
1152
  letterSpacing: 0.8,
1060
1153
  }}>
1061
- RAM-Based Auto Limits
1154
+ {t('settings.appearanceTheme')}
1062
1155
  </Text>
1063
1156
 
1064
- {/* Auto RAM Limit Toggle */}
1065
1157
  <View
1066
1158
  style={{
1067
1159
  flexDirection: 'row',
@@ -1084,7 +1176,11 @@ const SettingsPanel = () => {
1084
1176
  alignItems: 'center',
1085
1177
  justifyContent: 'center',
1086
1178
  }}>
1087
- <PerformanceIcon color={AppColors.purple} size={15} />
1179
+ {isDark ? (
1180
+ <SunIcon color={AppColors.purple} size={15} />
1181
+ ) : (
1182
+ <MoonIcon color={AppColors.purple} size={15} />
1183
+ )}
1088
1184
  </View>
1089
1185
  <View style={{flex: 1}}>
1090
1186
  <Text
@@ -1094,7 +1190,7 @@ const SettingsPanel = () => {
1094
1190
  lineHeight: 18,
1095
1191
  color: AppColors.primaryBlack,
1096
1192
  }}>
1097
- Auto-Calculate Limits from Device RAM
1193
+ {t('settings.general.darkMode')}
1098
1194
  </Text>
1099
1195
  <Text
1100
1196
  style={{
@@ -1104,8 +1200,7 @@ const SettingsPanel = () => {
1104
1200
  color: AppColors.grayText,
1105
1201
  marginTop: 1,
1106
1202
  }}>
1107
- Automatically set API, Logs, Analytics & Crash limits
1108
- based on available memory
1203
+ {t('settings.general.darkModeDescription')}
1109
1204
  </Text>
1110
1205
  </View>
1111
1206
  </View>
@@ -1113,21 +1208,23 @@ const SettingsPanel = () => {
1113
1208
  <TouchableScale
1114
1209
  accessible={true}
1115
1210
  accessibilityRole="switch"
1116
- accessibilityLabel="Toggle auto RAM limit calculation"
1117
- accessibilityState={{checked: isAutoRamLimitEnabled}}
1118
- onPress={() => setIsAutoRamLimitEnabled(prev => !prev)}
1211
+ accessibilityLabel="Toggle Dark Theme"
1212
+ accessibilityState={{checked: isDark}}
1213
+ onPress={() => {
1214
+ const newTheme = !isDark;
1215
+ setIsDark(newTheme);
1216
+ toggleGlobalTheme(newTheme);
1217
+ }}
1119
1218
  style={{
1120
1219
  width: 42,
1121
1220
  height: 24,
1122
1221
  borderRadius: 12,
1123
- backgroundColor: isAutoRamLimitEnabled
1222
+ backgroundColor: isDark
1124
1223
  ? AppColors.purple
1125
1224
  : AppColors.grayBorderSecondary,
1126
1225
  padding: 2,
1127
1226
  justifyContent: 'center',
1128
- alignItems: isAutoRamLimitEnabled
1129
- ? 'flex-end'
1130
- : 'flex-start',
1227
+ alignItems: isDark ? 'flex-end' : 'flex-start',
1131
1228
  }}>
1132
1229
  <View
1133
1230
  style={{
@@ -1143,168 +1240,9 @@ const SettingsPanel = () => {
1143
1240
  />
1144
1241
  </TouchableScale>
1145
1242
  </View>
1146
-
1147
- <View
1148
- style={{height: 1, backgroundColor: AppColors.dividerColor}}
1149
- />
1150
-
1151
- {/* Device Free RAM Display */}
1152
- <View
1153
- style={{flexDirection: 'row', alignItems: 'center', gap: 10}}>
1154
- <View
1155
- style={{
1156
- width: 32,
1157
- height: 32,
1158
- borderRadius: 8,
1159
- backgroundColor: isAutoRamLimitEnabled
1160
- ? `${AppColors.purple}14`
1161
- : AppColors.grayBackground,
1162
- alignItems: 'center',
1163
- justifyContent: 'center',
1164
- }}>
1165
- <SignalIcon
1166
- color={
1167
- isAutoRamLimitEnabled
1168
- ? AppColors.purple
1169
- : AppColors.grayTextWeak
1170
- }
1171
- size={15}
1172
- />
1173
- </View>
1174
- <View style={{flex: 1}}>
1175
- <Text
1176
- style={{
1177
- fontFamily: AppFonts.interBold,
1178
- fontSize: 13.5,
1179
- lineHeight: 18,
1180
- color: isAutoRamLimitEnabled
1181
- ? AppColors.primaryBlack
1182
- : AppColors.grayText,
1183
- }}>
1184
- Detected Free RAM
1185
- </Text>
1186
- <Text
1187
- style={{
1188
- fontFamily: AppFonts.interRegular,
1189
- fontSize: 11,
1190
- lineHeight: 15,
1191
- color: AppColors.grayText,
1192
- marginTop: 1,
1193
- }}>
1194
- {deviceFreeRamMb} MB available
1195
- </Text>
1196
- </View>
1197
- <View
1198
- style={{
1199
- paddingHorizontal: 10,
1200
- paddingVertical: 5,
1201
- borderRadius: 8,
1202
- backgroundColor: isAutoRamLimitEnabled
1203
- ? `${AppColors.purple}12`
1204
- : AppColors.grayBackground,
1205
- borderWidth: 1,
1206
- borderColor: isAutoRamLimitEnabled
1207
- ? `${AppColors.purple}26`
1208
- : AppColors.dividerColor,
1209
- }}>
1210
- <Text
1211
- style={{
1212
- fontFamily: AppFonts.interBold,
1213
- fontSize: 12,
1214
- lineHeight: 15,
1215
- color: isAutoRamLimitEnabled
1216
- ? AppColors.purple
1217
- : AppColors.grayText,
1218
- }}>
1219
- {deviceFreeRamMb} MB
1220
- </Text>
1221
- </View>
1222
- </View>
1223
-
1224
- {/* Current Auto-Calculated Limits Preview */}
1225
- {isAutoRamLimitEnabled && (
1226
- <View
1227
- style={{
1228
- marginTop: 8,
1229
- paddingTop: 8,
1230
- borderTopWidth: 1,
1231
- borderTopColor: AppColors.dividerColor,
1232
- gap: 6,
1233
- }}>
1234
- <Text
1235
- style={{
1236
- fontFamily: AppFonts.interBold,
1237
- fontSize: 11.5,
1238
- lineHeight: 15,
1239
- color: AppColors.purple,
1240
- }}>
1241
- Auto Profile: {autoRamProfile.profileName}
1242
- </Text>
1243
- <View
1244
- style={{flexDirection: 'row', flexWrap: 'wrap', gap: 8}}>
1245
- {[
1246
- {
1247
- label: 'APIs',
1248
- value: autoRamProfile.maxNetworkLogs,
1249
- color: AppColors.blue500,
1250
- },
1251
- {
1252
- label: 'Logs',
1253
- value: autoRamProfile.maxConsoleLogs,
1254
- color: AppColors.sky500,
1255
- },
1256
- {
1257
- label: 'Analytics',
1258
- value: autoRamProfile.maxAnalyticsEvents,
1259
- color: AppColors.purple,
1260
- },
1261
- {
1262
- label: 'Crash',
1263
- value: autoRamProfile.maxCrashRecords,
1264
- color: AppColors.errorColor,
1265
- },
1266
- ].map(item => (
1267
- <View
1268
- key={item.label}
1269
- style={{
1270
- flexDirection: 'row',
1271
- alignItems: 'center',
1272
- gap: 4,
1273
- paddingHorizontal: 8,
1274
- paddingVertical: 4,
1275
- borderRadius: 6,
1276
- backgroundColor: `${item.color}14`,
1277
- borderWidth: 1,
1278
- borderColor: `${item.color}33`,
1279
- }}>
1280
- <Text
1281
- style={{
1282
- fontFamily: AppFonts.interBold,
1283
- fontSize: 10.5,
1284
- lineHeight: 14,
1285
- color: item.color,
1286
- }}>
1287
- {item.label}
1288
- </Text>
1289
- <Text
1290
- style={{
1291
- fontFamily: AppFonts.interBold,
1292
- fontSize: 10.5,
1293
- lineHeight: 14,
1294
- color: item.color,
1295
- }}>
1296
- {item.value}
1297
- </Text>
1298
- </View>
1299
- ))}
1300
- </View>
1301
- </View>
1302
- )}
1303
1243
  </View>
1304
- </View>
1305
- ) : (
1306
- <View style={{gap: 14}}>
1307
- {/* Section 1: Appearance */}
1244
+
1245
+ {/* Section 2: Window & Layout */}
1308
1246
  <View
1309
1247
  style={{
1310
1248
  backgroundColor: AppColors.primaryLight,
@@ -1313,7 +1251,7 @@ const SettingsPanel = () => {
1313
1251
  borderColor: AppColors.grayBorderSecondary,
1314
1252
  overflow: 'hidden',
1315
1253
  padding: 14,
1316
- gap: 12,
1254
+ gap: 14,
1317
1255
  }}>
1318
1256
  <Text
1319
1257
  style={{
@@ -1323,143 +1261,33 @@ const SettingsPanel = () => {
1323
1261
  color: AppColors.grayTextWeak,
1324
1262
  letterSpacing: 0.8,
1325
1263
  }}>
1326
- {t('settings.appearanceTheme')}
1264
+ {t('settings.windowLayout')}
1327
1265
  </Text>
1328
1266
 
1329
- <View
1330
- style={{
1331
- flexDirection: 'row',
1332
- alignItems: 'center',
1333
- justifyContent: 'space-between',
1334
- }}>
1267
+ {/* Modal Height */}
1268
+ <View style={{gap: 8}}>
1335
1269
  <View
1336
1270
  style={{
1337
1271
  flexDirection: 'row',
1338
1272
  alignItems: 'center',
1273
+ justifyContent: 'space-between',
1339
1274
  gap: 10,
1340
- flex: 1,
1341
1275
  }}>
1342
1276
  <View
1343
1277
  style={{
1344
- width: 32,
1345
- height: 32,
1346
- borderRadius: 8,
1347
- backgroundColor: AppColors.purpleShade50,
1278
+ flexDirection: 'row',
1348
1279
  alignItems: 'center',
1349
- justifyContent: 'center',
1280
+ gap: 10,
1281
+ flex: 1,
1350
1282
  }}>
1351
- {isDark ? (
1352
- <SunIcon color={AppColors.purple} size={15} />
1353
- ) : (
1354
- <MoonIcon color={AppColors.purple} size={15} />
1355
- )}
1356
- </View>
1357
- <View style={{flex: 1}}>
1358
- <Text
1359
- style={{
1360
- fontFamily: AppFonts.interBold,
1361
- fontSize: 13.5,
1362
- lineHeight: 18,
1363
- color: AppColors.primaryBlack,
1364
- }}>
1365
- {t('settings.general.darkMode')}
1366
- </Text>
1367
- <Text
1283
+ <View
1368
1284
  style={{
1369
- fontFamily: AppFonts.interRegular,
1370
- fontSize: 11,
1371
- lineHeight: 15,
1372
- color: AppColors.grayText,
1373
- marginTop: 1,
1374
- }}>
1375
- {t('settings.general.darkModeDescription')}
1376
- </Text>
1377
- </View>
1378
- </View>
1379
-
1380
- <TouchableScale
1381
- accessible={true}
1382
- accessibilityRole="switch"
1383
- accessibilityLabel="Toggle Dark Theme"
1384
- accessibilityState={{checked: isDark}}
1385
- onPress={() => {
1386
- const newTheme = !isDark;
1387
- setIsDark(newTheme);
1388
- toggleGlobalTheme(newTheme);
1389
- }}
1390
- style={{
1391
- width: 42,
1392
- height: 24,
1393
- borderRadius: 12,
1394
- backgroundColor: isDark
1395
- ? AppColors.purple
1396
- : AppColors.grayBorderSecondary,
1397
- padding: 2,
1398
- justifyContent: 'center',
1399
- alignItems: isDark ? 'flex-end' : 'flex-start',
1400
- }}>
1401
- <View
1402
- style={{
1403
- width: 20,
1404
- height: 20,
1405
- borderRadius: 10,
1406
- backgroundColor: AppColors.white,
1407
- shadowColor: AppColors.black,
1408
- shadowOpacity: 0.18,
1409
- shadowRadius: 2,
1410
- shadowOffset: {width: 0, height: 1},
1411
- }}
1412
- />
1413
- </TouchableScale>
1414
- </View>
1415
- </View>
1416
-
1417
- {/* Section 2: Window & Layout */}
1418
- <View
1419
- style={{
1420
- backgroundColor: AppColors.primaryLight,
1421
- borderRadius: 14,
1422
- borderWidth: 1,
1423
- borderColor: AppColors.grayBorderSecondary,
1424
- overflow: 'hidden',
1425
- padding: 14,
1426
- gap: 14,
1427
- }}>
1428
- <Text
1429
- style={{
1430
- fontFamily: AppFonts.interBold,
1431
- fontSize: 11,
1432
- lineHeight: 14,
1433
- color: AppColors.grayTextWeak,
1434
- letterSpacing: 0.8,
1435
- }}>
1436
- {t('settings.windowLayout')}
1437
- </Text>
1438
-
1439
- {/* Modal Height */}
1440
- <View style={{gap: 8}}>
1441
- <View
1442
- style={{
1443
- flexDirection: 'row',
1444
- alignItems: 'center',
1445
- justifyContent: 'space-between',
1446
- gap: 10,
1447
- }}>
1448
- <View
1449
- style={{
1450
- flexDirection: 'row',
1451
- alignItems: 'center',
1452
- gap: 10,
1453
- flex: 1,
1454
- }}>
1455
- <View
1456
- style={{
1457
- width: 32,
1458
- height: 32,
1459
- borderRadius: 8,
1460
- backgroundColor: AppColors.purpleShade50,
1461
- alignItems: 'center',
1462
- justifyContent: 'center',
1285
+ width: 32,
1286
+ height: 32,
1287
+ borderRadius: 8,
1288
+ backgroundColor: AppColors.purpleShade50,
1289
+ alignItems: 'center',
1290
+ justifyContent: 'center',
1463
1291
  }}>
1464
1292
  <ScreenIcon color={AppColors.purple} size={15} />
1465
1293
  </View>
@@ -2126,6 +1954,9 @@ const SettingsPanel = () => {
2126
1954
  {updateAvailable ? (
2127
1955
  <View
2128
1956
  style={{
1957
+ flexDirection: 'row',
1958
+ alignItems: 'center',
1959
+ gap: 3,
2129
1960
  backgroundColor: '#F59E0B20',
2130
1961
  paddingHorizontal: 6,
2131
1962
  paddingVertical: 1.5,
@@ -2139,8 +1970,9 @@ const SettingsPanel = () => {
2139
1970
  fontSize: 9.5,
2140
1971
  color: '#D97706',
2141
1972
  }}>
2142
- v{latestNpmVersion} Available
1973
+ v{latestNpmVersion} Available
2143
1974
  </Text>
1975
+ <BoltIcon size={9} color="#D97706" />
2144
1976
  </View>
2145
1977
  ) : (
2146
1978
  <View
@@ -2207,6 +2039,440 @@ const SettingsPanel = () => {
2207
2039
  </View>
2208
2040
  </View>
2209
2041
  )}
2042
+
2043
+ {settingsActiveSubTab === 'limits' && (
2044
+ <View style={{gap: 14}}>
2045
+ {/* Section 1: Device RAM & Auto Profile */}
2046
+ <View
2047
+ style={{
2048
+ backgroundColor: AppColors.primaryLight,
2049
+ borderRadius: 14,
2050
+ borderWidth: 1,
2051
+ borderColor: AppColors.grayBorderSecondary,
2052
+ overflow: 'hidden',
2053
+ padding: 14,
2054
+ gap: 12,
2055
+ }}>
2056
+ <Text
2057
+ style={{
2058
+ fontFamily: AppFonts.interBold,
2059
+ fontSize: 11,
2060
+ lineHeight: 14,
2061
+ color: AppColors.grayTextWeak,
2062
+ letterSpacing: 0.8,
2063
+ }}>
2064
+ DEVICE MEMORY & AUTO PROFILES
2065
+ </Text>
2066
+
2067
+ {/* Auto RAM Limit Toggle */}
2068
+ <View
2069
+ style={{
2070
+ flexDirection: 'row',
2071
+ alignItems: 'center',
2072
+ justifyContent: 'space-between',
2073
+ }}>
2074
+ <View
2075
+ style={{
2076
+ flexDirection: 'row',
2077
+ alignItems: 'center',
2078
+ gap: 10,
2079
+ flex: 1,
2080
+ }}>
2081
+ <View
2082
+ style={{
2083
+ width: 32,
2084
+ height: 32,
2085
+ borderRadius: 8,
2086
+ backgroundColor: AppColors.purpleShade50,
2087
+ alignItems: 'center',
2088
+ justifyContent: 'center',
2089
+ }}>
2090
+ <BrainIcon color={AppColors.purple} size={16} />
2091
+ </View>
2092
+ <View style={{flex: 1}}>
2093
+ <Text
2094
+ style={{
2095
+ fontFamily: AppFonts.interBold,
2096
+ fontSize: 13.5,
2097
+ lineHeight: 18,
2098
+ color: AppColors.primaryBlack,
2099
+ }}>
2100
+ Auto-Calculate Limits from RAM
2101
+ </Text>
2102
+ <Text
2103
+ style={{
2104
+ fontFamily: AppFonts.interRegular,
2105
+ fontSize: 11,
2106
+ lineHeight: 15,
2107
+ color: AppColors.grayText,
2108
+ marginTop: 1,
2109
+ }}>
2110
+ Dynamically sets log limits according to available device memory
2111
+ </Text>
2112
+ </View>
2113
+ </View>
2114
+
2115
+ <TouchableScale
2116
+ accessible={true}
2117
+ accessibilityRole="switch"
2118
+ accessibilityLabel="Toggle auto RAM limit calculation"
2119
+ accessibilityState={{checked: isAutoRamLimitEnabled}}
2120
+ onPress={() => setIsAutoRamLimitEnabled(prev => !prev)}
2121
+ style={{
2122
+ width: 42,
2123
+ height: 24,
2124
+ borderRadius: 12,
2125
+ backgroundColor: isAutoRamLimitEnabled
2126
+ ? AppColors.purple
2127
+ : AppColors.grayBorderSecondary,
2128
+ padding: 2,
2129
+ justifyContent: 'center',
2130
+ alignItems: isAutoRamLimitEnabled
2131
+ ? 'flex-end'
2132
+ : 'flex-start',
2133
+ }}>
2134
+ <View
2135
+ style={{
2136
+ width: 20,
2137
+ height: 20,
2138
+ borderRadius: 10,
2139
+ backgroundColor: AppColors.white,
2140
+ shadowColor: AppColors.black,
2141
+ shadowOpacity: 0.18,
2142
+ shadowRadius: 2,
2143
+ shadowOffset: {width: 0, height: 1},
2144
+ }}
2145
+ />
2146
+ </TouchableScale>
2147
+ </View>
2148
+
2149
+ <View
2150
+ style={{height: 1, backgroundColor: AppColors.dividerColor}}
2151
+ />
2152
+
2153
+ {/* Device Free RAM Display */}
2154
+ <View
2155
+ style={{flexDirection: 'row', alignItems: 'center', gap: 10}}>
2156
+ <View
2157
+ style={{
2158
+ width: 32,
2159
+ height: 32,
2160
+ borderRadius: 8,
2161
+ backgroundColor: isAutoRamLimitEnabled
2162
+ ? `${AppColors.purple}14`
2163
+ : AppColors.grayBackground,
2164
+ alignItems: 'center',
2165
+ justifyContent: 'center',
2166
+ }}>
2167
+ <SignalIcon
2168
+ color={
2169
+ isAutoRamLimitEnabled
2170
+ ? AppColors.purple
2171
+ : AppColors.grayTextWeak
2172
+ }
2173
+ size={15}
2174
+ />
2175
+ </View>
2176
+ <View style={{flex: 1}}>
2177
+ <Text
2178
+ style={{
2179
+ fontFamily: AppFonts.interBold,
2180
+ fontSize: 13.5,
2181
+ lineHeight: 18,
2182
+ color: isAutoRamLimitEnabled
2183
+ ? AppColors.primaryBlack
2184
+ : AppColors.grayText,
2185
+ }}>
2186
+ Detected Available RAM
2187
+ </Text>
2188
+ <Text
2189
+ style={{
2190
+ fontFamily: AppFonts.interRegular,
2191
+ fontSize: 11,
2192
+ lineHeight: 15,
2193
+ color: AppColors.grayText,
2194
+ marginTop: 1,
2195
+ }}>
2196
+ {deviceFreeRamMb} MB available on device
2197
+ </Text>
2198
+ </View>
2199
+ <View
2200
+ style={{
2201
+ paddingHorizontal: 10,
2202
+ paddingVertical: 5,
2203
+ borderRadius: 8,
2204
+ backgroundColor: isAutoRamLimitEnabled
2205
+ ? `${AppColors.purple}12`
2206
+ : AppColors.grayBackground,
2207
+ borderWidth: 1,
2208
+ borderColor: isAutoRamLimitEnabled
2209
+ ? `${AppColors.purple}26`
2210
+ : AppColors.dividerColor,
2211
+ }}>
2212
+ <Text
2213
+ style={{
2214
+ fontFamily: AppFonts.interBold,
2215
+ fontSize: 12,
2216
+ lineHeight: 15,
2217
+ color: isAutoRamLimitEnabled
2218
+ ? AppColors.purple
2219
+ : AppColors.grayText,
2220
+ }}>
2221
+ {deviceFreeRamMb} MB
2222
+ </Text>
2223
+ </View>
2224
+ </View>
2225
+
2226
+ {/* Profile Overview */}
2227
+ <View
2228
+ style={{
2229
+ marginTop: 4,
2230
+ paddingTop: 8,
2231
+ borderTopWidth: 1,
2232
+ borderTopColor: AppColors.dividerColor,
2233
+ gap: 6,
2234
+ }}>
2235
+ <View
2236
+ style={{
2237
+ flexDirection: 'row',
2238
+ alignItems: 'center',
2239
+ justifyContent: 'space-between',
2240
+ }}>
2241
+ <Text
2242
+ style={{
2243
+ fontFamily: AppFonts.interBold,
2244
+ fontSize: 11.5,
2245
+ lineHeight: 15,
2246
+ color: AppColors.purple,
2247
+ }}>
2248
+ Profile: {autoRamProfile.profileName}
2249
+ </Text>
2250
+ <View
2251
+ style={{
2252
+ backgroundColor: isAutoRamLimitEnabled
2253
+ ? `${AppColors.emerald500}18`
2254
+ : `${AppColors.purple}18`,
2255
+ paddingHorizontal: 7,
2256
+ paddingVertical: 2.5,
2257
+ borderRadius: 4,
2258
+ }}>
2259
+ <Text
2260
+ style={{
2261
+ fontFamily: AppFonts.interBold,
2262
+ fontSize: 9.5,
2263
+ color: isAutoRamLimitEnabled
2264
+ ? AppColors.emerald500
2265
+ : AppColors.purple,
2266
+ }}>
2267
+ {isAutoRamLimitEnabled ? 'AUTO-TUNED' : 'MANUAL'}
2268
+ </Text>
2269
+ </View>
2270
+ </View>
2271
+
2272
+ <View
2273
+ style={{flexDirection: 'row', flexWrap: 'wrap', gap: 8, marginTop: 4}}>
2274
+ {[
2275
+ {
2276
+ label: 'APIs',
2277
+ value: isAutoRamLimitEnabled
2278
+ ? autoRamProfile.maxNetworkLogs
2279
+ : maxNetworkLogs,
2280
+ color: AppColors.blue500,
2281
+ },
2282
+ {
2283
+ label: 'Logs',
2284
+ value: isAutoRamLimitEnabled
2285
+ ? autoRamProfile.maxConsoleLogs
2286
+ : maxConsoleLogs,
2287
+ color: AppColors.sky500,
2288
+ },
2289
+ {
2290
+ label: 'Analytics',
2291
+ value: isAutoRamLimitEnabled
2292
+ ? autoRamProfile.maxAnalyticsEvents
2293
+ : maxAnalyticsEventsLimit,
2294
+ color: AppColors.purple,
2295
+ },
2296
+ {
2297
+ label: 'Crash',
2298
+ value: isAutoRamLimitEnabled
2299
+ ? autoRamProfile.maxCrashRecords
2300
+ : maxCrashLogs,
2301
+ color: AppColors.errorColor,
2302
+ },
2303
+ ].map(item => (
2304
+ <View
2305
+ key={item.label}
2306
+ style={{
2307
+ flexDirection: 'row',
2308
+ alignItems: 'center',
2309
+ gap: 4,
2310
+ paddingHorizontal: 8,
2311
+ paddingVertical: 4,
2312
+ borderRadius: 6,
2313
+ backgroundColor: `${item.color}14`,
2314
+ borderWidth: 1,
2315
+ borderColor: `${item.color}33`,
2316
+ }}>
2317
+ <Text
2318
+ style={{
2319
+ fontFamily: AppFonts.interBold,
2320
+ fontSize: 10.5,
2321
+ lineHeight: 14,
2322
+ color: item.color,
2323
+ }}>
2324
+ {item.label}:
2325
+ </Text>
2326
+ <Text
2327
+ style={{
2328
+ fontFamily: AppFonts.interBold,
2329
+ fontSize: 10.5,
2330
+ lineHeight: 14,
2331
+ color: item.color,
2332
+ }}>
2333
+ {item.value} max
2334
+ </Text>
2335
+ </View>
2336
+ ))}
2337
+ </View>
2338
+ </View>
2339
+ </View>
2340
+
2341
+ {/* Section 2: Memory-Safe OS Pruning Shield */}
2342
+ <View
2343
+ style={{
2344
+ backgroundColor: AppColors.primaryLight,
2345
+ borderRadius: 14,
2346
+ borderWidth: 1,
2347
+ borderColor: AppColors.grayBorderSecondary,
2348
+ overflow: 'hidden',
2349
+ padding: 14,
2350
+ gap: 12,
2351
+ }}>
2352
+ <Text
2353
+ style={{
2354
+ fontFamily: AppFonts.interBold,
2355
+ fontSize: 11,
2356
+ lineHeight: 14,
2357
+ color: AppColors.grayTextWeak,
2358
+ letterSpacing: 0.8,
2359
+ }}>
2360
+ LOW MEMORY PRESSURE PROTECTION
2361
+ </Text>
2362
+
2363
+ <View
2364
+ style={{flexDirection: 'row', alignItems: 'center', gap: 10}}>
2365
+ <View
2366
+ style={{
2367
+ width: 32,
2368
+ height: 32,
2369
+ borderRadius: 8,
2370
+ backgroundColor: `${AppColors.emerald500}14`,
2371
+ alignItems: 'center',
2372
+ justifyContent: 'center',
2373
+ }}>
2374
+ <ShieldAlertIcon color={AppColors.emerald500} size={15} />
2375
+ </View>
2376
+ <View style={{flex: 1}}>
2377
+ <Text
2378
+ style={{
2379
+ fontFamily: AppFonts.interBold,
2380
+ fontSize: 13.5,
2381
+ lineHeight: 18,
2382
+ color: AppColors.primaryBlack,
2383
+ }}>
2384
+ OS Memory Warning Guard
2385
+ </Text>
2386
+ <Text
2387
+ style={{
2388
+ fontFamily: AppFonts.interRegular,
2389
+ fontSize: 11,
2390
+ lineHeight: 15,
2391
+ color: AppColors.grayText,
2392
+ marginTop: 1,
2393
+ }}>
2394
+ Automatically prunes in-memory buffers by 50% when the OS signals low memory
2395
+ </Text>
2396
+ </View>
2397
+ <View
2398
+ style={{
2399
+ paddingHorizontal: 8,
2400
+ paddingVertical: 3,
2401
+ borderRadius: 6,
2402
+ backgroundColor: `${AppColors.emerald500}18`,
2403
+ }}>
2404
+ <Text
2405
+ style={{
2406
+ fontFamily: AppFonts.interBold,
2407
+ fontSize: 10,
2408
+ color: AppColors.emerald500,
2409
+ }}>
2410
+ ACTIVE
2411
+ </Text>
2412
+ </View>
2413
+ </View>
2414
+
2415
+ <View
2416
+ style={{height: 1, backgroundColor: AppColors.dividerColor}}
2417
+ />
2418
+
2419
+ {/* Instant Prune Button */}
2420
+ <View
2421
+ style={{
2422
+ flexDirection: 'row',
2423
+ alignItems: 'center',
2424
+ justifyContent: 'space-between',
2425
+ gap: 10,
2426
+ }}>
2427
+ <View style={{flex: 1}}>
2428
+ <Text
2429
+ style={{
2430
+ fontFamily: AppFonts.interBold,
2431
+ fontSize: 13,
2432
+ color: AppColors.primaryBlack,
2433
+ }}>
2434
+ Manual Memory Cleanup
2435
+ </Text>
2436
+ <Text
2437
+ style={{
2438
+ fontFamily: AppFonts.interRegular,
2439
+ fontSize: 11,
2440
+ color: AppColors.grayText,
2441
+ marginTop: 1,
2442
+ }}>
2443
+ Prune older entries across all log stores and free RAM
2444
+ </Text>
2445
+ </View>
2446
+ <TouchableScale
2447
+ onPress={() => {
2448
+ const summary = pruneAllLogs('manual', 0.5);
2449
+ showToast(
2450
+ `Pruned ${summary.totalPruned} items from memory`,
2451
+ );
2452
+ }}
2453
+ style={{
2454
+ backgroundColor: AppColors.purple,
2455
+ paddingHorizontal: 12,
2456
+ paddingVertical: 8,
2457
+ borderRadius: 8,
2458
+ flexDirection: 'row',
2459
+ alignItems: 'center',
2460
+ gap: 5,
2461
+ }}>
2462
+ <TrashIcon size={13} color={AppColors.white} />
2463
+ <Text
2464
+ style={{
2465
+ fontFamily: AppFonts.interBold,
2466
+ fontSize: 11.5,
2467
+ color: AppColors.white,
2468
+ }}>
2469
+ Prune Now
2470
+ </Text>
2471
+ </TouchableScale>
2472
+ </View>
2473
+ </View>
2474
+ </View>
2475
+ )}
2210
2476
  <View style={{height: 48}} />
2211
2477
  </ScrollView>
2212
2478