Fix notifications filter

This commit is contained in:
Thomas Ricouard 2024-09-16 17:32:37 +02:00
parent e4d1196301
commit 7a35779b29
2 changed files with 4 additions and 1 deletions

View file

@ -98,6 +98,8 @@ public struct NotificationsListView: View {
} }
.sheet(isPresented: $isNotificationsPolicyPresented) { .sheet(isPresented: $isNotificationsPolicyPresented) {
NotificationsPolicyView() NotificationsPolicyView()
.environment(client)
.environment(theme)
} }
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
#if !os(visionOS) #if !os(visionOS)
@ -124,6 +126,7 @@ public struct NotificationsListView: View {
SoundEffectManager.shared.playSound(.pull) SoundEffectManager.shared.playSound(.pull)
HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.3)) HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.3))
await viewModel.fetchNotifications(viewModel.selectedType) await viewModel.fetchNotifications(viewModel.selectedType)
await viewModel.fetchPolicy()
HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.7)) HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.7))
SoundEffectManager.shared.playSound(.refresh) SoundEffectManager.shared.playSound(.refresh)
} }

View file

@ -182,7 +182,7 @@ import SwiftUI
} }
func fetchPolicy() async { func fetchPolicy() async {
policy = try? await client?.get(endpoint: Notifications.policy) policy = try? await client?.get(endpoint: Notifications.policy, forceVersion: .v2)
} }
func handleEvent(selectedType: Models.Notification.NotificationType?, event: any StreamEvent) { func handleEvent(selectedType: Models.Notification.NotificationType?, event: any StreamEvent) {