TF-2182 Fix no blue bar for calendar events

(cherry picked from commit 7ea91d59e860dbd8f5bd38cefd76ca61bc4cc4e3)
This commit is contained in:
dab246
2023-10-04 16:18:32 +07:00
committed by Dat H. Pham
parent c3c8eacb9f
commit b4ce4651c0
17 changed files with 46 additions and 44 deletions
@@ -5,7 +5,7 @@ import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
abstract class CalendarEventDataSource {
Future<List<CalendarEvent>> parse(AccountId accountId, Set<Id> blobIds);
Future<Map<Id, List<CalendarEvent>>> parse(AccountId accountId, Set<Id> blobIds);
Future<List<EventAction>> getListEventAction(String emailContents);
}
@@ -15,7 +15,7 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
CalendarEventDataSourceImpl(this._calendarEventAPI, this._exceptionThrower);
@override
Future<List<CalendarEvent>> parse(AccountId accountId, Set<Id> blobIds) {
Future<Map<Id, List<CalendarEvent>>> parse(AccountId accountId, Set<Id> blobIds) {
return Future.sync(() async {
return await _calendarEventAPI.parse(accountId, blobIds);
}).catchError(_exceptionThrower.throwException);
@@ -16,7 +16,7 @@ class LocalCalendarEventDataSourceImpl extends CalendarEventDataSource {
LocalCalendarEventDataSourceImpl(this._htmlAnalyzer, this._exceptionThrower);
@override
Future<List<CalendarEvent>> parse(AccountId accountId, Set<Id> blobIds) {
Future<Map<Id, List<CalendarEvent>>> parse(AccountId accountId, Set<Id> blobIds) {
throw UnimplementedError();
}
@@ -15,7 +15,7 @@ class CalendarEventAPI {
CalendarEventAPI(this._httpClient);
Future<List<CalendarEvent>> parse(AccountId accountId, Set<Id> blobIds) async {
Future<Map<Id, List<CalendarEvent>>> parse(AccountId accountId, Set<Id> blobIds) async {
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
final calendarEventParseMethod = CalendarEventParseMethod(accountId, blobIds);
final calendarEventParseInvocation = requestBuilder.invocation(calendarEventParseMethod);
@@ -29,7 +29,7 @@ class CalendarEventAPI {
CalendarEventParseResponse.deserialize);
if (calendarEventParseResponse?.parsed?.isNotEmpty == true) {
return calendarEventParseResponse!.parsed!.values.toList();
return calendarEventParseResponse!.parsed!;
} else if (calendarEventParseResponse?.notParsable?.isNotEmpty == true) {
throw NotParsableCalendarEventException();
} else if (calendarEventParseResponse?.notFound?.isNotEmpty == true) {
@@ -14,7 +14,7 @@ class CalendarEventRepositoryImpl extends CalendarEventRepository {
CalendarEventRepositoryImpl(this._calendarEventDataSource);
@override
Future<List<CalendarEvent>> parse(AccountId accountId, Set<Id> blobIds) {
Future<Map<Id, List<CalendarEvent>>> parse(AccountId accountId, Set<Id> blobIds) {
return _calendarEventDataSource[DataSourceType.network]!.parse(accountId, blobIds);
}