TF-2802 Expose blobId of chosen calendar event after parse
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||
|
||||
@@ -7,13 +8,13 @@ class ParseCalendarEventLoading extends LoadingState {}
|
||||
|
||||
class ParseCalendarEventSuccess extends UIState {
|
||||
|
||||
final List<CalendarEvent> calendarEventList;
|
||||
final Map<Id, List<CalendarEvent>> calendarEventMap;
|
||||
final List<EventAction> eventActionList;
|
||||
|
||||
ParseCalendarEventSuccess(this.calendarEventList, this.eventActionList);
|
||||
ParseCalendarEventSuccess(this.calendarEventMap, this.eventActionList);
|
||||
|
||||
@override
|
||||
List<Object> get props => [calendarEventList, eventActionList];
|
||||
List<Object> get props => [calendarEventMap, eventActionList];
|
||||
}
|
||||
|
||||
class ParseCalendarEventFailure extends FeatureFailure {
|
||||
|
||||
@@ -30,21 +30,18 @@ class ParseCalendarEventInteractor {
|
||||
eagerError: true
|
||||
);
|
||||
|
||||
final listCalendarEvent = List<CalendarEvent>.empty(growable: true);
|
||||
final mapCalendarEvent = <Id, List<CalendarEvent>>{};
|
||||
final listEventAction = List<EventAction>.empty(growable: true);
|
||||
|
||||
if (listResult[0] is Map<Id, List<CalendarEvent>>) {
|
||||
final mapCalendarEvent = listResult[0] as Map<Id, List<CalendarEvent>>;
|
||||
for (var calendarEvents in mapCalendarEvent.values) {
|
||||
listCalendarEvent.addAll(calendarEvents);
|
||||
}
|
||||
mapCalendarEvent.addAll(listResult[0] as Map<Id, List<CalendarEvent>>);
|
||||
}
|
||||
if (listResult[1] is List<EventAction>) {
|
||||
listEventAction.addAll(listResult[1] as List<EventAction>);
|
||||
}
|
||||
|
||||
if (listCalendarEvent.isNotEmpty) {
|
||||
yield Right(ParseCalendarEventSuccess(listCalendarEvent, listEventAction));
|
||||
if (mapCalendarEvent.isNotEmpty) {
|
||||
yield Right(ParseCalendarEventSuccess(mapCalendarEvent, listEventAction));
|
||||
} else {
|
||||
yield Left(ParseCalendarEventFailure(NotFoundCalendarEventException()));
|
||||
}
|
||||
|
||||
@@ -1465,7 +1465,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
|
||||
void _handleParseCalendarEventSuccess(ParseCalendarEventSuccess success) {
|
||||
emailLoadedViewState.value = Right<Failure, Success>(success);
|
||||
calendarEvent.value = success.calendarEventList.first;
|
||||
calendarEvent.value = success.calendarEventMap.values.first.first;
|
||||
eventActions.value = success.eventActionList;
|
||||
if (PlatformInfo.isMobile) {
|
||||
_enableScrollPageView();
|
||||
|
||||
Reference in New Issue
Block a user