diff --git a/lib/riverpod_controllers/notification_services.dart b/lib/riverpod_controllers/notification_services.dart index b98b307..0b81ecc 100644 --- a/lib/riverpod_controllers/notification_services.dart +++ b/lib/riverpod_controllers/notification_services.dart @@ -144,14 +144,17 @@ class NotificationsManager extends _$NotificationsManager { Future _initialize() async { final result = await loadUnreadNotifications(false); - final hasNoNotifications = ref.read(hasAnyNotificationsProvider(profile)); + final hasNoNotifications = !ref.read(hasAnyNotificationsProvider(profile)); if (result.isSuccess && hasNoNotifications) { await loadOlderNotifications(withListenerNotification: false); } } void refreshNotifications() async { - clear(); + for (final t in NotificationType.values) { + ref.read(_NotificationsStoreProvider(profile, t).notifier).clear(); + } + _initialize(); } Future clearConnectionRequestNotifications() async { @@ -190,20 +193,6 @@ class NotificationsManager extends _$NotificationsManager { ); } - void clear() { - ref - .read(_NotificationsStoreProvider( - profile, NotificationType.direct_message) - .notifier) - .clear(); - ref - .read(_NotificationsStoreProvider( - profile, NotificationType.follow_request) - .notifier) - .clear(); - _initialize(); - } - FutureResult loadUnreadNotifications( bool withListenerNotification) async { final notificationsFromRefresh = []; diff --git a/lib/riverpod_controllers/notification_services.g.dart b/lib/riverpod_controllers/notification_services.g.dart index f337631..9591aa3 100644 --- a/lib/riverpod_controllers/notification_services.g.dart +++ b/lib/riverpod_controllers/notification_services.g.dart @@ -938,7 +938,7 @@ class _NotificationsStoreProviderElement } String _$notificationsManagerHash() => - r'27564686297b34af33b67ff01eba1167d9fb6491'; + r'5f9f1d16f0589be2f3ac42aa9d05ce9400fa6a35'; abstract class _$NotificationsManager extends BuildlessAsyncNotifier { late final Profile profile;