TF-2859 Add language when reply calendar invitation

This commit is contained in:
DatDang
2024-05-17 14:44:36 +07:00
committed by Dat H. Pham
parent c2979429cf
commit 2e68e7df7d
10 changed files with 161 additions and 36 deletions
@@ -9,9 +9,18 @@ import 'package:tmail_ui_user/features/email/presentation/model/blob_calendar_ev
abstract class CalendarEventDataSource {
Future<List<BlobCalendarEvent>> parse(AccountId accountId, Set<Id> blobIds);
Future<CalendarEventAcceptResponse> acceptEventInvitation(AccountId accountId, Set<Id> blobIds);
Future<CalendarEventAcceptResponse> acceptEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language);
Future<CalendarEventMaybeResponse> maybeEventInvitation(AccountId accountId, Set<Id> blobIds);
Future<CalendarEventMaybeResponse> maybeEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language);
Future<CalendarEventRejectResponse> rejectEventInvitation(AccountId accountId, Set<Id> blobIds);
Future<CalendarEventRejectResponse> rejectEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language);
}
@@ -24,23 +24,32 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
}
@override
Future<CalendarEventAcceptResponse> acceptEventInvitation(AccountId accountId, Set<Id> blobIds) {
Future<CalendarEventAcceptResponse> acceptEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language) {
return Future.sync(() async {
return await _calendarEventAPI.acceptEventInvitation(accountId, blobIds);
return await _calendarEventAPI.acceptEventInvitation(accountId, blobIds, language);
}).catchError(_exceptionThrower.throwException);
}
@override
Future<CalendarEventMaybeResponse> maybeEventInvitation(AccountId accountId, Set<Id> blobIds) {
Future<CalendarEventMaybeResponse> maybeEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language) {
return Future.sync(() async {
return await _calendarEventAPI.maybe(accountId, blobIds);
return await _calendarEventAPI.maybeEventInvitation(accountId, blobIds, language);
}).catchError(_exceptionThrower.throwException);
}
@override
Future<CalendarEventRejectResponse> rejectEventInvitation(AccountId accountId, Set<Id> blobIds) {
Future<CalendarEventRejectResponse> rejectEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language) {
return Future.sync(() async {
return await _calendarEventAPI.reject(accountId, blobIds);
return await _calendarEventAPI.rejectEventInvitation(accountId, blobIds, language);
}).catchError(_exceptionThrower.throwException);
}
}
@@ -49,11 +49,18 @@ class CalendarEventAPI {
}
}
Future<CalendarEventAcceptResponse> acceptEventInvitation(AccountId accountId, Set<Id> blobIds) async {
Future<CalendarEventAcceptResponse> acceptEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language
) async {
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
final calendarEventAcceptMethod = CalendarEventAcceptMethod(
accountId,
blobIds: blobIds.toList());
if (language != null) {
calendarEventAcceptMethod.addLanguage(language);
}
final calendarEventAcceptInvocation = requestBuilder.invocation(calendarEventAcceptMethod);
final response = await (requestBuilder..usings(calendarEventAcceptMethod.requiredCapabilities))
.build()
@@ -70,11 +77,18 @@ class CalendarEventAPI {
return calendarEventAcceptResponse;
}
Future<CalendarEventMaybeResponse> maybe(AccountId accountId, Set<Id> blobIds) async {
Future<CalendarEventMaybeResponse> maybeEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language
) async {
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
final calendarEventMaybeMethod = CalendarEventMaybeMethod(
accountId,
blobIds: blobIds.toList());
if (language != null) {
calendarEventMaybeMethod.addLanguage(language);
}
final calendarEventMaybeInvocation = requestBuilder.invocation(calendarEventMaybeMethod);
final response = await (requestBuilder..usings(calendarEventMaybeMethod.requiredCapabilities))
.build()
@@ -91,11 +105,18 @@ class CalendarEventAPI {
return calendarEventMaybeResponse;
}
Future<CalendarEventRejectResponse> reject(AccountId accountId, Set<Id> blobIds) async {
Future<CalendarEventRejectResponse> rejectEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language
) async {
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
final calendarEventRejectMethod = CalendarEventRejectMethod(
accountId,
blobIds: blobIds.toList());
if (language != null) {
calendarEventRejectMethod.addLanguage(language);
}
final calendarEventRejectInvocation = requestBuilder.invocation(calendarEventRejectMethod);
final response = await (requestBuilder..usings(calendarEventRejectMethod.requiredCapabilities))
.build()
@@ -21,17 +21,32 @@ class CalendarEventRepositoryImpl extends CalendarEventRepository {
}
@override
Future<CalendarEventAcceptResponse> acceptEventInvitation(AccountId accountId, Set<Id> blobIds) {
return _calendarEventDataSource[DataSourceType.network]!.acceptEventInvitation(accountId, blobIds);
Future<CalendarEventAcceptResponse> acceptEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language
) {
return _calendarEventDataSource[DataSourceType.network]!
.acceptEventInvitation(accountId, blobIds, language);
}
@override
Future<CalendarEventMaybeResponse> maybeEventInvitation(AccountId accountId, Set<Id> blobIds) {
return _calendarEventDataSource[DataSourceType.network]!.maybeEventInvitation(accountId, blobIds);
Future<CalendarEventMaybeResponse> maybeEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language
) {
return _calendarEventDataSource[DataSourceType.network]!
.maybeEventInvitation(accountId, blobIds, language);
}
@override
Future<CalendarEventRejectResponse> rejectEventInvitation(AccountId accountId, Set<Id> blobIds) {
return _calendarEventDataSource[DataSourceType.network]!.rejectEventInvitation(accountId, blobIds);
Future<CalendarEventRejectResponse> rejectEventInvitation(
AccountId accountId,
Set<Id> blobIds,
String? language
) {
return _calendarEventDataSource[DataSourceType.network]!
.rejectEventInvitation(accountId, blobIds, language);
}
}