Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,15 @@ public struct NotificationsListView: View {
if lockedType == nil && lockedAccountId == nil {
ToolbarTitleMenu {
Button {
selectedType = nil
Task {
viewState = .loading
await fetchNotifications()
}
applyFilter(type: nil)
} label: {
Label("notifications.navigation-title", systemImage: "bell.fill")
.tint(theme.labelColor)
}
Divider()
ForEach(Notification.NotificationType.allCases, id: \.self) { type in
Button {
selectedType = type
Task {
viewState = .loading
await fetchNotifications()
}
applyFilter(type: type)
} label: {
Label {
Text(type.menuTitle())
Expand Down Expand Up @@ -277,6 +269,16 @@ public struct NotificationsListView: View {
}

extension NotificationsListView {
private func applyFilter(type: Models.Notification.NotificationType?) {
selectedType = type
dataSource.reset()
viewState = .loading

Task {
await fetchNotifications()
}
}

private func fetchNotifications() async {
do {
let result = try await dataSource.fetchNotifications(
Expand Down
Loading