TF-2858 Implement store event attendance status on presentation layer
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
|
||||
|
||||
class CalendarEventAccepting extends CalendarEventReplying {}
|
||||
|
||||
class CalendarEventAccepted extends CalendarEventReplySuccess {
|
||||
|
||||
CalendarEventAccepted(super.calendarEventAcceptResponse);
|
||||
|
||||
CalendarEventAccepted(super.calendarEventAcceptResponse, super.emailId);
|
||||
|
||||
@override
|
||||
EventActionType getEventActionType() => EventActionType.yes;
|
||||
}
|
||||
|
||||
class CalendarEventAcceptFailure extends CalendarEventReplyFailure {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_maybe_response.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
|
||||
|
||||
class CalendarEventMaybeReplying extends CalendarEventReplying {}
|
||||
|
||||
class CalendarEventMaybeSuccess extends CalendarEventReplySuccess {
|
||||
final CalendarEventMaybeResponse calendarEventMaybeResponse;
|
||||
|
||||
CalendarEventMaybeSuccess(this.calendarEventMaybeResponse)
|
||||
: super(calendarEventMaybeResponse);
|
||||
|
||||
CalendarEventMaybeSuccess(super.calendarEventMaybeResponse, super.emailId);
|
||||
|
||||
@override
|
||||
EventActionType getEventActionType() => EventActionType.maybe;
|
||||
}
|
||||
|
||||
class CalendarEventMaybeFailure extends CalendarEventReplyFailure {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_reject_response.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
|
||||
|
||||
class CalendarEventRejecting extends CalendarEventReplying {}
|
||||
|
||||
class CalendarEventRejected extends CalendarEventReplySuccess {
|
||||
final CalendarEventRejectResponse calendarEventRejectResponse;
|
||||
|
||||
CalendarEventRejected(this.calendarEventRejectResponse)
|
||||
: super(calendarEventRejectResponse);
|
||||
|
||||
CalendarEventRejected(super.calendarEventRejectResponse, super.emailId);
|
||||
|
||||
@override
|
||||
EventActionType getEventActionType() => EventActionType.no;
|
||||
}
|
||||
|
||||
class CalendarEventRejectFailure extends CalendarEventReplyFailure {
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/method/response/calendar_event_reply_response.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||
|
||||
class CalendarEventReplying extends LoadingState {}
|
||||
|
||||
class CalendarEventReplySuccess extends UIState {
|
||||
abstract class CalendarEventReplySuccess extends UIState {
|
||||
final EmailId emailId;
|
||||
final CalendarEventReplyResponse calendarEventReplyResponse;
|
||||
|
||||
CalendarEventReplySuccess(this.calendarEventReplyResponse);
|
||||
CalendarEventReplySuccess(this.calendarEventReplyResponse, this.emailId);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [calendarEventReplyResponse];
|
||||
List<Object?> get props => [calendarEventReplyResponse, emailId];
|
||||
|
||||
EventActionType getEventActionType();
|
||||
}
|
||||
|
||||
class CalendarEventReplyFailure extends FeatureFailure {
|
||||
|
||||
@@ -3,6 +3,7 @@ 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/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/repository/calendar_event_repository.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_accept_state.dart';
|
||||
|
||||
@@ -13,12 +14,13 @@ class AcceptCalendarEventInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
AccountId accountId,
|
||||
Set<Id> blobIds
|
||||
Set<Id> blobIds,
|
||||
EmailId emailId,
|
||||
) async* {
|
||||
try {
|
||||
yield Right(CalendarEventAccepting());
|
||||
final result = await _calendarEventRepository.acceptEventInvitation(accountId, blobIds);
|
||||
yield Right(CalendarEventAccepted(result));
|
||||
yield Right(CalendarEventAccepted(result, emailId));
|
||||
} catch (e) {
|
||||
yield Left(CalendarEventAcceptFailure(exception: e));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/repository/calendar_event_repository.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reject_state.dart';
|
||||
|
||||
@@ -13,12 +14,13 @@ class RejectCalendarEventInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
AccountId accountId,
|
||||
Set<Id> blobIds
|
||||
Set<Id> blobIds,
|
||||
EmailId emailId,
|
||||
) async* {
|
||||
try {
|
||||
yield Right(CalendarEventRejecting());
|
||||
final result = await _calendarEventRepository.rejectEventInvitation(accountId, blobIds);
|
||||
yield Right(CalendarEventRejected(result));
|
||||
yield Right(CalendarEventRejected(result, emailId));
|
||||
} catch (e) {
|
||||
yield Left(CalendarEventRejectFailure(exception: e));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/repository/calendar_event_repository.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_maybe_state.dart';
|
||||
|
||||
@@ -13,12 +14,13 @@ class MaybeCalendarEventInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
AccountId accountId,
|
||||
Set<Id> blobIds
|
||||
Set<Id> blobIds,
|
||||
EmailId emailId,
|
||||
) async* {
|
||||
try {
|
||||
yield Right(CalendarEventMaybeReplying());
|
||||
final result = await _calendarEventRepository.maybeEventInvitation(accountId, blobIds);
|
||||
yield Right(CalendarEventMaybeSuccess(result));
|
||||
yield Right(CalendarEventMaybeSuccess(result, emailId));
|
||||
} catch (e) {
|
||||
yield Left(CalendarEventMaybeFailure(exception: e));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user