This commit is contained in:
ivan2282
2025-12-01 20:09:12 +03:00
parent cf61fda58e
commit b277da140a

View File

@@ -25,27 +25,19 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await initializeDateFormatting(); await initializeDateFormatting();
print("Инициализируем сервисы кеширования...");
await CacheService().initialize(); await CacheService().initialize();
await AvatarCacheService().initialize(); await AvatarCacheService().initialize();
await ChatCacheService().initialize(); await ChatCacheService().initialize();
await ContactLocalNamesService().initialize(); await ContactLocalNamesService().initialize();
print("Сервисы кеширования инициализированы");
print("Инициализируем AccountManager...");
await AccountManager().initialize(); await AccountManager().initialize();
await AccountManager().migrateOldAccount(); await AccountManager().migrateOldAccount();
print("AccountManager инициализирован");
print("Инициализируем MusicPlayerService...");
await MusicPlayerService().initialize(); await MusicPlayerService().initialize();
print("MusicPlayerService инициализирован");
final hasToken = await ApiService.instance.hasToken(); final hasToken = await ApiService.instance.hasToken();
print("При запуске приложения токен ${hasToken ? 'найден' : 'не найден'}");
if (hasToken) { if (hasToken) {
print("Инициируем подключение к WebSocket при запуске...");
ApiService.instance.connect(); ApiService.instance.connect();
} }
@@ -110,7 +102,7 @@ class MyApp extends StatelessWidget {
color: ColorScheme.fromSeed( color: ColorScheme.fromSeed(
seedColor: accentColor, seedColor: accentColor,
brightness: Brightness.dark, brightness: Brightness.dark,
).onSurface, // ← Используем цвет onSurface из цветовой схемы ).onSurface,
), ),
), ),
); );
@@ -148,33 +140,34 @@ class MyApp extends StatelessWidget {
? oledTheme ? oledTheme
: baseDarkTheme; : baseDarkTheme;
return MaterialApp( return SafeArea(
title: 'Komet', child: MaterialApp(
navigatorKey: navigatorKey, title: 'Komet',
builder: (context, child) { navigatorKey: navigatorKey,
final showHud = themeProvider.debugShowPerformanceOverlay; builder: (context, child) {
return SizedBox.expand( final showHud = themeProvider.debugShowPerformanceOverlay;
child: Stack( return SizedBox.expand(
children: [ child: Stack(
if (child != null) child, children: [
if (showHud) if (child != null) child,
const Positioned(top: 8, right: 56, child: _MiniFpsHud()), if (showHud)
], const Positioned(top: 8, right: 56, child: _MiniFpsHud()),
), ],
); ),
}, );
theme: baseLightTheme, },
darkTheme: activeDarkTheme, theme: baseLightTheme,
themeMode: themeProvider.themeMode, darkTheme: activeDarkTheme,
localizationsDelegates: const [ themeMode: themeProvider.themeMode,
GlobalMaterialLocalizations.delegate, localizationsDelegates: const [
GlobalWidgetsLocalizations.delegate, GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate, GlobalWidgetsLocalizations.delegate,
], GlobalCupertinoLocalizations.delegate,
supportedLocales: const [Locale('ru'), Locale('en')], ],
locale: const Locale('ru'), supportedLocales: const [Locale('ru'), Locale('en')],
locale: const Locale('ru'),
home: hasToken ? const HomeScreen() : const PhoneEntryScreen(), home: hasToken ? const HomeScreen() : const PhoneEntryScreen(),
),
); );
}, },
); );