feat: split legacy/payment apps via APP_MODE flag
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export 'src/domain/initial_route.dart';
|
||||
export 'src/splash_builder.dart';
|
||||
|
||||
@@ -10,11 +10,17 @@ class SplashScreen extends StatefulWidget {
|
||||
super.key,
|
||||
required this.navigationContract,
|
||||
required this.checkSessionUseCase,
|
||||
required this.routeMap,
|
||||
});
|
||||
|
||||
final NavigationContract navigationContract;
|
||||
final CheckSessionUseCase checkSessionUseCase;
|
||||
|
||||
/// Maps each [InitialRoute] to its destination path. Provided by the
|
||||
/// app layer so the splash module stays agnostic of which app
|
||||
/// (legacy vs payment) is being launched.
|
||||
final Map<InitialRoute, String> routeMap;
|
||||
|
||||
@override
|
||||
State<SplashScreen> createState() => _SplashScreenState();
|
||||
}
|
||||
@@ -52,11 +58,9 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
void _navigateIfReady() {
|
||||
if (!_animationDone || _route == null || !mounted) return;
|
||||
|
||||
final destination = switch (_route!) {
|
||||
InitialRoute.onboarding => AppRoutes.legacyOnboarding,
|
||||
InitialRoute.login => AppRoutes.legacyLogin,
|
||||
InitialRoute.home => AppRoutes.controlPanel,
|
||||
};
|
||||
final destination = widget.routeMap[_route!];
|
||||
if (destination == null) return;
|
||||
|
||||
widget.navigationContract.goTo(destination);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,16 @@ import 'package:navigation/navigation_contract.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:splash/src/domain/check_session_use_case_impl.dart';
|
||||
import 'package:splash/src/domain/initial_route.dart';
|
||||
import 'package:splash/src/presentation/splash_screen.dart';
|
||||
|
||||
class SplashBuilder {
|
||||
const SplashBuilder();
|
||||
const SplashBuilder({required this.routeMap});
|
||||
|
||||
/// Maps each [InitialRoute] to its destination path. The app layer
|
||||
/// provides this map so the splash module stays agnostic of which
|
||||
/// app (legacy vs payment) is being launched.
|
||||
final Map<InitialRoute, String> routeMap;
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
@@ -20,6 +26,7 @@ class SplashBuilder {
|
||||
child: SplashScreen(
|
||||
navigationContract: navigationContract,
|
||||
checkSessionUseCase: checkSessionUseCase,
|
||||
routeMap: routeMap,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user