Pipeline YouTube con relay, overlay e publisher sync lato backend; fix GL pauseGlDuringRotation su Android per evitare crash in rotazione durante lo streaming Flutter. Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
1.8 KiB
Dart
69 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../app/theme.dart';
|
|
import '../../providers/auth_provider.dart';
|
|
import '../../shared/widgets/match_live_wordmark.dart';
|
|
import '../../shared/widgets/screen_insets.dart';
|
|
|
|
/// Splash con wordmark e slogan.
|
|
class SplashScreen extends ConsumerStatefulWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
ConsumerState<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends ConsumerState<SplashScreen> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_bootstrap();
|
|
}
|
|
|
|
Future<void> _bootstrap() async {
|
|
final notifier = ref.read(authProvider.notifier);
|
|
await notifier.restoreSession();
|
|
await Future<void>.delayed(const Duration(milliseconds: 400));
|
|
if (!mounted) return;
|
|
|
|
var auth = ref.read(authProvider);
|
|
if (auth.isAuthenticated) {
|
|
final ok = await notifier.validateOrRefreshSession();
|
|
if (!mounted) return;
|
|
auth = ref.read(authProvider);
|
|
if (!ok || !auth.isAuthenticated) {
|
|
context.go('/login');
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!mounted) return;
|
|
if (auth.isAuthenticated) {
|
|
context.go('/matches');
|
|
} else {
|
|
context.go('/login');
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppTheme.background,
|
|
body: AppSafeArea(
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const MatchLiveWordmark(showSlogan: true),
|
|
const SizedBox(height: 48),
|
|
const CircularProgressIndicator(color: AppTheme.primaryRed),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|