mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 06:07:48 -06:00
feat: Add new translations, add list of existing accounts to login page
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user