Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/features/email/presentation/email_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/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/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';
Expand Down Expand Up @@ -317,7 +318,7 @@ class EmailView extends GetWidget<SingleEmailController> {
ownEmailAddress: controller.ownEmailAddress,
onMailtoAttendeesAction: controller.handleMailToAttendees,
openEmailAddressDetailAction: (_, emailAddress) => controller.openEmailAddressDialog(emailAddress),
isFree: controller.isCalendarEventFree,
isFreeBusyEnabled: controller.isFreeBusyEnabled(emailAddressSender ?? []),
listEmailAddressSender: emailAddressSender ?? [],
isPortraitMobile: controller
.responsiveUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
EventId? eventId,
String? title,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
final AttendanceStatus? attendanceStatus;
final OnMailtoAttendeesAction? onMailtoAttendeesAction;
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;
final bool isFree;
final bool isFreeBusyEnabled;
final List<String> listEmailAddressSender;
final String ownEmailAddress;
final bool isPortraitMobile;
Expand All @@ -41,7 +41,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
required this.calendarEvent,
required this.onCalendarEventReplyActionClick,
required this.calendarEventReplying,
required this.isFree,
required this.isFreeBusyEnabled,
required this.ownEmailAddress,
this.onOpenNewTabAction,
this.onOpenComposerAction,
Expand Down Expand Up @@ -233,7 +233,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
child: EventTimeInformationWidget(
timeEvent: dateTimeEvent,
isFree: isFree,
isFreeBusyEnabled: isFreeBusyEnabled,
),
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
class EventTimeInformationWidget extends StatelessWidget {

final String timeEvent;
final bool isFree;
final bool isFreeBusyEnabled;

const EventTimeInformationWidget({
super.key,
required this.timeEvent,
required this.isFree,
required this.isFreeBusyEnabled,
});

@override
Expand Down Expand Up @@ -51,7 +51,7 @@ class EventTimeInformationWidget extends StatelessWidget {
color: EventTimeInformationWidgetStyles.valueColor
),
)),
if (!isFree)
if (isFreeBusyEnabled)
...[
const SizedBox(width: EventTimeInformationWidgetStyles.horizontalSpacing),
Tooltip(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main() {
calendarEvent: calendarEvent,
onCalendarEventReplyActionClick: (_) {},
calendarEventReplying: false,
isFree: false,
isFreeBusyEnabled: false,
ownEmailAddress: ownEmail,
),
),
Expand Down Expand Up @@ -81,7 +81,7 @@ void main() {
calendarEvent: calendarEvent,
onCalendarEventReplyActionClick: (_) {},
calendarEventReplying: false,
isFree: false,
isFreeBusyEnabled: false,
ownEmailAddress: ownEmail,
),
),
Expand Down Expand Up @@ -121,7 +121,7 @@ void main() {
calendarEvent: calendarEvent,
onCalendarEventReplyActionClick: (_) {},
calendarEventReplying: false,
isFree: false,
isFreeBusyEnabled: false,
ownEmailAddress: ownEmail,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ void main() {
group('EventTimeInformationWidget tests', () {
Widget makeTestableWidget({
required String timeEvent,
required bool isFree,
required bool isFreeBusyEnabled,
}) {
return WidgetFixtures.makeTestableWidget(
child: EventTimeInformationWidget(
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
final widget = makeTestableWidget(
timeEvent: '10:00 AM - 11:00 AM',
isFree: false,
isFreeBusyEnabled: true,
);

// act
Expand All @@ -51,11 +51,11 @@ void main() {
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
final widget = makeTestableWidget(
timeEvent: '10:00 AM - 11:00 AM',
isFree: true,
isFreeBusyEnabled: false,
);

// act
Expand Down
Loading