feat: add mobile device detection and update session state management
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
@@ -109,6 +112,14 @@ class _FluxAppState extends State<FluxApp> {
|
||||
super.initState();
|
||||
// Creiamo il router passandogli il Cubit per i redirect
|
||||
_router = AppRouter.createRouter(context.read<SessionCubit>());
|
||||
GetIt.I.get<SessionCubit>().setIsMobileDevice(isMobileDevice(context));
|
||||
}
|
||||
|
||||
bool isMobileDevice(BuildContext context) {
|
||||
if (kIsWeb) {
|
||||
return false; // Il web non lo consideriamo "mobile nativo" per i deep link
|
||||
}
|
||||
return Platform.isAndroid || Platform.isIOS;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user