From 7a35779b29bb5a9e1a7ab82bf58acf102fff8674 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Mon, 16 Sep 2024 17:32:37 +0200 Subject: [PATCH] Fix notifications filter --- .../Sources/Notifications/NotificationsListView.swift | 3 +++ .../Sources/Notifications/NotificationsViewModel.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift index 65d2f3a9..6a1c75a4 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift @@ -98,6 +98,8 @@ public struct NotificationsListView: View { } .sheet(isPresented: $isNotificationsPolicyPresented) { NotificationsPolicyView() + .environment(client) + .environment(theme) } .navigationBarTitleDisplayMode(.inline) #if !os(visionOS) @@ -124,6 +126,7 @@ public struct NotificationsListView: View { SoundEffectManager.shared.playSound(.pull) HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.3)) await viewModel.fetchNotifications(viewModel.selectedType) + await viewModel.fetchPolicy() HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.7)) SoundEffectManager.shared.playSound(.refresh) } diff --git a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift index 33eff9d7..ed129f63 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift @@ -182,7 +182,7 @@ import SwiftUI } 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) {