v1.1.6
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flux/core/services/notification_service.dart';
|
||||
import 'package:flux/core/utils/version_check_service.dart';
|
||||
import 'package:flux/features/attachments/data/attachments_repository.dart';
|
||||
import 'package:flux/features/auth/bloc/auth_cubit.dart';
|
||||
@@ -61,6 +62,7 @@ void main() async {
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
await setupInteractedMessage();
|
||||
} catch (e) {
|
||||
debugPrint('Errore inizializzazione Firebase: $e');
|
||||
}
|
||||
@@ -194,6 +196,13 @@ class _FluxAppState extends State<FluxApp> {
|
||||
return _buildLoadingScreen();
|
||||
}
|
||||
|
||||
if (sessionState.status == SessionStatus.error) {
|
||||
return _buildSessionErrorScreen(
|
||||
state: sessionState,
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
||||
return BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, themeState) {
|
||||
return MaterialApp.router(
|
||||
@@ -245,6 +254,42 @@ class _FluxAppState extends State<FluxApp> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildSessionErrorScreen({
|
||||
required SessionState state,
|
||||
required BuildContext context,
|
||||
}) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.wifi_off_rounded, size: 64, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
state.errorMessage ?? 'Errore nella connessione',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
// Il ninja riprova a lanciare l'inizializzazione
|
||||
context.read<SessionCubit>().initializeSession();
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text("Riprova a connetterti"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// --- IL WIDGET GUARDIANO DEGLI AGGIORNAMENTI ---
|
||||
class GlobalUpdateChecker extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
Reference in New Issue
Block a user