fix: refresh the merged notifications list when a push notification is opened (#71)

**Why.** Tapping a push notification bumps `NavigationState.notificationsRefreshTrigger` so the notifications tab reloads on arrival. The single-instance `NotificationsOverviewView` observes the trigger; the merged multi-instance overview never did, so multi-instance users landed on a stale list that still showed the tapped thread as unread until a manual pull-to-refresh.

**What changed.** `MergedNotificationsOverviewView` observes the same trigger with the same `onChange` the single-instance view uses, and reloads.

**Verification.** Full `ForjiTests` suite passes (218 passed / 0 failed, iPhone 17 Pro, iOS 26.5, rebased onto current main). SwiftLint and SwiftFormat clean. The push-open path needs a real APNs round trip, so I couldn't exercise it end-to-end locally; the change mirrors the single-instance wiring line for line.

I grant Stefan Hausotte an irrevocable, worldwide, royalty-free license to use, sublicense, and distribute my contribution, including through Apple's App Store under the project's App Store exception.

Reviewed-on: https://codeberg.org/secana/Forji/pulls/71
This commit is contained in:
systemblue 2026-06-10 20:17:57 +02:00 committed by secana
parent 2a679140e6
commit f8a050e484

View file

@ -6,6 +6,7 @@ struct MergedNotificationsOverviewView: View {
@State private var pagination: PaginationState<TaggedItem<NotificationThread>> @State private var pagination: PaginationState<TaggedItem<NotificationThread>>
@State private var statusFilter: String = "unread" @State private var statusFilter: String = "unread"
@Environment(NavigationState.self) private var navigationState
init(manager: MultiInstanceManager) { init(manager: MultiInstanceManager) {
self.manager = manager self.manager = manager
@ -95,6 +96,9 @@ struct MergedNotificationsOverviewView: View {
.onChange(of: statusFilter) { .onChange(of: statusFilter) {
reloadNotifications(clearItems: true) reloadNotifications(clearItems: true)
} }
.onChange(of: navigationState.notificationsRefreshTrigger) {
reloadNotifications()
}
.errorAlert(message: $pagination.errorMessage, isPresented: $pagination.showError) .errorAlert(message: $pagination.errorMessage, isPresented: $pagination.showError)
} }