import React, { useEffect, useState } from "react"; import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native"; import { Feather } from "@expo/vector-icons"; import { useRouter } from "expo-router"; import { getDiagnostics, sessionMemory } from "../src/api"; import { getTokenInfo } from "../src/auth"; import { useApp } from "../src/app-context"; import { isProduction } from "../src/config"; import { getRealtimeDiagnostics } from "../src/realtime"; import { ScreenShell } from "../src/components/ScreenShell"; import { styles } from "../src/ui"; import { colors, radii, spacing } from "../src/theme"; export default function DiagnosticsScreen() { const app = useApp(); const router = useRouter(); const [, render] = useState(0); useEffect(() => { const timer = setInterval(() => render((value) => value + 1), 1000); return () => clearInterval(timer); }, []); if (isProduction) { return ( router.back()} style={stylesLocal.backButton}> Диагностика Экран отключён в production. ); } const token = getTokenInfo(); return ( router.back()} style={stylesLocal.backButton}> Безопасная диагностика Режим: {app.authStatus} Realtime: {app.realtimeState} UX-сессия: {sessionMemory.id ?? "нет"} Access token истекает: {token ? new Date(token.expiresAt).toLocaleString("ru-RU") : "нет"} {getRealtimeDiagnostics().map((item) => Cursor {item.dialog}: {item.cursor}, )} Токены, OTP, персональные данные, сообщения и presigned URL здесь никогда не отображаются. Последние запросы {!getDiagnostics().length && Запросов ещё нет.} {getDiagnostics().map((item) => {item.status} {item.method} {item.path} request_id: {item.requestId} )} ); } const stylesLocal = StyleSheet.create({ topBar: { flexDirection: "row", alignItems: "center", gap: spacing.md, marginBottom: spacing.sm }, backButton: { width: 36, height: 36, borderRadius: radii.full, alignItems: "center", justifyContent: "center" }, });