TF-571 Implement AccountRepository with HiveAccountDataSource
This commit is contained in:
committed by
Dat H. Pham
parent
f8e7429751
commit
ff6e6d8878
@@ -0,0 +1,22 @@
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:model/account/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';
|
||||
|
||||
class HiveAccountDatasourceImpl extends AccountDatasource {
|
||||
final AccountCacheManager _accountCacheManager;
|
||||
|
||||
HiveAccountDatasourceImpl(this._accountCacheManager);
|
||||
|
||||
@override
|
||||
Future<Account> getCurrentAccount() {
|
||||
return _accountCacheManager.getSelectedAccount();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setCurrentAccount(Account newCurrentAccount) {
|
||||
log('HiveAccountDatasourceImpl::setCurrentAccount(): $newCurrentAccount');
|
||||
log('HiveAccountDatasourceImpl::setCurrentAccount(): $_accountCacheManager');
|
||||
return _accountCacheManager.setSelectedAccount(newCurrentAccount);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user