Fix notifications locked type

This commit is contained in:
Thomas Ricouard 2023-12-28 12:03:01 +01:00
parent a09b2fa95e
commit fa4603e77c
2 changed files with 5 additions and 1 deletions

View file

@ -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()

View file

@ -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 {