TF-4186 Add datasource/repository for save and get company server login info

This commit is contained in:
dab246
2025-12-03 11:16:39 +07:00
committed by Dat H. Pham
parent 860154acc1
commit 0bbcfd0f75
11 changed files with 202 additions and 0 deletions
@@ -0,0 +1,35 @@
import 'package:tmail_ui_user/features/login/data/datasource/company_server_login_datasource.dart';
import 'package:tmail_ui_user/features/login/data/local/company_server_login_cache_manager.dart';
import 'package:tmail_ui_user/features/login/domain/model/company_server_login_info.dart';
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
class CompanyServerLoginDatasourceImpl implements CompanyServerLoginDataSource {
final CompanyServerLoginCacheManager _loginCacheManager;
final ExceptionThrower _exceptionThrower;
CompanyServerLoginDatasourceImpl(
this._loginCacheManager,
this._exceptionThrower,
);
@override
Future<CompanyServerLoginInfo> getCompanyServerLoginInfo() {
return Future.sync(() {
return _loginCacheManager.getCompanyServerLoginInfo();
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> removeCompanyServerLoginInfo() {
return Future.sync(() async {
return await _loginCacheManager.removeCompanyServerLoginInfo();
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> saveCompanyServerLoginInfo(CompanyServerLoginInfo loginInfo) {
return Future.sync(() async {
return await _loginCacheManager.saveCompanyServerLoginInfo(loginInfo);
}).catchError(_exceptionThrower.throwException);
}
}