feat: Add new translations, add list of existing accounts to login page

This commit is contained in:
Anton Stubenbord
2023-05-30 01:19:27 +02:00
parent cd56f5fdb8
commit 1dc7d22d3a
19 changed files with 694 additions and 381 deletions

View File

@@ -140,20 +140,14 @@ class AuthenticationCubit extends Cubit<AuthenticationState> {
}
Future<void> removeAccount(String userId) async {
final globalSettings = Hive.box<GlobalSettings>(HiveBoxes.globalSettings).getValue()!;
final userAccountBox = Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount);
final userAppStateBox = Hive.box<LocalUserAppState>(HiveBoxes.localUserAppState);
final currentUser = globalSettings.currentLoggedInUser;
await userAccountBox.delete(userId);
await userAppStateBox.delete(userId);
await withEncryptedBox(HiveBoxes.localUserCredentials, (box) {
await withEncryptedBox<UserCredentials, void>(HiveBoxes.localUserCredentials, (box) {
box.delete(userId);
});
if (currentUser == userId) {
return logout();
}
}
///
@@ -209,10 +203,10 @@ class AuthenticationCubit extends Cubit<AuthenticationState> {
Future<void> logout() async {
await _resetExternalState();
final globalSettings = Hive.box<GlobalSettings>(HiveBoxes.globalSettings).getValue()!;
emit(const AuthenticationState.unauthenticated());
globalSettings
..currentLoggedInUser = null
..save();
emit(const AuthenticationState.unauthenticated());
}
Future<void> _resetExternalState() async {