mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 10:11:00 +00:00
Run notifications panel stream in a Task + animations
This commit is contained in:
parent
c748c935c9
commit
3a3ae87502
1 changed files with 14 additions and 10 deletions
|
@ -116,17 +116,21 @@ class NotificationsViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleEvent(event: any StreamEvent) {
|
func handleEvent(event: any StreamEvent) {
|
||||||
if let event = event as? StreamEventNotification,
|
Task {
|
||||||
!consolidatedNotifications.contains(where: { $0.id == event.notification.id })
|
if let event = event as? StreamEventNotification,
|
||||||
{
|
!consolidatedNotifications.contains(where: { $0.id == event.notification.id })
|
||||||
if let selectedType, event.notification.type == selectedType.rawValue {
|
{
|
||||||
notifications.insert(event.notification, at: 0)
|
if let selectedType, event.notification.type == selectedType.rawValue {
|
||||||
consolidatedNotifications = notifications.consolidated(selectedType: selectedType)
|
notifications.insert(event.notification, at: 0)
|
||||||
} else if selectedType == nil {
|
consolidatedNotifications = notifications.consolidated(selectedType: selectedType)
|
||||||
notifications.insert(event.notification, at: 0)
|
} else if selectedType == nil {
|
||||||
consolidatedNotifications = notifications.consolidated(selectedType: selectedType)
|
notifications.insert(event.notification, at: 0)
|
||||||
|
consolidatedNotifications = notifications.consolidated(selectedType: selectedType)
|
||||||
|
}
|
||||||
|
withAnimation {
|
||||||
|
state = .display(notifications: consolidatedNotifications, nextPageState: .hasNextPage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
state = .display(notifications: consolidatedNotifications, nextPageState: .hasNextPage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue