TF-4102 Don't display free-busy on IMIP responses (accepted, tentative, rejected)
This commit is contained in:
@@ -19,6 +19,7 @@ import 'package:tmail_ui_user/features/base/widget/optional_expanded.dart';
|
|||||||
import 'package:tmail_ui_user/features/base/widget/optional_scroll.dart';
|
import 'package:tmail_ui_user/features/base/widget/optional_scroll.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';
|
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/extensions/validate_display_free_busy_message_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/styles/email_view_styles.dart';
|
import 'package:tmail_ui_user/features/email/presentation/styles/email_view_styles.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/utils/email_action_reactor/email_action_reactor.dart';
|
import 'package:tmail_ui_user/features/email/presentation/utils/email_action_reactor/email_action_reactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart';
|
||||||
@@ -315,7 +316,7 @@ class EmailView extends GetWidget<SingleEmailController> {
|
|||||||
ownEmailAddress: controller.ownEmailAddress,
|
ownEmailAddress: controller.ownEmailAddress,
|
||||||
onMailtoAttendeesAction: controller.handleMailToAttendees,
|
onMailtoAttendeesAction: controller.handleMailToAttendees,
|
||||||
openEmailAddressDetailAction: (_, emailAddress) => controller.openEmailAddressDialog(emailAddress),
|
openEmailAddressDetailAction: (_, emailAddress) => controller.openEmailAddressDialog(emailAddress),
|
||||||
isFree: controller.isCalendarEventFree,
|
isFreeBusyEnabled: controller.isFreeBusyEnabled(emailAddressSender ?? []),
|
||||||
listEmailAddressSender: emailAddressSender ?? [],
|
listEmailAddressSender: emailAddressSender ?? [],
|
||||||
isPortraitMobile: controller
|
isPortraitMobile: controller
|
||||||
.responsiveUtils
|
.responsiveUtils
|
||||||
|
|||||||
@@ -437,6 +437,17 @@ extension CalendarEventExtension on CalendarEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isIMIPResponsesAvailable(List<String> listEmailAddressSender) {
|
||||||
|
final participationStatus = findAttendeeHasUpdatedStatus(
|
||||||
|
listEmailAddressSender,
|
||||||
|
)?.participationStatus?.value;
|
||||||
|
|
||||||
|
return method == EventMethod.reply &&
|
||||||
|
(participationStatus == acceptedParticipationStatus ||
|
||||||
|
participationStatus == tentativeParticipationStatus ||
|
||||||
|
participationStatus == declinedParticipationStatus);
|
||||||
|
}
|
||||||
|
|
||||||
CalendarEvent copyWith({
|
CalendarEvent copyWith({
|
||||||
EventId? eventId,
|
EventId? eventId,
|
||||||
String? title,
|
String? title,
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';
|
||||||
|
|
||||||
|
extension ValidateDisplayFreeBusyMessageExtension on SingleEmailController {
|
||||||
|
bool isFreeBusyEnabled(List<String> listEmailAddressSender) {
|
||||||
|
return !isCalendarEventFree &&
|
||||||
|
calendarEvent?.isIMIPResponsesAvailable(listEmailAddressSender) != true;
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-3
@@ -31,7 +31,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
|
|||||||
final AttendanceStatus? attendanceStatus;
|
final AttendanceStatus? attendanceStatus;
|
||||||
final OnMailtoAttendeesAction? onMailtoAttendeesAction;
|
final OnMailtoAttendeesAction? onMailtoAttendeesAction;
|
||||||
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;
|
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;
|
||||||
final bool isFree;
|
final bool isFreeBusyEnabled;
|
||||||
final List<String> listEmailAddressSender;
|
final List<String> listEmailAddressSender;
|
||||||
final String ownEmailAddress;
|
final String ownEmailAddress;
|
||||||
final bool isPortraitMobile;
|
final bool isPortraitMobile;
|
||||||
@@ -41,7 +41,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
|
|||||||
required this.calendarEvent,
|
required this.calendarEvent,
|
||||||
required this.onCalendarEventReplyActionClick,
|
required this.onCalendarEventReplyActionClick,
|
||||||
required this.calendarEventReplying,
|
required this.calendarEventReplying,
|
||||||
required this.isFree,
|
required this.isFreeBusyEnabled,
|
||||||
required this.ownEmailAddress,
|
required this.ownEmailAddress,
|
||||||
this.onOpenNewTabAction,
|
this.onOpenNewTabAction,
|
||||||
this.onOpenComposerAction,
|
this.onOpenComposerAction,
|
||||||
@@ -233,7 +233,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
child: EventTimeInformationWidget(
|
child: EventTimeInformationWidget(
|
||||||
timeEvent: dateTimeEvent,
|
timeEvent: dateTimeEvent,
|
||||||
isFree: isFree,
|
isFreeBusyEnabled: isFreeBusyEnabled,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-3
@@ -13,12 +13,12 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|||||||
class EventTimeInformationWidget extends StatelessWidget {
|
class EventTimeInformationWidget extends StatelessWidget {
|
||||||
|
|
||||||
final String timeEvent;
|
final String timeEvent;
|
||||||
final bool isFree;
|
final bool isFreeBusyEnabled;
|
||||||
|
|
||||||
const EventTimeInformationWidget({
|
const EventTimeInformationWidget({
|
||||||
super.key,
|
super.key,
|
||||||
required this.timeEvent,
|
required this.timeEvent,
|
||||||
required this.isFree,
|
required this.isFreeBusyEnabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -51,7 +51,7 @@ class EventTimeInformationWidget extends StatelessWidget {
|
|||||||
color: EventTimeInformationWidgetStyles.valueColor
|
color: EventTimeInformationWidgetStyles.valueColor
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
if (!isFree)
|
if (isFreeBusyEnabled)
|
||||||
...[
|
...[
|
||||||
const SizedBox(width: EventTimeInformationWidgetStyles.horizontalSpacing),
|
const SizedBox(width: EventTimeInformationWidgetStyles.horizontalSpacing),
|
||||||
Tooltip(
|
Tooltip(
|
||||||
|
|||||||
+3
-3
@@ -38,7 +38,7 @@ void main() {
|
|||||||
calendarEvent: calendarEvent,
|
calendarEvent: calendarEvent,
|
||||||
onCalendarEventReplyActionClick: (_) {},
|
onCalendarEventReplyActionClick: (_) {},
|
||||||
calendarEventReplying: false,
|
calendarEventReplying: false,
|
||||||
isFree: false,
|
isFreeBusyEnabled: false,
|
||||||
ownEmailAddress: ownEmail,
|
ownEmailAddress: ownEmail,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -81,7 +81,7 @@ void main() {
|
|||||||
calendarEvent: calendarEvent,
|
calendarEvent: calendarEvent,
|
||||||
onCalendarEventReplyActionClick: (_) {},
|
onCalendarEventReplyActionClick: (_) {},
|
||||||
calendarEventReplying: false,
|
calendarEventReplying: false,
|
||||||
isFree: false,
|
isFreeBusyEnabled: false,
|
||||||
ownEmailAddress: ownEmail,
|
ownEmailAddress: ownEmail,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -121,7 +121,7 @@ void main() {
|
|||||||
calendarEvent: calendarEvent,
|
calendarEvent: calendarEvent,
|
||||||
onCalendarEventReplyActionClick: (_) {},
|
onCalendarEventReplyActionClick: (_) {},
|
||||||
calendarEventReplying: false,
|
calendarEventReplying: false,
|
||||||
isFree: false,
|
isFreeBusyEnabled: false,
|
||||||
ownEmailAddress: ownEmail,
|
ownEmailAddress: ownEmail,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
+6
-6
@@ -21,21 +21,21 @@ void main() {
|
|||||||
group('EventTimeInformationWidget tests', () {
|
group('EventTimeInformationWidget tests', () {
|
||||||
Widget makeTestableWidget({
|
Widget makeTestableWidget({
|
||||||
required String timeEvent,
|
required String timeEvent,
|
||||||
required bool isFree,
|
required bool isFreeBusyEnabled,
|
||||||
}) {
|
}) {
|
||||||
return WidgetFixtures.makeTestableWidget(
|
return WidgetFixtures.makeTestableWidget(
|
||||||
child: EventTimeInformationWidget(
|
child: EventTimeInformationWidget(
|
||||||
timeEvent: timeEvent,
|
timeEvent: timeEvent,
|
||||||
isFree: isFree,
|
isFreeBusyEnabled: isFreeBusyEnabled,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
testWidgets('should show error icon with tooltip when isFree is false', (tester) async {
|
testWidgets('should show error icon with tooltip when isFreeBusyEnabled is true', (tester) async {
|
||||||
// arrange
|
// arrange
|
||||||
final widget = makeTestableWidget(
|
final widget = makeTestableWidget(
|
||||||
timeEvent: '10:00 AM - 11:00 AM',
|
timeEvent: '10:00 AM - 11:00 AM',
|
||||||
isFree: false,
|
isFreeBusyEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@@ -51,11 +51,11 @@ void main() {
|
|||||||
expect(find.byType(Tooltip), findsOneWidget);
|
expect(find.byType(Tooltip), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should not show error icon when isFree is true', (tester) async {
|
testWidgets('should not show error icon when isFreeBusyEnabled is false', (tester) async {
|
||||||
// arrange
|
// arrange
|
||||||
final widget = makeTestableWidget(
|
final widget = makeTestableWidget(
|
||||||
timeEvent: '10:00 AM - 11:00 AM',
|
timeEvent: '10:00 AM - 11:00 AM',
|
||||||
isFree: true,
|
isFreeBusyEnabled: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
|
|||||||
Reference in New Issue
Block a user