Fix behavior on following notifications and inconsistent click/tap regions on notifications

merge-requests/67/merge
Hank Grabowski 2023-01-23 16:25:14 -05:00
rodzic 7fe16f44a9
commit 04add9a31c
2 zmienionych plików z 40 dodań i 27 usunięć

Wyświetl plik

@ -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( return ListTile(
tileColor: notification.dismissed ? null : Colors.black12, tileColor: notification.dismissed ? null : Colors.black12,
leading: fromIcon, leading: fromIcon,
title: GestureDetector( title: GestureDetector(
onTap: () async { onTap: onTap == null ? null : () async => onTap!(),
switch (notification.type) { child: HtmlWidget(
case NotificationType.follow: notification.content,
context.push('/connect/${notification.fromId}'); onTapUrl: onTap == null ? null : (_) async => onTap!(),
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),
), ),
subtitle: subtitle: GestureDetector(
Text(ElapsedDateUtils.epochSecondsToString(notification.timestamp)), onTap: onTap == null ? null : () async => onTap!(),
trailing: notification.dismissed || child: Text(
(notification.type == NotificationType.follow || ElapsedDateUtils.epochSecondsToString(notification.timestamp),
notification.type == NotificationType.follow_request) ),
),
trailing: notification.dismissed
? null ? null
: IconButton( : IconButton(
onPressed: () async { onPressed: () async {

Wyświetl plik

@ -29,7 +29,7 @@ extension NotificationMastodonExtension on UserNotification {
var content = ''; var content = '';
switch (type) { switch (type) {
case NotificationType.follow: case NotificationType.follow:
content = '${from.name} wants to follow you'; content = '${from.name} is now following you';
break; break;
case NotificationType.follow_request: case NotificationType.follow_request:
content = '${from.name} submitted a follow request '; content = '${from.name} submitted a follow request ';