Format calendar event description
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
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/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_response.dart';
|
||||
@@ -23,4 +24,8 @@ abstract class CalendarEventRepository {
|
||||
AccountId accountId,
|
||||
Set<Id> blobIds,
|
||||
String? language);
|
||||
|
||||
Future<List<BlobCalendarEvent>> transformCalendarEventDescription(
|
||||
List<BlobCalendarEvent> blobCalendarEvents,
|
||||
TransformConfiguration transformConfiguration);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/html_transformer/transform_configuration.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
@@ -15,15 +16,19 @@ class ParseCalendarEventInteractor {
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
AccountId accountId,
|
||||
Set<Id> blobIds,
|
||||
String emailContents
|
||||
TransformConfiguration transformConfiguration,
|
||||
) async* {
|
||||
try {
|
||||
yield Right(ParseCalendarEventLoading());
|
||||
|
||||
final listBlobCalendarEvent = await _calendarEventRepository.parse(accountId, blobIds);
|
||||
final listBlobCalendarEventWithTransformedDescription = await _calendarEventRepository.transformCalendarEventDescription(
|
||||
listBlobCalendarEvent,
|
||||
transformConfiguration,
|
||||
);
|
||||
|
||||
if (listBlobCalendarEvent.isNotEmpty) {
|
||||
yield Right(ParseCalendarEventSuccess(listBlobCalendarEvent));
|
||||
if (listBlobCalendarEventWithTransformedDescription.isNotEmpty) {
|
||||
yield Right(ParseCalendarEventSuccess(listBlobCalendarEventWithTransformedDescription));
|
||||
} else {
|
||||
yield Left(ParseCalendarEventFailure(NotFoundCalendarEventException()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user