kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix not properly loading notifications when no unread
rodzic
b1af640269
commit
eff9df9191
|
@ -144,14 +144,17 @@ class NotificationsManager extends _$NotificationsManager {
|
|||
|
||||
Future<void> _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<void> 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<bool, ExecError> loadUnreadNotifications(
|
||||
bool withListenerNotification) async {
|
||||
final notificationsFromRefresh = <UserNotification>[];
|
||||
|
|
|
@ -938,7 +938,7 @@ class _NotificationsStoreProviderElement
|
|||
}
|
||||
|
||||
String _$notificationsManagerHash() =>
|
||||
r'27564686297b34af33b67ff01eba1167d9fb6491';
|
||||
r'5f9f1d16f0589be2f3ac42aa9d05ce9400fa6a35';
|
||||
|
||||
abstract class _$NotificationsManager extends BuildlessAsyncNotifier<bool> {
|
||||
late final Profile profile;
|
||||
|
|
Ładowanie…
Reference in New Issue