Use TupleKey(ObjectKey-AccountId-UserName) to store data to hive
(cherry picked from commit e0ace535d5f3af71eb13598d92524caf2c6d9bbf)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:model/account/account.dart';
|
||||
import 'package:model/account/personal_account.dart';
|
||||
import 'package:tmail_ui_user/features/caching/account_cache_client.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/extensions/account_cache_extensions.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/extensions/account_extensions.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/extensions/personal_account_extension.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/exceptions/authentication_exception.dart';
|
||||
|
||||
class AccountCacheManager {
|
||||
@@ -10,7 +10,7 @@ class AccountCacheManager {
|
||||
|
||||
AccountCacheManager(this._accountCacheClient);
|
||||
|
||||
Future<Account> getSelectedAccount() async {
|
||||
Future<PersonalAccount> getSelectedAccount() async {
|
||||
try {
|
||||
final allAccounts = await _accountCacheClient.getAll();
|
||||
return allAccounts.firstWhere((account) => account.isSelected)
|
||||
@@ -21,7 +21,7 @@ class AccountCacheManager {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setSelectedAccount(Account account) {
|
||||
Future<void> setSelectedAccount(PersonalAccount account) {
|
||||
log('AccountCacheManager::setSelectedAccount(): $_accountCacheClient');
|
||||
return _accountCacheClient.insertItem(account.id, account.toCache());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user