diff --git a/app/lib/protected_page_handler.dart b/app/lib/protected_page_handler.dart index 3872dade..80017515 100644 --- a/app/lib/protected_page_handler.dart +++ b/app/lib/protected_page_handler.dart @@ -28,7 +28,8 @@ class ProtectedPageAuthException implements Exception { } extension ProtectedPageBuildContextExtension on NavigatorState { - Future pushReplacementProtected( + Future + pushReplacementNamedProtected( String routeName, { U? result, Object? arguments, @@ -41,7 +42,7 @@ extension ProtectedPageBuildContextExtension on NavigatorState { } } - Future pushProtected( + Future pushNamedProtected( String routeName, { Object? arguments, }) async { @@ -52,6 +53,14 @@ extension ProtectedPageBuildContextExtension on NavigatorState { } } + Future pushProtected(Route route) async { + if (await _auth()) { + return push(route); + } else { + throw const ProtectedPageAuthException(); + } + } + Future _auth() async { final securePrefController = context.read(); switch (securePrefController.protectedPageAuthTypeValue) { diff --git a/app/lib/widget/splash.dart b/app/lib/widget/splash.dart index 52c54a86..e42e6af6 100644 --- a/app/lib/widget/splash.dart +++ b/app/lib/widget/splash.dart @@ -145,7 +145,7 @@ class _SplashState extends State { Navigator.pushReplacementNamed(context, SignIn.routeName); } else { Navigator.of(context) - .pushReplacementProtected(Home.routeName, + .pushReplacementNamedProtected(Home.routeName, arguments: HomeArguments(account)) .then((value) async { if (getRawPlatform() == NpPlatform.android) {