Skip to content

Commit

Permalink
TF-3295 Fix BLUE-BAR attendees mail addresses are not clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 authored and hoangdat committed Dec 2, 2024
1 parent c5b1e87 commit 6fff59a
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/features/email/presentation/email_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ class EmailView extends GetWidget<SingleEmailController> {
calendarEventReplying: controller.calendarEventProcessing,
presentationEmail: controller.currentEmail,
onMailtoAttendeesAction: controller.handleMailToAttendees,
openEmailAddressDetailAction: controller.openEmailAddressDialog,
)),
if (_validateDisplayEventActionBanner(
context: context,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';

extension CalendarOrganierExtension on CalendarOrganizer {
EmailAddress toEmailAddress() {
return EmailAddress(
name, mailto?.value,
);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_attendee_extension.dart';
import 'package:tmail_ui_user/features/email/presentation/styles/attendee_widget_styles.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart';

class AttendeeWidget extends StatelessWidget {

final CalendarAttendee attendee;
final List<CalendarAttendee> listAttendees;
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;

const AttendeeWidget({
super.key,
required this.attendee,
required this.listAttendees,
this.openEmailAddressDetailAction,
});

@override
Expand All @@ -34,11 +39,16 @@ class AttendeeWidget extends StatelessWidget {
fontSize: AttendeeWidgetStyles.textSize,
fontWeight: FontWeight.w500
),
recognizer: TapGestureRecognizer()..onTap = () => _onClickMailAddress(context)
),
if (listAttendees.last != attendee)
const TextSpan(text: ', '),
]
)
);
}

void _onClickMailAddress(BuildContext context) {
openEmailAddressDetailAction?.call(context, attendee.toEmailAddress());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_location_information_widget.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_time_information_widget.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_title_widget.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/utils/app_utils.dart';

Expand All @@ -30,6 +31,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
final bool calendarEventReplying;
final PresentationEmail? presentationEmail;
final OnMailtoAttendeesAction? onMailtoAttendeesAction;
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;

final _responsiveUtils = Get.find<ResponsiveUtils>();

Expand All @@ -42,6 +44,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
this.onOpenComposerAction,
this.presentationEmail,
this.onMailtoAttendeesAction,
this.openEmailAddressDetailAction,
});

@override
Expand Down Expand Up @@ -130,6 +133,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
child: EventAttendeeDetailWidget(
attendees: calendarEvent.participants ?? [],
organizer: calendarEvent.organizer,
openEmailAddressDetailAction: openEmailAddressDetailAction,
),
),
if (calendarEvent.isDisplayedEventReplyAction)
Expand Down Expand Up @@ -215,6 +219,7 @@ class CalendarEventInformationWidget extends StatelessWidget {
child: EventAttendeeDetailWidget(
attendees: calendarEvent.participants ?? [],
organizer: calendarEvent.organizer,
openEmailAddressDetailAction: openEmailAddressDetailAction,
),
),
if (calendarEvent.isDisplayedEventReplyAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/hide_all_attendees_button_widget.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/organizer_widget.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/see_all_attendees_button_widget.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';

class EventAttendeeDetailWidget extends StatefulWidget {
Expand All @@ -17,11 +18,13 @@ class EventAttendeeDetailWidget extends StatefulWidget {

final List<CalendarAttendee> attendees;
final CalendarOrganizer? organizer;
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;

const EventAttendeeDetailWidget({
super.key,
required this.attendees,
required this.organizer
required this.organizer,
this.openEmailAddressDetailAction,
});

@override
Expand Down Expand Up @@ -61,10 +64,17 @@ class _EventAttendeeDetailWidgetState extends State<EventAttendeeDetailWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.organizer != null)
OrganizerWidget(organizer: widget.organizer!),
OrganizerWidget(
organizer: widget.organizer!,
openEmailAddressDetailAction: widget.openEmailAddressDetailAction
),
if (_attendeesDisplayed.isNotEmpty)
..._attendeesDisplayed
.map((attendee) => AttendeeWidget(attendee: attendee, listAttendees: _attendeesDisplayed))
.map((attendee) => AttendeeWidget(
attendee: attendee,
listAttendees: _attendeesDisplayed,
openEmailAddressDetailAction: widget.openEmailAddressDetailAction
))
.toList(),
if (!_isShowAllAttendee)
Padding(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_organier_extension.dart';
import 'package:tmail_ui_user/features/email/presentation/styles/organizer_widget_styles.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';

class OrganizerWidget extends StatelessWidget {

final CalendarOrganizer organizer;
final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction;

const OrganizerWidget({
super.key,
required this.organizer
required this.organizer,
this.openEmailAddressDetailAction,
});

@override
Expand All @@ -33,11 +38,16 @@ class OrganizerWidget extends StatelessWidget {
fontSize: OrganizerWidgetStyles.textSize,
fontWeight: FontWeight.w500
),
recognizer: TapGestureRecognizer()..onTap = () => _onClickMailAddress(context)
),
TextSpan(text: '(${AppLocalizations.of(context).organizer})'),
const TextSpan(text: ', '),
]
)
);
}

void _onClickMailAddress(BuildContext context) {
openEmailAddressDetailAction?.call(context, organizer.toEmailAddress());
}
}

0 comments on commit 6fff59a

Please sign in to comment.