diff --git a/lib/controls/notifications_control.dart b/lib/controls/notifications_control.dart index 4d80080..1374b8c 100644 --- a/lib/controls/notifications_control.dart +++ b/lib/controls/notifications_control.dart @@ -67,37 +67,50 @@ class NotificationControl extends StatelessWidget { ), ); + Function()? onTap; + switch (notification.type) { + case NotificationType.follow: + onTap = () { + context.pushNamed(ScreenPaths.userProfile, + params: {'id': notification.fromId}); + }; + break; + case NotificationType.follow_request: + onTap = () { + context.push('/connect/${notification.fromId}'); + }; + break; + case NotificationType.unknown: + buildSnackbar(context, 'Unknown message type, nothing to do'); + break; + case NotificationType.favourite: + case NotificationType.mention: + case NotificationType.reshare: + case NotificationType.reblog: + case NotificationType.status: + onTap = () { + _goToStatus(context); + }; + break; + } + return ListTile( tileColor: notification.dismissed ? null : Colors.black12, leading: fromIcon, title: GestureDetector( - onTap: () async { - switch (notification.type) { - case NotificationType.follow: - context.push('/connect/${notification.fromId}'); - break; - case NotificationType.follow_request: - context.push('/connect/${notification.fromId}'); - break; - case NotificationType.unknown: - buildSnackbar(context, 'Unknown message type, nothing to do'); - break; - case NotificationType.favourite: - case NotificationType.mention: - case NotificationType.reshare: - case NotificationType.reblog: - case NotificationType.status: - _goToStatus(context); - break; - } - }, - child: HtmlWidget(notification.content), + onTap: onTap == null ? null : () async => onTap!(), + child: HtmlWidget( + notification.content, + onTapUrl: onTap == null ? null : (_) async => onTap!(), + ), ), - subtitle: - Text(ElapsedDateUtils.epochSecondsToString(notification.timestamp)), - trailing: notification.dismissed || - (notification.type == NotificationType.follow || - notification.type == NotificationType.follow_request) + subtitle: GestureDetector( + onTap: onTap == null ? null : () async => onTap!(), + child: Text( + ElapsedDateUtils.epochSecondsToString(notification.timestamp), + ), + ), + trailing: notification.dismissed ? null : IconButton( onPressed: () async { diff --git a/lib/serializers/mastodon/notification_mastodon_extension.dart b/lib/serializers/mastodon/notification_mastodon_extension.dart index 217a4e6..55d1b85 100644 --- a/lib/serializers/mastodon/notification_mastodon_extension.dart +++ b/lib/serializers/mastodon/notification_mastodon_extension.dart @@ -29,7 +29,7 @@ extension NotificationMastodonExtension on UserNotification { var content = ''; switch (type) { case NotificationType.follow: - content = '${from.name} wants to follow you'; + content = '${from.name} is now following you'; break; case NotificationType.follow_request: content = '${from.name} submitted a follow request ';