TF-2901 Implement caching composer on log out
This commit is contained in:
@@ -1,10 +1,31 @@
|
||||
import 'package:core/presentation/utils/html_transformer/transform_configuration.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/model/screen_display_mode.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/model/composer_cache.dart';
|
||||
|
||||
abstract class ComposerCacheRepository {
|
||||
void saveComposerCacheOnWeb(Email email);
|
||||
Future<void> saveComposerCacheOnWeb(
|
||||
Email email,
|
||||
{
|
||||
required AccountId accountId,
|
||||
required UserName userName,
|
||||
required ScreenDisplayMode displayMode,
|
||||
Identity? identity,
|
||||
bool? readReceipentEnabled
|
||||
}
|
||||
);
|
||||
|
||||
ComposerCache getComposerCacheOnWeb();
|
||||
Future<ComposerCache> getComposerCacheOnWeb(
|
||||
AccountId accountId,
|
||||
UserName userName);
|
||||
|
||||
void removeComposerCacheOnWeb();
|
||||
Future<void> removeComposerCacheOnWeb();
|
||||
|
||||
Future<String> restoreEmailInlineImages(
|
||||
String htmlContent,
|
||||
TransformConfiguration transformConfiguration,
|
||||
Map<String, String> mapUrlDownloadCID);
|
||||
}
|
||||
|
||||
+6
-4
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user