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(
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 {

Wyświetl plik

@ -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 ';