From eb9b9d8b0eda105c87e4dfba0d1fb1720dbcf1a3 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 11 Aug 2026 22:38:29 +0200 Subject: [PATCH] fix(dashpay): add back navigation to notifications --- .../Contacts/SwiftUI/NotificationsScreen.swift | 18 +++++++++++++++--- .../Sources/UI/Home/HomeViewController.swift | 9 +++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/NotificationsScreen.swift b/DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/NotificationsScreen.swift index b29ba8e9f..868fce87b 100644 --- a/DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/NotificationsScreen.swift +++ b/DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/NotificationsScreen.swift @@ -21,6 +21,8 @@ struct NotificationsScreen: View { @StateObject private var viewModel = ContactsViewModel() @State private var selectedContact: ContactItem? = nil + let onBack: () -> Void + /// Read-state captured once at screen entry so rows don't jump /// between sections while the user is looking at them; the marker /// itself advances on exit (`markNotificationsViewed`). @@ -29,10 +31,20 @@ struct NotificationsScreen: View { var body: some View { ZStack { Color.dash.primaryBackground.ignoresSafeArea() - content + + VStack(spacing: 0) { + NavigationBar( + leading: { NavigationBarElement.back.button { onBack() } }, + central: { + Text(NSLocalizedString("Notifications", comment: "DashPay Notifications")) + .font(.subheadMedium) + .foregroundColor(.dash.primaryText) + } + ) + + content + } } - .navigationTitle(NSLocalizedString("Notifications", comment: "DashPay Notifications")) - .navigationBarTitleDisplayMode(.inline) .sheet(item: $selectedContact) { contact in ContactProfileSheet(contact: contact) } diff --git a/DashWallet/Sources/UI/Home/HomeViewController.swift b/DashWallet/Sources/UI/Home/HomeViewController.swift index 0c6cc59a4..da30c27c3 100644 --- a/DashWallet/Sources/UI/Home/HomeViewController.swift +++ b/DashWallet/Sources/UI/Home/HomeViewController.swift @@ -202,8 +202,13 @@ class HomeViewController: DWBasePayViewController, NavigationBarDisplayable { @objc func notificationAction() { // Notifications are backed by the SwiftDashSDK contacts service. - let controller = UIHostingController(rootView: NotificationsScreen()) - navigationController?.pushViewController(controller, animated: true) + guard let navigation = navigationController, + navigation.topViewController === self else { return } + let screen = NotificationsScreen(onBack: { [weak navigation] in + navigation?.popViewController(animated: true) + }) + let controller = UIHostingController(rootView: screen) + navigation.pushViewController(controller, animated: true) } @objc func profileAction() {