diff --git a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift index 4e77ef43..7b42352f 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift @@ -91,6 +91,7 @@ public struct NotificationsListView: View { viewModel.client = client viewModel.currentAccount = account if let lockedType { + viewModel.isLockedType = true viewModel.selectedType = lockedType } await viewModel.fetchNotifications() diff --git a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift index a443f38d..3f024ad5 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift @@ -38,13 +38,16 @@ import SwiftUI private let filterKey = "notification-filter" var state: State = .loading + var isLockedType: Bool = false var selectedType: Models.Notification.NotificationType? { didSet { guard oldValue != selectedType, let id = client?.id else { return } - UserDefaults.standard.set(selectedType?.rawValue ?? "", forKey: filterKey) + if !isLockedType { + UserDefaults.standard.set(selectedType?.rawValue ?? "", forKey: filterKey) + } consolidatedNotifications = [] Task {