Add manual auth screen
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-07-02 19:50:25 +02:00
parent ce1c175c62
commit c8fa4552bb
15 changed files with 163 additions and 42 deletions

View File

@ -1,4 +1,4 @@
import 'package:moneymgr_mobile/routes/login/login_model.dart';
import 'package:moneymgr_mobile/services/api/api_token.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
@ -8,7 +8,7 @@ part 'auth_state.g.dart';
/// The current authentication state of the app.
///
/// This notifier is responsible for saving/removing the token and profile info
/// to the storage through the [login] and [logout] methods.
/// to the storage through the [setAuthToken] and [logout] methods.
@riverpod
class CurrentAuthState extends _$CurrentAuthState {
@override
@ -18,9 +18,9 @@ class CurrentAuthState extends _$CurrentAuthState {
return token != null ? AuthState.authenticated : AuthState.unauthenticated;
}
/// Attempts to log in with [data] and saves the token and profile info to storage.
/// Attempts to authenticate with [data] and saves the token and profile info to storage.
/// Will invalidate the state if success.
Future<void> login(LoginModel data) async {
Future<void> setAuthToken(ApiToken data) async {
// TODO : perform login
/*final secureStorage = ref.read(secureStorageProvider).requireValue;
final token = await ref.read(apiServiceProvider).login(data);
@ -53,13 +53,12 @@ class CurrentAuthState extends _$CurrentAuthState {
}
}
/// The possible authentication states of the app.
enum AuthState {
unknown(redirectPath: homePage, allowedPaths: [homePage]),
unauthenticated(
redirectPath: authPage,
allowedPaths: [authPage, settingsPage],
allowedPaths: [authPage, manualAuthPage, settingsPage],
),
authenticated(redirectPath: homePage, allowedPaths: null);