Use TupleKey(ObjectKey-AccountId-UserName) to store data to hive
(cherry picked from commit e0ace535d5f3af71eb13598d92524caf2c6d9bbf)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import 'package:model/model.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:model/account/password.dart';
|
||||
import 'package:model/user/user_profile.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/datasource/authentication_datasource.dart';
|
||||
|
||||
class AuthenticationDataSourceImpl extends AuthenticationDataSource {
|
||||
@@ -8,7 +10,7 @@ class AuthenticationDataSourceImpl extends AuthenticationDataSource {
|
||||
@override
|
||||
Future<UserProfile> authenticationUser(Uri baseUrl, UserName userName, Password password) {
|
||||
return Future.sync(() {
|
||||
return UserProfile(userName.userName);
|
||||
return UserProfile(userName.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:model/account/account.dart';
|
||||
import 'package:model/account/personal_account.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/datasource/account_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/local/account_cache_manager.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
@@ -11,14 +11,14 @@ class HiveAccountDatasourceImpl extends AccountDatasource {
|
||||
HiveAccountDatasourceImpl(this._accountCacheManager, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<Account> getCurrentAccount() {
|
||||
Future<PersonalAccount> getCurrentAccount() {
|
||||
return Future.sync(() async {
|
||||
return await _accountCacheManager.getSelectedAccount();
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setCurrentAccount(Account newCurrentAccount) {
|
||||
Future<void> setCurrentAccount(PersonalAccount newCurrentAccount) {
|
||||
return Future.sync(() async {
|
||||
return await _accountCacheManager.setSelectedAccount(newCurrentAccount);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
|
||||
Reference in New Issue
Block a user