From e81ea4ee8103863160447387a3af19f1d9eac249 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Thu, 19 Jan 2023 07:45:42 +0100 Subject: [PATCH] Fixes --- .../Sources/Notifications/NotificationsViewModel.swift | 9 ++++++--- .../Sources/Status/Row/StatusMediaPreviewView.swift | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift index 43bb4c12..ed827bcd 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift @@ -103,11 +103,14 @@ class NotificationsViewModel: ObservableObject { } func handleEvent(event: any StreamEvent) { - if selectedType == nil, - let event = event as? StreamEventNotification, + if let event = event as? StreamEventNotification, !notifications.contains(where: { $0.id == event.notification.id }) { - notifications.insert(event.notification, at: 0) + if let selectedType, event.notification.type == selectedType.rawValue { + notifications.insert(event.notification, at: 0) + } else { + notifications.insert(event.notification, at: 0) + } state = .display(notifications: notifications, nextPageState: .hasNextPage) } } diff --git a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift index e4cbb975..5d59f92b 100644 --- a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift +++ b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift @@ -33,7 +33,7 @@ public struct StatusMediaPreviewView: View { if attachments.count == 1 { return 300 } - return attachments.count > 2 ? 100 : 200 + return attachments.count > 2 ? 150 : 200 } private func size(for media: MediaAttachment) -> CGSize? { @@ -181,7 +181,7 @@ public struct StatusMediaPreviewView: View { placeholder: { RoundedRectangle(cornerRadius: 4) .fill(Color.gray) - .frame(maxHeight: isNotifications ? imageMaxHeight : nil) + .frame(height: imageMaxHeight) .shimmering() } )