TF-2901 Implement caching composer on log out

This commit is contained in:
DatDang
2024-06-18 15:24:02 +07:00
committed by Dat H. Pham
parent c4bffd6626
commit b2c92388f2
18 changed files with 507 additions and 185 deletions
@@ -1,6 +1,8 @@
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/user_name.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/repository/composer_cache_repository.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/state/get_composer_cache_state.dart';
@@ -9,12 +11,12 @@ class GetComposerCacheOnWebInteractor {
GetComposerCacheOnWebInteractor(this.composerCacheRepository);
Either<Failure, Success> execute() {
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
try {
final data = composerCacheRepository.getComposerCacheOnWeb();
return Right(GetComposerCacheSuccess(data));
final data = await composerCacheRepository.getComposerCacheOnWeb(accountId, userName);
yield Right(GetComposerCacheSuccess(data));
} catch (exception) {
return Left(GetComposerCacheFailure(exception));
yield Left(GetComposerCacheFailure(exception));
}
}
}