diff --git a/lib/screens/notification.dart b/lib/screens/notification.dart index 21cf51f..1e9ec8f 100644 --- a/lib/screens/notification.dart +++ b/lib/screens/notification.dart @@ -82,24 +82,15 @@ class _NotificationScreenState extends State { if (!mounted) return; setState(() => _isSubmitting = true); - List markList = List.empty(growable: true); - for (final element in _notifications) { - if (element.id <= 0) continue; - if (element.readAt != null) continue; - markList.add(element.id); - } - try { final sn = context.read(); - await sn.client.put('/cgi/id/notifications/read', data: { - 'messages': markList, - }); + final resp = await sn.client.put('/cgi/id/notifications/read/all'); _notifications.clear(); _fetchNotifications(); if (!mounted) return; context.showSnackbar( - 'notificationMarkAllReadPrompt'.plural(markList.length), + 'notificationMarkAllReadPrompt'.plural(resp.data['count']), ); } catch (err) { if (!mounted) return;